@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
|
@@ -1,154 +1,169 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: i18n-localization
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: Implement internationalization and localization including RTL support, pluralization, date/number formatting, translation workflows, and locale-aware UI.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: cubis-foundry
|
|
7
|
+
version: "3.0"
|
|
8
|
+
compatibility: Claude Code, Codex, GitHub Copilot, Gemini CLI
|
|
5
9
|
---
|
|
6
10
|
|
|
7
|
-
#
|
|
11
|
+
# I18N & Localization
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Purpose
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Guide internationalization (i18n) and localization (l10n) implementation. Ensure applications can be adapted for different languages, regions, and cultural conventions without code changes.
|
|
12
16
|
|
|
13
|
-
##
|
|
17
|
+
## When to Use
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
- Adding multi-language support to an application
|
|
20
|
+
- Implementing RTL (right-to-left) layout support
|
|
21
|
+
- Handling dates, numbers, and currencies across locales
|
|
22
|
+
- Setting up translation workflows and string management
|
|
23
|
+
- Reviewing code for i18n readiness
|
|
24
|
+
- Building locale-aware UI components
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
## Instructions
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
### Step 1 — Externalize All User-Facing Strings
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|--------------|--------------|
|
|
28
|
-
| Public web app | ✅ Yes |
|
|
29
|
-
| SaaS product | ✅ Yes |
|
|
30
|
-
| Internal tool | ⚠️ Maybe |
|
|
31
|
-
| Single-region app | ⚠️ Consider future |
|
|
32
|
-
| Personal project | ❌ Optional |
|
|
30
|
+
**Never hardcode user-visible text**:
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
```typescript
|
|
33
|
+
// DON'T
|
|
34
|
+
<button>Save Changes</button>
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// DO
|
|
37
|
+
<button>{t('actions.save_changes')}</button>
|
|
38
|
+
```
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
**String keys**:
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
- Use namespaced dot notation: `page.section.element`
|
|
43
|
+
- Keys should be descriptive, not the English text
|
|
44
|
+
- Group by feature/page, not by component
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
**Message format** (ICU MessageFormat):
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"items.count": "{count, plural, =0 {No items} one {# item} other {# items}}",
|
|
51
|
+
"greeting": "Hello, {name}!",
|
|
52
|
+
"order.total": "Total: {total, number, currency}"
|
|
46
53
|
}
|
|
47
54
|
```
|
|
48
55
|
|
|
49
|
-
###
|
|
56
|
+
### Step 2 — Handle Pluralization
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
import { useTranslations } from 'next-intl';
|
|
58
|
+
Different languages have different plural rules (Arabic has 6 plural forms):
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"en": { "items": "{count, plural, one {# item} other {# items}}" },
|
|
63
|
+
"ar": {
|
|
64
|
+
"items": "{count, plural, zero {لا عناصر} one {عنصر واحد} two {عنصران} few {# عناصر} many {# عنصراً} other {# عنصر}}"
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
67
|
```
|
|
59
68
|
|
|
60
|
-
|
|
69
|
+
Never build pluralization with ternaries — always use the ICU plural syntax or equivalent library (Intl.PluralRules).
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
from gettext import gettext as _
|
|
71
|
+
### Step 3 — Format Dates, Numbers, and Currencies
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
```
|
|
73
|
+
Use `Intl` APIs — never format manually:
|
|
67
74
|
|
|
68
|
-
|
|
75
|
+
```typescript
|
|
76
|
+
// Date
|
|
77
|
+
new Intl.DateTimeFormat("de-DE", { dateStyle: "long" }).format(date);
|
|
78
|
+
// → "15. Januar 2025"
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
// Number
|
|
81
|
+
new Intl.NumberFormat("ja-JP").format(1234567);
|
|
82
|
+
// → "1,234,567"
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
│ └── errors.json
|
|
82
|
-
└── ar/ # RTL
|
|
83
|
-
└── ...
|
|
84
|
+
// Currency
|
|
85
|
+
new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(
|
|
86
|
+
42.5,
|
|
87
|
+
);
|
|
88
|
+
// → "$42.50"
|
|
89
|
+
|
|
90
|
+
// Relative time
|
|
91
|
+
new Intl.RelativeTimeFormat("fr", { numeric: "auto" }).format(-1, "day");
|
|
92
|
+
// → "hier"
|
|
84
93
|
```
|
|
85
94
|
|
|
86
|
-
|
|
95
|
+
### Step 4 — Support RTL Languages
|
|
87
96
|
|
|
88
|
-
|
|
97
|
+
**CSS logical properties** (replace physical with logical):
|
|
89
98
|
|
|
90
|
-
|
|
99
|
+
| Physical (DON'T) | Logical (DO) |
|
|
100
|
+
| ------------------ | --------------------- |
|
|
101
|
+
| `margin-left` | `margin-inline-start` |
|
|
102
|
+
| `padding-right` | `padding-inline-end` |
|
|
103
|
+
| `text-align: left` | `text-align: start` |
|
|
104
|
+
| `float: left` | `float: inline-start` |
|
|
105
|
+
| `border-left` | `border-inline-start` |
|
|
91
106
|
|
|
92
|
-
|
|
93
|
-
- Namespace translations by feature
|
|
94
|
-
- Support pluralization
|
|
95
|
-
- Handle date/number formats per locale
|
|
96
|
-
- Plan for RTL from the start
|
|
97
|
-
- Use ICU message format for complex strings
|
|
107
|
+
**Layout**:
|
|
98
108
|
|
|
99
|
-
|
|
109
|
+
- Use `dir="auto"` on user-generated content
|
|
110
|
+
- Set `<html dir="rtl" lang="ar">` at the document level
|
|
111
|
+
- Flexbox and Grid respect `direction` automatically
|
|
112
|
+
- Mirror icons that indicate direction (arrows, back buttons)
|
|
113
|
+
- Don't mirror: logos, numbers, media controls, checkmarks
|
|
100
114
|
|
|
101
|
-
|
|
102
|
-
- Concatenate translated strings
|
|
103
|
-
- Assume text length (German is 30% longer)
|
|
104
|
-
- Forget about RTL layout
|
|
105
|
-
- Mix languages in same file
|
|
115
|
+
### Step 5 — Translation Workflow
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
**File structure**:
|
|
108
118
|
|
|
109
|
-
|
|
119
|
+
```
|
|
120
|
+
locales/
|
|
121
|
+
├── en/
|
|
122
|
+
│ ├── common.json (shared strings)
|
|
123
|
+
│ ├── auth.json (login/signup)
|
|
124
|
+
│ └── dashboard.json (dashboard page)
|
|
125
|
+
├── fr/
|
|
126
|
+
├── ja/
|
|
127
|
+
└── ar/
|
|
128
|
+
```
|
|
110
129
|
|
|
111
|
-
|
|
112
|
-
|-------|----------|
|
|
113
|
-
| Missing translation | Fallback to default language |
|
|
114
|
-
| Hardcoded strings | Use linter/checker script |
|
|
115
|
-
| Date format | Use Intl.DateTimeFormat |
|
|
116
|
-
| Number format | Use Intl.NumberFormat |
|
|
117
|
-
| Pluralization | Use ICU message format |
|
|
130
|
+
**Process**:
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
1. Developer adds key + English string
|
|
133
|
+
2. CI extracts new/changed keys automatically
|
|
134
|
+
3. Strings sent to translators (Crowdin, Lokalise, or equivalent)
|
|
135
|
+
4. Translations imported back as JSON/YAML
|
|
136
|
+
5. CI validates: no missing keys, no untranslated strings, valid ICU syntax
|
|
120
137
|
|
|
121
|
-
|
|
138
|
+
**Rules**:
|
|
122
139
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
- Never concatenate translated strings (`t('hello') + ' ' + name` breaks in many languages)
|
|
141
|
+
- Provide context for translators (comments in message files)
|
|
142
|
+
- Max string length varies by language (German ~30% longer than English)
|
|
143
|
+
- Test with pseudo-localization (e.g., "Ŝàvé Çhàñgéŝ") to catch hardcoded strings
|
|
144
|
+
|
|
145
|
+
## Output Format
|
|
129
146
|
|
|
130
|
-
[dir="rtl"] .icon {
|
|
131
|
-
transform: scaleX(-1);
|
|
132
|
-
}
|
|
133
147
|
```
|
|
148
|
+
## I18N Assessment
|
|
149
|
+
[current state and gaps]
|
|
134
150
|
|
|
135
|
-
|
|
151
|
+
## Implementation
|
|
152
|
+
[code changes for i18n support]
|
|
136
153
|
|
|
137
|
-
##
|
|
154
|
+
## Translation Setup
|
|
155
|
+
[file structure, workflow, tooling]
|
|
138
156
|
|
|
139
|
-
|
|
157
|
+
## RTL Support
|
|
158
|
+
[layout changes for bidirectional support]
|
|
159
|
+
```
|
|
140
160
|
|
|
141
|
-
|
|
142
|
-
- [ ] Locale files exist for all supported languages
|
|
143
|
-
- [ ] Date/number formatting uses Intl API
|
|
144
|
-
- [ ] RTL layout tested (if applicable)
|
|
145
|
-
- [ ] Fallback language configured
|
|
146
|
-
- [ ] No hardcoded strings in components
|
|
161
|
+
## Examples
|
|
147
162
|
|
|
148
|
-
|
|
163
|
+
**User**: "Add multi-language support to our React app"
|
|
164
|
+
|
|
165
|
+
**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.
|
|
149
166
|
|
|
150
|
-
|
|
167
|
+
**User**: "Our app needs to support Arabic"
|
|
151
168
|
|
|
152
|
-
|
|
153
|
-
|--------|---------|---------|
|
|
154
|
-
| `scripts/i18n_checker.py` | Detect hardcoded strings & missing translations | `python scripts/i18n_checker.py <project_path>` |
|
|
169
|
+
**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.
|
|
@@ -5,39 +5,64 @@ name: "java-pro"
|
|
|
5
5
|
description: "Use for modern Java backend and platform engineering with Java 25-era language/runtime practices."
|
|
6
6
|
license: MIT
|
|
7
7
|
metadata:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
stack: "java"
|
|
12
|
-
baseline: "Java SE 25"
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "1.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
13
11
|
---
|
|
14
12
|
|
|
15
13
|
# Java Pro
|
|
16
14
|
|
|
17
|
-
##
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Expert-level guidance for modern Java backend and platform engineering. Covers records, sealed types, virtual threads (Project Loom), null handling, performance profiling, and production observability using current JDK practices.
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
18
20
|
|
|
19
21
|
- Building or modernizing Java backend services.
|
|
20
22
|
- Designing JVM architecture for high-throughput systems.
|
|
21
|
-
- Improving reliability, observability, and maintainability.
|
|
23
|
+
- Improving reliability, observability, and maintainability of Java codebases.
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
1. **Clarify runtime target and deployment constraints** — confirm the JDK baseline approved by project policy and deployment environment before choosing language features.
|
|
28
|
+
|
|
29
|
+
2. **Define module boundaries and API contracts** — separate domain, service, and infrastructure layers. Use records for immutable data carriers (API responses, DTOs, event payloads). Use sealed classes/interfaces for closed domain hierarchies with exhaustive pattern matching.
|
|
30
|
+
|
|
31
|
+
3. **Implement with explicit null handling** — use `Optional<T>` for return types that may legitimately have no value, but never for parameters or fields. Use `@Nullable`/`@NonNull` annotations from JSpecify or Checker Framework. Fail fast with `Objects.requireNonNull()` at method entry. Do not return raw `null` from methods that could return `Optional` or empty collections because it creates silent NPE pathways.
|
|
32
|
+
|
|
33
|
+
4. **Use virtual threads for blocking I/O workloads** — HTTP calls, database queries, and file reads benefit from virtual threads via `Executors.newVirtualThreadPerTaskExecutor()`. Do not use virtual threads for CPU-bound work because they share carrier threads and cause starvation. Do not use `synchronized` blocks in virtual-thread code because it causes carrier-thread pinning — use `ReentrantLock` instead.
|
|
34
|
+
|
|
35
|
+
5. **Add structured logging and trace propagation** — capture request/job correlation IDs in logs and traces. Keep exception handling consistent between transport, service, and persistence layers. Do not expose stack traces in production responses.
|
|
36
|
+
|
|
37
|
+
6. **Enforce dependency and API compatibility checks in CI** — use current JDK tooling, static analysis, and dependency verification. Separate transport DTOs from domain and persistence models to reduce cascade failures.
|
|
38
|
+
|
|
39
|
+
7. **Profile before optimizing** — use `jcmd`, `async-profiler`, or JFR for production diagnostics without restart. Profile GC behavior with `-Xlog:gc*` before tuning heap sizes. Use escape analysis awareness to avoid large short-lived objects in hot loops. Prefer explicit timeouts, bulkheads, and retry budgets at I/O boundaries.
|
|
40
|
+
|
|
41
|
+
8. **Add tests and performance checks for critical paths** — use JUnit 5, parameterized tests, and Testcontainers for integration testing. Do not use `Thread.sleep()` for retry logic because it blocks threads — use structured retry with backoff. Do not leak persistence entities directly into API contracts because it couples layers.
|
|
42
|
+
|
|
43
|
+
9. **Do not use reflection-heavy magic when explicit code is clearer** because it hurts readability and debuggability. Do not build monolithic service classes with mixed responsibilities because they resist testing and change.
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
Produces Java code using records, sealed types, and modern JDK APIs with clear layer separation, explicit null handling, and structured error propagation. Includes virtual-thread-aware patterns where applicable.
|
|
22
48
|
|
|
23
|
-
##
|
|
49
|
+
## References
|
|
24
50
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
| File | Load when |
|
|
52
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `references/virtual-threads-patterns.md` | Virtual thread adoption, carrier pinning avoidance, or Loom migration patterns need detail. |
|
|
54
|
+
| `references/records-sealed-types.md` | Record design, sealed hierarchy modeling, or pattern matching with switch expressions need detail. |
|
|
55
|
+
| `references/stream-api-patterns.md` | Stream pipeline design, collector patterns, parallel stream tradeoffs, or functional idioms need detail. |
|
|
56
|
+
| `references/modern-testing.md` | JUnit 5 patterns, parameterized tests, Testcontainers, or test architecture decisions need detail. |
|
|
57
|
+
| `references/gc-and-allocation.md` | GC tuning, allocation profiling, escape analysis, or memory-sensitive design decisions need detail. |
|
|
29
58
|
|
|
30
|
-
##
|
|
59
|
+
## Scripts
|
|
31
60
|
|
|
32
|
-
|
|
33
|
-
- Prefer records/sealed hierarchies where they simplify modeling.
|
|
34
|
-
- Keep null-handling explicit; avoid silent NPE pathways.
|
|
35
|
-
- Use structured logging and trace propagation.
|
|
36
|
-
- Enforce dependency and API compatibility checks in CI.
|
|
61
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
37
62
|
|
|
38
|
-
##
|
|
63
|
+
## Examples
|
|
39
64
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
65
|
+
- "Migrate this blocking HTTP client code to use virtual threads with proper carrier-thread pinning avoidance."
|
|
66
|
+
- "Refactor this service to use sealed classes and pattern matching instead of the visitor pattern."
|
|
67
|
+
- "Design the null-handling strategy for this API layer using Optional returns and JSpecify annotations."
|
|
43
68
|
````
|
|
@@ -3,38 +3,63 @@ name: "java-pro"
|
|
|
3
3
|
description: "Use for modern Java backend and platform engineering with Java 25-era language/runtime practices."
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
stack: "java"
|
|
10
|
-
baseline: "Java SE 25"
|
|
6
|
+
author: cubis-foundry
|
|
7
|
+
version: "1.0"
|
|
8
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
11
9
|
---
|
|
12
10
|
|
|
13
11
|
# Java Pro
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Expert-level guidance for modern Java backend and platform engineering. Covers records, sealed types, virtual threads (Project Loom), null handling, performance profiling, and production observability using current JDK practices.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
16
18
|
|
|
17
19
|
- Building or modernizing Java backend services.
|
|
18
20
|
- Designing JVM architecture for high-throughput systems.
|
|
19
|
-
- Improving reliability, observability, and maintainability.
|
|
21
|
+
- Improving reliability, observability, and maintainability of Java codebases.
|
|
22
|
+
|
|
23
|
+
## Instructions
|
|
24
|
+
|
|
25
|
+
1. **Clarify runtime target and deployment constraints** — confirm the JDK baseline approved by project policy and deployment environment before choosing language features.
|
|
26
|
+
|
|
27
|
+
2. **Define module boundaries and API contracts** — separate domain, service, and infrastructure layers. Use records for immutable data carriers (API responses, DTOs, event payloads). Use sealed classes/interfaces for closed domain hierarchies with exhaustive pattern matching.
|
|
28
|
+
|
|
29
|
+
3. **Implement with explicit null handling** — use `Optional<T>` for return types that may legitimately have no value, but never for parameters or fields. Use `@Nullable`/`@NonNull` annotations from JSpecify or Checker Framework. Fail fast with `Objects.requireNonNull()` at method entry. Do not return raw `null` from methods that could return `Optional` or empty collections because it creates silent NPE pathways.
|
|
30
|
+
|
|
31
|
+
4. **Use virtual threads for blocking I/O workloads** — HTTP calls, database queries, and file reads benefit from virtual threads via `Executors.newVirtualThreadPerTaskExecutor()`. Do not use virtual threads for CPU-bound work because they share carrier threads and cause starvation. Do not use `synchronized` blocks in virtual-thread code because it causes carrier-thread pinning — use `ReentrantLock` instead.
|
|
32
|
+
|
|
33
|
+
5. **Add structured logging and trace propagation** — capture request/job correlation IDs in logs and traces. Keep exception handling consistent between transport, service, and persistence layers. Do not expose stack traces in production responses.
|
|
34
|
+
|
|
35
|
+
6. **Enforce dependency and API compatibility checks in CI** — use current JDK tooling, static analysis, and dependency verification. Separate transport DTOs from domain and persistence models to reduce cascade failures.
|
|
36
|
+
|
|
37
|
+
7. **Profile before optimizing** — use `jcmd`, `async-profiler`, or JFR for production diagnostics without restart. Profile GC behavior with `-Xlog:gc*` before tuning heap sizes. Use escape analysis awareness to avoid large short-lived objects in hot loops. Prefer explicit timeouts, bulkheads, and retry budgets at I/O boundaries.
|
|
38
|
+
|
|
39
|
+
8. **Add tests and performance checks for critical paths** — use JUnit 5, parameterized tests, and Testcontainers for integration testing. Do not use `Thread.sleep()` for retry logic because it blocks threads — use structured retry with backoff. Do not leak persistence entities directly into API contracts because it couples layers.
|
|
40
|
+
|
|
41
|
+
9. **Do not use reflection-heavy magic when explicit code is clearer** because it hurts readability and debuggability. Do not build monolithic service classes with mixed responsibilities because they resist testing and change.
|
|
42
|
+
|
|
43
|
+
## Output Format
|
|
44
|
+
|
|
45
|
+
Produces Java code using records, sealed types, and modern JDK APIs with clear layer separation, explicit null handling, and structured error propagation. Includes virtual-thread-aware patterns where applicable.
|
|
20
46
|
|
|
21
|
-
##
|
|
47
|
+
## References
|
|
22
48
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
49
|
+
| File | Load when |
|
|
50
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `references/virtual-threads-patterns.md` | Virtual thread adoption, carrier pinning avoidance, or Loom migration patterns need detail. |
|
|
52
|
+
| `references/records-sealed-types.md` | Record design, sealed hierarchy modeling, or pattern matching with switch expressions need detail. |
|
|
53
|
+
| `references/stream-api-patterns.md` | Stream pipeline design, collector patterns, parallel stream tradeoffs, or functional idioms need detail. |
|
|
54
|
+
| `references/modern-testing.md` | JUnit 5 patterns, parameterized tests, Testcontainers, or test architecture decisions need detail. |
|
|
55
|
+
| `references/gc-and-allocation.md` | GC tuning, allocation profiling, escape analysis, or memory-sensitive design decisions need detail. |
|
|
27
56
|
|
|
28
|
-
##
|
|
57
|
+
## Scripts
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
- Prefer records/sealed hierarchies where they simplify modeling.
|
|
32
|
-
- Keep null-handling explicit; avoid silent NPE pathways.
|
|
33
|
-
- Use structured logging and trace propagation.
|
|
34
|
-
- Enforce dependency and API compatibility checks in CI.
|
|
59
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
35
60
|
|
|
36
|
-
##
|
|
61
|
+
## Examples
|
|
37
62
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
63
|
+
- "Migrate this blocking HTTP client code to use virtual threads with proper carrier-thread pinning avoidance."
|
|
64
|
+
- "Refactor this service to use sealed classes and pattern matching instead of the visitor pattern."
|
|
65
|
+
- "Design the null-handling strategy for this API layer using Optional returns and JSpecify annotations."
|
|
@@ -2,57 +2,70 @@
|
|
|
2
2
|
---
|
|
3
3
|
inclusion: manual
|
|
4
4
|
name: "javascript-pro"
|
|
5
|
-
description: "Use for modern JavaScript architecture and implementation across browser, Node, and edge runtimes with
|
|
5
|
+
description: "Use for modern JavaScript architecture and implementation across browser, Node, and edge runtimes with runtime-aware production practices."
|
|
6
6
|
license: MIT
|
|
7
7
|
metadata:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
stack: "javascript"
|
|
12
|
-
baseline: "ES2025+"
|
|
8
|
+
author: cubis-foundry
|
|
9
|
+
version: "3.0"
|
|
10
|
+
compatibility: Claude Code, Codex, GitHub Copilot
|
|
13
11
|
---
|
|
14
12
|
|
|
15
13
|
# JavaScript Pro
|
|
16
14
|
|
|
17
|
-
##
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Expert-level guidance for modern JavaScript development across browser, Node.js, and edge runtimes. Covers module design, async orchestration, runtime-specific patterns, and production-grade error handling with a focus on runtime-aware code that respects platform boundaries.
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
18
20
|
|
|
19
21
|
- Implementing feature work in plain JavaScript.
|
|
20
22
|
- Refactoring legacy JS toward modern modules and async flows.
|
|
21
|
-
- Improving performance and reliability in browser
|
|
23
|
+
- Improving performance and reliability in browser, Node, or edge runtimes.
|
|
24
|
+
- Serving as the language baseline before framework-specific skills are loaded.
|
|
25
|
+
|
|
26
|
+
## Instructions
|
|
27
|
+
|
|
28
|
+
1. **Confirm runtime constraints** — identify browser targets, Node version, or edge runtime before choosing APIs or module formats. Runtime determines available features and performance characteristics.
|
|
29
|
+
|
|
30
|
+
2. **Choose module boundaries and format** — prefer ESM (`import`/`export`) for new code. Configure `"type": "module"` in `package.json`. Keep modules focused to one responsibility. Use barrel exports (`index.js`) only for the public API to preserve tree-shaking.
|
|
31
|
+
|
|
32
|
+
3. **Design async strategy** — use `AbortSignal` and `AbortController` for cancellable operations. Use `Promise.allSettled()` when all results matter regardless of individual failures. Limit concurrent operations with semaphore patterns to prevent resource exhaustion.
|
|
33
|
+
|
|
34
|
+
4. **Implement with explicit error and cancellation handling** — always attach `.catch()` or use `try/catch` in async flows. Do not leave promise rejections unhandled because they terminate Node.js processes and cause silent failures in browsers.
|
|
35
|
+
|
|
36
|
+
5. **Keep side effects at module edges** — pure logic belongs in reusable modules. Side-effectful initialization at module top-level prevents tree-shaking and complicates testing.
|
|
37
|
+
|
|
38
|
+
6. **Validate untrusted input at boundaries** — sanitize at system entry points such as API handlers and form inputs. Keep dependency surface intentionally small.
|
|
39
|
+
|
|
40
|
+
7. **Use runtime-appropriate tooling** — Vitest or `node --test` for testing, Biome or ESLint for linting, Vite or esbuild for bundling. Use lockfile-based installs (`npm ci`, `pnpm install --frozen-lockfile`) in CI. Enable `corepack` for consistent package manager versions.
|
|
41
|
+
|
|
42
|
+
8. **Debug in the target environment** — reproduce runtime-specific failures in the exact target (browser, Node, or edge). Use structured logging with consistent error shapes. Profile with Chrome DevTools or `node --prof` before redesigning hot paths.
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
9. **Optimize deliberately** — use streams for large payloads to avoid memory spikes. Use `Promise.all` for independent parallel operations. Use dynamic `import()` for code-splitting heavy modules. Do not use UA sniffing in browser code because feature detection is more reliable and maintainable.
|
|
24
45
|
|
|
25
|
-
|
|
26
|
-
2. Choose module boundaries and async strategy.
|
|
27
|
-
3. Implement with explicit error and cancellation handling.
|
|
28
|
-
4. Verify behavior with tests and runtime checks.
|
|
46
|
+
10. **Do not use heavy framework coupling in low-level modules** because it prevents reuse. Do not allow copy-paste utility proliferation without consolidation because it causes drift and duplication.
|
|
29
47
|
|
|
30
|
-
##
|
|
48
|
+
## Output Format
|
|
31
49
|
|
|
32
|
-
|
|
33
|
-
- Use `AbortSignal` for cancellable async operations.
|
|
34
|
-
- Keep side effects at edges; pure logic in reusable modules.
|
|
35
|
-
- Validate untrusted input at boundaries.
|
|
36
|
-
- Keep dependency surface intentionally small.
|
|
50
|
+
Produces JavaScript code following ESM module conventions with explicit async error handling, runtime-appropriate API usage, and clear module boundaries. Includes structured error objects and cancellation support where applicable.
|
|
37
51
|
|
|
38
|
-
##
|
|
52
|
+
## References
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
54
|
+
| File | Load when |
|
|
55
|
+
| ------------------------------- | --------------------------------------------------------------------------- |
|
|
56
|
+
| `references/modern-syntax.md` | Choosing modern syntax/features for current runtime targets. |
|
|
57
|
+
| `references/async-patterns.md` | Cancellation, retries, concurrency, or promise orchestration needs detail. |
|
|
58
|
+
| `references/modules.md` | ESM/CJS/module-boundary tradeoffs are in scope. |
|
|
59
|
+
| `references/browser-apis.md` | Browser-specific APIs, capability checks, or UX/runtime constraints matter. |
|
|
60
|
+
| `references/node-essentials.md` | Node runtime behavior, streams, files, or process concerns matter. |
|
|
44
61
|
|
|
45
|
-
##
|
|
62
|
+
## Scripts
|
|
46
63
|
|
|
47
|
-
|
|
48
|
-
- Heavy framework coupling in low-level modules.
|
|
49
|
-
- Copy-paste utility proliferation without consolidation.
|
|
64
|
+
No helper scripts are required for this skill right now. Keep execution in `SKILL.md` and `references/` unless repeated automation becomes necessary.
|
|
50
65
|
|
|
51
|
-
##
|
|
66
|
+
## Examples
|
|
52
67
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- `references/browser-apis.md`
|
|
57
|
-
- `references/node-essentials.md`
|
|
68
|
+
- "Refactor this callback-heavy Express handler to use async/await with proper error handling and AbortController for timeout."
|
|
69
|
+
- "Design the module structure for a shared utility library that needs to support both ESM and CJS consumers."
|
|
70
|
+
- "Optimize this Node.js data pipeline to use streams instead of loading the full dataset into memory."
|
|
58
71
|
````
|