@cubis/foundry 0.3.71 → 0.3.73
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.
- package/CHANGELOG.md +23 -2
- package/dist/cli/core.js +9 -22
- package/dist/cli/core.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/core.ts +13 -22
- package/workflows/powers/accessibility/POWER.md +83 -94
- package/workflows/powers/accessibility/SKILL.md +82 -94
- package/workflows/powers/agent-design/POWER.md +201 -0
- package/workflows/powers/agent-design/SKILL.md +198 -0
- package/workflows/powers/agent-design/references/clarification-patterns.md +153 -0
- package/workflows/powers/agent-design/references/skill-testing.md +164 -0
- package/workflows/powers/agent-design/references/workflow-patterns.md +226 -0
- package/workflows/powers/agentic-eval/POWER.md +62 -0
- package/workflows/powers/agentic-eval/SKILL.md +59 -0
- package/workflows/powers/agentic-eval/references/rubric-and-regression-checklist.md +11 -0
- package/workflows/powers/api-designer/POWER.md +43 -71
- package/workflows/powers/api-designer/SKILL.md +43 -71
- package/workflows/powers/api-patterns/POWER.md +42 -56
- package/workflows/powers/api-patterns/SKILL.md +42 -57
- package/workflows/powers/architecture-designer/POWER.md +43 -60
- package/workflows/powers/architecture-designer/SKILL.md +43 -60
- package/workflows/powers/ask-questions-if-underspecified/POWER.md +51 -3
- package/workflows/powers/auth-architect/POWER.md +69 -0
- package/workflows/powers/auth-architect/SKILL.md +66 -0
- package/workflows/powers/auth-architect/references/session-token-policy-checklist.md +45 -0
- package/workflows/powers/behavioral-modes/POWER.md +100 -9
- package/workflows/powers/c-pro/POWER.md +105 -0
- package/workflows/powers/c-pro/SKILL.md +102 -0
- package/workflows/powers/c-pro/references/build-systems-and-toolchains.md +148 -0
- package/workflows/powers/c-pro/references/common-ub-and-portability.md +166 -0
- package/workflows/powers/c-pro/references/debugging-with-sanitizers.md +205 -0
- package/workflows/powers/c-pro/references/memory-safety-and-build-checklist.md +60 -0
- package/workflows/powers/c-pro/references/posix-and-platform-apis.md +244 -0
- package/workflows/powers/changelog-generator/POWER.md +127 -63
- package/workflows/powers/changelog-generator/SKILL.md +126 -63
- package/workflows/powers/ci-cd-pipelines/POWER.md +156 -0
- package/workflows/powers/ci-cd-pipelines/SKILL.md +153 -0
- package/workflows/powers/ci-cd-pipelines/references/github-actions-patterns.md +160 -0
- package/workflows/powers/ci-cd-pipelines/references/pipeline-security-checklist.md +57 -0
- package/workflows/powers/cli-developer/POWER.md +152 -95
- package/workflows/powers/cli-developer/SKILL.md +152 -95
- package/workflows/powers/cpp-pro/POWER.md +111 -0
- package/workflows/powers/cpp-pro/SKILL.md +108 -0
- package/workflows/powers/cpp-pro/references/concurrency-primitives.md +266 -0
- package/workflows/powers/cpp-pro/references/move-semantics-and-value-types.md +149 -0
- package/workflows/powers/cpp-pro/references/performance-and-profiling.md +191 -0
- package/workflows/powers/cpp-pro/references/raii-and-modern-cpp-checklist.md +87 -0
- package/workflows/powers/cpp-pro/references/template-and-concepts-patterns.md +205 -0
- package/workflows/powers/csharp-pro/POWER.md +47 -22
- package/workflows/powers/csharp-pro/SKILL.md +47 -22
- package/workflows/powers/dart-pro/POWER.md +68 -0
- package/workflows/powers/dart-pro/SKILL.md +65 -0
- package/workflows/powers/dart-pro/references/isolate-and-concurrency.md +180 -0
- package/workflows/powers/dart-pro/references/null-safety-and-async-patterns.md +133 -0
- package/workflows/powers/dart-pro/references/package-structure-and-linting.md +193 -0
- package/workflows/powers/dart-pro/references/sealed-records-patterns.md +173 -0
- package/workflows/powers/dart-pro/references/testing-and-mocking.md +235 -0
- package/workflows/powers/database-design/POWER.md +47 -33
- package/workflows/powers/database-design/SKILL.md +47 -33
- package/workflows/powers/database-optimizer/POWER.md +43 -64
- package/workflows/powers/database-optimizer/SKILL.md +43 -64
- package/workflows/powers/database-skills/POWER.md +59 -93
- package/workflows/powers/database-skills/SKILL.md +59 -93
- package/workflows/powers/debugging-strategies/POWER.md +69 -0
- package/workflows/powers/debugging-strategies/SKILL.md +66 -0
- package/workflows/powers/debugging-strategies/references/reproduce-isolate-verify-checklist.md +42 -0
- package/workflows/powers/deep-research/POWER.md +67 -0
- package/workflows/powers/deep-research/SKILL.md +64 -0
- package/workflows/powers/deep-research/references/multi-round-research-loop.md +80 -0
- package/workflows/powers/design-system-builder/POWER.md +130 -116
- package/workflows/powers/design-system-builder/SKILL.md +130 -116
- package/workflows/powers/devops-engineer/POWER.md +120 -57
- package/workflows/powers/devops-engineer/SKILL.md +120 -57
- package/workflows/powers/docker-kubernetes/POWER.md +94 -0
- package/workflows/powers/docker-kubernetes/SKILL.md +91 -0
- package/workflows/powers/docker-kubernetes/references/dockerfile-optimization-checklist.md +35 -0
- package/workflows/powers/docker-kubernetes/references/kubernetes-deployment-patterns.md +59 -0
- package/workflows/powers/documentation-templates/POWER.md +158 -127
- package/workflows/powers/documentation-templates/SKILL.md +158 -127
- package/workflows/powers/drizzle-expert/POWER.md +66 -0
- package/workflows/powers/drizzle-expert/SKILL.md +63 -0
- package/workflows/powers/drizzle-expert/references/runtime-pairing-matrix.md +16 -0
- package/workflows/powers/drizzle-expert/references/schema-and-migration-playbook.md +18 -0
- package/workflows/powers/error-ux-observability/POWER.md +144 -131
- package/workflows/powers/error-ux-observability/SKILL.md +143 -131
- package/workflows/powers/fastapi-expert/POWER.md +46 -60
- package/workflows/powers/fastapi-expert/SKILL.md +46 -60
- package/workflows/powers/firebase/POWER.md +65 -0
- package/workflows/powers/firebase/SKILL.md +62 -0
- package/workflows/powers/firebase/references/platform-routing.md +16 -0
- package/workflows/powers/firebase/references/rules-and-indexes-checklist.md +11 -0
- package/workflows/powers/flutter-design-system/POWER.md +63 -0
- package/workflows/powers/flutter-design-system/SKILL.md +60 -0
- package/workflows/powers/flutter-design-system/references/shared-widgets.md +29 -0
- package/workflows/powers/flutter-design-system/references/tokens-and-theme.md +34 -0
- package/workflows/powers/flutter-drift/POWER.md +65 -0
- package/workflows/powers/flutter-drift/SKILL.md +62 -0
- package/workflows/powers/flutter-drift/references/migrations.md +22 -0
- package/workflows/powers/flutter-drift/references/query-patterns.md +26 -0
- package/workflows/powers/flutter-feature/POWER.md +65 -0
- package/workflows/powers/flutter-feature/SKILL.md +62 -0
- package/workflows/powers/flutter-feature/references/architecture-rules.md +85 -0
- package/workflows/powers/flutter-feature/references/composite-provider.md +58 -0
- package/workflows/powers/flutter-feature/references/outbox-pattern.md +87 -0
- package/workflows/powers/flutter-feature/references/testing-patterns.md +218 -0
- package/workflows/powers/flutter-go-router/POWER.md +64 -0
- package/workflows/powers/flutter-go-router/SKILL.md +61 -0
- package/workflows/powers/flutter-go-router/references/guards-and-deeplinks.md +20 -0
- package/workflows/powers/flutter-go-router/references/typed-routes.md +27 -0
- package/workflows/powers/flutter-offline-sync/POWER.md +62 -0
- package/workflows/powers/flutter-offline-sync/SKILL.md +59 -0
- package/workflows/powers/flutter-offline-sync/references/outbox-full.md +44 -0
- package/workflows/powers/flutter-repository/POWER.md +64 -0
- package/workflows/powers/flutter-repository/SKILL.md +61 -0
- package/workflows/powers/flutter-repository/references/drift-patterns.md +21 -0
- package/workflows/powers/flutter-repository/references/retrofit-patterns.md +20 -0
- package/workflows/powers/flutter-riverpod/POWER.md +70 -0
- package/workflows/powers/flutter-riverpod/SKILL.md +67 -0
- package/workflows/powers/flutter-riverpod/references/async-and-mutations.md +19 -0
- package/workflows/powers/flutter-riverpod/references/async-lifecycle.md +19 -0
- package/workflows/powers/flutter-riverpod/references/provider-selection.md +20 -0
- package/workflows/powers/flutter-riverpod/references/testing.md +21 -0
- package/workflows/powers/flutter-riverpod/references/version-matrix.md +24 -0
- package/workflows/powers/flutter-state-machine/POWER.md +62 -0
- package/workflows/powers/flutter-state-machine/SKILL.md +59 -0
- package/workflows/powers/flutter-state-machine/references/app-state-contract.md +23 -0
- package/workflows/powers/flutter-state-machine/references/ui-rendering.md +14 -0
- package/workflows/powers/flutter-testing/POWER.md +64 -0
- package/workflows/powers/flutter-testing/SKILL.md +61 -0
- package/workflows/powers/flutter-testing/references/offline-sync-tests.md +16 -0
- package/workflows/powers/flutter-testing/references/test-layers.md +33 -0
- package/workflows/powers/frontend-code-review/POWER.md +137 -0
- package/workflows/powers/frontend-code-review/SKILL.md +134 -0
- package/workflows/powers/frontend-code-review/references/common-antipatterns.md +86 -0
- package/workflows/powers/frontend-code-review/references/performance-budgets.md +56 -0
- package/workflows/powers/frontend-code-review/references/review-checklists.md +47 -0
- package/workflows/powers/frontend-design/POWER.md +163 -362
- package/workflows/powers/frontend-design/SKILL.md +163 -362
- package/workflows/powers/game-development/POWER.md +57 -140
- package/workflows/powers/game-development/SKILL.md +57 -140
- package/workflows/powers/geo-fundamentals/POWER.md +64 -126
- package/workflows/powers/geo-fundamentals/SKILL.md +64 -127
- package/workflows/powers/git-workflow/POWER.md +135 -0
- package/workflows/powers/git-workflow/SKILL.md +132 -0
- package/workflows/powers/git-workflow/references/pr-review-checklist.md +63 -0
- package/workflows/powers/golang-pro/POWER.md +46 -35
- package/workflows/powers/golang-pro/SKILL.md +46 -35
- package/workflows/powers/graphql-architect/POWER.md +44 -62
- package/workflows/powers/graphql-architect/SKILL.md +44 -62
- package/workflows/powers/i18n-localization/POWER.md +118 -103
- package/workflows/powers/i18n-localization/SKILL.md +118 -103
- package/workflows/powers/java-pro/POWER.md +47 -22
- package/workflows/powers/java-pro/SKILL.md +47 -22
- package/workflows/powers/javascript-pro/POWER.md +47 -34
- package/workflows/powers/javascript-pro/SKILL.md +47 -34
- package/workflows/powers/kotlin-pro/POWER.md +46 -23
- package/workflows/powers/kotlin-pro/SKILL.md +46 -23
- package/workflows/powers/legacy-modernizer/POWER.md +43 -60
- package/workflows/powers/legacy-modernizer/SKILL.md +43 -60
- package/workflows/powers/mcp-builder/POWER.md +65 -0
- package/workflows/powers/mcp-builder/SKILL.md +62 -0
- package/workflows/powers/mcp-builder/references/testing-and-evals.md +17 -0
- package/workflows/powers/mcp-builder/references/transport-and-tool-design.md +17 -0
- package/workflows/powers/microservices-architect/POWER.md +43 -70
- package/workflows/powers/microservices-architect/SKILL.md +43 -70
- package/workflows/powers/mobile-design/POWER.md +110 -345
- package/workflows/powers/mobile-design/SKILL.md +110 -345
- package/workflows/powers/mongodb/POWER.md +67 -0
- package/workflows/powers/mongodb/SKILL.md +64 -0
- package/workflows/powers/mongodb/references/mongodb-checklist.md +20 -0
- package/workflows/powers/mysql/POWER.md +67 -0
- package/workflows/powers/mysql/SKILL.md +64 -0
- package/workflows/powers/mysql/references/mysql-checklist.md +20 -0
- package/workflows/powers/neki/POWER.md +67 -0
- package/workflows/powers/neki/SKILL.md +64 -0
- package/workflows/powers/neki/references/neki-checklist.md +18 -0
- package/workflows/powers/nestjs-expert/POWER.md +45 -91
- package/workflows/powers/nestjs-expert/SKILL.md +45 -91
- package/workflows/powers/nextjs-developer/POWER.md +51 -44
- package/workflows/powers/nextjs-developer/SKILL.md +51 -44
- package/workflows/powers/nodejs-best-practices/POWER.md +48 -29
- package/workflows/powers/nodejs-best-practices/SKILL.md +48 -29
- package/workflows/powers/observability/POWER.md +109 -0
- package/workflows/powers/observability/SKILL.md +106 -0
- package/workflows/powers/observability/references/alerting-and-slo-checklist.md +87 -0
- package/workflows/powers/observability/references/opentelemetry-setup-guide.md +121 -0
- package/workflows/powers/openai-docs/POWER.md +61 -0
- package/workflows/powers/openai-docs/SKILL.md +58 -0
- package/workflows/powers/openai-docs/references/official-source-playbook.md +10 -0
- package/workflows/powers/performance-profiling/POWER.md +61 -114
- package/workflows/powers/performance-profiling/SKILL.md +61 -114
- package/workflows/powers/php-pro/POWER.md +116 -0
- package/workflows/powers/php-pro/SKILL.md +113 -0
- package/workflows/powers/php-pro/references/architecture-and-di.md +239 -0
- package/workflows/powers/php-pro/references/modern-php-features.md +189 -0
- package/workflows/powers/php-pro/references/performance-and-deployment.md +197 -0
- package/workflows/powers/php-pro/references/php84-strict-typing-checklist.md +161 -0
- package/workflows/powers/php-pro/references/testing-and-static-analysis.md +235 -0
- package/workflows/powers/playwright-e2e/POWER.md +85 -0
- package/workflows/powers/playwright-e2e/SKILL.md +82 -0
- package/workflows/powers/playwright-e2e/references/locator-trace-flake-checklist.md +80 -0
- package/workflows/powers/postgres/POWER.md +67 -0
- package/workflows/powers/postgres/SKILL.md +64 -0
- package/workflows/powers/postgres/references/postgres-checklist.md +20 -0
- package/workflows/powers/prompt-engineer/POWER.md +47 -30
- package/workflows/powers/prompt-engineer/SKILL.md +47 -30
- package/workflows/powers/python-pro/POWER.md +47 -36
- package/workflows/powers/python-pro/SKILL.md +47 -36
- package/workflows/powers/react-best-practices/POWER.md +56 -33
- package/workflows/powers/react-best-practices/SKILL.md +56 -33
- package/workflows/powers/react-expert/POWER.md +47 -37
- package/workflows/powers/react-expert/SKILL.md +47 -37
- package/workflows/powers/redis/POWER.md +67 -0
- package/workflows/powers/redis/SKILL.md +64 -0
- package/workflows/powers/redis/references/redis-checklist.md +19 -0
- package/workflows/powers/ruby-pro/POWER.md +118 -0
- package/workflows/powers/ruby-pro/SKILL.md +115 -0
- package/workflows/powers/ruby-pro/references/modern-ruby-features.md +189 -0
- package/workflows/powers/ruby-pro/references/object-design-patterns.md +220 -0
- package/workflows/powers/ruby-pro/references/performance-and-profiling.md +224 -0
- package/workflows/powers/ruby-pro/references/ruby-concurrency-and-testing.md +190 -0
- package/workflows/powers/ruby-pro/references/testing-and-rspec.md +236 -0
- package/workflows/powers/rust-pro/POWER.md +45 -31
- package/workflows/powers/rust-pro/SKILL.md +45 -31
- package/workflows/powers/security-engineer/POWER.md +129 -0
- package/workflows/powers/security-engineer/SKILL.md +126 -0
- package/workflows/powers/seo-fundamentals/POWER.md +59 -102
- package/workflows/powers/seo-fundamentals/SKILL.md +59 -102
- package/workflows/powers/serverless-patterns/POWER.md +171 -0
- package/workflows/powers/serverless-patterns/SKILL.md +168 -0
- package/workflows/powers/skill-creator/POWER.md +90 -0
- package/workflows/powers/skill-creator/SKILL.md +87 -0
- package/workflows/powers/skill-creator/references/platform-formats.md +181 -0
- package/workflows/powers/skill-creator/references/schemas.md +430 -0
- package/workflows/powers/spec-miner/POWER.md +49 -57
- package/workflows/powers/spec-miner/SKILL.md +49 -57
- package/workflows/powers/sqlite/POWER.md +67 -0
- package/workflows/powers/sqlite/SKILL.md +64 -0
- package/workflows/powers/sqlite/references/sqlite-checklist.md +19 -0
- package/workflows/powers/sre-engineer/POWER.md +123 -64
- package/workflows/powers/sre-engineer/SKILL.md +123 -64
- package/workflows/powers/static-analysis/POWER.md +121 -77
- package/workflows/powers/static-analysis/SKILL.md +121 -77
- package/workflows/powers/stripe-best-practices/POWER.md +140 -17
- package/workflows/powers/stripe-best-practices/SKILL.md +139 -17
- package/workflows/powers/supabase/POWER.md +67 -0
- package/workflows/powers/supabase/SKILL.md +64 -0
- package/workflows/powers/supabase/references/supabase-checklist.md +19 -0
- package/workflows/powers/swift-pro/POWER.md +118 -0
- package/workflows/powers/swift-pro/SKILL.md +115 -0
- package/workflows/powers/swift-pro/references/concurrency-patterns.md +165 -0
- package/workflows/powers/swift-pro/references/protocol-and-generics.md +172 -0
- package/workflows/powers/swift-pro/references/sendable-and-isolation.md +116 -0
- package/workflows/powers/swift-pro/references/swift-concurrency-and-protocols.md +260 -0
- package/workflows/powers/swift-pro/references/testing-and-packages.md +192 -0
- package/workflows/powers/tailwind-patterns/POWER.md +71 -240
- package/workflows/powers/tailwind-patterns/SKILL.md +71 -240
- package/workflows/powers/testing-patterns/POWER.md +155 -10
- package/workflows/powers/testing-patterns/SKILL.md +155 -10
- package/workflows/powers/typescript-pro/POWER.md +47 -38
- package/workflows/powers/typescript-pro/SKILL.md +47 -38
- package/workflows/powers/vitess/POWER.md +67 -0
- package/workflows/powers/vitess/SKILL.md +64 -0
- package/workflows/powers/vitess/references/vitess-checklist.md +19 -0
- package/workflows/powers/vulnerability-scanner/POWER.md +146 -10
- package/workflows/powers/vulnerability-scanner/SKILL.md +146 -10
- package/workflows/powers/web-perf/POWER.md +43 -170
- package/workflows/powers/web-perf/SKILL.md +43 -170
- package/workflows/powers/webapp-testing/POWER.md +43 -164
- package/workflows/powers/webapp-testing/SKILL.md +43 -164
- package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +65 -42
- package/workflows/workflows/agent-environment-setup/platforms/claude/rules/CLAUDE.md +8 -6
- package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +65 -41
- package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/copilot-instructions.md +8 -6
- package/workflows/workflows/agent-environment-setup/shared/rules/STEERING.md +9 -8
- package/workflows/workflows/agent-environment-setup/shared/rules/overrides/codex.md +1 -1
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
##
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
45
|
+
## Output Format
|
|
29
46
|
|
|
30
|
-
|
|
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
|
-
##
|
|
49
|
+
## References
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
##
|
|
59
|
+
## Scripts
|
|
45
60
|
|
|
46
|
-
|
|
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
|
-
##
|
|
63
|
+
## Examples
|
|
51
64
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
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,
|
|
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:
|
|
9
|
-
version: "
|
|
10
|
-
|
|
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
|
-
|
|
15
|
+
## Purpose
|
|
21
16
|
|
|
22
|
-
|
|
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
|
-
|
|
19
|
+
## When to Use
|
|
25
20
|
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
+
### Constraints
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
##
|
|
51
|
+
## Output Format
|
|
57
52
|
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
57
|
+
Load on demand. Do not preload all reference files.
|
|
79
58
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
##
|
|
63
|
+
## Scripts
|
|
87
64
|
|
|
88
|
-
|
|
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,
|
|
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:
|
|
7
|
-
version: "
|
|
8
|
-
|
|
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
|
-
|
|
13
|
+
## Purpose
|
|
19
14
|
|
|
20
|
-
|
|
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
|
-
|
|
17
|
+
## When to Use
|
|
23
18
|
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
+
### Constraints
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
##
|
|
49
|
+
## Output Format
|
|
55
50
|
|
|
56
|
-
|
|
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
|
-
|
|
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
|
-
|
|
55
|
+
Load on demand. Do not preload all reference files.
|
|
77
56
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
##
|
|
61
|
+
## Scripts
|
|
85
62
|
|
|
86
|
-
|
|
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:
|
|
6
|
-
|
|
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
|
-
#
|
|
13
|
+
# I18N & Localization
|
|
10
14
|
|
|
11
|
-
|
|
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
|
-
##
|
|
19
|
+
## When to Use
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
30
|
+
### Step 1 — Externalize All User-Facing Strings
|
|
27
31
|
|
|
28
|
-
|
|
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
|
-
|
|
38
|
+
// DO
|
|
39
|
+
<button>{t('actions.save_changes')}</button>
|
|
40
|
+
```
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
**String keys**:
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
###
|
|
58
|
+
### Step 2 — Handle Pluralization
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
import { useTranslations } from 'next-intl';
|
|
60
|
+
Different languages have different plural rules (Arabic has 6 plural forms):
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
71
|
+
Never build pluralization with ternaries — always use the ICU plural syntax or equivalent library (Intl.PluralRules).
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
from gettext import gettext as _
|
|
73
|
+
### Step 3 — Format Dates, Numbers, and Currencies
|
|
66
74
|
|
|
67
|
-
|
|
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
|
-
|
|
82
|
+
// Number
|
|
83
|
+
new Intl.NumberFormat("ja-JP").format(1234567);
|
|
84
|
+
// → "1,234,567"
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
99
|
+
**CSS logical properties** (replace physical with logical):
|
|
91
100
|
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
140
|
+
**Rules**:
|
|
124
141
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
##
|
|
156
|
+
## Translation Setup
|
|
157
|
+
[file structure, workflow, tooling]
|
|
140
158
|
|
|
141
|
-
|
|
159
|
+
## RTL Support
|
|
160
|
+
[layout changes for bidirectional support]
|
|
161
|
+
```
|
|
142
162
|
|
|
143
|
-
|
|
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
|
-
|
|
169
|
+
**User**: "Our app needs to support Arabic"
|
|
153
170
|
|
|
154
|
-
|
|
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
|
````
|