@geraldmaron/construct 1.0.0
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/.env.example +69 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/agents/prompts/cx-accessibility.md +29 -0
- package/agents/prompts/cx-ai-engineer.md +31 -0
- package/agents/prompts/cx-architect.md +40 -0
- package/agents/prompts/cx-business-strategist.md +25 -0
- package/agents/prompts/cx-data-analyst.md +30 -0
- package/agents/prompts/cx-data-engineer.md +32 -0
- package/agents/prompts/cx-debugger.md +27 -0
- package/agents/prompts/cx-designer.md +33 -0
- package/agents/prompts/cx-devil-advocate.md +36 -0
- package/agents/prompts/cx-docs-keeper.md +50 -0
- package/agents/prompts/cx-engineer.md +36 -0
- package/agents/prompts/cx-evaluator.md +26 -0
- package/agents/prompts/cx-explorer.md +38 -0
- package/agents/prompts/cx-legal-compliance.md +25 -0
- package/agents/prompts/cx-operations.md +28 -0
- package/agents/prompts/cx-orchestrator.md +30 -0
- package/agents/prompts/cx-platform-engineer.md +25 -0
- package/agents/prompts/cx-product-manager.md +30 -0
- package/agents/prompts/cx-qa.md +42 -0
- package/agents/prompts/cx-rd-lead.md +25 -0
- package/agents/prompts/cx-release-manager.md +31 -0
- package/agents/prompts/cx-researcher.md +31 -0
- package/agents/prompts/cx-reviewer.md +36 -0
- package/agents/prompts/cx-security.md +37 -0
- package/agents/prompts/cx-sre.md +26 -0
- package/agents/prompts/cx-test-automation.md +35 -0
- package/agents/prompts/cx-trace-reviewer.md +76 -0
- package/agents/prompts/cx-ux-researcher.md +30 -0
- package/agents/registry.json +879 -0
- package/agents/teams.json +94 -0
- package/bin/construct +613 -0
- package/commands/build/feature.md +21 -0
- package/commands/build/fix.md +20 -0
- package/commands/design/access.md +19 -0
- package/commands/design/flow.md +16 -0
- package/commands/design/ui.md +18 -0
- package/commands/measure/experiment.md +18 -0
- package/commands/measure/metrics.md +18 -0
- package/commands/measure/results.md +18 -0
- package/commands/plan/api.md +19 -0
- package/commands/plan/challenge.md +18 -0
- package/commands/plan/decide.md +20 -0
- package/commands/plan/feature.md +49 -0
- package/commands/plan/requirements.md +24 -0
- package/commands/remember/context.md +26 -0
- package/commands/remember/handoff.md +19 -0
- package/commands/remember/runbook.md +20 -0
- package/commands/review/code.md +21 -0
- package/commands/review/quality.md +19 -0
- package/commands/review/security.md +16 -0
- package/commands/ship/ready.md +19 -0
- package/commands/ship/release.md +19 -0
- package/commands/ship/status.md +18 -0
- package/commands/understand/docs.md +22 -0
- package/commands/understand/research.md +22 -0
- package/commands/understand/this.md +23 -0
- package/commands/understand/why.md +18 -0
- package/commands/work/clean.md +32 -0
- package/commands/work/drive.md +69 -0
- package/commands/work/optimize-prompts.md +46 -0
- package/commands/work/parallel-review.md +40 -0
- package/db/migrations/001_init.sql +38 -0
- package/langfuse/docker-compose.yml +82 -0
- package/lib/audit-skills.mjs +118 -0
- package/lib/auto-docs.mjs +293 -0
- package/lib/cli-commands.mjs +409 -0
- package/lib/codex-config.mjs +114 -0
- package/lib/comment-lint.mjs +191 -0
- package/lib/completions.mjs +170 -0
- package/lib/context-state.mjs +99 -0
- package/lib/cost.mjs +213 -0
- package/lib/distill.mjs +403 -0
- package/lib/efficiency.mjs +139 -0
- package/lib/env-config.mjs +53 -0
- package/lib/eval-harness.mjs +59 -0
- package/lib/features.mjs +209 -0
- package/lib/headhunt.mjs +597 -0
- package/lib/hooks/adaptive-lint.mjs +112 -0
- package/lib/hooks/agent-tracker.mjs +50 -0
- package/lib/hooks/bootstrap-guard.mjs +90 -0
- package/lib/hooks/comment-lint.mjs +26 -0
- package/lib/hooks/config-protection.mjs +52 -0
- package/lib/hooks/console-warn.mjs +43 -0
- package/lib/hooks/context-window-recovery.mjs +90 -0
- package/lib/hooks/continuation-enforcer.mjs +72 -0
- package/lib/hooks/dep-audit.mjs +155 -0
- package/lib/hooks/drive-guard.mjs +89 -0
- package/lib/hooks/edit-accumulator.mjs +36 -0
- package/lib/hooks/edit-error-recovery.mjs +46 -0
- package/lib/hooks/edit-guard.mjs +109 -0
- package/lib/hooks/env-check.mjs +80 -0
- package/lib/hooks/guard-bash.mjs +83 -0
- package/lib/hooks/mcp-audit.mjs +57 -0
- package/lib/hooks/mcp-health-check.mjs +51 -0
- package/lib/hooks/mcp-task-scope.mjs +47 -0
- package/lib/hooks/model-fallback.mjs +105 -0
- package/lib/hooks/pre-compact.mjs +212 -0
- package/lib/hooks/pre-push-gate.mjs +129 -0
- package/lib/hooks/read-tracker.mjs +129 -0
- package/lib/hooks/registry-sync.mjs +23 -0
- package/lib/hooks/scan-secrets.mjs +76 -0
- package/lib/hooks/session-start.mjs +95 -0
- package/lib/hooks/stop-notify.mjs +191 -0
- package/lib/hooks/stop-typecheck.mjs +83 -0
- package/lib/hooks/task-completed-guard.mjs +43 -0
- package/lib/hooks/teammate-idle-guard.mjs +54 -0
- package/lib/hooks/workflow-guard.mjs +62 -0
- package/lib/host-capabilities.mjs +123 -0
- package/lib/init-docs.mjs +382 -0
- package/lib/mcp/server.mjs +1123 -0
- package/lib/mcp-catalog.json +243 -0
- package/lib/mcp-manager.mjs +433 -0
- package/lib/mcp-platform-config.mjs +104 -0
- package/lib/model-router.mjs +810 -0
- package/lib/opencode-config.mjs +44 -0
- package/lib/opencode-runtime-plugin.mjs +909 -0
- package/lib/opencode-telemetry.mjs +433 -0
- package/lib/orchestration-policy.mjs +258 -0
- package/lib/prompt-composer.mjs +196 -0
- package/lib/prompt-metadata.mjs +68 -0
- package/lib/review.mjs +429 -0
- package/lib/role-preload.mjs +52 -0
- package/lib/schemas/decision.json +50 -0
- package/lib/schemas/implementation.json +51 -0
- package/lib/schemas/review-report.json +32 -0
- package/lib/schemas/test-report.json +43 -0
- package/lib/server/index.mjs +334 -0
- package/lib/server/static/app.js +841 -0
- package/lib/server/static/index.html +820 -0
- package/lib/service-manager.mjs +225 -0
- package/lib/setup.mjs +319 -0
- package/lib/status.mjs +707 -0
- package/lib/storage/backend.mjs +44 -0
- package/lib/storage/embeddings.mjs +70 -0
- package/lib/storage/hybrid-query.mjs +184 -0
- package/lib/storage/sql-store.mjs +55 -0
- package/lib/storage/state-source.mjs +101 -0
- package/lib/storage/sync.mjs +164 -0
- package/lib/storage/vector-store.mjs +59 -0
- package/lib/telemetry/backends/langfuse.mjs +58 -0
- package/lib/telemetry/backends/noop.mjs +16 -0
- package/lib/telemetry/langfuse-ingest.mjs +108 -0
- package/lib/telemetry/langfuse-model-sync.mjs +270 -0
- package/lib/telemetry/team-rollup.mjs +143 -0
- package/lib/toolkit-env.mjs +30 -0
- package/lib/validator.mjs +181 -0
- package/lib/workflow-state.mjs +794 -0
- package/package.json +53 -0
- package/personas/construct.md +94 -0
- package/platforms/claude/CLAUDE.md +30 -0
- package/platforms/claude/settings.template.json +472 -0
- package/platforms/opencode/config.template.json +65 -0
- package/platforms/opencode/plugins/construct-fallback.js +5 -0
- package/platforms/opencode/sync-config.mjs +69 -0
- package/rules/common/agents.md +55 -0
- package/rules/common/code-review.md +129 -0
- package/rules/common/coding-style.md +95 -0
- package/rules/common/comments.md +139 -0
- package/rules/common/cx-agent-routing.md +61 -0
- package/rules/common/cx-skill-routing.md +11 -0
- package/rules/common/development-workflow.md +49 -0
- package/rules/common/git-workflow.md +29 -0
- package/rules/common/hooks.md +35 -0
- package/rules/common/patterns.md +36 -0
- package/rules/common/performance.md +71 -0
- package/rules/common/security.md +34 -0
- package/rules/common/testing.md +62 -0
- package/rules/golang/coding-style.md +37 -0
- package/rules/golang/hooks.md +22 -0
- package/rules/golang/patterns.md +50 -0
- package/rules/golang/security.md +39 -0
- package/rules/golang/testing.md +36 -0
- package/rules/python/coding-style.md +47 -0
- package/rules/python/hooks.md +24 -0
- package/rules/python/patterns.md +44 -0
- package/rules/python/security.md +35 -0
- package/rules/python/testing.md +43 -0
- package/rules/swift/coding-style.md +52 -0
- package/rules/swift/hooks.md +25 -0
- package/rules/swift/patterns.md +71 -0
- package/rules/swift/security.md +38 -0
- package/rules/swift/testing.md +50 -0
- package/rules/typescript/coding-style.md +204 -0
- package/rules/typescript/hooks.md +27 -0
- package/rules/typescript/patterns.md +57 -0
- package/rules/typescript/security.md +33 -0
- package/rules/typescript/testing.md +23 -0
- package/rules/web/coding-style.md +101 -0
- package/rules/web/design-quality.md +68 -0
- package/rules/web/hooks.md +125 -0
- package/rules/web/patterns.md +84 -0
- package/rules/web/performance.md +69 -0
- package/rules/web/security.md +62 -0
- package/rules/web/testing.md +60 -0
- package/rules/zh/README.md +113 -0
- package/rules/zh/agents.md +55 -0
- package/rules/zh/code-review.md +129 -0
- package/rules/zh/coding-style.md +53 -0
- package/rules/zh/development-workflow.md +49 -0
- package/rules/zh/git-workflow.md +29 -0
- package/rules/zh/hooks.md +35 -0
- package/rules/zh/patterns.md +36 -0
- package/rules/zh/performance.md +60 -0
- package/rules/zh/security.md +34 -0
- package/rules/zh/testing.md +34 -0
- package/skills/ai/agent-dev.md +102 -0
- package/skills/ai/llm-security.md +105 -0
- package/skills/ai/ml-ops.md +169 -0
- package/skills/ai/orchestration-workflow.md +87 -0
- package/skills/ai/prompt-and-eval.md +114 -0
- package/skills/ai/prompt-optimizer.md +114 -0
- package/skills/ai/rag-system.md +104 -0
- package/skills/architecture/api-design.md +100 -0
- package/skills/architecture/caching.md +101 -0
- package/skills/architecture/cloud-native.md +97 -0
- package/skills/architecture/message-queue.md +100 -0
- package/skills/architecture/security-arch.md +105 -0
- package/skills/development/cpp.md +127 -0
- package/skills/development/go.md +129 -0
- package/skills/development/java.md +134 -0
- package/skills/development/kotlin.md +140 -0
- package/skills/development/mobile-crossplatform.md +144 -0
- package/skills/development/python.md +109 -0
- package/skills/development/rust.md +127 -0
- package/skills/development/shell.md +127 -0
- package/skills/development/swift.md +129 -0
- package/skills/development/typescript.md +129 -0
- package/skills/devops/ci-cd.md +108 -0
- package/skills/devops/containerization.md +106 -0
- package/skills/devops/cost-optimization.md +105 -0
- package/skills/devops/data-engineering.md +181 -0
- package/skills/devops/database.md +95 -0
- package/skills/devops/dependency-management.md +91 -0
- package/skills/devops/devsecops.md +96 -0
- package/skills/devops/git-workflow.md +100 -0
- package/skills/devops/incident-response.md +167 -0
- package/skills/devops/monorepo.md +87 -0
- package/skills/devops/observability.md +103 -0
- package/skills/devops/performance.md +104 -0
- package/skills/devops/testing.md +104 -0
- package/skills/docs/adr-workflow.md +32 -0
- package/skills/docs/backlog-proposal-workflow.md +19 -0
- package/skills/docs/customer-profile-workflow.md +22 -0
- package/skills/docs/evidence-ingest-workflow.md +23 -0
- package/skills/docs/init-docs.md +160 -0
- package/skills/docs/init-project.md +50 -0
- package/skills/docs/prd-workflow.md +57 -0
- package/skills/docs/prfaq-workflow.md +25 -0
- package/skills/docs/product-intelligence-review.md +22 -0
- package/skills/docs/product-intelligence-workflow.md +62 -0
- package/skills/docs/product-signal-workflow.md +27 -0
- package/skills/docs/research-workflow.md +28 -0
- package/skills/docs/runbook-workflow.md +24 -0
- package/skills/exploration/repo-map.md +297 -0
- package/skills/frameworks/django.md +159 -0
- package/skills/frameworks/nextjs.md +148 -0
- package/skills/frameworks/react.md +132 -0
- package/skills/frameworks/spring-boot.md +165 -0
- package/skills/frontend-design/accessibility.md +153 -0
- package/skills/frontend-design/component-patterns.md +111 -0
- package/skills/frontend-design/engineering.md +122 -0
- package/skills/frontend-design/state-management.md +118 -0
- package/skills/frontend-design/ui-aesthetics.md +102 -0
- package/skills/frontend-design/ux-principles.md +126 -0
- package/skills/quality-gates/review-work.md +90 -0
- package/skills/quality-gates/verify-change.md +94 -0
- package/skills/quality-gates/verify-module.md +96 -0
- package/skills/quality-gates/verify-quality.md +93 -0
- package/skills/quality-gates/verify-security.md +95 -0
- package/skills/roles/architect.ai-systems.md +37 -0
- package/skills/roles/architect.data.md +37 -0
- package/skills/roles/architect.enterprise.md +37 -0
- package/skills/roles/architect.integration.md +37 -0
- package/skills/roles/architect.md +68 -0
- package/skills/roles/architect.platform.md +37 -0
- package/skills/roles/data-analyst.experiment.md +37 -0
- package/skills/roles/data-analyst.md +68 -0
- package/skills/roles/data-analyst.product-intelligence.md +37 -0
- package/skills/roles/data-analyst.product.md +37 -0
- package/skills/roles/data-analyst.telemetry.md +37 -0
- package/skills/roles/data-engineer.pipeline.md +37 -0
- package/skills/roles/data-engineer.vector-retrieval.md +37 -0
- package/skills/roles/data-engineer.warehouse.md +37 -0
- package/skills/roles/debugger.md +68 -0
- package/skills/roles/designer.accessibility.md +43 -0
- package/skills/roles/designer.md +68 -0
- package/skills/roles/engineer.ai.md +49 -0
- package/skills/roles/engineer.data.md +49 -0
- package/skills/roles/engineer.md +85 -0
- package/skills/roles/engineer.platform.md +49 -0
- package/skills/roles/operator.docs.md +43 -0
- package/skills/roles/operator.md +68 -0
- package/skills/roles/operator.release.md +43 -0
- package/skills/roles/operator.sre.md +43 -0
- package/skills/roles/orchestrator.md +66 -0
- package/skills/roles/product-manager.ai-product.md +37 -0
- package/skills/roles/product-manager.business-strategy.md +43 -0
- package/skills/roles/product-manager.enterprise.md +37 -0
- package/skills/roles/product-manager.growth.md +37 -0
- package/skills/roles/product-manager.md +67 -0
- package/skills/roles/product-manager.platform.md +37 -0
- package/skills/roles/product-manager.product.md +37 -0
- package/skills/roles/qa.ai-eval.md +37 -0
- package/skills/roles/qa.api-contract.md +37 -0
- package/skills/roles/qa.data-pipeline.md +37 -0
- package/skills/roles/qa.md +68 -0
- package/skills/roles/qa.test-automation.md +49 -0
- package/skills/roles/qa.web-ui.md +37 -0
- package/skills/roles/researcher.explorer.md +43 -0
- package/skills/roles/researcher.md +68 -0
- package/skills/roles/researcher.ux.md +43 -0
- package/skills/roles/reviewer.devil-advocate.md +43 -0
- package/skills/roles/reviewer.evaluator.md +43 -0
- package/skills/roles/reviewer.md +68 -0
- package/skills/roles/reviewer.trace.md +43 -0
- package/skills/roles/security.ai.md +37 -0
- package/skills/roles/security.appsec.md +37 -0
- package/skills/roles/security.cloud.md +37 -0
- package/skills/roles/security.legal-compliance.md +49 -0
- package/skills/roles/security.md +68 -0
- package/skills/roles/security.privacy.md +37 -0
- package/skills/roles/security.supply-chain.md +37 -0
- package/skills/routing.md +139 -0
- package/skills/security/blue-team.md +83 -0
- package/skills/security/code-audit.md +94 -0
- package/skills/security/pentest.md +84 -0
- package/skills/security/red-team.md +81 -0
- package/skills/security/threat-intel.md +89 -0
- package/skills/security/vuln-research.md +87 -0
- package/skills/utility/clean-code.md +165 -0
- package/sync-agents.mjs +899 -0
- package/templates/docs/adr.md +27 -0
- package/templates/docs/backlog-proposal.md +26 -0
- package/templates/docs/customer-profile.md +34 -0
- package/templates/docs/evidence-brief.md +37 -0
- package/templates/docs/incident-report.md +46 -0
- package/templates/docs/memo.md +27 -0
- package/templates/docs/meta-prd.md +56 -0
- package/templates/docs/one-pager.md +24 -0
- package/templates/docs/prd-business.md +61 -0
- package/templates/docs/prd-platform.md +62 -0
- package/templates/docs/prd.md +47 -0
- package/templates/docs/prfaq.md +31 -0
- package/templates/docs/product-intelligence-report.md +31 -0
- package/templates/docs/research-brief.md +29 -0
- package/templates/docs/rfc-platform.md +60 -0
- package/templates/docs/rfc.md +46 -0
- package/templates/docs/runbook.md +33 -0
- package/templates/docs/signal-brief.md +25 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/swift/coding-style.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.swift"
|
|
9
|
+
- "**/Package.swift"
|
|
10
|
+
---
|
|
11
|
+
# Swift Coding Style
|
|
12
|
+
|
|
13
|
+
> This file extends [common/coding-style.md](../common/coding-style.md) with Swift specific content.
|
|
14
|
+
|
|
15
|
+
## Formatting
|
|
16
|
+
|
|
17
|
+
- **SwiftFormat** for auto-formatting, **SwiftLint** for style enforcement
|
|
18
|
+
- `swift-format` is bundled with Xcode 16+ as an alternative
|
|
19
|
+
|
|
20
|
+
## Immutability
|
|
21
|
+
|
|
22
|
+
- Prefer `let` over `var` — define everything as `let` and only change to `var` if the compiler requires it
|
|
23
|
+
- Use `struct` with value semantics by default; use `class` only when identity or reference semantics are needed
|
|
24
|
+
|
|
25
|
+
## Naming
|
|
26
|
+
|
|
27
|
+
Follow [Apple API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/):
|
|
28
|
+
|
|
29
|
+
- Clarity at the point of use — omit needless words
|
|
30
|
+
- Name methods and properties for their roles, not their types
|
|
31
|
+
- Use `static let` for constants over global constants
|
|
32
|
+
|
|
33
|
+
## Error Handling
|
|
34
|
+
|
|
35
|
+
Use typed throws (Swift 6+) and pattern matching:
|
|
36
|
+
|
|
37
|
+
```swift
|
|
38
|
+
func load(id: String) throws(LoadError) -> Item {
|
|
39
|
+
guard let data = try? read(from: path) else {
|
|
40
|
+
throw .fileNotFound(id)
|
|
41
|
+
}
|
|
42
|
+
return try decode(data)
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Concurrency
|
|
47
|
+
|
|
48
|
+
Enable Swift 6 strict concurrency checking. Prefer:
|
|
49
|
+
|
|
50
|
+
- `Sendable` value types for data crossing isolation boundaries
|
|
51
|
+
- Actors for shared mutable state
|
|
52
|
+
- Structured concurrency (`async let`, `TaskGroup`) over unstructured `Task {}`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/swift/hooks.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.swift"
|
|
9
|
+
- "**/Package.swift"
|
|
10
|
+
---
|
|
11
|
+
# Swift Hooks
|
|
12
|
+
|
|
13
|
+
> This file extends [common/hooks.md](../common/hooks.md) with Swift specific content.
|
|
14
|
+
|
|
15
|
+
## PostToolUse Hooks
|
|
16
|
+
|
|
17
|
+
Configure in `~/.claude/settings.json`:
|
|
18
|
+
|
|
19
|
+
- **SwiftFormat**: Auto-format `.swift` files after edit
|
|
20
|
+
- **SwiftLint**: Run lint checks after editing `.swift` files
|
|
21
|
+
- **swift build**: Type-check modified packages after edit
|
|
22
|
+
|
|
23
|
+
## Warning
|
|
24
|
+
|
|
25
|
+
Flag `print()` statements — use `os.Logger` or structured logging instead for production code.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/swift/patterns.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.swift"
|
|
9
|
+
- "**/Package.swift"
|
|
10
|
+
---
|
|
11
|
+
# Swift Patterns
|
|
12
|
+
|
|
13
|
+
> This file extends [common/patterns.md](../common/patterns.md) with Swift specific content.
|
|
14
|
+
|
|
15
|
+
## Protocol-Oriented Design
|
|
16
|
+
|
|
17
|
+
Define small, focused protocols. Use protocol extensions for shared defaults:
|
|
18
|
+
|
|
19
|
+
```swift
|
|
20
|
+
protocol Repository: Sendable {
|
|
21
|
+
associatedtype Item: Identifiable & Sendable
|
|
22
|
+
func find(by id: Item.ID) async throws -> Item?
|
|
23
|
+
func save(_ item: Item) async throws
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Value Types
|
|
28
|
+
|
|
29
|
+
- Use structs for data transfer objects and models
|
|
30
|
+
- Use enums with associated values to model distinct states:
|
|
31
|
+
|
|
32
|
+
```swift
|
|
33
|
+
enum LoadState<T: Sendable>: Sendable {
|
|
34
|
+
case idle
|
|
35
|
+
case loading
|
|
36
|
+
case loaded(T)
|
|
37
|
+
case failed(Error)
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Actor Pattern
|
|
42
|
+
|
|
43
|
+
Use actors for shared mutable state instead of locks or dispatch queues:
|
|
44
|
+
|
|
45
|
+
```swift
|
|
46
|
+
actor Cache<Key: Hashable & Sendable, Value: Sendable> {
|
|
47
|
+
private var storage: [Key: Value] = [:]
|
|
48
|
+
|
|
49
|
+
func get(_ key: Key) -> Value? { storage[key] }
|
|
50
|
+
func set(_ key: Key, value: Value) { storage[key] = value }
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Dependency Injection
|
|
55
|
+
|
|
56
|
+
Inject protocols with default parameters — production uses defaults, tests inject mocks:
|
|
57
|
+
|
|
58
|
+
```swift
|
|
59
|
+
struct UserService {
|
|
60
|
+
private let repository: any UserRepository
|
|
61
|
+
|
|
62
|
+
init(repository: any UserRepository = DefaultUserRepository()) {
|
|
63
|
+
self.repository = repository
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## References
|
|
69
|
+
|
|
70
|
+
See skill: `swift-actor-persistence` for actor-based persistence patterns.
|
|
71
|
+
See skill: `swift-protocol-di-testing` for protocol-based DI and testing.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/swift/security.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.swift"
|
|
9
|
+
- "**/Package.swift"
|
|
10
|
+
---
|
|
11
|
+
# Swift Security
|
|
12
|
+
|
|
13
|
+
> This file extends [common/security.md](../common/security.md) with Swift specific content.
|
|
14
|
+
|
|
15
|
+
## Secret Management
|
|
16
|
+
|
|
17
|
+
- Use **Keychain Services** for sensitive data (tokens, passwords, keys) — never `UserDefaults`
|
|
18
|
+
- Use environment variables or `.xcconfig` files for build-time secrets
|
|
19
|
+
- Never hardcode secrets in source — decompilation tools extract them trivially
|
|
20
|
+
|
|
21
|
+
```swift
|
|
22
|
+
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]
|
|
23
|
+
guard let apiKey, !apiKey.isEmpty else {
|
|
24
|
+
fatalError("API_KEY not configured")
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Transport Security
|
|
29
|
+
|
|
30
|
+
- App Transport Security (ATS) is enforced by default — do not disable it
|
|
31
|
+
- Use certificate pinning for critical endpoints
|
|
32
|
+
- Validate all server certificates
|
|
33
|
+
|
|
34
|
+
## Input Validation
|
|
35
|
+
|
|
36
|
+
- Sanitize all user input before display to prevent injection
|
|
37
|
+
- Use `URL(string:)` with validation rather than force-unwrapping
|
|
38
|
+
- Validate data from external sources (APIs, deep links, pasteboard) before processing
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/swift/testing.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.swift"
|
|
9
|
+
- "**/Package.swift"
|
|
10
|
+
---
|
|
11
|
+
# Swift Testing
|
|
12
|
+
|
|
13
|
+
> This file extends [common/testing.md](../common/testing.md) with Swift specific content.
|
|
14
|
+
|
|
15
|
+
## Framework
|
|
16
|
+
|
|
17
|
+
Use **Swift Testing** (`import Testing`) for new tests. Use `@Test` and `#expect`:
|
|
18
|
+
|
|
19
|
+
```swift
|
|
20
|
+
@Test("User creation validates email")
|
|
21
|
+
func userCreationValidatesEmail() throws {
|
|
22
|
+
#expect(throws: ValidationError.invalidEmail) {
|
|
23
|
+
try User(email: "not-an-email")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Test Isolation
|
|
29
|
+
|
|
30
|
+
Each test gets a fresh instance — set up in `init`, tear down in `deinit`. No shared mutable state between tests.
|
|
31
|
+
|
|
32
|
+
## Parameterized Tests
|
|
33
|
+
|
|
34
|
+
```swift
|
|
35
|
+
@Test("Validates formats", arguments: ["json", "xml", "csv"])
|
|
36
|
+
func validatesFormat(format: String) throws {
|
|
37
|
+
let parser = try Parser(format: format)
|
|
38
|
+
#expect(parser.isValid)
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Coverage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
swift test --enable-code-coverage
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Reference
|
|
49
|
+
|
|
50
|
+
See skill: `swift-protocol-di-testing` for protocol-based dependency injection and mock patterns with Swift Testing.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/typescript/coding-style.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.ts"
|
|
9
|
+
- "**/*.tsx"
|
|
10
|
+
- "**/*.js"
|
|
11
|
+
- "**/*.jsx"
|
|
12
|
+
---
|
|
13
|
+
# TypeScript/JavaScript Coding Style
|
|
14
|
+
|
|
15
|
+
> This file extends [common/coding-style.md](../common/coding-style.md) with TypeScript/JavaScript specific content.
|
|
16
|
+
|
|
17
|
+
## Types and Interfaces
|
|
18
|
+
|
|
19
|
+
Use types to make public APIs, shared models, and component props explicit, readable, and reusable.
|
|
20
|
+
|
|
21
|
+
### Public APIs
|
|
22
|
+
|
|
23
|
+
- Add parameter and return types to exported functions, shared utilities, and public class methods
|
|
24
|
+
- Let TypeScript infer obvious local variable types
|
|
25
|
+
- Extract repeated inline object shapes into named types or interfaces
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// WRONG: Exported function without explicit types
|
|
29
|
+
export function formatUser(user) {
|
|
30
|
+
return `${user.firstName} ${user.lastName}`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// CORRECT: Explicit types on public APIs
|
|
34
|
+
interface User {
|
|
35
|
+
firstName: string
|
|
36
|
+
lastName: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function formatUser(user: User): string {
|
|
40
|
+
return `${user.firstName} ${user.lastName}`
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Interfaces vs. Type Aliases
|
|
45
|
+
|
|
46
|
+
- Use `interface` for object shapes that may be extended or implemented
|
|
47
|
+
- Use `type` for unions, intersections, tuples, mapped types, and utility types
|
|
48
|
+
- Prefer string literal unions over `enum` unless an `enum` is required for interoperability
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
interface User {
|
|
52
|
+
id: string
|
|
53
|
+
email: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type UserRole = 'admin' | 'member'
|
|
57
|
+
type UserWithRole = User & {
|
|
58
|
+
role: UserRole
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Avoid `any`
|
|
63
|
+
|
|
64
|
+
- Avoid `any` in application code
|
|
65
|
+
- Use `unknown` for external or untrusted input, then narrow it safely
|
|
66
|
+
- Use generics when a value's type depends on the caller
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// WRONG: any removes type safety
|
|
70
|
+
function getErrorMessage(error: any) {
|
|
71
|
+
return error.message
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// CORRECT: unknown forces safe narrowing
|
|
75
|
+
function getErrorMessage(error: unknown): string {
|
|
76
|
+
if (error instanceof Error) {
|
|
77
|
+
return error.message
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return 'Unexpected error'
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### React Props
|
|
85
|
+
|
|
86
|
+
- Define component props with a named `interface` or `type`
|
|
87
|
+
- Type callback props explicitly
|
|
88
|
+
- Do not use `React.FC` unless there is a specific reason to do so
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
interface User {
|
|
92
|
+
id: string
|
|
93
|
+
email: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface UserCardProps {
|
|
97
|
+
user: User
|
|
98
|
+
onSelect: (id: string) => void
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function UserCard({ user, onSelect }: UserCardProps) {
|
|
102
|
+
return <button onClick={() => onSelect(user.id)}>{user.email}</button>
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### JavaScript Files
|
|
107
|
+
|
|
108
|
+
- In `.js` and `.jsx` files, use JSDoc when types improve clarity and a TypeScript migration is not practical
|
|
109
|
+
- Keep JSDoc aligned with runtime behavior
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
/**
|
|
113
|
+
* @param {{ firstName: string, lastName: string }} user
|
|
114
|
+
* @returns {string}
|
|
115
|
+
*/
|
|
116
|
+
export function formatUser(user) {
|
|
117
|
+
return `${user.firstName} ${user.lastName}`
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Immutability
|
|
122
|
+
|
|
123
|
+
Use spread operator for immutable updates:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
interface User {
|
|
127
|
+
id: string
|
|
128
|
+
name: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// WRONG: Mutation
|
|
132
|
+
function updateUser(user: User, name: string): User {
|
|
133
|
+
user.name = name // MUTATION!
|
|
134
|
+
return user
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// CORRECT: Immutability
|
|
138
|
+
function updateUser(user: Readonly<User>, name: string): User {
|
|
139
|
+
return {
|
|
140
|
+
...user,
|
|
141
|
+
name
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Error Handling
|
|
147
|
+
|
|
148
|
+
Use async/await with try-catch and narrow unknown errors safely:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
interface User {
|
|
152
|
+
id: string
|
|
153
|
+
email: string
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare function riskyOperation(userId: string): Promise<User>
|
|
157
|
+
|
|
158
|
+
function getErrorMessage(error: unknown): string {
|
|
159
|
+
if (error instanceof Error) {
|
|
160
|
+
return error.message
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return 'Unexpected error'
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const logger = {
|
|
167
|
+
error: (message: string, error: unknown) => {
|
|
168
|
+
// Replace with your production logger (for example, pino or winston).
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async function loadUser(userId: string): Promise<User> {
|
|
173
|
+
try {
|
|
174
|
+
const result = await riskyOperation(userId)
|
|
175
|
+
return result
|
|
176
|
+
} catch (error: unknown) {
|
|
177
|
+
logger.error('Operation failed', error)
|
|
178
|
+
throw new Error(getErrorMessage(error))
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Input Validation
|
|
184
|
+
|
|
185
|
+
Use Zod for schema-based validation and infer types from the schema:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { z } from 'zod'
|
|
189
|
+
|
|
190
|
+
const userSchema = z.object({
|
|
191
|
+
email: z.string().email(),
|
|
192
|
+
age: z.number().int().min(0).max(150)
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
type UserInput = z.infer<typeof userSchema>
|
|
196
|
+
|
|
197
|
+
const validated: UserInput = userSchema.parse(input)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Console.log
|
|
201
|
+
|
|
202
|
+
- No `console.log` statements in production code
|
|
203
|
+
- Use proper logging libraries instead
|
|
204
|
+
- See hooks for automatic detection
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/typescript/hooks.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.ts"
|
|
9
|
+
- "**/*.tsx"
|
|
10
|
+
- "**/*.js"
|
|
11
|
+
- "**/*.jsx"
|
|
12
|
+
---
|
|
13
|
+
# TypeScript/JavaScript Hooks
|
|
14
|
+
|
|
15
|
+
> This file extends [common/hooks.md](../common/hooks.md) with TypeScript/JavaScript specific content.
|
|
16
|
+
|
|
17
|
+
## PostToolUse Hooks
|
|
18
|
+
|
|
19
|
+
Configure in `~/.claude/settings.json`:
|
|
20
|
+
|
|
21
|
+
- **Prettier**: Auto-format JS/TS files after edit
|
|
22
|
+
- **TypeScript check**: Run `tsc` after editing `.ts`/`.tsx` files
|
|
23
|
+
- **console.log warning**: Warn about `console.log` in edited files
|
|
24
|
+
|
|
25
|
+
## Stop Hooks
|
|
26
|
+
|
|
27
|
+
- **console.log audit**: Check all modified files for `console.log` before session ends
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/typescript/patterns.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.ts"
|
|
9
|
+
- "**/*.tsx"
|
|
10
|
+
- "**/*.js"
|
|
11
|
+
- "**/*.jsx"
|
|
12
|
+
---
|
|
13
|
+
# TypeScript/JavaScript Patterns
|
|
14
|
+
|
|
15
|
+
> This file extends [common/patterns.md](../common/patterns.md) with TypeScript/JavaScript specific content.
|
|
16
|
+
|
|
17
|
+
## API Response Format
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
interface ApiResponse<T> {
|
|
21
|
+
success: boolean
|
|
22
|
+
data?: T
|
|
23
|
+
error?: string
|
|
24
|
+
meta?: {
|
|
25
|
+
total: number
|
|
26
|
+
page: number
|
|
27
|
+
limit: number
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Custom Hooks Pattern
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
export function useDebounce<T>(value: T, delay: number): T {
|
|
36
|
+
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay)
|
|
40
|
+
return () => clearTimeout(handler)
|
|
41
|
+
}, [value, delay])
|
|
42
|
+
|
|
43
|
+
return debouncedValue
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Repository Pattern
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
interface Repository<T> {
|
|
51
|
+
findAll(filters?: Filters): Promise<T[]>
|
|
52
|
+
findById(id: string): Promise<T | null>
|
|
53
|
+
create(data: CreateDto): Promise<T>
|
|
54
|
+
update(id: string, data: UpdateDto): Promise<T>
|
|
55
|
+
delete(id: string): Promise<void>
|
|
56
|
+
}
|
|
57
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/typescript/security.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.ts"
|
|
9
|
+
- "**/*.tsx"
|
|
10
|
+
- "**/*.js"
|
|
11
|
+
- "**/*.jsx"
|
|
12
|
+
---
|
|
13
|
+
# TypeScript/JavaScript Security
|
|
14
|
+
|
|
15
|
+
> This file extends [common/security.md](../common/security.md) with TypeScript/JavaScript specific content.
|
|
16
|
+
|
|
17
|
+
## Secret Management
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// NEVER: Hardcoded secrets
|
|
21
|
+
const apiKey = process.env.OPENAI_API_KEY
|
|
22
|
+
|
|
23
|
+
// ALWAYS: Environment variables
|
|
24
|
+
const apiKey = process.env.OPENAI_API_KEY
|
|
25
|
+
|
|
26
|
+
if (!apiKey) {
|
|
27
|
+
throw new Error('OPENAI_API_KEY not configured')
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Agent Support
|
|
32
|
+
|
|
33
|
+
- Use **security-reviewer** skill for comprehensive security audits
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/typescript/testing.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
---
|
|
7
|
+
paths:
|
|
8
|
+
- "**/*.ts"
|
|
9
|
+
- "**/*.tsx"
|
|
10
|
+
- "**/*.js"
|
|
11
|
+
- "**/*.jsx"
|
|
12
|
+
---
|
|
13
|
+
# TypeScript/JavaScript Testing
|
|
14
|
+
|
|
15
|
+
> This file extends [common/testing.md](../common/testing.md) with TypeScript/JavaScript specific content.
|
|
16
|
+
|
|
17
|
+
## E2E Testing
|
|
18
|
+
|
|
19
|
+
Use **Playwright** as the E2E testing framework for critical user flows.
|
|
20
|
+
|
|
21
|
+
## Agent Support
|
|
22
|
+
|
|
23
|
+
- **e2e-runner** - Playwright E2E testing specialist
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/coding-style.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/coding-style.md](../common/coding-style.md) with web-specific frontend content.
|
|
7
|
+
|
|
8
|
+
# Web Coding Style
|
|
9
|
+
|
|
10
|
+
## File Organization
|
|
11
|
+
|
|
12
|
+
Organize by feature or surface area, not by file type:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
src/
|
|
16
|
+
├── components/
|
|
17
|
+
│ ├── hero/
|
|
18
|
+
│ │ ├── Hero.tsx
|
|
19
|
+
│ │ ├── HeroVisual.tsx
|
|
20
|
+
│ │ └── hero.css
|
|
21
|
+
│ ├── scrolly-section/
|
|
22
|
+
│ │ ├── ScrollySection.tsx
|
|
23
|
+
│ │ ├── StickyVisual.tsx
|
|
24
|
+
│ │ └── scrolly.css
|
|
25
|
+
│ └── ui/
|
|
26
|
+
│ ├── Button.tsx
|
|
27
|
+
│ ├── SurfaceCard.tsx
|
|
28
|
+
│ └── AnimatedText.tsx
|
|
29
|
+
├── hooks/
|
|
30
|
+
│ ├── useReducedMotion.ts
|
|
31
|
+
│ └── useScrollProgress.ts
|
|
32
|
+
├── lib/
|
|
33
|
+
│ ├── animation.ts
|
|
34
|
+
│ └── color.ts
|
|
35
|
+
└── styles/
|
|
36
|
+
├── tokens.css
|
|
37
|
+
├── typography.css
|
|
38
|
+
└── global.css
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## CSS Custom Properties
|
|
42
|
+
|
|
43
|
+
Define design tokens as variables. Do not hardcode palette, typography, or spacing repeatedly:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
:root {
|
|
47
|
+
--color-surface: oklch(98% 0 0);
|
|
48
|
+
--color-text: oklch(18% 0 0);
|
|
49
|
+
--color-accent: oklch(68% 0.21 250);
|
|
50
|
+
|
|
51
|
+
--text-base: clamp(1rem, 0.92rem + 0.4vw, 1.125rem);
|
|
52
|
+
--text-hero: clamp(3rem, 1rem + 7vw, 8rem);
|
|
53
|
+
|
|
54
|
+
--space-section: clamp(4rem, 3rem + 5vw, 10rem);
|
|
55
|
+
|
|
56
|
+
--duration-fast: 150ms;
|
|
57
|
+
--duration-normal: 300ms;
|
|
58
|
+
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Animation-Only Properties
|
|
63
|
+
|
|
64
|
+
Prefer compositor-friendly motion:
|
|
65
|
+
- `transform`
|
|
66
|
+
- `opacity`
|
|
67
|
+
- `clip-path`
|
|
68
|
+
- `filter` (sparingly)
|
|
69
|
+
|
|
70
|
+
Avoid animating layout-bound properties:
|
|
71
|
+
- `width`
|
|
72
|
+
- `height`
|
|
73
|
+
- `top`
|
|
74
|
+
- `left`
|
|
75
|
+
- `margin`
|
|
76
|
+
- `padding`
|
|
77
|
+
- `border`
|
|
78
|
+
- `font-size`
|
|
79
|
+
|
|
80
|
+
## Semantic HTML First
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<header>
|
|
84
|
+
<nav aria-label="Main navigation">...</nav>
|
|
85
|
+
</header>
|
|
86
|
+
<main>
|
|
87
|
+
<section aria-labelledby="hero-heading">
|
|
88
|
+
<h1 id="hero-heading">...</h1>
|
|
89
|
+
</section>
|
|
90
|
+
</main>
|
|
91
|
+
<footer>...</footer>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Do not reach for generic wrapper `div` stacks when a semantic element exists.
|
|
95
|
+
|
|
96
|
+
## Naming
|
|
97
|
+
|
|
98
|
+
- Components: PascalCase (`ScrollySection`, `SurfaceCard`)
|
|
99
|
+
- Hooks: `use` prefix (`useReducedMotion`)
|
|
100
|
+
- CSS classes: kebab-case or utility classes
|
|
101
|
+
- Animation timelines: camelCase with intent (`heroRevealTl`)
|