@cubis/foundry 0.3.71 → 0.3.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cli/core.js +4 -18
  3. package/dist/cli/core.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/cli/core.ts +4 -18
  6. package/workflows/powers/accessibility/POWER.md +83 -94
  7. package/workflows/powers/accessibility/SKILL.md +82 -94
  8. package/workflows/powers/agent-design/POWER.md +201 -0
  9. package/workflows/powers/agent-design/SKILL.md +198 -0
  10. package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
  11. package/workflows/powers/agent-design/references/skill-testing.md +164 -0
  12. package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
  13. package/workflows/powers/agentic-eval/POWER.md +62 -0
  14. package/workflows/powers/agentic-eval/SKILL.md +59 -0
  15. package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
  16. package/workflows/powers/api-designer/POWER.md +43 -71
  17. package/workflows/powers/api-designer/SKILL.md +43 -71
  18. package/workflows/powers/api-patterns/POWER.md +42 -56
  19. package/workflows/powers/api-patterns/SKILL.md +42 -57
  20. package/workflows/powers/architecture-designer/POWER.md +43 -60
  21. package/workflows/powers/architecture-designer/SKILL.md +43 -60
  22. package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
  23. package/workflows/powers/auth-architect/POWER.md +69 -0
  24. package/workflows/powers/auth-architect/SKILL.md +66 -0
  25. package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
  26. package/workflows/powers/behavioral-modes/POWER.md +100 -9
  27. package/workflows/powers/c-pro/POWER.md +105 -0
  28. package/workflows/powers/c-pro/SKILL.md +102 -0
  29. package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
  30. package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
  31. package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
  32. package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
  33. package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
  34. package/workflows/powers/changelog-generator/POWER.md +127 -63
  35. package/workflows/powers/changelog-generator/SKILL.md +126 -63
  36. package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
  37. package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
  38. package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
  39. package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
  40. package/workflows/powers/cli-developer/POWER.md +152 -95
  41. package/workflows/powers/cli-developer/SKILL.md +152 -95
  42. package/workflows/powers/cpp-pro/POWER.md +111 -0
  43. package/workflows/powers/cpp-pro/SKILL.md +108 -0
  44. package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
  45. package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
  46. package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
  47. package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
  48. package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
  49. package/workflows/powers/csharp-pro/POWER.md +47 -22
  50. package/workflows/powers/csharp-pro/SKILL.md +47 -22
  51. package/workflows/powers/dart-pro/POWER.md +68 -0
  52. package/workflows/powers/dart-pro/SKILL.md +65 -0
  53. package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
  54. package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
  55. package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
  56. package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
  57. package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
  58. package/workflows/powers/database-design/POWER.md +47 -33
  59. package/workflows/powers/database-design/SKILL.md +47 -33
  60. package/workflows/powers/database-optimizer/POWER.md +43 -64
  61. package/workflows/powers/database-optimizer/SKILL.md +43 -64
  62. package/workflows/powers/database-skills/POWER.md +59 -93
  63. package/workflows/powers/database-skills/SKILL.md +59 -93
  64. package/workflows/powers/debugging-strategies/POWER.md +69 -0
  65. package/workflows/powers/debugging-strategies/SKILL.md +66 -0
  66. package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
  67. package/workflows/powers/deep-research/POWER.md +67 -0
  68. package/workflows/powers/deep-research/SKILL.md +64 -0
  69. package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
  70. package/workflows/powers/design-system-builder/POWER.md +130 -116
  71. package/workflows/powers/design-system-builder/SKILL.md +130 -116
  72. package/workflows/powers/devops-engineer/POWER.md +120 -57
  73. package/workflows/powers/devops-engineer/SKILL.md +120 -57
  74. package/workflows/powers/docker-kubernetes/POWER.md +94 -0
  75. package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
  76. package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
  77. package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
  78. package/workflows/powers/documentation-templates/POWER.md +158 -127
  79. package/workflows/powers/documentation-templates/SKILL.md +158 -127
  80. package/workflows/powers/drizzle-expert/POWER.md +66 -0
  81. package/workflows/powers/drizzle-expert/SKILL.md +63 -0
  82. package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
  83. package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
  84. package/workflows/powers/error-ux-observability/POWER.md +144 -131
  85. package/workflows/powers/error-ux-observability/SKILL.md +143 -131
  86. package/workflows/powers/fastapi-expert/POWER.md +46 -60
  87. package/workflows/powers/fastapi-expert/SKILL.md +46 -60
  88. package/workflows/powers/firebase/POWER.md +65 -0
  89. package/workflows/powers/firebase/SKILL.md +62 -0
  90. package/workflows/powers/firebase/references/platform-routing.md +16 -0
  91. package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
  92. package/workflows/powers/flutter-design-system/POWER.md +63 -0
  93. package/workflows/powers/flutter-design-system/SKILL.md +60 -0
  94. package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
  95. package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
  96. package/workflows/powers/flutter-drift/POWER.md +65 -0
  97. package/workflows/powers/flutter-drift/SKILL.md +62 -0
  98. package/workflows/powers/flutter-drift/references/migrations.md +22 -0
  99. package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
  100. package/workflows/powers/flutter-feature/POWER.md +65 -0
  101. package/workflows/powers/flutter-feature/SKILL.md +62 -0
  102. package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
  103. package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
  104. package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
  105. package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
  106. package/workflows/powers/flutter-go-router/POWER.md +64 -0
  107. package/workflows/powers/flutter-go-router/SKILL.md +61 -0
  108. package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
  109. package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
  110. package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
  111. package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
  112. package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
  113. package/workflows/powers/flutter-repository/POWER.md +64 -0
  114. package/workflows/powers/flutter-repository/SKILL.md +61 -0
  115. package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
  116. package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
  117. package/workflows/powers/flutter-riverpod/POWER.md +70 -0
  118. package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
  119. package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
  120. package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
  121. package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
  122. package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
  123. package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
  124. package/workflows/powers/flutter-state-machine/POWER.md +62 -0
  125. package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
  126. package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
  127. package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
  128. package/workflows/powers/flutter-testing/POWER.md +64 -0
  129. package/workflows/powers/flutter-testing/SKILL.md +61 -0
  130. package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
  131. package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
  132. package/workflows/powers/frontend-code-review/POWER.md +137 -0
  133. package/workflows/powers/frontend-code-review/SKILL.md +134 -0
  134. package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
  135. package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
  136. package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
  137. package/workflows/powers/frontend-design/POWER.md +163 -362
  138. package/workflows/powers/frontend-design/SKILL.md +163 -362
  139. package/workflows/powers/game-development/POWER.md +57 -140
  140. package/workflows/powers/game-development/SKILL.md +57 -140
  141. package/workflows/powers/geo-fundamentals/POWER.md +64 -126
  142. package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
  143. package/workflows/powers/git-workflow/POWER.md +135 -0
  144. package/workflows/powers/git-workflow/SKILL.md +132 -0
  145. package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
  146. package/workflows/powers/golang-pro/POWER.md +46 -35
  147. package/workflows/powers/golang-pro/SKILL.md +46 -35
  148. package/workflows/powers/graphql-architect/POWER.md +44 -62
  149. package/workflows/powers/graphql-architect/SKILL.md +44 -62
  150. package/workflows/powers/i18n-localization/POWER.md +118 -103
  151. package/workflows/powers/i18n-localization/SKILL.md +118 -103
  152. package/workflows/powers/java-pro/POWER.md +47 -22
  153. package/workflows/powers/java-pro/SKILL.md +47 -22
  154. package/workflows/powers/javascript-pro/POWER.md +47 -34
  155. package/workflows/powers/javascript-pro/SKILL.md +47 -34
  156. package/workflows/powers/kotlin-pro/POWER.md +46 -23
  157. package/workflows/powers/kotlin-pro/SKILL.md +46 -23
  158. package/workflows/powers/legacy-modernizer/POWER.md +43 -60
  159. package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
  160. package/workflows/powers/mcp-builder/POWER.md +65 -0
  161. package/workflows/powers/mcp-builder/SKILL.md +62 -0
  162. package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
  163. package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
  164. package/workflows/powers/microservices-architect/POWER.md +43 -70
  165. package/workflows/powers/microservices-architect/SKILL.md +43 -70
  166. package/workflows/powers/mobile-design/POWER.md +110 -345
  167. package/workflows/powers/mobile-design/SKILL.md +110 -345
  168. package/workflows/powers/mongodb/POWER.md +67 -0
  169. package/workflows/powers/mongodb/SKILL.md +64 -0
  170. package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
  171. package/workflows/powers/mysql/POWER.md +67 -0
  172. package/workflows/powers/mysql/SKILL.md +64 -0
  173. package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
  174. package/workflows/powers/neki/POWER.md +67 -0
  175. package/workflows/powers/neki/SKILL.md +64 -0
  176. package/workflows/powers/neki/references/neki-checklist.md +18 -0
  177. package/workflows/powers/nestjs-expert/POWER.md +45 -91
  178. package/workflows/powers/nestjs-expert/SKILL.md +45 -91
  179. package/workflows/powers/nextjs-developer/POWER.md +51 -44
  180. package/workflows/powers/nextjs-developer/SKILL.md +51 -44
  181. package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
  182. package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
  183. package/workflows/powers/observability/POWER.md +109 -0
  184. package/workflows/powers/observability/SKILL.md +106 -0
  185. package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
  186. package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
  187. package/workflows/powers/openai-docs/POWER.md +61 -0
  188. package/workflows/powers/openai-docs/SKILL.md +58 -0
  189. package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
  190. package/workflows/powers/performance-profiling/POWER.md +61 -114
  191. package/workflows/powers/performance-profiling/SKILL.md +61 -114
  192. package/workflows/powers/php-pro/POWER.md +116 -0
  193. package/workflows/powers/php-pro/SKILL.md +113 -0
  194. package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
  195. package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
  196. package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
  197. package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
  198. package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
  199. package/workflows/powers/playwright-e2e/POWER.md +85 -0
  200. package/workflows/powers/playwright-e2e/SKILL.md +82 -0
  201. package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
  202. package/workflows/powers/postgres/POWER.md +67 -0
  203. package/workflows/powers/postgres/SKILL.md +64 -0
  204. package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
  205. package/workflows/powers/prompt-engineer/POWER.md +47 -30
  206. package/workflows/powers/prompt-engineer/SKILL.md +47 -30
  207. package/workflows/powers/python-pro/POWER.md +47 -36
  208. package/workflows/powers/python-pro/SKILL.md +47 -36
  209. package/workflows/powers/react-best-practices/POWER.md +56 -33
  210. package/workflows/powers/react-best-practices/SKILL.md +56 -33
  211. package/workflows/powers/react-expert/POWER.md +47 -37
  212. package/workflows/powers/react-expert/SKILL.md +47 -37
  213. package/workflows/powers/redis/POWER.md +67 -0
  214. package/workflows/powers/redis/SKILL.md +64 -0
  215. package/workflows/powers/redis/references/redis-checklist.md +19 -0
  216. package/workflows/powers/ruby-pro/POWER.md +118 -0
  217. package/workflows/powers/ruby-pro/SKILL.md +115 -0
  218. package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
  219. package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
  220. package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
  221. package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
  222. package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
  223. package/workflows/powers/rust-pro/POWER.md +45 -31
  224. package/workflows/powers/rust-pro/SKILL.md +45 -31
  225. package/workflows/powers/security-engineer/POWER.md +129 -0
  226. package/workflows/powers/security-engineer/SKILL.md +126 -0
  227. package/workflows/powers/seo-fundamentals/POWER.md +59 -102
  228. package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
  229. package/workflows/powers/serverless-patterns/POWER.md +171 -0
  230. package/workflows/powers/serverless-patterns/SKILL.md +168 -0
  231. package/workflows/powers/skill-creator/POWER.md +90 -0
  232. package/workflows/powers/skill-creator/SKILL.md +87 -0
  233. package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
  234. package/workflows/powers/skill-creator/references/schemas.md +430 -0
  235. package/workflows/powers/spec-miner/POWER.md +49 -57
  236. package/workflows/powers/spec-miner/SKILL.md +49 -57
  237. package/workflows/powers/sqlite/POWER.md +67 -0
  238. package/workflows/powers/sqlite/SKILL.md +64 -0
  239. package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
  240. package/workflows/powers/sre-engineer/POWER.md +123 -64
  241. package/workflows/powers/sre-engineer/SKILL.md +123 -64
  242. package/workflows/powers/static-analysis/POWER.md +121 -77
  243. package/workflows/powers/static-analysis/SKILL.md +121 -77
  244. package/workflows/powers/stripe-best-practices/POWER.md +140 -17
  245. package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
  246. package/workflows/powers/supabase/POWER.md +67 -0
  247. package/workflows/powers/supabase/SKILL.md +64 -0
  248. package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
  249. package/workflows/powers/swift-pro/POWER.md +118 -0
  250. package/workflows/powers/swift-pro/SKILL.md +115 -0
  251. package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
  252. package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
  253. package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
  254. package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
  255. package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
  256. package/workflows/powers/tailwind-patterns/POWER.md +71 -240
  257. package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
  258. package/workflows/powers/testing-patterns/POWER.md +155 -10
  259. package/workflows/powers/testing-patterns/SKILL.md +155 -10
  260. package/workflows/powers/typescript-pro/POWER.md +47 -38
  261. package/workflows/powers/typescript-pro/SKILL.md +47 -38
  262. package/workflows/powers/vitess/POWER.md +67 -0
  263. package/workflows/powers/vitess/SKILL.md +64 -0
  264. package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
  265. package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
  266. package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
  267. package/workflows/powers/web-perf/POWER.md +43 -170
  268. package/workflows/powers/web-perf/SKILL.md +43 -170
  269. package/workflows/powers/webapp-testing/POWER.md +43 -164
  270. package/workflows/powers/webapp-testing/SKILL.md +43 -164
@@ -3,54 +3,65 @@ name: "golang-pro"
3
3
  description: "Use for modern Go services and tooling with Go 1.26-era language/runtime patterns, concurrency safety, and production operations."
4
4
  license: MIT
5
5
  metadata:
6
- version: "2.0.0"
7
- domain: "language"
8
- role: "specialist"
9
- stack: "go"
10
- baseline: "Go 1.26"
6
+ author: cubis-foundry
7
+ version: "3.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
11
9
  ---
12
10
 
13
11
  # Golang Pro
14
12
 
15
- ## When to use
13
+ ## Purpose
14
+
15
+ Expert-level guidance for modern Go development covering APIs, workers, CLIs, and microservices. Focuses on explicit error handling, context-propagated concurrency, generics where they simplify, and production profiling discipline.
16
+
17
+ ## When to Use
16
18
 
17
19
  - Building APIs, workers, CLIs, and microservices in Go.
18
- - Designing concurrency with goroutines/channels/context.
19
- - Optimizing latency, allocations, and reliability.
20
+ - Designing concurrency patterns with goroutines, channels, and context.
21
+ - Optimizing latency, allocations, and reliability in Go services.
22
+
23
+ ## Instructions
24
+
25
+ 1. **Define package boundaries and interfaces** — keep interfaces small and accept them where consumed, not where implemented. Prefer composition over deep inheritance-like abstractions.
26
+
27
+ 2. **Pass `context.Context` as the first parameter** in all APIs that cross network or scheduling boundaries. Do not store contexts in structs because they represent request-scoped lifetimes.
28
+
29
+ 3. **Handle every error with actionable wrapping** — wrap with `%w` for traceable error chains. Define sentinel errors for well-known failure conditions. Use custom error types when errors carry structured context. Do not discard errors silently; document any intentional discard with a comment. Do not use stringly-typed error comparisons (`err.Error() == "something"`) because sentinel values and type assertions are safer and refactor-proof.
30
+
31
+ 4. **Design concurrency with clear ownership** — use channels for ownership transfer, not shared mutation. Choose sync primitives (`Mutex`, `RWMutex`, `atomic`) deliberately. Keep goroutine lifecycles bounded with cancellation via `select` with `ctx.Done()`. Bound worker pools with fixed goroutine counts reading from a shared channel. Use `errgroup.Group` for coordinated fan-out with shared error propagation.
32
+
33
+ 5. **Use generics where they simplify** — generics serve well when the abstraction covers 3+ distinct types. Prefer concrete types when a function has only one or two callers because generics add cognitive cost. Avoid deeply nested type parameter lists; if a generic needs 4+ parameters, break it into smaller pieces.
34
+
35
+ 6. **Test with table-driven subtests and race detection** — use `t.Run` for systematic input coverage. Run `go test -race -count=1 ./...` in CI. Use `httptest.NewServer` for HTTP handler tests. Use `t.Cleanup()` for teardown. Use `testing.B` benchmarks with `b.ReportAllocs()` to prove optimization impact.
36
+
37
+ 7. **Lint and format consistently** — use `golangci-lint` with `govet`, `staticcheck`, `errcheck`, `gosec`, and `revive` at minimum. Enforce `gofmt`/`goimports` in CI. Use `gofumpt` for stricter formatting.
38
+
39
+ 8. **Thread observability through the stack** — use structured logs with request IDs and trace context. Make cancellation, retries, and deadlines visible in logging. Reproduce concurrency issues with race tests and deterministic fixtures first.
20
40
 
21
- ## Core workflow
41
+ 9. **Profile before optimizing** — benchmark hot paths with `testing.B` and `b.ReportAllocs()`. Use `pprof` (CPU, heap, goroutine, block, mutex) for production profiling. Do not fire-and-forget goroutines without a cancellation path because they leak resources. Do not use panic-based control flow because it circumvents explicit error handling. Do not create over-generalized interfaces without real callers because they add indirection without value.
22
42
 
23
- 1. Define package boundaries and interfaces.
24
- 2. Implement with explicit error handling and context propagation.
25
- 3. Add tests and race checks for behavior under load.
26
- 4. Profile before optimization.
43
+ 10. **Build for production** use `go build -trimpath -ldflags='-s -w'` for release binaries. Keep `go.mod` tidy. Use `ko` or multi-stage Docker for container builds.
27
44
 
28
- ## Baseline standards
45
+ ## Output Format
29
46
 
30
- - Keep APIs context-aware: pass `context.Context` first.
31
- - Handle every error with actionable wrapping.
32
- - Use table-driven tests and subtests for logic coverage.
33
- - Run `go test -race` for concurrency-sensitive paths.
34
- - Prefer composition over deep inheritance-like abstractions.
47
+ Produces Go code following standard project layout with explicit error handling, context propagation, and bounded concurrency patterns. Includes table-driven tests and structured error types where applicable.
35
48
 
36
- ## Implementation guidance
49
+ ## References
37
50
 
38
- - Use channels for ownership transfer, not shared mutation.
39
- - Choose sync primitives deliberately (`Mutex`, `RWMutex`, `atomic`).
40
- - Keep goroutine lifecycles bounded with cancellation.
41
- - Use generics where they simplify, not where they obscure.
42
- - Benchmark hot paths (`testing.B`, `pprof`) before tuning.
51
+ | File | Load when |
52
+ | --------------------------------- | ----------------------------------------------------------------------------- |
53
+ | `references/concurrency.md` | Concurrency ownership, channels, mutexes, or cancellation safety need detail. |
54
+ | `references/generics.md` | Generics tradeoffs or reusable type-safe helpers are in scope. |
55
+ | `references/interfaces.md` | Interface boundaries and package seams need review. |
56
+ | `references/testing.md` | Test strategy, race checks, or benchmark setup is needed. |
57
+ | `references/project-structure.md` | Package layout or service/module decomposition needs guidance. |
43
58
 
44
- ## Avoid
59
+ ## Scripts
45
60
 
46
- - Fire-and-forget goroutines without cancellation path.
47
- - Panic-based control flow.
48
- - Over-generalized interfaces without real callers.
61
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
49
62
 
50
- ## Reference files
63
+ ## Examples
51
64
 
52
- - `references/concurrency.md`
53
- - `references/generics.md`
54
- - `references/interfaces.md`
55
- - `references/testing.md`
56
- - `references/project-structure.md`
65
+ - "Design the error handling strategy for this Go API service with custom error types and middleware-based error mapping."
66
+ - "Refactor this unbounded goroutine fan-out into a bounded worker pool with context cancellation."
67
+ - "Set up a table-driven test suite for this parser with race detection and benchmark coverage."
@@ -2,88 +2,70 @@
2
2
  ---
3
3
  inclusion: manual
4
4
  name: graphql-architect
5
- description: Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions. Invoke for schema design, resolvers with DataLoader, query optimization, federation directives.
5
+ description: "Use when designing GraphQL schemas, resolver boundaries, batching strategy, auth and policy enforcement, federation shape, query safety, and real-time graph behavior."
6
6
  license: MIT
7
7
  metadata:
8
- author: https://github.com/Jeffallan
9
- version: "1.0.0"
10
- domain: api-architecture
11
- triggers: GraphQL, Apollo Federation, GraphQL schema, API graph, GraphQL subscriptions, Apollo Server, schema design, GraphQL resolvers, DataLoader
12
- role: architect
13
- scope: design
14
- output-format: schema
15
- related-skills: api-designer, microservices-architect, database-optimizer
8
+ author: cubis-foundry
9
+ version: "3.0"
10
+ compatibility: Claude Code, Codex, GitHub Copilot
16
11
  ---
17
12
 
18
13
  # GraphQL Architect
19
14
 
20
- Senior GraphQL architect specializing in schema design and distributed graph architectures with deep expertise in Apollo Federation 2.5+, GraphQL subscriptions, and performance optimization.
15
+ ## Purpose
21
16
 
22
- ## Role Definition
17
+ Use when designing GraphQL schemas, resolver boundaries, batching strategy, auth and policy enforcement, federation shape, query safety, and real-time graph behavior.
23
18
 
24
- You are a senior GraphQL architect with 10+ years of API design experience. You specialize in Apollo Federation, schema-first design, and building type-safe API graphs that scale across teams and services. You master resolvers, DataLoader patterns, and real-time subscriptions.
19
+ ## When to Use
25
20
 
26
- ## When to Use This Skill
21
+ - Designing or refactoring GraphQL schemas and resolver structure.
22
+ - Choosing batching, caching, federation, auth, and subscription behavior.
23
+ - Reviewing query safety, nullability, and graph boundary decisions.
24
+ - Converting a REST-shaped backend into a graph with deliberate tradeoffs.
27
25
 
28
- - Designing GraphQL schemas and type systems
29
- - Implementing Apollo Federation architectures
30
- - Building resolvers with DataLoader optimization
31
- - Creating real-time GraphQL subscriptions
32
- - Optimizing query complexity and performance
33
- - Setting up authentication and authorization
26
+ ## Instructions
34
27
 
35
- ## Core Workflow
28
+ 1. Model the domain graph and choose what belongs in the schema, not the storage layer.
29
+ 2. Define nullability, pagination, mutation semantics, and auth ownership explicitly.
30
+ 3. Design resolver boundaries with batching and cache behavior in mind.
31
+ 4. Add query safety controls, policy checks, and subscription behavior where needed.
32
+ 5. Verify that the graph remains understandable for clients and operable for services.
36
33
 
37
- 1. **Domain Modeling** - Map business domains to GraphQL type system
38
- 2. **Design Schema** - Create types, interfaces, unions with federation directives
39
- 3. **Implement Resolvers** - Write efficient resolvers with DataLoader patterns
40
- 4. **Secure** - Add query complexity limits, depth limiting, field-level auth
41
- 5. **Optimize** - Performance tune with caching, persisted queries, monitoring
34
+ ### Baseline standards
42
35
 
43
- ## Reference Guide
36
+ - Prefer schema clarity over exposing every backend shape.
37
+ - Use batching to prevent N+1 patterns.
38
+ - Keep nullability intentional and documented.
39
+ - Keep auth and permission rules explicit at schema or resolver boundaries.
40
+ - Treat federation and subscriptions as architectural choices, not defaults.
41
+ - Make query cost and auth behavior explicit.
44
42
 
45
- Load detailed guidance based on context:
43
+ ### Constraints
46
44
 
47
- | Topic | Reference | Load When |
48
- |-------|-----------|-----------|
49
- | Schema Design | `references/schema-design.md` | Types, interfaces, unions, enums, input types |
50
- | Resolvers | `references/resolvers.md` | Resolver patterns, context, DataLoader, N+1 |
51
- | Federation | `references/federation.md` | Apollo Federation, subgraphs, entities, directives |
52
- | Subscriptions | `references/subscriptions.md` | Real-time updates, WebSocket, pub/sub patterns |
53
- | Security | `references/security.md` | Query depth, complexity analysis, authentication |
54
- | REST Migration | `references/migration-from-rest.md` | Migrating REST APIs to GraphQL |
45
+ - Avoid rEST-shaped GraphQL that only mirrors endpoint habits.
46
+ - Avoid resolver logic that hides unbounded fan-out.
47
+ - Avoid ambiguous nullability and inconsistent mutation payloads.
48
+ - Avoid authorization that exists only in the client or gateway with no resolver ownership.
49
+ - Avoid adding federation complexity before single-graph boundaries are clear.
55
50
 
56
- ## Constraints
51
+ ## Output Format
57
52
 
58
- ### MUST DO
59
- - Use schema-first design approach
60
- - Implement proper nullable field patterns
61
- - Use DataLoader for batching and caching
62
- - Add query complexity analysis
63
- - Document all types and fields
64
- - Follow GraphQL naming conventions (camelCase)
65
- - Use federation directives correctly
66
- - Provide example queries for all operations
53
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
67
54
 
68
- ### MUST NOT DO
69
- - Create N+1 query problems
70
- - Skip query depth limiting
71
- - Expose internal implementation details
72
- - Use REST patterns in GraphQL
73
- - Return null for non-nullable fields
74
- - Skip error handling in resolvers
75
- - Hardcode authorization logic
76
- - Ignore schema validation
55
+ ## References
77
56
 
78
- ## Output Templates
57
+ Load on demand. Do not preload all reference files.
79
58
 
80
- When implementing GraphQL features, provide:
81
- 1. Schema definition (SDL with types and directives)
82
- 2. Resolver implementation (with DataLoader patterns)
83
- 3. Query/mutation/subscription examples
84
- 4. Brief explanation of design decisions
59
+ | File | Load when |
60
+ | --- | --- |
61
+ | `references/schema-resolver-checklist.md` | You need a more detailed checklist for schema shape, nullability, batching, auth and policy, subscriptions, federation, and query safety. |
85
62
 
86
- ## Knowledge Reference
63
+ ## Scripts
87
64
 
88
- Apollo Server, Apollo Federation 2.5+, GraphQL SDL, DataLoader, GraphQL Subscriptions, WebSocket, Redis pub/sub, schema composition, query complexity, persisted queries, schema stitching, type generation
65
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
66
+
67
+ ## Examples
68
+
69
+ - "Help me with graphql architect best practices in this project"
70
+ - "Review my graphql architect implementation for issues"
89
71
  ````
@@ -1,86 +1,68 @@
1
1
  ---
2
2
  name: graphql-architect
3
- description: Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions. Invoke for schema design, resolvers with DataLoader, query optimization, federation directives.
3
+ description: "Use when designing GraphQL schemas, resolver boundaries, batching strategy, auth and policy enforcement, federation shape, query safety, and real-time graph behavior."
4
4
  license: MIT
5
5
  metadata:
6
- author: https://github.com/Jeffallan
7
- version: "1.0.0"
8
- domain: api-architecture
9
- triggers: GraphQL, Apollo Federation, GraphQL schema, API graph, GraphQL subscriptions, Apollo Server, schema design, GraphQL resolvers, DataLoader
10
- role: architect
11
- scope: design
12
- output-format: schema
13
- related-skills: api-designer, microservices-architect, database-optimizer
6
+ author: cubis-foundry
7
+ version: "3.0"
8
+ compatibility: Claude Code, Codex, GitHub Copilot
14
9
  ---
15
10
 
16
11
  # GraphQL Architect
17
12
 
18
- Senior GraphQL architect specializing in schema design and distributed graph architectures with deep expertise in Apollo Federation 2.5+, GraphQL subscriptions, and performance optimization.
13
+ ## Purpose
19
14
 
20
- ## Role Definition
15
+ Use when designing GraphQL schemas, resolver boundaries, batching strategy, auth and policy enforcement, federation shape, query safety, and real-time graph behavior.
21
16
 
22
- You are a senior GraphQL architect with 10+ years of API design experience. You specialize in Apollo Federation, schema-first design, and building type-safe API graphs that scale across teams and services. You master resolvers, DataLoader patterns, and real-time subscriptions.
17
+ ## When to Use
23
18
 
24
- ## When to Use This Skill
19
+ - Designing or refactoring GraphQL schemas and resolver structure.
20
+ - Choosing batching, caching, federation, auth, and subscription behavior.
21
+ - Reviewing query safety, nullability, and graph boundary decisions.
22
+ - Converting a REST-shaped backend into a graph with deliberate tradeoffs.
25
23
 
26
- - Designing GraphQL schemas and type systems
27
- - Implementing Apollo Federation architectures
28
- - Building resolvers with DataLoader optimization
29
- - Creating real-time GraphQL subscriptions
30
- - Optimizing query complexity and performance
31
- - Setting up authentication and authorization
24
+ ## Instructions
32
25
 
33
- ## Core Workflow
26
+ 1. Model the domain graph and choose what belongs in the schema, not the storage layer.
27
+ 2. Define nullability, pagination, mutation semantics, and auth ownership explicitly.
28
+ 3. Design resolver boundaries with batching and cache behavior in mind.
29
+ 4. Add query safety controls, policy checks, and subscription behavior where needed.
30
+ 5. Verify that the graph remains understandable for clients and operable for services.
34
31
 
35
- 1. **Domain Modeling** - Map business domains to GraphQL type system
36
- 2. **Design Schema** - Create types, interfaces, unions with federation directives
37
- 3. **Implement Resolvers** - Write efficient resolvers with DataLoader patterns
38
- 4. **Secure** - Add query complexity limits, depth limiting, field-level auth
39
- 5. **Optimize** - Performance tune with caching, persisted queries, monitoring
32
+ ### Baseline standards
40
33
 
41
- ## Reference Guide
34
+ - Prefer schema clarity over exposing every backend shape.
35
+ - Use batching to prevent N+1 patterns.
36
+ - Keep nullability intentional and documented.
37
+ - Keep auth and permission rules explicit at schema or resolver boundaries.
38
+ - Treat federation and subscriptions as architectural choices, not defaults.
39
+ - Make query cost and auth behavior explicit.
42
40
 
43
- Load detailed guidance based on context:
41
+ ### Constraints
44
42
 
45
- | Topic | Reference | Load When |
46
- |-------|-----------|-----------|
47
- | Schema Design | `references/schema-design.md` | Types, interfaces, unions, enums, input types |
48
- | Resolvers | `references/resolvers.md` | Resolver patterns, context, DataLoader, N+1 |
49
- | Federation | `references/federation.md` | Apollo Federation, subgraphs, entities, directives |
50
- | Subscriptions | `references/subscriptions.md` | Real-time updates, WebSocket, pub/sub patterns |
51
- | Security | `references/security.md` | Query depth, complexity analysis, authentication |
52
- | REST Migration | `references/migration-from-rest.md` | Migrating REST APIs to GraphQL |
43
+ - Avoid rEST-shaped GraphQL that only mirrors endpoint habits.
44
+ - Avoid resolver logic that hides unbounded fan-out.
45
+ - Avoid ambiguous nullability and inconsistent mutation payloads.
46
+ - Avoid authorization that exists only in the client or gateway with no resolver ownership.
47
+ - Avoid adding federation complexity before single-graph boundaries are clear.
53
48
 
54
- ## Constraints
49
+ ## Output Format
55
50
 
56
- ### MUST DO
57
- - Use schema-first design approach
58
- - Implement proper nullable field patterns
59
- - Use DataLoader for batching and caching
60
- - Add query complexity analysis
61
- - Document all types and fields
62
- - Follow GraphQL naming conventions (camelCase)
63
- - Use federation directives correctly
64
- - Provide example queries for all operations
51
+ Provide implementation guidance, code examples, and configuration as appropriate to the task.
65
52
 
66
- ### MUST NOT DO
67
- - Create N+1 query problems
68
- - Skip query depth limiting
69
- - Expose internal implementation details
70
- - Use REST patterns in GraphQL
71
- - Return null for non-nullable fields
72
- - Skip error handling in resolvers
73
- - Hardcode authorization logic
74
- - Ignore schema validation
53
+ ## References
75
54
 
76
- ## Output Templates
55
+ Load on demand. Do not preload all reference files.
77
56
 
78
- When implementing GraphQL features, provide:
79
- 1. Schema definition (SDL with types and directives)
80
- 2. Resolver implementation (with DataLoader patterns)
81
- 3. Query/mutation/subscription examples
82
- 4. Brief explanation of design decisions
57
+ | File | Load when |
58
+ | --- | --- |
59
+ | `references/schema-resolver-checklist.md` | You need a more detailed checklist for schema shape, nullability, batching, auth and policy, subscriptions, federation, and query safety. |
83
60
 
84
- ## Knowledge Reference
61
+ ## Scripts
85
62
 
86
- Apollo Server, Apollo Federation 2.5+, GraphQL SDL, DataLoader, GraphQL Subscriptions, WebSocket, Redis pub/sub, schema composition, query complexity, persisted queries, schema stitching, type generation
63
+ No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
64
+
65
+ ## Examples
66
+
67
+ - "Help me with graphql architect best practices in this project"
68
+ - "Review my graphql architect implementation for issues"
@@ -2,156 +2,171 @@
2
2
  ---
3
3
  inclusion: manual
4
4
  name: i18n-localization
5
- description: Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.
6
- allowed-tools: Read, Glob, Grep
5
+ description: Implement internationalization and localization including RTL support, pluralization, date/number formatting, translation workflows, and locale-aware UI.
6
+ license: Apache-2.0
7
+ metadata:
8
+ author: cubis-foundry
9
+ version: "3.0"
10
+ compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
7
11
  ---
8
12
 
9
- # i18n & Localization
13
+ # I18N & Localization
10
14
 
11
- > Internationalization (i18n) and Localization (L10n) best practices.
15
+ ## Purpose
12
16
 
13
- ---
17
+ Guide internationalization (i18n) and localization (l10n) implementation. Ensure applications can be adapted for different languages, regions, and cultural conventions without code changes.
14
18
 
15
- ## 1. Core Concepts
19
+ ## When to Use
16
20
 
17
- | Term | Meaning |
18
- |------|---------|
19
- | **i18n** | Internationalization - making app translatable |
20
- | **L10n** | Localization - actual translations |
21
- | **Locale** | Language + Region (en-US, tr-TR) |
22
- | **RTL** | Right-to-left languages (Arabic, Hebrew) |
21
+ - Adding multi-language support to an application
22
+ - Implementing RTL (right-to-left) layout support
23
+ - Handling dates, numbers, and currencies across locales
24
+ - Setting up translation workflows and string management
25
+ - Reviewing code for i18n readiness
26
+ - Building locale-aware UI components
23
27
 
24
- ---
28
+ ## Instructions
25
29
 
26
- ## 2. When to Use i18n
30
+ ### Step 1 Externalize All User-Facing Strings
27
31
 
28
- | Project Type | i18n Needed? |
29
- |--------------|--------------|
30
- | Public web app | ✅ Yes |
31
- | SaaS product | ✅ Yes |
32
- | Internal tool | ⚠️ Maybe |
33
- | Single-region app | ⚠️ Consider future |
34
- | Personal project | ❌ Optional |
32
+ **Never hardcode user-visible text**:
35
33
 
36
- ---
34
+ ```typescript
35
+ // DON'T
36
+ <button>Save Changes</button>
37
37
 
38
- ## 3. Implementation Patterns
38
+ // DO
39
+ <button>{t('actions.save_changes')}</button>
40
+ ```
39
41
 
40
- ### React (react-i18next)
42
+ **String keys**:
41
43
 
42
- ```tsx
43
- import { useTranslation } from 'react-i18next';
44
+ - Use namespaced dot notation: `page.section.element`
45
+ - Keys should be descriptive, not the English text
46
+ - Group by feature/page, not by component
44
47
 
45
- function Welcome() {
46
- const { t } = useTranslation();
47
- return <h1>{t('welcome.title')}</h1>;
48
+ **Message format** (ICU MessageFormat):
49
+
50
+ ```json
51
+ {
52
+ "items.count": "{count, plural, =0 {No items} one {# item} other {# items}}",
53
+ "greeting": "Hello, {name}!",
54
+ "order.total": "Total: {total, number, currency}"
48
55
  }
49
56
  ```
50
57
 
51
- ### Next.js (next-intl)
58
+ ### Step 2 — Handle Pluralization
52
59
 
53
- ```tsx
54
- import { useTranslations } from 'next-intl';
60
+ Different languages have different plural rules (Arabic has 6 plural forms):
55
61
 
56
- export default function Page() {
57
- const t = useTranslations('Home');
58
- return <h1>{t('title')}</h1>;
62
+ ```json
63
+ {
64
+ "en": { "items": "{count, plural, one {# item} other {# items}}" },
65
+ "ar": {
66
+ "items": "{count, plural, zero {لا عناصر} one {عنصر واحد} two {عنصران} few {# عناصر} many {# عنصراً} other {# عنصر}}"
67
+ }
59
68
  }
60
69
  ```
61
70
 
62
- ### Python (gettext)
71
+ Never build pluralization with ternaries — always use the ICU plural syntax or equivalent library (Intl.PluralRules).
63
72
 
64
- ```python
65
- from gettext import gettext as _
73
+ ### Step 3 — Format Dates, Numbers, and Currencies
66
74
 
67
- print(_("Welcome to our app"))
68
- ```
75
+ Use `Intl` APIs — never format manually:
69
76
 
70
- ---
77
+ ```typescript
78
+ // Date
79
+ new Intl.DateTimeFormat("de-DE", { dateStyle: "long" }).format(date);
80
+ // → "15. Januar 2025"
71
81
 
72
- ## 4. File Structure
82
+ // Number
83
+ new Intl.NumberFormat("ja-JP").format(1234567);
84
+ // → "1,234,567"
73
85
 
74
- ```
75
- locales/
76
- ├── en/
77
- │ ├── common.json
78
- │ ├── auth.json
79
- │ └── errors.json
80
- ├── tr/
81
- │ ├── common.json
82
- │ ├── auth.json
83
- │ └── errors.json
84
- └── ar/ # RTL
85
- └── ...
86
+ // Currency
87
+ new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(
88
+ 42.5,
89
+ );
90
+ // → "$42.50"
91
+
92
+ // Relative time
93
+ new Intl.RelativeTimeFormat("fr", { numeric: "auto" }).format(-1, "day");
94
+ // → "hier"
86
95
  ```
87
96
 
88
- ---
97
+ ### Step 4 — Support RTL Languages
89
98
 
90
- ## 5. Best Practices
99
+ **CSS logical properties** (replace physical with logical):
91
100
 
92
- ### DO
101
+ | Physical (DON'T) | Logical (DO) |
102
+ | ------------------ | --------------------- |
103
+ | `margin-left` | `margin-inline-start` |
104
+ | `padding-right` | `padding-inline-end` |
105
+ | `text-align: left` | `text-align: start` |
106
+ | `float: left` | `float: inline-start` |
107
+ | `border-left` | `border-inline-start` |
93
108
 
94
- - Use translation keys, not raw text
95
- - Namespace translations by feature
96
- - Support pluralization
97
- - Handle date/number formats per locale
98
- - Plan for RTL from the start
99
- - Use ICU message format for complex strings
109
+ **Layout**:
100
110
 
101
- ### DON'T
111
+ - Use `dir="auto"` on user-generated content
112
+ - Set `<html dir="rtl" lang="ar">` at the document level
113
+ - Flexbox and Grid respect `direction` automatically
114
+ - Mirror icons that indicate direction (arrows, back buttons)
115
+ - Don't mirror: logos, numbers, media controls, checkmarks
102
116
 
103
- - Hardcode strings in components
104
- - Concatenate translated strings
105
- - Assume text length (German is 30% longer)
106
- - Forget about RTL layout
107
- - Mix languages in same file
117
+ ### Step 5 Translation Workflow
108
118
 
109
- ---
119
+ **File structure**:
110
120
 
111
- ## 6. Common Issues
121
+ ```
122
+ locales/
123
+ ├── en/
124
+ │ ├── common.json (shared strings)
125
+ │ ├── auth.json (login/signup)
126
+ │ └── dashboard.json (dashboard page)
127
+ ├── fr/
128
+ ├── ja/
129
+ └── ar/
130
+ ```
112
131
 
113
- | Issue | Solution |
114
- |-------|----------|
115
- | Missing translation | Fallback to default language |
116
- | Hardcoded strings | Use linter/checker script |
117
- | Date format | Use Intl.DateTimeFormat |
118
- | Number format | Use Intl.NumberFormat |
119
- | Pluralization | Use ICU message format |
132
+ **Process**:
120
133
 
121
- ---
134
+ 1. Developer adds key + English string
135
+ 2. CI extracts new/changed keys automatically
136
+ 3. Strings sent to translators (Crowdin, Lokalise, or equivalent)
137
+ 4. Translations imported back as JSON/YAML
138
+ 5. CI validates: no missing keys, no untranslated strings, valid ICU syntax
122
139
 
123
- ## 7. RTL Support
140
+ **Rules**:
124
141
 
125
- ```css
126
- /* CSS Logical Properties */
127
- .container {
128
- margin-inline-start: 1rem; /* Not margin-left */
129
- padding-inline-end: 1rem; /* Not padding-right */
130
- }
142
+ - Never concatenate translated strings (`t('hello') + ' ' + name` breaks in many languages)
143
+ - Provide context for translators (comments in message files)
144
+ - Max string length varies by language (German ~30% longer than English)
145
+ - Test with pseudo-localization (e.g., "Ŝàvé Çhàñgéŝ") to catch hardcoded strings
146
+
147
+ ## Output Format
131
148
 
132
- [dir="rtl"] .icon {
133
- transform: scaleX(-1);
134
- }
135
149
  ```
150
+ ## I18N Assessment
151
+ [current state and gaps]
136
152
 
137
- ---
153
+ ## Implementation
154
+ [code changes for i18n support]
138
155
 
139
- ## 8. Checklist
156
+ ## Translation Setup
157
+ [file structure, workflow, tooling]
140
158
 
141
- Before shipping:
159
+ ## RTL Support
160
+ [layout changes for bidirectional support]
161
+ ```
142
162
 
143
- - [ ] All user-facing strings use translation keys
144
- - [ ] Locale files exist for all supported languages
145
- - [ ] Date/number formatting uses Intl API
146
- - [ ] RTL layout tested (if applicable)
147
- - [ ] Fallback language configured
148
- - [ ] No hardcoded strings in components
163
+ ## Examples
149
164
 
150
- ---
165
+ **User**: "Add multi-language support to our React app"
166
+
167
+ **Response approach**: Set up react-intl or next-intl. Externalize all strings with namespaced keys. Configure locale detection (URL, browser, user preference). Set up ICU MessageFormat for plurals and interpolation. Show translation file structure.
151
168
 
152
- ## Script
169
+ **User**: "Our app needs to support Arabic"
153
170
 
154
- | Script | Purpose | Command |
155
- |--------|---------|---------|
156
- | `scripts/i18n_checker.py` | Detect hardcoded strings & missing translations | `python scripts/i18n_checker.py <project_path>` |
171
+ **Response approach**: Add RTL support with CSS logical properties. Set `dir="rtl"` on html element. Audit all physical CSS properties. Mirror directional icons. Test with Arabic translations for text expansion.
157
172
  ````