forgecraft-mcp 0.1.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/README.md +251 -0
- package/dist/analyzers/anti-pattern.d.ts +21 -0
- package/dist/analyzers/anti-pattern.d.ts.map +1 -0
- package/dist/analyzers/anti-pattern.js +130 -0
- package/dist/analyzers/anti-pattern.js.map +1 -0
- package/dist/analyzers/completeness.d.ts +15 -0
- package/dist/analyzers/completeness.d.ts.map +1 -0
- package/dist/analyzers/completeness.js +207 -0
- package/dist/analyzers/completeness.js.map +1 -0
- package/dist/analyzers/folder-structure.d.ts +35 -0
- package/dist/analyzers/folder-structure.d.ts.map +1 -0
- package/dist/analyzers/folder-structure.js +151 -0
- package/dist/analyzers/folder-structure.js.map +1 -0
- package/dist/analyzers/package-json.d.ts +22 -0
- package/dist/analyzers/package-json.d.ts.map +1 -0
- package/dist/analyzers/package-json.js +229 -0
- package/dist/analyzers/package-json.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/composer.d.ts +32 -0
- package/dist/registry/composer.d.ts.map +1 -0
- package/dist/registry/composer.js +169 -0
- package/dist/registry/composer.js.map +1 -0
- package/dist/registry/loader.d.ts +37 -0
- package/dist/registry/loader.d.ts.map +1 -0
- package/dist/registry/loader.js +278 -0
- package/dist/registry/loader.js.map +1 -0
- package/dist/registry/renderer.d.ts +53 -0
- package/dist/registry/renderer.d.ts.map +1 -0
- package/dist/registry/renderer.js +275 -0
- package/dist/registry/renderer.js.map +1 -0
- package/dist/shared/config/index.d.ts +15 -0
- package/dist/shared/config/index.d.ts.map +1 -0
- package/dist/shared/config/index.js +16 -0
- package/dist/shared/config/index.js.map +1 -0
- package/dist/shared/errors/index.d.ts +30 -0
- package/dist/shared/errors/index.d.ts.map +1 -0
- package/dist/shared/errors/index.js +44 -0
- package/dist/shared/errors/index.js.map +1 -0
- package/dist/shared/logger/index.d.ts +27 -0
- package/dist/shared/logger/index.d.ts.map +1 -0
- package/dist/shared/logger/index.js +59 -0
- package/dist/shared/logger/index.js.map +1 -0
- package/dist/shared/types.d.ts +212 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +30 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tools/add-hook.d.ts +26 -0
- package/dist/tools/add-hook.d.ts.map +1 -0
- package/dist/tools/add-hook.js +82 -0
- package/dist/tools/add-hook.js.map +1 -0
- package/dist/tools/add-module.d.ts +29 -0
- package/dist/tools/add-module.d.ts.map +1 -0
- package/dist/tools/add-module.js +244 -0
- package/dist/tools/add-module.js.map +1 -0
- package/dist/tools/audit.d.ts +26 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +111 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/classify.d.ts +23 -0
- package/dist/tools/classify.d.ts.map +1 -0
- package/dist/tools/classify.js +73 -0
- package/dist/tools/classify.js.map +1 -0
- package/dist/tools/configure-mcp.d.ts +49 -0
- package/dist/tools/configure-mcp.d.ts.map +1 -0
- package/dist/tools/configure-mcp.js +127 -0
- package/dist/tools/configure-mcp.js.map +1 -0
- package/dist/tools/convert.d.ts +27 -0
- package/dist/tools/convert.d.ts.map +1 -0
- package/dist/tools/convert.js +154 -0
- package/dist/tools/convert.js.map +1 -0
- package/dist/tools/generate-claude-md.d.ts +29 -0
- package/dist/tools/generate-claude-md.d.ts.map +1 -0
- package/dist/tools/generate-claude-md.js +116 -0
- package/dist/tools/generate-claude-md.js.map +1 -0
- package/dist/tools/get-nfr.d.ts +20 -0
- package/dist/tools/get-nfr.d.ts.map +1 -0
- package/dist/tools/get-nfr.js +53 -0
- package/dist/tools/get-nfr.js.map +1 -0
- package/dist/tools/list.d.ts +33 -0
- package/dist/tools/list.d.ts.map +1 -0
- package/dist/tools/list.js +155 -0
- package/dist/tools/list.js.map +1 -0
- package/dist/tools/refresh-project.d.ts +34 -0
- package/dist/tools/refresh-project.d.ts.map +1 -0
- package/dist/tools/refresh-project.js +257 -0
- package/dist/tools/refresh-project.js.map +1 -0
- package/dist/tools/review.d.ts +31 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/review.js +62 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/scaffold.d.ts +32 -0
- package/dist/tools/scaffold.d.ts.map +1 -0
- package/dist/tools/scaffold.js +160 -0
- package/dist/tools/scaffold.js.map +1 -0
- package/dist/tools/setup-project.d.ts +37 -0
- package/dist/tools/setup-project.d.ts.map +1 -0
- package/dist/tools/setup-project.js +270 -0
- package/dist/tools/setup-project.js.map +1 -0
- package/package.json +69 -0
- package/templates/analytics/claude-md.yaml +37 -0
- package/templates/analytics/structure.yaml +25 -0
- package/templates/api/claude-md.yaml +85 -0
- package/templates/api/nfr.yaml +23 -0
- package/templates/api/review.yaml +103 -0
- package/templates/api/structure.yaml +34 -0
- package/templates/cli/claude-md.yaml +31 -0
- package/templates/cli/review.yaml +53 -0
- package/templates/cli/structure.yaml +16 -0
- package/templates/data-pipeline/claude-md.yaml +42 -0
- package/templates/data-pipeline/nfr.yaml +39 -0
- package/templates/data-pipeline/structure.yaml +23 -0
- package/templates/fintech/claude-md.yaml +42 -0
- package/templates/fintech/nfr.yaml +46 -0
- package/templates/game/claude-md.yaml +42 -0
- package/templates/healthcare/claude-md.yaml +42 -0
- package/templates/healthcare/nfr.yaml +47 -0
- package/templates/infra/claude-md.yaml +104 -0
- package/templates/infra/nfr.yaml +46 -0
- package/templates/infra/review.yaml +65 -0
- package/templates/infra/structure.yaml +25 -0
- package/templates/library/claude-md.yaml +36 -0
- package/templates/library/review.yaml +56 -0
- package/templates/library/structure.yaml +19 -0
- package/templates/ml/claude-md.yaml +42 -0
- package/templates/ml/nfr.yaml +39 -0
- package/templates/ml/structure.yaml +25 -0
- package/templates/mobile/claude-md.yaml +44 -0
- package/templates/mobile/nfr.yaml +49 -0
- package/templates/mobile/structure.yaml +27 -0
- package/templates/realtime/claude-md.yaml +42 -0
- package/templates/social/claude-md.yaml +43 -0
- package/templates/state-machine/claude-md.yaml +42 -0
- package/templates/universal/claude-md.yaml +477 -0
- package/templates/universal/hooks.yaml +196 -0
- package/templates/universal/nfr.yaml +197 -0
- package/templates/universal/review.yaml +164 -0
- package/templates/universal/structure.yaml +52 -0
- package/templates/web-react/claude-md.yaml +110 -0
- package/templates/web-react/hooks.yaml +44 -0
- package/templates/web-react/nfr.yaml +27 -0
- package/templates/web-react/review.yaml +94 -0
- package/templates/web-react/structure.yaml +46 -0
- package/templates/web-static/claude-md.yaml +73 -0
- package/templates/web3/claude-md.yaml +44 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
tag: UNIVERSAL
|
|
2
|
+
section: nfr
|
|
3
|
+
blocks:
|
|
4
|
+
- id: security
|
|
5
|
+
tier: core
|
|
6
|
+
title: "Security"
|
|
7
|
+
content: |
|
|
8
|
+
## NFR: Security
|
|
9
|
+
|
|
10
|
+
### Authentication & Authorization
|
|
11
|
+
- Authentication mechanism: {{auth_mechanism}}
|
|
12
|
+
- Authorization model: {{auth_model}}
|
|
13
|
+
- Secret management: environment variables minimum, secrets manager preferred (AWS SSM, Vault)
|
|
14
|
+
- No secrets in code, config files, or git history. Ever.
|
|
15
|
+
|
|
16
|
+
### Input Validation
|
|
17
|
+
- Validate and sanitize ALL external input at system boundary.
|
|
18
|
+
- Use allowlists, not denylists.
|
|
19
|
+
- Parameterized queries only — no string concatenation for SQL/commands.
|
|
20
|
+
|
|
21
|
+
### Dependencies
|
|
22
|
+
- Automated dependency vulnerability scanning (Dependabot, Snyk, or equivalent).
|
|
23
|
+
- No dependencies with known critical CVEs.
|
|
24
|
+
- Lock file committed (package-lock.json, poetry.lock, Cargo.lock).
|
|
25
|
+
|
|
26
|
+
### Transport
|
|
27
|
+
- TLS 1.2+ for all network communication.
|
|
28
|
+
- HSTS headers on all web responses.
|
|
29
|
+
- CORS configured to minimum necessary origins.
|
|
30
|
+
|
|
31
|
+
- id: observability
|
|
32
|
+
tier: recommended
|
|
33
|
+
title: "Observability"
|
|
34
|
+
content: |
|
|
35
|
+
## NFR: Observability
|
|
36
|
+
|
|
37
|
+
### Structured Logging
|
|
38
|
+
- JSON-formatted structured logs (structlog for Python, pino for Node).
|
|
39
|
+
- Every log entry includes: timestamp, level, service, trace_id, operation, context.
|
|
40
|
+
- Log levels used correctly: DEBUG for development, INFO for operations, WARN for degraded
|
|
41
|
+
state, ERROR for failures requiring attention.
|
|
42
|
+
- NO sensitive data in logs (PHI, PII, credentials, tokens).
|
|
43
|
+
|
|
44
|
+
### Metrics
|
|
45
|
+
- RED metrics on all service boundaries: Rate, Errors, Duration.
|
|
46
|
+
- Business metrics for key operations.
|
|
47
|
+
- Alerting thresholds defined for all critical metrics.
|
|
48
|
+
|
|
49
|
+
### Health Checks
|
|
50
|
+
- /health endpoint returning: status, version, uptime, dependency health.
|
|
51
|
+
- Readiness vs liveness probes (Kubernetes) or equivalent.
|
|
52
|
+
|
|
53
|
+
- id: reliability
|
|
54
|
+
tier: recommended
|
|
55
|
+
title: "Reliability"
|
|
56
|
+
content: |
|
|
57
|
+
## NFR: Reliability
|
|
58
|
+
|
|
59
|
+
### Graceful Degradation
|
|
60
|
+
- Circuit breakers on all external service calls.
|
|
61
|
+
- Timeout configured on every external call (no indefinite waits).
|
|
62
|
+
- Fallback behavior defined for each dependency failure.
|
|
63
|
+
|
|
64
|
+
### Disaster Recovery
|
|
65
|
+
- Backup strategy: automated, tested, documented.
|
|
66
|
+
- Runbook for common failure scenarios.
|
|
67
|
+
- **RPO** (Recovery Point Objective): maximum acceptable data loss = {{rpo | default: 1 hour}}.
|
|
68
|
+
- **RTO** (Recovery Time Objective): maximum acceptable downtime = {{rto | default: 4 hours}}.
|
|
69
|
+
- Failover tested at least quarterly. Document time-to-recovery in post-mortems.
|
|
70
|
+
- Database point-in-time recovery enabled. Retention: {{backup_retention | default: 30 days}}.
|
|
71
|
+
|
|
72
|
+
### Availability Targets
|
|
73
|
+
- Target uptime: {{uptime_target | default: 99.9%}} (≈ 8.7 hours downtime/year).
|
|
74
|
+
- Define SLIs (error rate, latency p99, availability) and SLOs per service.
|
|
75
|
+
- Error budget policy: when budget is exhausted, freeze feature releases until reliability improves.
|
|
76
|
+
- Maintenance windows communicated 48h in advance. Prefer zero-downtime deployments.
|
|
77
|
+
|
|
78
|
+
- id: scalability
|
|
79
|
+
tier: optional
|
|
80
|
+
title: "Scalability"
|
|
81
|
+
content: |
|
|
82
|
+
## NFR: Scalability
|
|
83
|
+
|
|
84
|
+
### Horizontal Scaling
|
|
85
|
+
- Application designed for horizontal scaling — no in-process state that can't be lost.
|
|
86
|
+
- Session/cache state externalized to Redis, Memcached, or equivalent.
|
|
87
|
+
- Connection pooling configured per environment. Pool exhaustion triggers alerts, not failures.
|
|
88
|
+
|
|
89
|
+
### Data Layer
|
|
90
|
+
- Database queries support the expected data volume. Test with 10x expected load.
|
|
91
|
+
- Pagination on all list operations. No unbounded queries.
|
|
92
|
+
- Read replicas for read-heavy workloads. Write/read split documented.
|
|
93
|
+
- Index strategy reviewed quarterly. Slow query log monitored.
|
|
94
|
+
|
|
95
|
+
### Queue & Async Processing
|
|
96
|
+
- CPU-intensive or long-running work offloaded to background queues.
|
|
97
|
+
- Queue depth monitored. Auto-scale workers based on queue backlog.
|
|
98
|
+
- Dead letter queues for failed messages. Alert and review DLQ weekly.
|
|
99
|
+
|
|
100
|
+
- id: compliance
|
|
101
|
+
tier: optional
|
|
102
|
+
title: "Compliance & Data Governance"
|
|
103
|
+
content: |
|
|
104
|
+
## NFR: Compliance & Data Governance
|
|
105
|
+
|
|
106
|
+
### Data Classification
|
|
107
|
+
- All data fields classified: Public, Internal, Confidential, Restricted.
|
|
108
|
+
- Restricted data (PII, PHI, financial) encrypted at rest and in transit.
|
|
109
|
+
- Access to restricted data logged and auditable.
|
|
110
|
+
|
|
111
|
+
### GDPR / Privacy
|
|
112
|
+
- Data processing purposes documented. No collection beyond stated purpose.
|
|
113
|
+
- Right to access: user can export their data in machine-readable format.
|
|
114
|
+
- Right to erasure: user data deletable within {{deletion_sla | default: 30 days}} of request.
|
|
115
|
+
- Data retention schedules defined per data type. Auto-delete expired data.
|
|
116
|
+
- Cookie consent where required. No tracking before consent.
|
|
117
|
+
|
|
118
|
+
### Audit Trail
|
|
119
|
+
- Security-relevant actions logged: authentication events, permission changes,
|
|
120
|
+
data access, admin operations.
|
|
121
|
+
- Audit logs immutable, retained for {{audit_retention | default: 1 year}}.
|
|
122
|
+
- Logs stored separately from application data.
|
|
123
|
+
|
|
124
|
+
- id: accessibility
|
|
125
|
+
tier: optional
|
|
126
|
+
title: "Accessibility"
|
|
127
|
+
content: |
|
|
128
|
+
## NFR: Accessibility
|
|
129
|
+
|
|
130
|
+
### Standards
|
|
131
|
+
- Target: WCAG 2.1 AA compliance minimum for all user-facing interfaces.
|
|
132
|
+
- Semantic HTML. Proper heading hierarchy. ARIA attributes where HTML semantics aren't sufficient.
|
|
133
|
+
- All interactive elements keyboard-accessible. Visible focus indicators.
|
|
134
|
+
- Color contrast: minimum 4.5:1 for normal text, 3:1 for large text.
|
|
135
|
+
|
|
136
|
+
### Testing
|
|
137
|
+
- Automated accessibility audit in CI (axe-core, Lighthouse accessibility).
|
|
138
|
+
- Screen reader testing for critical user journeys (at least quarterly).
|
|
139
|
+
- No images without alt text. No videos without captions.
|
|
140
|
+
|
|
141
|
+
### Universal Design
|
|
142
|
+
- Support reduced motion (`prefers-reduced-motion`).
|
|
143
|
+
- Support high contrast mode.
|
|
144
|
+
- Touch targets minimum 44x44px on mobile interfaces.
|
|
145
|
+
|
|
146
|
+
- id: internationalization
|
|
147
|
+
tier: optional
|
|
148
|
+
title: "Internationalization"
|
|
149
|
+
content: |
|
|
150
|
+
## NFR: Internationalization (i18n)
|
|
151
|
+
|
|
152
|
+
### Text & Content
|
|
153
|
+
- All user-facing text externalized to translation files from day one.
|
|
154
|
+
- No hardcoded strings in UI code. No string concatenation for translatable sentences.
|
|
155
|
+
- Translation keys namespaced by feature: `module.component.label`.
|
|
156
|
+
|
|
157
|
+
### Formatting
|
|
158
|
+
- Dates, numbers, currencies formatted via `Intl` API or equivalent — never manual formatting.
|
|
159
|
+
- Time zones handled correctly. Store UTC, display in user's local zone.
|
|
160
|
+
- Support RTL layouts if right-to-left languages are in scope.
|
|
161
|
+
|
|
162
|
+
### Workflow
|
|
163
|
+
- New strings automatically flagged for translation in CI.
|
|
164
|
+
- Missing translations fall back to default locale, never show raw keys to users.
|
|
165
|
+
|
|
166
|
+
- id: maintainability
|
|
167
|
+
tier: recommended
|
|
168
|
+
title: "Maintainability & Developer Experience"
|
|
169
|
+
content: |
|
|
170
|
+
## NFR: Maintainability & Developer Experience
|
|
171
|
+
|
|
172
|
+
### Onboarding
|
|
173
|
+
- New developer productive within 1 day: clone → install → run → make a change → test → commit.
|
|
174
|
+
- README.md with step-by-step local setup.
|
|
175
|
+
- .env.example with every variable documented.
|
|
176
|
+
|
|
177
|
+
### Code Quality Metrics
|
|
178
|
+
- Cyclomatic complexity: flag functions > 10, block > 15.
|
|
179
|
+
- Dead code detection.
|
|
180
|
+
- Documentation coverage: all public APIs have docstrings/JSDoc.
|
|
181
|
+
|
|
182
|
+
### Technical Debt Tracking
|
|
183
|
+
- Tech debt items logged in Status.md.
|
|
184
|
+
- No "we'll fix it later" without a tracked item.
|
|
185
|
+
|
|
186
|
+
- id: cost-management
|
|
187
|
+
tier: optional
|
|
188
|
+
title: "Cost Management"
|
|
189
|
+
content: |
|
|
190
|
+
## NFR: Cost Management
|
|
191
|
+
|
|
192
|
+
### Resource Budgets
|
|
193
|
+
- Monthly cloud spend budget defined and alerted at 80% threshold.
|
|
194
|
+
- Cost per user/transaction tracked as a business KPI.
|
|
195
|
+
|
|
196
|
+
### Optimization Cadence
|
|
197
|
+
- Monthly: review top 5 cost drivers, identify optimization opportunities.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
tag: UNIVERSAL
|
|
2
|
+
section: review
|
|
3
|
+
blocks:
|
|
4
|
+
- id: architecture-review
|
|
5
|
+
tier: core
|
|
6
|
+
dimension: architecture
|
|
7
|
+
title: "Architecture Review"
|
|
8
|
+
description: |
|
|
9
|
+
Evaluate the system's structural integrity, coupling, and scalability.
|
|
10
|
+
Focus on component boundaries, dependency flow, and failure modes.
|
|
11
|
+
checklist:
|
|
12
|
+
- id: component-boundaries
|
|
13
|
+
description: "Component boundaries are well-defined with clear public APIs (index.ts exports)."
|
|
14
|
+
severity: critical
|
|
15
|
+
- id: dependency-graph
|
|
16
|
+
description: "Dependency graph is acyclic. No circular imports between modules."
|
|
17
|
+
severity: critical
|
|
18
|
+
- id: layer-violations
|
|
19
|
+
description: "No layer violations — dependencies point downward only. Handlers never import from infrastructure."
|
|
20
|
+
severity: critical
|
|
21
|
+
- id: coupling-concerns
|
|
22
|
+
description: "Modules communicate through interfaces, not concrete implementations."
|
|
23
|
+
severity: important
|
|
24
|
+
- id: data-flow
|
|
25
|
+
description: "Data flow patterns are clear and documented. No hidden side channels."
|
|
26
|
+
severity: important
|
|
27
|
+
- id: single-point-of-failure
|
|
28
|
+
description: "No single points of failure in critical paths. External calls have timeouts and fallbacks."
|
|
29
|
+
severity: important
|
|
30
|
+
- id: security-boundaries
|
|
31
|
+
description: "Auth, data access, and API boundaries are explicitly defined and enforced."
|
|
32
|
+
severity: critical
|
|
33
|
+
- id: hexagonal-ports
|
|
34
|
+
description: "Port interfaces (Repository, Gateway) defined in the domain layer, implemented by adapters. Adapters are swappable."
|
|
35
|
+
severity: important
|
|
36
|
+
- id: dto-boundaries
|
|
37
|
+
description: "DTOs used at layer boundaries. Domain entities never leaked to API responses or persisted directly."
|
|
38
|
+
severity: important
|
|
39
|
+
- id: bounded-contexts
|
|
40
|
+
description: "If multiple domains exist, each has its own bounded context with separate models. No shared DB tables across contexts."
|
|
41
|
+
severity: important
|
|
42
|
+
- id: domain-events-decoupling
|
|
43
|
+
description: "Cross-module communication uses domain events or defined interfaces — no direct imports between unrelated modules."
|
|
44
|
+
severity: nice-to-have
|
|
45
|
+
|
|
46
|
+
- id: code-quality-review
|
|
47
|
+
tier: core
|
|
48
|
+
dimension: code-quality
|
|
49
|
+
title: "Code Quality Review"
|
|
50
|
+
description: |
|
|
51
|
+
Evaluate code organization, DRY compliance, error handling, and technical debt.
|
|
52
|
+
Flag repetition aggressively. Call out missing edge cases explicitly.
|
|
53
|
+
checklist:
|
|
54
|
+
- id: module-structure
|
|
55
|
+
description: "Code is organized by feature, not by layer. Each module owns its models, service, and types."
|
|
56
|
+
severity: critical
|
|
57
|
+
- id: dry-violations
|
|
58
|
+
description: "No duplicated logic across modules. Shared utilities extracted to shared/."
|
|
59
|
+
severity: important
|
|
60
|
+
- id: error-handling-patterns
|
|
61
|
+
description: "Custom error hierarchy used consistently. No bare Error throws. Errors carry context (IDs, timestamps, operation)."
|
|
62
|
+
severity: critical
|
|
63
|
+
- id: missing-edge-cases
|
|
64
|
+
description: "Edge cases handled: empty inputs, null/undefined, boundary values, concurrent access."
|
|
65
|
+
severity: important
|
|
66
|
+
- id: technical-debt
|
|
67
|
+
description: "No TODO/FIXME without a tracked item. No commented-out code."
|
|
68
|
+
severity: important
|
|
69
|
+
- id: naming-quality
|
|
70
|
+
description: "All names are intention-revealing. No abbreviations except universally understood ones (id, url, http)."
|
|
71
|
+
severity: nice-to-have
|
|
72
|
+
- id: over-under-engineering
|
|
73
|
+
description: "Code is 'engineered enough' — no premature abstractions, no fragile shortcuts."
|
|
74
|
+
severity: important
|
|
75
|
+
- id: cqs-compliance
|
|
76
|
+
description: "Functions either change state (command) or return data (query), not both. Exceptions are documented."
|
|
77
|
+
severity: important
|
|
78
|
+
- id: guard-clauses
|
|
79
|
+
description: "No deep nesting. Invalid cases handled first with early returns. Happy path runs at shallowest indentation."
|
|
80
|
+
severity: important
|
|
81
|
+
- id: composition-over-inheritance
|
|
82
|
+
description: "Prefer composition via interfaces and delegation. Class inheritance used only for genuine is-a relationships."
|
|
83
|
+
severity: important
|
|
84
|
+
- id: law-of-demeter
|
|
85
|
+
description: "No long method chains through objects (a.b().c().d()). Objects expose only the information their callers need."
|
|
86
|
+
severity: nice-to-have
|
|
87
|
+
- id: immutability
|
|
88
|
+
description: "const over let, readonly on properties. Mutable state restricted to smallest possible scope."
|
|
89
|
+
severity: important
|
|
90
|
+
- id: pure-functions
|
|
91
|
+
description: "Domain logic, validation, and transformations are pure (same input → same output, no side effects). Side effects pushed to adapters."
|
|
92
|
+
severity: important
|
|
93
|
+
- id: primitive-obsession
|
|
94
|
+
description: "Domain concepts wrapped in typed Value Objects (EmailAddress, Money) instead of raw strings/numbers."
|
|
95
|
+
severity: nice-to-have
|
|
96
|
+
|
|
97
|
+
- id: test-review
|
|
98
|
+
tier: recommended
|
|
99
|
+
dimension: tests
|
|
100
|
+
title: "Test Review"
|
|
101
|
+
description: |
|
|
102
|
+
Evaluate test coverage, assertion quality, and edge case thoroughness.
|
|
103
|
+
Well-tested code is non-negotiable. Rather too many tests than too few.
|
|
104
|
+
checklist:
|
|
105
|
+
- id: coverage-gaps
|
|
106
|
+
description: "Minimum 80% line coverage overall. 90% on new/changed code. 95% on critical paths."
|
|
107
|
+
severity: critical
|
|
108
|
+
- id: test-pyramid
|
|
109
|
+
description: "Test distribution follows pyramid: 60-75% unit, 20-30% integration, 5-10% E2E."
|
|
110
|
+
severity: important
|
|
111
|
+
- id: assertion-strength
|
|
112
|
+
description: "Assertions are specific and meaningful. No assert(true), no empty catch blocks, no tests that can't fail."
|
|
113
|
+
severity: critical
|
|
114
|
+
- id: edge-case-coverage
|
|
115
|
+
description: "Tests cover edge cases: empty collections, boundary values, error paths, concurrent scenarios."
|
|
116
|
+
severity: important
|
|
117
|
+
- id: test-naming
|
|
118
|
+
description: "Every test name is a specification: 'rejects_unknown_tag' not 'test_validation'."
|
|
119
|
+
severity: nice-to-have
|
|
120
|
+
- id: failure-modes
|
|
121
|
+
description: "Failure modes and error paths are tested, not just happy paths."
|
|
122
|
+
severity: critical
|
|
123
|
+
- id: test-isolation
|
|
124
|
+
description: "Tests are independent — no shared mutable state, no order dependencies. Each test sets up its own data."
|
|
125
|
+
severity: important
|
|
126
|
+
- id: test-data-builders
|
|
127
|
+
description: "Test data constructed via factories/builders, not copy-pasted literals. Shared fixtures for common objects."
|
|
128
|
+
severity: nice-to-have
|
|
129
|
+
|
|
130
|
+
- id: performance-review
|
|
131
|
+
tier: recommended
|
|
132
|
+
dimension: performance
|
|
133
|
+
title: "Performance Review"
|
|
134
|
+
description: |
|
|
135
|
+
Evaluate query patterns, memory usage, caching opportunities, and algorithmic complexity.
|
|
136
|
+
Focus on measurable bottlenecks, not micro-optimizations.
|
|
137
|
+
checklist:
|
|
138
|
+
- id: n-plus-one
|
|
139
|
+
description: "No N+1 query or I/O patterns. Batch operations where possible."
|
|
140
|
+
severity: critical
|
|
141
|
+
- id: memory-usage
|
|
142
|
+
description: "No unbounded collections or memory leaks. Large data sets streamed, not loaded in full."
|
|
143
|
+
severity: important
|
|
144
|
+
- id: caching
|
|
145
|
+
description: "Repeated expensive operations have caching. Cache invalidation strategy documented."
|
|
146
|
+
severity: nice-to-have
|
|
147
|
+
- id: algorithmic-complexity
|
|
148
|
+
description: "No O(n²) or worse algorithms on unbounded data. Complexity documented for non-obvious paths."
|
|
149
|
+
severity: important
|
|
150
|
+
- id: startup-time
|
|
151
|
+
description: "Application startup is fast. Heavy initialization is lazy or async."
|
|
152
|
+
severity: nice-to-have
|
|
153
|
+
- id: graceful-shutdown
|
|
154
|
+
description: "Application handles SIGTERM/SIGINT gracefully: drains connections, finishes in-flight work, then exits."
|
|
155
|
+
severity: important
|
|
156
|
+
- id: ci-pipeline
|
|
157
|
+
description: "CI pipeline runs lint, type-check, tests, and build on every push. Failures block merge."
|
|
158
|
+
severity: critical
|
|
159
|
+
- id: deployment-automation
|
|
160
|
+
description: "Deploy is one command or one button. No multi-step manual runbooks. Rollback is equally simple."
|
|
161
|
+
severity: important
|
|
162
|
+
- id: environment-parity
|
|
163
|
+
description: "Staging mirrors production: same provider, same DB engine, same services. No 'works on staging' surprises."
|
|
164
|
+
severity: important
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
tag: UNIVERSAL
|
|
2
|
+
section: structure
|
|
3
|
+
language: both
|
|
4
|
+
entries:
|
|
5
|
+
- path: CLAUDE.md
|
|
6
|
+
type: file
|
|
7
|
+
description: "CC persistent instruction set"
|
|
8
|
+
- path: Status.md
|
|
9
|
+
type: file
|
|
10
|
+
description: "Session bridge — updated every session"
|
|
11
|
+
- path: .env.example
|
|
12
|
+
type: file
|
|
13
|
+
description: "All required env vars documented"
|
|
14
|
+
- path: .claude/hooks
|
|
15
|
+
type: directory
|
|
16
|
+
description: "Git quality gate scripts"
|
|
17
|
+
- path: docs
|
|
18
|
+
type: directory
|
|
19
|
+
description: "PRD, Tech Spec, ADRs"
|
|
20
|
+
- path: docs/PRD.md
|
|
21
|
+
type: file
|
|
22
|
+
description: "Product requirements document"
|
|
23
|
+
- path: docs/TechSpec.md
|
|
24
|
+
type: file
|
|
25
|
+
description: "Technical specification"
|
|
26
|
+
- path: docs/adr
|
|
27
|
+
type: directory
|
|
28
|
+
description: "Architecture Decision Records"
|
|
29
|
+
- path: scripts
|
|
30
|
+
type: directory
|
|
31
|
+
description: "Project utility scripts"
|
|
32
|
+
- path: src
|
|
33
|
+
type: directory
|
|
34
|
+
description: "Application source code"
|
|
35
|
+
- path: src/shared/config
|
|
36
|
+
type: directory
|
|
37
|
+
description: "Env validation, fail-fast on startup"
|
|
38
|
+
- path: src/shared/exceptions
|
|
39
|
+
type: directory
|
|
40
|
+
description: "Base exception hierarchy"
|
|
41
|
+
- path: src/shared/logging
|
|
42
|
+
type: directory
|
|
43
|
+
description: "Structured logging setup"
|
|
44
|
+
- path: tests
|
|
45
|
+
type: directory
|
|
46
|
+
description: "Test suites"
|
|
47
|
+
- path: tests/unit
|
|
48
|
+
type: directory
|
|
49
|
+
description: "Unit tests"
|
|
50
|
+
- path: tests/integration
|
|
51
|
+
type: directory
|
|
52
|
+
description: "Integration tests"
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
tag: WEB-REACT
|
|
2
|
+
section: claude-md
|
|
3
|
+
blocks:
|
|
4
|
+
- id: react-component-architecture
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "React Component Architecture"
|
|
7
|
+
content: |
|
|
8
|
+
## React & Frontend Standards
|
|
9
|
+
|
|
10
|
+
### Component Architecture
|
|
11
|
+
- Atomic Design: atoms → molecules → organisms → templates → pages.
|
|
12
|
+
- Components are pure UI. No API calls, no business logic, no direct state management.
|
|
13
|
+
- Container/Presenter split: containers fetch data, presenters render UI.
|
|
14
|
+
- All components must have TypeScript props interfaces. No `any` types.
|
|
15
|
+
- No inline styles. Use CSS modules, Tailwind, or styled-components consistently.
|
|
16
|
+
|
|
17
|
+
- id: react-state-management
|
|
18
|
+
tier: recommended
|
|
19
|
+
title: "State Management"
|
|
20
|
+
content: |
|
|
21
|
+
### State Management
|
|
22
|
+
- Local state (useState) for UI-only state (open/closed, hover, form inputs).
|
|
23
|
+
- Shared state via context or state library ONLY when 3+ components need the same data.
|
|
24
|
+
- Server state via React Query / TanStack Query / SWR — NEVER manually cache API responses.
|
|
25
|
+
- No prop drilling beyond 2 levels. Use composition (children) or context.
|
|
26
|
+
|
|
27
|
+
- id: react-i18n
|
|
28
|
+
tier: recommended
|
|
29
|
+
title: "Internationalization (i18n)"
|
|
30
|
+
content: |
|
|
31
|
+
### Internationalization — From Day One
|
|
32
|
+
- EVERY user-facing string goes through the i18n system. No hardcoded display text.
|
|
33
|
+
- Use react-i18next or next-intl.
|
|
34
|
+
- Translation keys namespaced by feature: `members.table.header.name`.
|
|
35
|
+
- Date, number, currency formatting via Intl API — never manual formatting.
|
|
36
|
+
|
|
37
|
+
- id: react-forms
|
|
38
|
+
tier: recommended
|
|
39
|
+
title: "Forms"
|
|
40
|
+
content: |
|
|
41
|
+
### Forms
|
|
42
|
+
- Use a form library (React Hook Form or Formik). No manual onChange handlers per field.
|
|
43
|
+
- Validation schema defined separately (Zod, Yup) and shared with backend if possible.
|
|
44
|
+
- All forms must handle: loading state, validation errors, submission errors, success feedback.
|
|
45
|
+
|
|
46
|
+
- id: react-api-integration
|
|
47
|
+
tier: recommended
|
|
48
|
+
title: "API Integration"
|
|
49
|
+
content: |
|
|
50
|
+
### API Integration
|
|
51
|
+
- All API calls go through a centralized API client module.
|
|
52
|
+
- API client handles: auth headers, base URL from config, error transformation, retry logic.
|
|
53
|
+
- Use React Query for all server state.
|
|
54
|
+
|
|
55
|
+
- id: react-accessibility
|
|
56
|
+
tier: recommended
|
|
57
|
+
title: "Accessibility (a11y)"
|
|
58
|
+
content: |
|
|
59
|
+
### Accessibility (a11y) — Non-Negotiable
|
|
60
|
+
- Semantic HTML elements (nav, main, section, article, button — not div for everything).
|
|
61
|
+
- All interactive elements keyboard-accessible. All images have alt text.
|
|
62
|
+
- ARIA labels on non-obvious interactive elements.
|
|
63
|
+
- Color contrast minimum AA (4.5:1 for text).
|
|
64
|
+
|
|
65
|
+
- id: react-error-boundaries
|
|
66
|
+
tier: recommended
|
|
67
|
+
title: "Error Handling & Suspense"
|
|
68
|
+
content: |
|
|
69
|
+
### Error Boundaries
|
|
70
|
+
- Wrap feature areas in Error Boundaries — a crash in one widget must not take down the page.
|
|
71
|
+
- Error boundaries display user-friendly fallback UI with retry action.
|
|
72
|
+
- Log caught errors to monitoring service (Sentry, DataDog, etc.).
|
|
73
|
+
- Never catch errors silently — always report and show feedback.
|
|
74
|
+
|
|
75
|
+
### Suspense & Loading States
|
|
76
|
+
- Use React Suspense for code-split components and async data.
|
|
77
|
+
- Every async operation has three states: loading, success, error. No blank screens.
|
|
78
|
+
- Skeleton loaders preferred over spinners for layout stability (reduces CLS).
|
|
79
|
+
- Optimistic updates for user-driven mutations (like/unlike, form submit).
|
|
80
|
+
|
|
81
|
+
- id: react-deployment
|
|
82
|
+
tier: recommended
|
|
83
|
+
title: "React Deployment & Hosting"
|
|
84
|
+
content: |
|
|
85
|
+
## Frontend Deployment
|
|
86
|
+
|
|
87
|
+
### Platform Selection
|
|
88
|
+
- **Vercel**: First choice for Next.js. Zero-config deploys, edge functions, image optimization built in.
|
|
89
|
+
ISR / on-demand revalidation works natively. Preview deployments on every PR.
|
|
90
|
+
- **Netlify**: Great for static + serverless. Form handling, edge functions, split testing built in.
|
|
91
|
+
Works well with Gatsby, Astro, plain React (via adapter).
|
|
92
|
+
- **Cloudflare Pages**: Unlimited bandwidth, global edge. Best for static or Pages Functions.
|
|
93
|
+
- **AWS Amplify / S3+CloudFront**: Full control, lower cost at scale. More ops overhead.
|
|
94
|
+
- Self-hosted Docker: only when platform restrictions require it.
|
|
95
|
+
|
|
96
|
+
### Build & Deploy
|
|
97
|
+
- CI builds produce a static bundle (`dist/` or `.next/`). Same bundle deploys to staging then prod.
|
|
98
|
+
- Preview deployments for every PR — URL posted in PR comments for stakeholder review.
|
|
99
|
+
- Environment variables injected at build time (`NEXT_PUBLIC_*`, `VITE_*`). No secrets in client bundles.
|
|
100
|
+
- Build cache enabled (Turborepo, Nx, or platform-native). Target < 2 min builds.
|
|
101
|
+
|
|
102
|
+
### Performance Budgets
|
|
103
|
+
- JavaScript budget: < {{js_budget_kb | default: 200}} KB compressed for initial load.
|
|
104
|
+
- Lighthouse CI in pipeline. Fail build if performance score drops below {{lighthouse_min | default: 90}}.
|
|
105
|
+
- Monitor Core Web Vitals in production (Vercel Analytics, web-vitals library, or RUM).
|
|
106
|
+
|
|
107
|
+
### Edge & CDN
|
|
108
|
+
- Static assets served from CDN with immutable cache headers (content-hashed filenames).
|
|
109
|
+
- HTML entry point: short cache (5 min) or stale-while-revalidate.
|
|
110
|
+
- Use edge middleware for: redirects, A/B testing, geo-routing, auth checks (avoid full round-trip).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
tag: WEB-REACT
|
|
2
|
+
section: hooks
|
|
3
|
+
hooks:
|
|
4
|
+
- name: i18n-enforcement
|
|
5
|
+
trigger: pre-commit
|
|
6
|
+
description: "Scan JSX/TSX for hardcoded user-facing strings not wrapped in t()"
|
|
7
|
+
filename: pre-commit-i18n.sh
|
|
8
|
+
script: |
|
|
9
|
+
#!/bin/bash
|
|
10
|
+
STAGED=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(tsx|jsx)$')
|
|
11
|
+
if [ -z "$STAGED" ]; then exit 0; fi
|
|
12
|
+
VIOLATIONS=0
|
|
13
|
+
for file in $STAGED; do
|
|
14
|
+
# Find string literals in JSX that aren't in t() calls, className, data-testid, etc.
|
|
15
|
+
if grep -nE '>\s*[A-Z][a-z]+(\s+[a-z]+)+\s*<' "$file" | grep -vE '(className|data-testid|aria-|console\.)' > /tmp/i18n_violations 2>/dev/null; then
|
|
16
|
+
if [ -s /tmp/i18n_violations ]; then
|
|
17
|
+
echo " ⚠️ $file — possible untranslated string:"
|
|
18
|
+
cat /tmp/i18n_violations | head -3
|
|
19
|
+
VIOLATIONS=$((VIOLATIONS + 1))
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
done
|
|
23
|
+
rm -f /tmp/i18n_violations
|
|
24
|
+
if [ $VIOLATIONS -gt 0 ]; then
|
|
25
|
+
echo "⚠️ $VIOLATIONS file(s) may have untranslated strings. Use t() wrapper."
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
- name: a11y-lint
|
|
29
|
+
trigger: pre-commit
|
|
30
|
+
description: "Run accessibility checks on staged JSX/TSX files"
|
|
31
|
+
filename: pre-commit-a11y.sh
|
|
32
|
+
script: |
|
|
33
|
+
#!/bin/bash
|
|
34
|
+
STAGED=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(tsx|jsx)$')
|
|
35
|
+
if [ -z "$STAGED" ]; then exit 0; fi
|
|
36
|
+
# Check for div used as button without role
|
|
37
|
+
for file in $STAGED; do
|
|
38
|
+
if grep -nE '<div\s+onClick' "$file" | grep -v 'role=' > /tmp/a11y_violations 2>/dev/null; then
|
|
39
|
+
if [ -s /tmp/a11y_violations ]; then
|
|
40
|
+
echo " ⚠️ $file — clickable div without role attribute. Use <button> or add role=\"button\""
|
|
41
|
+
fi
|
|
42
|
+
fi
|
|
43
|
+
done
|
|
44
|
+
rm -f /tmp/a11y_violations
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
tag: WEB-REACT
|
|
2
|
+
section: nfr
|
|
3
|
+
blocks:
|
|
4
|
+
- id: frontend-performance
|
|
5
|
+
tier: recommended
|
|
6
|
+
title: "Frontend Performance"
|
|
7
|
+
content: |
|
|
8
|
+
## NFR: Frontend Performance
|
|
9
|
+
|
|
10
|
+
### Core Web Vitals Targets
|
|
11
|
+
- LCP (Largest Contentful Paint): < 2.5s
|
|
12
|
+
- FID (First Input Delay): < 100ms
|
|
13
|
+
- CLS (Cumulative Layout Shift): < 0.1
|
|
14
|
+
|
|
15
|
+
### Bundle
|
|
16
|
+
- Code splitting by route. No single bundle > 200KB gzipped.
|
|
17
|
+
- Tree shaking enabled. No unused exports.
|
|
18
|
+
- Bundle size tracked in CI — PRs that increase bundle > 10KB require justification.
|
|
19
|
+
|
|
20
|
+
### Runtime
|
|
21
|
+
- Virtual/windowed lists for collections > 50 items.
|
|
22
|
+
- Debounce search inputs (300ms minimum).
|
|
23
|
+
|
|
24
|
+
### Assets
|
|
25
|
+
- Images in modern formats (WebP/AVIF with fallback).
|
|
26
|
+
- Responsive images with srcset.
|
|
27
|
+
- Fonts preloaded, display:swap.
|