forgecraft-mcp 1.2.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +525 -525
  2. package/dist/cli/help.js +44 -44
  3. package/dist/registry/renderer-skeletons.js +92 -92
  4. package/dist/shared/gs-score-logger.js +6 -6
  5. package/dist/tools/add-module.js +123 -123
  6. package/dist/tools/advice-registry.js +18 -18
  7. package/dist/tools/check-cascade-report.js +64 -64
  8. package/dist/tools/configure-mcp.d.ts +3 -0
  9. package/dist/tools/configure-mcp.d.ts.map +1 -1
  10. package/dist/tools/configure-mcp.js +10 -0
  11. package/dist/tools/configure-mcp.js.map +1 -1
  12. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  13. package/dist/tools/forgecraft-dispatch.js +3 -0
  14. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  15. package/dist/tools/forgecraft-schema-params.d.ts +9 -0
  16. package/dist/tools/forgecraft-schema-params.d.ts.map +1 -1
  17. package/dist/tools/forgecraft-schema-params.js +21 -0
  18. package/dist/tools/forgecraft-schema-params.js.map +1 -1
  19. package/dist/tools/forgecraft-schema.d.ts +9 -0
  20. package/dist/tools/forgecraft-schema.d.ts.map +1 -1
  21. package/dist/tools/refresh-output.js +14 -14
  22. package/dist/tools/scaffold-spec-stubs.js +115 -115
  23. package/dist/tools/scaffold-templates.js +62 -62
  24. package/dist/tools/setup-artifact-writers.d.ts +30 -0
  25. package/dist/tools/setup-artifact-writers.d.ts.map +1 -1
  26. package/dist/tools/setup-artifact-writers.js +120 -8
  27. package/dist/tools/setup-artifact-writers.js.map +1 -1
  28. package/dist/tools/setup-phase1.d.ts +3 -0
  29. package/dist/tools/setup-phase1.d.ts.map +1 -1
  30. package/dist/tools/setup-phase1.js +79 -35
  31. package/dist/tools/setup-phase1.js.map +1 -1
  32. package/dist/tools/setup-phase2.d.ts +2 -0
  33. package/dist/tools/setup-phase2.d.ts.map +1 -1
  34. package/dist/tools/setup-phase2.js +10 -1
  35. package/dist/tools/setup-phase2.js.map +1 -1
  36. package/dist/tools/setup-project.d.ts +18 -0
  37. package/dist/tools/setup-project.d.ts.map +1 -1
  38. package/dist/tools/setup-project.js +77 -1
  39. package/dist/tools/setup-project.js.map +1 -1
  40. package/dist/tools/spec-parser-tags.d.ts +9 -0
  41. package/dist/tools/spec-parser-tags.d.ts.map +1 -1
  42. package/dist/tools/spec-parser-tags.js +92 -0
  43. package/dist/tools/spec-parser-tags.js.map +1 -1
  44. package/package.json +89 -86
  45. package/templates/analytics/instructions.yaml +37 -37
  46. package/templates/analytics/mcp-servers.yaml +11 -11
  47. package/templates/analytics/structure.yaml +25 -25
  48. package/templates/api/instructions.yaml +231 -231
  49. package/templates/api/mcp-servers.yaml +22 -13
  50. package/templates/api/nfr.yaml +23 -23
  51. package/templates/api/review.yaml +103 -103
  52. package/templates/api/structure.yaml +34 -34
  53. package/templates/api/verification.yaml +132 -132
  54. package/templates/cli/instructions.yaml +31 -31
  55. package/templates/cli/mcp-servers.yaml +11 -11
  56. package/templates/cli/review.yaml +53 -53
  57. package/templates/cli/structure.yaml +16 -16
  58. package/templates/data-lineage/instructions.yaml +28 -28
  59. package/templates/data-lineage/mcp-servers.yaml +22 -22
  60. package/templates/data-pipeline/instructions.yaml +84 -84
  61. package/templates/data-pipeline/mcp-servers.yaml +13 -13
  62. package/templates/data-pipeline/nfr.yaml +39 -39
  63. package/templates/data-pipeline/structure.yaml +23 -23
  64. package/templates/fintech/hooks.yaml +55 -55
  65. package/templates/fintech/instructions.yaml +112 -112
  66. package/templates/fintech/mcp-servers.yaml +13 -13
  67. package/templates/fintech/nfr.yaml +46 -46
  68. package/templates/fintech/playbook.yaml +210 -210
  69. package/templates/fintech/verification.yaml +239 -239
  70. package/templates/game/instructions.yaml +289 -289
  71. package/templates/game/mcp-servers.yaml +38 -38
  72. package/templates/game/nfr.yaml +64 -64
  73. package/templates/game/playbook.yaml +214 -214
  74. package/templates/game/review.yaml +97 -97
  75. package/templates/game/structure.yaml +67 -67
  76. package/templates/game/verification.yaml +174 -174
  77. package/templates/healthcare/instructions.yaml +42 -42
  78. package/templates/healthcare/mcp-servers.yaml +13 -13
  79. package/templates/healthcare/nfr.yaml +47 -47
  80. package/templates/hipaa/instructions.yaml +41 -41
  81. package/templates/hipaa/mcp-servers.yaml +13 -13
  82. package/templates/infra/instructions.yaml +104 -104
  83. package/templates/infra/mcp-servers.yaml +20 -20
  84. package/templates/infra/nfr.yaml +46 -46
  85. package/templates/infra/review.yaml +65 -65
  86. package/templates/infra/structure.yaml +25 -25
  87. package/templates/library/instructions.yaml +36 -36
  88. package/templates/library/mcp-servers.yaml +20 -20
  89. package/templates/library/review.yaml +56 -56
  90. package/templates/library/structure.yaml +19 -19
  91. package/templates/medallion-architecture/instructions.yaml +41 -41
  92. package/templates/medallion-architecture/mcp-servers.yaml +22 -22
  93. package/templates/ml/instructions.yaml +85 -85
  94. package/templates/ml/mcp-servers.yaml +11 -11
  95. package/templates/ml/nfr.yaml +39 -39
  96. package/templates/ml/structure.yaml +25 -25
  97. package/templates/ml/verification.yaml +156 -156
  98. package/templates/mobile/instructions.yaml +44 -44
  99. package/templates/mobile/mcp-servers.yaml +11 -11
  100. package/templates/mobile/nfr.yaml +49 -49
  101. package/templates/mobile/structure.yaml +27 -27
  102. package/templates/mobile/verification.yaml +121 -121
  103. package/templates/observability-xray/instructions.yaml +40 -40
  104. package/templates/observability-xray/mcp-servers.yaml +15 -15
  105. package/templates/realtime/instructions.yaml +42 -42
  106. package/templates/realtime/mcp-servers.yaml +13 -13
  107. package/templates/soc2/instructions.yaml +41 -41
  108. package/templates/soc2/mcp-servers.yaml +24 -24
  109. package/templates/social/instructions.yaml +43 -43
  110. package/templates/social/mcp-servers.yaml +24 -24
  111. package/templates/state-machine/instructions.yaml +42 -42
  112. package/templates/state-machine/mcp-servers.yaml +11 -11
  113. package/templates/tools-registry.yaml +164 -164
  114. package/templates/universal/hooks.yaml +531 -531
  115. package/templates/universal/instructions.yaml +1692 -1692
  116. package/templates/universal/mcp-servers.yaml +50 -50
  117. package/templates/universal/nfr.yaml +197 -197
  118. package/templates/universal/reference.yaml +326 -326
  119. package/templates/universal/review.yaml +204 -204
  120. package/templates/universal/skills.yaml +262 -262
  121. package/templates/universal/structure.yaml +67 -67
  122. package/templates/universal/verification.yaml +416 -416
  123. package/templates/web-react/hooks.yaml +44 -44
  124. package/templates/web-react/instructions.yaml +207 -207
  125. package/templates/web-react/mcp-servers.yaml +20 -20
  126. package/templates/web-react/nfr.yaml +27 -27
  127. package/templates/web-react/review.yaml +94 -94
  128. package/templates/web-react/structure.yaml +46 -46
  129. package/templates/web-react/verification.yaml +126 -126
  130. package/templates/web-static/instructions.yaml +115 -115
  131. package/templates/web-static/mcp-servers.yaml +20 -20
  132. package/templates/web3/instructions.yaml +44 -44
  133. package/templates/web3/mcp-servers.yaml +11 -11
  134. package/templates/web3/verification.yaml +159 -159
  135. package/templates/zero-trust/instructions.yaml +41 -41
  136. package/templates/zero-trust/mcp-servers.yaml +15 -15
package/README.md CHANGED
@@ -1,525 +1,525 @@
1
- <p align="center">
2
- <h1 align="center">ForgeCraft</h1>
3
- <p align="center">
4
- <strong>The quality contract your AI coding assistant works within.</strong>
5
- </p>
6
- <p align="center">
7
- <a href="https://www.npmjs.com/package/forgecraft-mcp"><img src="https://img.shields.io/npm/v/forgecraft-mcp.svg" alt="npm version"></a>
8
- <a href="https://github.com/jghiringhelli/forgecraft-mcp/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/forgecraft-mcp.svg" alt="license"></a>
9
- <a href="https://www.npmjs.com/package/forgecraft-mcp"><img src="https://img.shields.io/npm/dm/forgecraft-mcp.svg" alt="downloads"></a>
10
- </p>
11
- </p>
12
-
13
- ---
14
-
15
- > You hired an AI engineer. It's brilliant. It also installed the same 14 VS Code extensions twice today, spun up 6 Docker containers it will never clean up, and your disk went from 12 GB free to 0 KB in one session.
16
- >
17
- > A full disk doesn't fail gracefully. It kills VS Code, the terminal, Docker, and the database simultaneously.
18
-
19
- ForgeCraft is the quality contract your AI coding assistant works within — so it builds fast **and** doesn't burn down the house.
20
-
21
- ```bash
22
- npx forgecraft-mcp setup .
23
- ```
24
-
25
- **Supports:** Claude (CLAUDE.md) · Cursor (.cursor/rules/) · GitHub Copilot (.github/copilot-instructions.md) · Windsurf (.windsurfrules) · Cline (.clinerules) · Aider (CONVENTIONS.md)
26
-
27
- ---
28
-
29
- ## A quality framework for AI-assisted software development
30
-
31
- Every session, every project, every AI assistant — measured against the same 7-property **Generative Specification** model. Not vibes. Not a linter score. A score out of 14 that tells you exactly where the gap is and why.
32
-
33
- ```
34
- $ npx forgecraft-mcp verify .
35
-
36
- | Property | Score | Evidence |
37
- |-----------------|-------|-------------------------------------------------|
38
- | Self-Describing | ✅ 2/2 | CLAUDE.md — 352 non-empty lines |
39
- | Bounded | ✅ 2/2 | No direct DB calls in route files |
40
- | Verifiable | ✅ 2/2 | 64 test files — 87% coverage |
41
- | Defended | ✅ 2/2 | Pre-commit hook + lint config present |
42
- | Auditable | ✅ 2/2 | 11 ADRs in docs/adrs/ + Status.md |
43
- | Composable | ✅ 2/2 | Service layer + repository layer detected |
44
- | Executable | ✅ 2/2 | Tests passed + CI pipeline configured |
45
-
46
- Total: 14/14 ✅ PASS · Threshold 11/14
47
- ```
48
-
49
- | Property | What it checks |
50
- |---|---|
51
- | **Self-Describing** | Does the codebase explain itself without you? |
52
- | **Bounded** | Is business logic leaking into your routes? |
53
- | **Verifiable** | Are there tests, and did they pass in a real runtime? |
54
- | **Defended** | Are hooks blocking bad commits before they land? |
55
- | **Auditable** | Is every architectural decision recorded and findable? |
56
- | **Composable** | Can you swap the database without touching the domain? |
57
- | **Executable** | Is there CI evidence this thing actually ran? |
58
-
59
- ---
60
-
61
- ## Dev environment hygiene — enforced by convention
62
-
63
- ForgeCraft injects enforceable rules into every project's AI instructions that make environment pollution a convention violation, not an incident.
64
-
65
- **VS Code extensions**
66
- Before installing: `code --list-extensions | grep -i <name>`. Only install if no version in the required major range is already present. The same extension doesn't get downloaded twice in the same day.
67
-
68
- **Docker containers**
69
- Check before creating: `docker ps -a --filter name=<service>`. If it exists, start it — don't create it. Prefer `docker compose up` (reuse) over bare `docker run` (always creates new). Logs capped at 500 MB. `docker system prune -f` is documented as a periodic maintenance step, not an emergency.
70
-
71
- > **Exception:** Multiple containers of the same service are permitted when they differ meaningfully in plugin set or major version — for example, a `postgres-pgvector` container alongside a standard `postgres` container. Name containers to reflect the variant (e.g., `db-pgvector`, `db-timescale`); otherwise the deduplication rule applies.
72
-
73
- **Python virtual environments**
74
- One `.venv` per project root. Reuse if the Python major.minor version matches. Never create a venv in a subdirectory unless it's a standalone installable package. Unused dependencies flagged by `pip list --not-required`.
75
-
76
- **Synthetic and time-series data**
77
- Before writing more than 100 MB of generated data, the AI asks: retain raw, condense statistically, or delete after the run? Synthetic datasets older than 7 days with no code reference: ask to delete.
78
-
79
- **General**
80
- If the workspace grows beyond 2 GB outside of known build artifacts (`node_modules/`, `.venv/`, `dist/`), surface a warning and stop. Never silently grow the workspace.
81
-
82
- ---
83
-
84
- ## Project setup in one sentence
85
-
86
- ```
87
- Read the spec in docs/specs/, set up this project with ForgeCraft,
88
- scaffold it with the right tags, recommend the tech stack, start building.
89
- ```
90
-
91
- That's the entire onboarding prompt. ForgeCraft reads the spec, the AI assigns the tags, and ForgeCraft writes the instruction file, emits `Status.md`, `docs/adrs/`, `docs/PRD.md`, `docs/TechSpec.md`, hooks, and skills. The AI has full context. You start building.
92
-
93
- ForgeCraft scans your project, auto-detects your stack, and generates tailored instruction files from 116 curated blocks — SOLID, hexagonal architecture, testing pyramids, CI/CD, and 24 domain-specific rule sets — in seconds.
94
-
95
- ---
96
-
97
- ## Quality gates
98
-
99
- Quality gates are structured pass/fail checks your AI assistant runs at defined moments — before a commit, before a release, after a deployment. They're not linter rules. Each gate has a condition, an evidence requirement, and a flag for whether human review is mandatory.
100
-
101
- Gates are organized by release phase so you're not running pre-release chaos tests on day one of a greenfield project:
102
-
103
- | Phase | Example gates |
104
- |---|---|
105
- | **development** | Unit tests pass · lint clean · no layer violations · no hardcoded secrets |
106
- | **pre-release hardening** | Mutation testing ≥80% · DAST scan · 2× peak load · chaos (Toxiproxy) |
107
- | **release candidate** | OWASP Top 10 pentest · full mutation audit · compatibility matrix · accessibility |
108
- | **deployment** | Canary config verified · smoke tests pass · observability confirmed |
109
- | **post-deployment** | Synthetic probes live · 30-min error window monitored · incident runbook reviewed |
110
-
111
- Gates tagged `requires_human_review: true` cannot be auto-passed — some checks require a human.
112
-
113
- The full gate library, contribution guide, and schema are in the [quality gates repository →](https://github.com/jghiringhelli/genspec-dev-quality-gates)
114
-
115
- ---
116
-
117
- ## ADRs, automatically sequenced
118
-
119
- Every non-obvious architectural decision gets recorded. ForgeCraft auto-sequences `docs/adrs/NNNN-slug.md` in MADR format — context, decision, alternatives, consequences. Your AI assistant reasons about past choices. Your team stops re-litigating them.
120
-
121
- ```bash
122
- npx forgecraft-mcp generate_adr . --title "Use event sourcing for order history" \
123
- --status Accepted \
124
- --context "Order mutations need full audit trail for compliance" \
125
- --decision "Append-only event log, project current state on read"
126
- # → docs/adrs/0004-use-event-sourcing-for-order-history.md
127
- ```
128
-
129
- ---
130
-
131
- ## AI assistant setup vs ForgeCraft
132
-
133
- `claude init`, Cursor's workspace rules, or Copilot's instructions file get you started. ForgeCraft gets you to production standards — across every AI assistant, every session, every engineer on the team.
134
-
135
- | | Default AI setup | ForgeCraft |
136
- |---|---|---|
137
- | **Instruction file** | Generic, one-size-fits-all | 116 curated blocks matched to your stack |
138
- | **AI assistants** | Varies by tool | Claude, Cursor, Copilot, Windsurf, Cline, Aider |
139
- | **Architecture** | None | SOLID, hexagonal, clean code, DDD |
140
- | **Testing** | Basic mention | Testing pyramid, coverage targets, mutation gates |
141
- | **Domain rules** | None | 24 domains (fintech, healthcare, gaming…) |
142
- | **Quality score** | None | GS score out of 14 — know exactly where the gap is |
143
- | **Release phases** | None | 7 phases from development through post-deployment |
144
- | **Dev hygiene** | None | VS Code, Docker, Python venv, disk guard |
145
- | **ADRs** | None | Auto-sequenced, MADR format |
146
- | **Session continuity** | None | `Status.md` + `forgecraft.yaml` persist context |
147
- | **Drift detection** | None | `refresh` detects scope changes |
148
-
149
- ## Workflow Playbook
150
-
151
- After setup, your AI has the context. These prompts direct the work. Copy, paste, run.
152
-
153
- | Situation | Prompt |
154
- |---|---|
155
- | New project — scaffold structure | [Greenfield Setup](WORKFLOWS.md#greenfield-setup) |
156
- | Existing project — integrate ForgeCraft | [Brownfield Integration](WORKFLOWS.md#brownfield-integration) |
157
- | Audit shows `file_length` failures | [Decompose by responsibility](WORKFLOWS.md#file_length--file-too-large) |
158
- | Audit shows `hardcoded_url` failures | [Extract to env vars](WORKFLOWS.md#hardcoded_url--urls-or-hosts-in-source) |
159
- | Audit shows `hardcoded_credential` failures | [Remove secrets — do this first](WORKFLOWS.md#hardcoded_credential--secrets-in-source) |
160
- | Audit shows `layer_violation` failures | [Fix route → DB direct calls](WORKFLOWS.md#layer_violation--direct-db-call-in-route-handler) |
161
- | Audit shows `mock_in_source` failures | [Move mocks out of production](WORKFLOWS.md#mock_in_source--mock-data-in-production-code) |
162
- | Audit shows `missing_prd` failures | [Reverse-engineer spec docs](WORKFLOWS.md#missing_prd--missing_techspec--no-spec-docs) |
163
- | Audit shows `stale_status` failures | [Update Status.md](WORKFLOWS.md#stale_status--statusmd-not-updated) |
164
- | Score ≥ 80 and preparing to ship | [Pre-release hardening](WORKFLOWS.md#pre-release-hardening) |
165
- | Just deployed to production | [Post-deployment checklist](WORKFLOWS.md#post-deployment) |
166
- | Project scope changed | [Drift detection](WORKFLOWS.md#drift-detection) |
167
-
168
- → [Full Workflow Playbook](WORKFLOWS.md) · [Online version](https://forgecraft.tools/docs/workflows)
169
-
170
- ---
171
-
172
- ## How It Works
173
-
174
- ```bash
175
- # First-time setup — auto-detects your stack
176
- npx forgecraft-mcp setup .
177
- ```
178
-
179
- ```mermaid
180
- flowchart TD
181
- A["<b>setup .</b><br/>npx forgecraft-mcp setup ."] --> B["Phase 1 — Analyze<br/>Reads spec · infers tags"]
182
- B --> C{AI assistant\nin the loop?}
183
- C -->|"Yes (MCP)"| D["Phase 2 — Calibrate<br/>LLM corrects tags from spec<br/>Writes forgecraft.yaml · CLAUDE.md<br/>PRD.md · hooks · ADR-000"]
184
- C -->|"No (CLI only)"| E["⚠️ CLI-only mode<br/>Directory heuristics only<br/>→ configure an AI assistant"]
185
- D --> F["<b>check_cascade</b><br/>5-step readiness gate<br/>1 · Functional spec<br/>2 · Architecture + C4<br/>3 · Constitution<br/>4 · ADRs<br/>5 · Use cases"]
186
- F --> G{All 5 passing?}
187
- G -->|"Stubs / missing"| H["Fill artifacts<br/>docs/PRD.md · docs/adrs/<br/>docs/use-cases.md"]
188
- H --> F
189
- G -->|"✅ All pass"| I["<b>generate_session_prompt</b><br/>Bound context for next task"]
190
- I --> J["Implement with TDD<br/>RED → GREEN → REFACTOR<br/>+ Documentation Cascade"]
191
- J --> K["<b>audit_project</b><br/>Score 0 – 100"]
192
- K --> L{Score ≥ 90?}
193
- L -->|"Violations found"| M["WORKFLOWS.md remediation<br/>file_length · layer_violation<br/>hardcoded_url · missing_prd"]
194
- M --> J
195
- L -->|"✅ Score ≥ 90"| N["<b>close_cycle</b><br/>Re-check cascade · assess gates<br/>promote to registry · bump version"]
196
- N --> O{Roadmap\ncomplete?}
197
- O -->|"More features"| I
198
- O -->|"All done"| P["<b>start_hardening</b><br/>Mutation tests · OWASP · load test"]
199
- P --> Q["🚢 Ship"]
200
-
201
- style A fill:#1a2e1a,color:#90ee90,stroke:#3a6e3a
202
- style Q fill:#1a2a3e,color:#87ceeb,stroke:#3a5a8e
203
- style E fill:#2e1a1a,color:#ffaa88,stroke:#6e3a3a
204
- style M fill:#2e2a00,color:#ffd700,stroke:#6e6000
205
- ```
206
-
207
- ForgeCraft is a **setup-time CLI tool**. Run it once to configure your project, then remove it — it has no runtime footprint.
208
-
209
- Optionally add the MCP sentinel to let your AI assistant diagnose and recommend commands:
210
-
211
- ```bash
212
- claude mcp add forgecraft -- npx -y forgecraft-mcp
213
- ```
214
-
215
- The sentinel is a single tool (~200 tokens). It reads three artifacts — `forgecraft.yaml`, `CLAUDE.md`, `.claude/hooks` — derives the correct next CLI command, and returns it. Nothing more. This is the methodology's core principle expressed as tool design: a stateless reader, a finite artifact set, a derived action. [Remove it](#mcp-sentinel) after initial setup to reclaim token budget.
216
-
217
- ## What You Get
218
-
219
- After `npx forgecraft-mcp setup`, your project has:
220
-
221
- ```
222
- your-project/
223
- ├── forgecraft.yaml ← Your config (tags, tier, customizations)
224
- ├── CLAUDE.md ← Engineering standards (Claude)
225
- ├── .cursor/rules/ ← Engineering standards (Cursor)
226
- ├── .github/copilot-instructions.md ← Engineering standards (Copilot)
227
- ├── Status.md ← Session continuity tracker
228
- ├── .claude/hooks/ ← Pre-commit quality gates
229
- ├── docs/
230
- │ ├── PRD.md ← Requirements skeleton
231
- │ └── TechSpec.md ← Architecture + NFR sections
232
- └── src/shared/ ← Config, errors, logger starters
233
- ```
234
-
235
- ### The Instruction Files
236
-
237
- This is the core value. Assembled from curated blocks covering:
238
-
239
- - **SOLID principles** — concrete rules, not platitudes
240
- - **Hexagonal architecture** — ports, adapters, DTOs, layer boundaries
241
- - **Testing pyramid** — unit/integration/E2E targets, test doubles taxonomy
242
- - **Clean code** — CQS, guard clauses, immutability, pure functions
243
- - **CI/CD & deployment** — pipeline stages, environments, preview deploys
244
- - **Domain patterns** — DDD, CQRS, event sourcing (when your project needs it)
245
- - **12-Factor ops** — config, statelessness, disposability, logging
246
-
247
- Every block is sourced from established engineering literature (Martin, Evans, Wiggins) and adapted for AI-assisted development.
248
-
249
- ## 24 Tags — AI-detected, user-adjustable
250
-
251
- Tags tell ForgeCraft what your project is. On first setup, the AI analyzes your spec and codebase and assigns them. You can review and override in `forgecraft.yaml`. Blocks merge without conflicts — add or remove tags as the project evolves.
252
-
253
- The full tag list and contribution guide live in the [quality gates repository →](https://github.com/jghiringhelli/genspec-dev-quality-gates)
254
-
255
- | Tag | What it adds |
256
- |-----|-------------|
257
- | `UNIVERSAL` | SOLID, testing, commits, error handling *(always on)* |
258
- | `API` | REST/GraphQL contracts, auth, rate limiting, versioning |
259
- | `WEB-REACT` | Component arch, state management, a11y, perf budgets |
260
- | `WEB-STATIC` | Build optimization, SEO, CDN, static deploy |
261
- | `CLI` | Arg parsing, output formatting, exit codes |
262
- | `LIBRARY` | API design, semver, backwards compatibility |
263
- | `INFRA` | Terraform/CDK, Kubernetes, secrets management |
264
- | `DATA-PIPELINE` | ETL, idempotency, checkpointing, schema evolution |
265
- | `ML` | Experiment tracking, model versioning, reproducibility |
266
- | `FINTECH` | Double-entry accounting, decimal precision, compliance |
267
- | `HEALTHCARE` | HIPAA, PHI handling, audit logs, encryption |
268
- | `MOBILE` | React Native/Flutter, offline-first, native APIs |
269
- | `REALTIME` | WebSockets, presence, conflict resolution |
270
- | `GAME` | Game loop, ECS, Phaser 3, PixiJS, Three.js/WebGL, performance budgets |
271
- | `SOCIAL` | Feeds, connections, messaging, moderation |
272
- | `ANALYTICS` | Event tracking, dashboards, data warehousing |
273
- | `STATE-MACHINE` | Transitions, guards, event-driven workflows |
274
- | `WEB3` | Smart contracts, gas optimization, wallet security |
275
- | `HIPAA` | PII masking, encryption checks, audit logging |
276
- | `SOC2` | Access control, change management, incident response |
277
- | `DATA-LINEAGE` | 100% field coverage, lineage tracking decorators |
278
- | `OBSERVABILITY-XRAY` | Auto X-Ray instrumentation for Lambdas |
279
- | `MEDALLION-ARCHITECTURE` | Bronze=immutable, Silver=validated, Gold=aggregated |
280
- | `ZERO-TRUST` | Deny-by-default IAM, explicit allow rules |
281
-
282
- ## Content depth tiers
283
-
284
- Not every project needs DDD on day one.
285
-
286
- | Tier | Includes | Best for |
287
- |------|----------|----------|
288
- | **core** | Code standards, testing, commit protocol | New/small projects |
289
- | **recommended** | + architecture, CI/CD, clean code, deploy | Most projects *(default)* |
290
- | **optional** | + DDD, CQRS, event sourcing, design patterns | Mature teams, complex domains |
291
-
292
- Set in `forgecraft.yaml`:
293
- ```yaml
294
- projectName: my-api
295
- tags: [UNIVERSAL, API]
296
- tier: recommended
297
- ```
298
-
299
- ## CLI Commands
300
-
301
- ```bash
302
- npx forgecraft-mcp <command> [dir] [flags]
303
- ```
304
-
305
- | Command | Purpose |
306
- |---------|--------|
307
- | `setup <dir>` | **Start here.** Analyze → auto-detect stack → generate instruction files + hooks |
308
- | `refresh <dir>` | Re-scan after project changes. Detects new tags, shows before/after diff. |
309
- | `refresh <dir> --apply` | Apply the refresh (default is preview-only) |
310
- | `audit <dir>` | Score compliance (0-100). Reads tags from `forgecraft.yaml`. |
311
- | `scaffold <dir> --tags ...` | Generate full folder structure + instruction files |
312
- | `review [dir] --tags ...` | Structured code review checklist (4 dimensions) |
313
- | `list tags` | Show all 24 available tags |
314
- | `list hooks --tags ...` | Show quality-gate hooks for given tags |
315
- | `list skills --tags ...` | Show skill files for given tags |
316
- | `classify [dir]` | Analyze code to suggest tags |
317
- | `generate <dir>` | Regenerate instruction files only |
318
- | `convert <dir>` | Phased migration plan for legacy code |
319
- | `add-hook <name> <dir>` | Add a quality-gate hook |
320
- | `add-module <name> <dir>` | Scaffold a feature module |
321
-
322
- ### Common flags
323
-
324
- ```
325
- --tags UNIVERSAL API Project classification tags (or read from forgecraft.yaml)
326
- --tier core|recommended Content depth (default: recommended)
327
- --targets claude cursor AI assistant targets (default: claude)
328
- --dry-run Preview without writing files
329
- --compact Strip explanatory bullet tails and deduplicate lines (~20-40% smaller output)
330
- --apply Apply changes (for refresh)
331
- --language typescript typescript | python (default: typescript)
332
- --scope focused comprehensive | focused (for review)
333
- ```
334
-
335
- ## MCP Sentinel
336
-
337
- Optionally add the ForgeCraft MCP sentinel to let your AI assistant diagnose your project and suggest the right CLI command:
338
-
339
- The sentinel is a **single minimal tool** (~200 tokens per request, vs ~1,500 for a full tool suite). It checks whether `forgecraft.yaml`, your AI instruction file, and your hooks exist, then returns the targeted CLI command for the project's current state.
340
-
341
- **The design is intentional.** The full ForgeCraft command surface — 21 actions — lives in the CLI, not the MCP server. The MCP server exposes exactly one tool that reads three artifacts and returns one recommendation. This is the Generative Specification principle in the tool's own architecture: a stateless reader, a bounded artifact set, a derived action. The tool practices what it writes into your instruction files.
342
-
343
- A side effect: every declared MCP tool is read by the model on every turn whether invoked or not. One tool costs 200 tokens. Twenty-one tools costs 1,500. The sentinel keeps the methodology's recommended MCP budget (≤3 active servers) by design.
344
-
345
- **Recommended workflow:**
346
- 1. Add the sentinel to your AI assistant (see config examples below)
347
- 2. Let your AI assistant run `npx forgecraft-mcp setup .`
348
- 3. Remove the sentinel from your active MCP config
349
- 4. Re-add it when you need to refresh or audit
350
-
351
- <details>
352
- <summary>Manual MCP config — Claude</summary>
353
-
354
- Add to `.claude/settings.json`:
355
- ```json
356
- {
357
- "mcpServers": {
358
- "forgecraft": {
359
- "command": "npx",
360
- "args": ["-y", "forgecraft-mcp"]
361
- }
362
- }
363
- }
364
- ```
365
- </details>
366
-
367
- <details>
368
- <summary>Manual MCP config — GitHub Copilot (VS Code)</summary>
369
-
370
- Add to `.vscode/mcp.json` in your project root (create it if it doesn't exist):
371
- ```json
372
- {
373
- "servers": {
374
- "forgecraft": {
375
- "type": "stdio",
376
- "command": "npx",
377
- "args": ["-y", "forgecraft-mcp"]
378
- }
379
- }
380
- }
381
- ```
382
-
383
- Then open the Copilot Chat panel, switch to **Agent mode**, and the forgecraft sentinel will appear in the tools list.
384
- </details>
385
-
386
- <details>
387
- <summary>Manual MCP config — Cursor</summary>
388
-
389
- Add to `.cursor/mcp.json`:
390
- ```json
391
- {
392
- "mcpServers": {
393
- "forgecraft": {
394
- "command": "npx",
395
- "args": ["-y", "forgecraft-mcp"]
396
- }
397
- }
398
- }
399
- ```
400
- </details>
401
-
402
- > **No MCP client?** That's fine — you don't need it. Run `npx forgecraft-mcp setup .` directly in your terminal. The MCP sentinel is optional; the CLI does everything.
403
-
404
- > **Already ran `claude init`?** Use `npx forgecraft-mcp generate . --merge` to merge with your existing CLAUDE.md, keeping your custom sections while adding production standards.
405
-
406
- ---
407
-
408
- ## Free and open source
409
-
410
- ForgeCraft is free. No limits, no tiers, no API keys.
411
-
412
- The quality gate library grows through community contribution. If you propose a gate that gets accepted, your name goes in [CONTRIBUTORS.md](CONTRIBUTORS.md) and you helped raise the floor for everyone building with AI.
413
-
414
- [Open a gate proposal →](.github/ISSUE_TEMPLATE/quality-gate-proposal.md) · [See contributors →](CONTRIBUTORS.md)
415
-
416
- Running this with a team? → [forgeworkshop.dev](https://forgeworkshop.dev)
417
-
418
- ---
419
-
420
- ## Theoretical foundation
421
-
422
- ForgeCraft implements the **Generative Specification** model — a formal 7-property framework for evaluating AI-generated code quality. The model, the S_realized convergence formula, and the release phase framework are documented in the white paper.
423
-
424
- > [Generative Specification White Paper](https://github.com/jghiringhelli/argos) — the academic foundation behind the `verify` score
425
-
426
- The white paper is the theory. ForgeCraft is the toolchain. Quality gates proposed for the library that generalize into theoretical insights may be incorporated into future white paper revisions.
427
-
428
- ---
429
-
430
- ## Configuration
431
-
432
- ### Fine-tune what your AI assistant sees
433
-
434
- ```yaml
435
- # forgecraft.yaml
436
- projectName: my-api
437
- tags: [UNIVERSAL, API, FINTECH]
438
- tier: recommended
439
- outputTargets: [claude, cursor, copilot] # Generate for multiple assistants
440
- compact: true # Slim output (~20-40% fewer tokens)
441
-
442
- exclude:
443
- - cqrs-event-patterns # Don't need this yet
444
-
445
- variables:
446
- coverage_minimum: 90 # Override defaults
447
- max_file_length: 400
448
- ```
449
-
450
- ### Community template packs
451
-
452
- ```yaml
453
- templateDirs:
454
- - ./my-company-standards
455
- - node_modules/@my-org/forgecraft-flutter/templates
456
- ```
457
-
458
- ## Keeping Standards Fresh
459
-
460
- ### Audit (run anytime, or in CI)
461
-
462
- ```
463
- Score: 72/100 Grade: C
464
-
465
- ✅ Instruction files exist
466
- ✅ Hooks installed (3/3)
467
- ✅ Test script configured
468
- 🔴 hardcoded_url: src/auth/service.ts
469
- 🔴 status_md_current: not updated in 12 days
470
- 🟡 lock_file: not committed
471
- ```
472
-
473
- ### Refresh (project scope changed?)
474
-
475
- ```bash
476
- npx forgecraft-mcp refresh . --apply
477
- ```
478
-
479
- Or in preview mode first (default):
480
- ```bash
481
- npx forgecraft-mcp refresh . # shows before/after diff without writing
482
- ```
483
-
484
- ## Contributing
485
-
486
- Templates are YAML, not code. You can add patterns without writing TypeScript.
487
-
488
- ```
489
- templates/your-tag/
490
- ├── instructions.yaml # Instruction file blocks (with tier metadata)
491
- ├── structure.yaml # Folder structure
492
- ├── nfr.yaml # Non-functional requirements
493
- ├── hooks.yaml # Quality gate scripts
494
- ├── review.yaml # Code review checklists
495
- └── mcp-servers.yaml # Recommended MCP servers for this tag
496
- ```
497
-
498
- PRs welcome. See [`templates/universal/`](templates/universal/) for the format.
499
-
500
- ### MCP Server Discovery
501
-
502
- `npx forgecraft-mcp configure-mcp` dynamically discovers recommended MCP servers matching your project tags. Servers are curated in `mcp-servers.yaml` per tag — community-contributable via PRs.
503
-
504
- Built-in recommendations include Context7 (docs), Playwright (testing), Chrome DevTools (debugging), Stripe (fintech), Docker/K8s (infra), and more across all 24 tags.
505
-
506
- Optionally fetch from a remote registry at setup time:
507
- ```yaml
508
- # In forgecraft.yaml or via tool parameter
509
- include_remote: true
510
- remote_registry_url: https://your-org.com/mcp-registry.json
511
- ```
512
-
513
- ## Development
514
-
515
- ```bash
516
- git clone https://github.com/jghiringhelli/forgecraft-mcp.git
517
- cd forgecraft-mcp
518
- npm install
519
- npm run build
520
- npm test # 610 tests, 42 suites
521
- ```
522
-
523
- ## License
524
-
525
- MIT
1
+ <p align="center">
2
+ <h1 align="center">ForgeCraft</h1>
3
+ <p align="center">
4
+ <strong>The quality contract your AI coding assistant works within.</strong>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://www.npmjs.com/package/forgecraft-mcp"><img src="https://img.shields.io/npm/v/forgecraft-mcp.svg" alt="npm version"></a>
8
+ <a href="https://github.com/jghiringhelli/forgecraft-mcp/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/forgecraft-mcp.svg" alt="license"></a>
9
+ <a href="https://www.npmjs.com/package/forgecraft-mcp"><img src="https://img.shields.io/npm/dm/forgecraft-mcp.svg" alt="downloads"></a>
10
+ </p>
11
+ </p>
12
+
13
+ ---
14
+
15
+ > You hired an AI engineer. It's brilliant. It also installed the same 14 VS Code extensions twice today, spun up 6 Docker containers it will never clean up, and your disk went from 12 GB free to 0 KB in one session.
16
+ >
17
+ > A full disk doesn't fail gracefully. It kills VS Code, the terminal, Docker, and the database simultaneously.
18
+
19
+ ForgeCraft is the quality contract your AI coding assistant works within — so it builds fast **and** doesn't burn down the house.
20
+
21
+ ```bash
22
+ npx forgecraft-mcp setup .
23
+ ```
24
+
25
+ **Supports:** Claude (CLAUDE.md) · Cursor (.cursor/rules/) · GitHub Copilot (.github/copilot-instructions.md) · Windsurf (.windsurfrules) · Cline (.clinerules) · Aider (CONVENTIONS.md)
26
+
27
+ ---
28
+
29
+ ## A quality framework for AI-assisted software development
30
+
31
+ Every session, every project, every AI assistant — measured against the same 7-property **Generative Specification** model. Not vibes. Not a linter score. A score out of 14 that tells you exactly where the gap is and why.
32
+
33
+ ```
34
+ $ npx forgecraft-mcp verify .
35
+
36
+ | Property | Score | Evidence |
37
+ |-----------------|-------|-------------------------------------------------|
38
+ | Self-Describing | ✅ 2/2 | CLAUDE.md — 352 non-empty lines |
39
+ | Bounded | ✅ 2/2 | No direct DB calls in route files |
40
+ | Verifiable | ✅ 2/2 | 64 test files — 87% coverage |
41
+ | Defended | ✅ 2/2 | Pre-commit hook + lint config present |
42
+ | Auditable | ✅ 2/2 | 11 ADRs in docs/adrs/ + Status.md |
43
+ | Composable | ✅ 2/2 | Service layer + repository layer detected |
44
+ | Executable | ✅ 2/2 | Tests passed + CI pipeline configured |
45
+
46
+ Total: 14/14 ✅ PASS · Threshold 11/14
47
+ ```
48
+
49
+ | Property | What it checks |
50
+ |---|---|
51
+ | **Self-Describing** | Does the codebase explain itself without you? |
52
+ | **Bounded** | Is business logic leaking into your routes? |
53
+ | **Verifiable** | Are there tests, and did they pass in a real runtime? |
54
+ | **Defended** | Are hooks blocking bad commits before they land? |
55
+ | **Auditable** | Is every architectural decision recorded and findable? |
56
+ | **Composable** | Can you swap the database without touching the domain? |
57
+ | **Executable** | Is there CI evidence this thing actually ran? |
58
+
59
+ ---
60
+
61
+ ## Dev environment hygiene — enforced by convention
62
+
63
+ ForgeCraft injects enforceable rules into every project's AI instructions that make environment pollution a convention violation, not an incident.
64
+
65
+ **VS Code extensions**
66
+ Before installing: `code --list-extensions | grep -i <name>`. Only install if no version in the required major range is already present. The same extension doesn't get downloaded twice in the same day.
67
+
68
+ **Docker containers**
69
+ Check before creating: `docker ps -a --filter name=<service>`. If it exists, start it — don't create it. Prefer `docker compose up` (reuse) over bare `docker run` (always creates new). Logs capped at 500 MB. `docker system prune -f` is documented as a periodic maintenance step, not an emergency.
70
+
71
+ > **Exception:** Multiple containers of the same service are permitted when they differ meaningfully in plugin set or major version — for example, a `postgres-pgvector` container alongside a standard `postgres` container. Name containers to reflect the variant (e.g., `db-pgvector`, `db-timescale`); otherwise the deduplication rule applies.
72
+
73
+ **Python virtual environments**
74
+ One `.venv` per project root. Reuse if the Python major.minor version matches. Never create a venv in a subdirectory unless it's a standalone installable package. Unused dependencies flagged by `pip list --not-required`.
75
+
76
+ **Synthetic and time-series data**
77
+ Before writing more than 100 MB of generated data, the AI asks: retain raw, condense statistically, or delete after the run? Synthetic datasets older than 7 days with no code reference: ask to delete.
78
+
79
+ **General**
80
+ If the workspace grows beyond 2 GB outside of known build artifacts (`node_modules/`, `.venv/`, `dist/`), surface a warning and stop. Never silently grow the workspace.
81
+
82
+ ---
83
+
84
+ ## Project setup in one sentence
85
+
86
+ ```
87
+ Read the spec in docs/specs/, set up this project with ForgeCraft,
88
+ scaffold it with the right tags, recommend the tech stack, start building.
89
+ ```
90
+
91
+ That's the entire onboarding prompt. ForgeCraft reads the spec, the AI assigns the tags, and ForgeCraft writes the instruction file, emits `Status.md`, `docs/adrs/`, `docs/PRD.md`, `docs/TechSpec.md`, hooks, and skills. The AI has full context. You start building.
92
+
93
+ ForgeCraft scans your project, auto-detects your stack, and generates tailored instruction files from 116 curated blocks — SOLID, hexagonal architecture, testing pyramids, CI/CD, and 24 domain-specific rule sets — in seconds.
94
+
95
+ ---
96
+
97
+ ## Quality gates
98
+
99
+ Quality gates are structured pass/fail checks your AI assistant runs at defined moments — before a commit, before a release, after a deployment. They're not linter rules. Each gate has a condition, an evidence requirement, and a flag for whether human review is mandatory.
100
+
101
+ Gates are organized by release phase so you're not running pre-release chaos tests on day one of a greenfield project:
102
+
103
+ | Phase | Example gates |
104
+ |---|---|
105
+ | **development** | Unit tests pass · lint clean · no layer violations · no hardcoded secrets |
106
+ | **pre-release hardening** | Mutation testing ≥80% · DAST scan · 2× peak load · chaos (Toxiproxy) |
107
+ | **release candidate** | OWASP Top 10 pentest · full mutation audit · compatibility matrix · accessibility |
108
+ | **deployment** | Canary config verified · smoke tests pass · observability confirmed |
109
+ | **post-deployment** | Synthetic probes live · 30-min error window monitored · incident runbook reviewed |
110
+
111
+ Gates tagged `requires_human_review: true` cannot be auto-passed — some checks require a human.
112
+
113
+ The full gate library, contribution guide, and schema are in the [quality gates repository →](https://github.com/jghiringhelli/genspec-dev-quality-gates)
114
+
115
+ ---
116
+
117
+ ## ADRs, automatically sequenced
118
+
119
+ Every non-obvious architectural decision gets recorded. ForgeCraft auto-sequences `docs/adrs/NNNN-slug.md` in MADR format — context, decision, alternatives, consequences. Your AI assistant reasons about past choices. Your team stops re-litigating them.
120
+
121
+ ```bash
122
+ npx forgecraft-mcp generate_adr . --title "Use event sourcing for order history" \
123
+ --status Accepted \
124
+ --context "Order mutations need full audit trail for compliance" \
125
+ --decision "Append-only event log, project current state on read"
126
+ # → docs/adrs/0004-use-event-sourcing-for-order-history.md
127
+ ```
128
+
129
+ ---
130
+
131
+ ## AI assistant setup vs ForgeCraft
132
+
133
+ `claude init`, Cursor's workspace rules, or Copilot's instructions file get you started. ForgeCraft gets you to production standards — across every AI assistant, every session, every engineer on the team.
134
+
135
+ | | Default AI setup | ForgeCraft |
136
+ |---|---|---|
137
+ | **Instruction file** | Generic, one-size-fits-all | 116 curated blocks matched to your stack |
138
+ | **AI assistants** | Varies by tool | Claude, Cursor, Copilot, Windsurf, Cline, Aider |
139
+ | **Architecture** | None | SOLID, hexagonal, clean code, DDD |
140
+ | **Testing** | Basic mention | Testing pyramid, coverage targets, mutation gates |
141
+ | **Domain rules** | None | 24 domains (fintech, healthcare, gaming…) |
142
+ | **Quality score** | None | GS score out of 14 — know exactly where the gap is |
143
+ | **Release phases** | None | 7 phases from development through post-deployment |
144
+ | **Dev hygiene** | None | VS Code, Docker, Python venv, disk guard |
145
+ | **ADRs** | None | Auto-sequenced, MADR format |
146
+ | **Session continuity** | None | `Status.md` + `forgecraft.yaml` persist context |
147
+ | **Drift detection** | None | `refresh` detects scope changes |
148
+
149
+ ## Workflow Playbook
150
+
151
+ After setup, your AI has the context. These prompts direct the work. Copy, paste, run.
152
+
153
+ | Situation | Prompt |
154
+ |---|---|
155
+ | New project — scaffold structure | [Greenfield Setup](WORKFLOWS.md#greenfield-setup) |
156
+ | Existing project — integrate ForgeCraft | [Brownfield Integration](WORKFLOWS.md#brownfield-integration) |
157
+ | Audit shows `file_length` failures | [Decompose by responsibility](WORKFLOWS.md#file_length--file-too-large) |
158
+ | Audit shows `hardcoded_url` failures | [Extract to env vars](WORKFLOWS.md#hardcoded_url--urls-or-hosts-in-source) |
159
+ | Audit shows `hardcoded_credential` failures | [Remove secrets — do this first](WORKFLOWS.md#hardcoded_credential--secrets-in-source) |
160
+ | Audit shows `layer_violation` failures | [Fix route → DB direct calls](WORKFLOWS.md#layer_violation--direct-db-call-in-route-handler) |
161
+ | Audit shows `mock_in_source` failures | [Move mocks out of production](WORKFLOWS.md#mock_in_source--mock-data-in-production-code) |
162
+ | Audit shows `missing_prd` failures | [Reverse-engineer spec docs](WORKFLOWS.md#missing_prd--missing_techspec--no-spec-docs) |
163
+ | Audit shows `stale_status` failures | [Update Status.md](WORKFLOWS.md#stale_status--statusmd-not-updated) |
164
+ | Score ≥ 80 and preparing to ship | [Pre-release hardening](WORKFLOWS.md#pre-release-hardening) |
165
+ | Just deployed to production | [Post-deployment checklist](WORKFLOWS.md#post-deployment) |
166
+ | Project scope changed | [Drift detection](WORKFLOWS.md#drift-detection) |
167
+
168
+ → [Full Workflow Playbook](WORKFLOWS.md) · [Online version](https://forgecraft.tools/docs/workflows)
169
+
170
+ ---
171
+
172
+ ## How It Works
173
+
174
+ ```bash
175
+ # First-time setup — auto-detects your stack
176
+ npx forgecraft-mcp setup .
177
+ ```
178
+
179
+ ```mermaid
180
+ flowchart TD
181
+ A["<b>setup .</b><br/>npx forgecraft-mcp setup ."] --> B["Phase 1 — Analyze<br/>Reads spec · infers tags"]
182
+ B --> C{AI assistant\nin the loop?}
183
+ C -->|"Yes (MCP)"| D["Phase 2 — Calibrate<br/>LLM corrects tags from spec<br/>Writes forgecraft.yaml · CLAUDE.md<br/>PRD.md · hooks · ADR-000"]
184
+ C -->|"No (CLI only)"| E["⚠️ CLI-only mode<br/>Directory heuristics only<br/>→ configure an AI assistant"]
185
+ D --> F["<b>check_cascade</b><br/>5-step readiness gate<br/>1 · Functional spec<br/>2 · Architecture + C4<br/>3 · Constitution<br/>4 · ADRs<br/>5 · Use cases"]
186
+ F --> G{All 5 passing?}
187
+ G -->|"Stubs / missing"| H["Fill artifacts<br/>docs/PRD.md · docs/adrs/<br/>docs/use-cases.md"]
188
+ H --> F
189
+ G -->|"✅ All pass"| I["<b>generate_session_prompt</b><br/>Bound context for next task"]
190
+ I --> J["Implement with TDD<br/>RED → GREEN → REFACTOR<br/>+ Documentation Cascade"]
191
+ J --> K["<b>audit_project</b><br/>Score 0 – 100"]
192
+ K --> L{Score ≥ 90?}
193
+ L -->|"Violations found"| M["WORKFLOWS.md remediation<br/>file_length · layer_violation<br/>hardcoded_url · missing_prd"]
194
+ M --> J
195
+ L -->|"✅ Score ≥ 90"| N["<b>close_cycle</b><br/>Re-check cascade · assess gates<br/>promote to registry · bump version"]
196
+ N --> O{Roadmap\ncomplete?}
197
+ O -->|"More features"| I
198
+ O -->|"All done"| P["<b>start_hardening</b><br/>Mutation tests · OWASP · load test"]
199
+ P --> Q["🚢 Ship"]
200
+
201
+ style A fill:#1a2e1a,color:#90ee90,stroke:#3a6e3a
202
+ style Q fill:#1a2a3e,color:#87ceeb,stroke:#3a5a8e
203
+ style E fill:#2e1a1a,color:#ffaa88,stroke:#6e3a3a
204
+ style M fill:#2e2a00,color:#ffd700,stroke:#6e6000
205
+ ```
206
+
207
+ ForgeCraft is a **setup-time CLI tool**. Run it once to configure your project, then remove it — it has no runtime footprint.
208
+
209
+ Optionally add the MCP sentinel to let your AI assistant diagnose and recommend commands:
210
+
211
+ ```bash
212
+ claude mcp add forgecraft -- npx -y forgecraft-mcp
213
+ ```
214
+
215
+ The sentinel is a single tool (~200 tokens). It reads three artifacts — `forgecraft.yaml`, `CLAUDE.md`, `.claude/hooks` — derives the correct next CLI command, and returns it. Nothing more. This is the methodology's core principle expressed as tool design: a stateless reader, a finite artifact set, a derived action. [Remove it](#mcp-sentinel) after initial setup to reclaim token budget.
216
+
217
+ ## What You Get
218
+
219
+ After `npx forgecraft-mcp setup`, your project has:
220
+
221
+ ```
222
+ your-project/
223
+ ├── forgecraft.yaml ← Your config (tags, tier, customizations)
224
+ ├── CLAUDE.md ← Engineering standards (Claude)
225
+ ├── .cursor/rules/ ← Engineering standards (Cursor)
226
+ ├── .github/copilot-instructions.md ← Engineering standards (Copilot)
227
+ ├── Status.md ← Session continuity tracker
228
+ ├── .claude/hooks/ ← Pre-commit quality gates
229
+ ├── docs/
230
+ │ ├── PRD.md ← Requirements skeleton
231
+ │ └── TechSpec.md ← Architecture + NFR sections
232
+ └── src/shared/ ← Config, errors, logger starters
233
+ ```
234
+
235
+ ### The Instruction Files
236
+
237
+ This is the core value. Assembled from curated blocks covering:
238
+
239
+ - **SOLID principles** — concrete rules, not platitudes
240
+ - **Hexagonal architecture** — ports, adapters, DTOs, layer boundaries
241
+ - **Testing pyramid** — unit/integration/E2E targets, test doubles taxonomy
242
+ - **Clean code** — CQS, guard clauses, immutability, pure functions
243
+ - **CI/CD & deployment** — pipeline stages, environments, preview deploys
244
+ - **Domain patterns** — DDD, CQRS, event sourcing (when your project needs it)
245
+ - **12-Factor ops** — config, statelessness, disposability, logging
246
+
247
+ Every block is sourced from established engineering literature (Martin, Evans, Wiggins) and adapted for AI-assisted development.
248
+
249
+ ## 24 Tags — AI-detected, user-adjustable
250
+
251
+ Tags tell ForgeCraft what your project is. On first setup, the AI analyzes your spec and codebase and assigns them. You can review and override in `forgecraft.yaml`. Blocks merge without conflicts — add or remove tags as the project evolves.
252
+
253
+ The full tag list and contribution guide live in the [quality gates repository →](https://github.com/jghiringhelli/genspec-dev-quality-gates)
254
+
255
+ | Tag | What it adds |
256
+ |-----|-------------|
257
+ | `UNIVERSAL` | SOLID, testing, commits, error handling *(always on)* |
258
+ | `API` | REST/GraphQL contracts, auth, rate limiting, versioning |
259
+ | `WEB-REACT` | Component arch, state management, a11y, perf budgets |
260
+ | `WEB-STATIC` | Build optimization, SEO, CDN, static deploy |
261
+ | `CLI` | Arg parsing, output formatting, exit codes |
262
+ | `LIBRARY` | API design, semver, backwards compatibility |
263
+ | `INFRA` | Terraform/CDK, Kubernetes, secrets management |
264
+ | `DATA-PIPELINE` | ETL, idempotency, checkpointing, schema evolution |
265
+ | `ML` | Experiment tracking, model versioning, reproducibility |
266
+ | `FINTECH` | Double-entry accounting, decimal precision, compliance |
267
+ | `HEALTHCARE` | HIPAA, PHI handling, audit logs, encryption |
268
+ | `MOBILE` | React Native/Flutter, offline-first, native APIs |
269
+ | `REALTIME` | WebSockets, presence, conflict resolution |
270
+ | `GAME` | Game loop, ECS, Phaser 3, PixiJS, Three.js/WebGL, performance budgets |
271
+ | `SOCIAL` | Feeds, connections, messaging, moderation |
272
+ | `ANALYTICS` | Event tracking, dashboards, data warehousing |
273
+ | `STATE-MACHINE` | Transitions, guards, event-driven workflows |
274
+ | `WEB3` | Smart contracts, gas optimization, wallet security |
275
+ | `HIPAA` | PII masking, encryption checks, audit logging |
276
+ | `SOC2` | Access control, change management, incident response |
277
+ | `DATA-LINEAGE` | 100% field coverage, lineage tracking decorators |
278
+ | `OBSERVABILITY-XRAY` | Auto X-Ray instrumentation for Lambdas |
279
+ | `MEDALLION-ARCHITECTURE` | Bronze=immutable, Silver=validated, Gold=aggregated |
280
+ | `ZERO-TRUST` | Deny-by-default IAM, explicit allow rules |
281
+
282
+ ## Content depth tiers
283
+
284
+ Not every project needs DDD on day one.
285
+
286
+ | Tier | Includes | Best for |
287
+ |------|----------|----------|
288
+ | **core** | Code standards, testing, commit protocol | New/small projects |
289
+ | **recommended** | + architecture, CI/CD, clean code, deploy | Most projects *(default)* |
290
+ | **optional** | + DDD, CQRS, event sourcing, design patterns | Mature teams, complex domains |
291
+
292
+ Set in `forgecraft.yaml`:
293
+ ```yaml
294
+ projectName: my-api
295
+ tags: [UNIVERSAL, API]
296
+ tier: recommended
297
+ ```
298
+
299
+ ## CLI Commands
300
+
301
+ ```bash
302
+ npx forgecraft-mcp <command> [dir] [flags]
303
+ ```
304
+
305
+ | Command | Purpose |
306
+ |---------|--------|
307
+ | `setup <dir>` | **Start here.** Analyze → auto-detect stack → generate instruction files + hooks |
308
+ | `refresh <dir>` | Re-scan after project changes. Detects new tags, shows before/after diff. |
309
+ | `refresh <dir> --apply` | Apply the refresh (default is preview-only) |
310
+ | `audit <dir>` | Score compliance (0-100). Reads tags from `forgecraft.yaml`. |
311
+ | `scaffold <dir> --tags ...` | Generate full folder structure + instruction files |
312
+ | `review [dir] --tags ...` | Structured code review checklist (4 dimensions) |
313
+ | `list tags` | Show all 24 available tags |
314
+ | `list hooks --tags ...` | Show quality-gate hooks for given tags |
315
+ | `list skills --tags ...` | Show skill files for given tags |
316
+ | `classify [dir]` | Analyze code to suggest tags |
317
+ | `generate <dir>` | Regenerate instruction files only |
318
+ | `convert <dir>` | Phased migration plan for legacy code |
319
+ | `add-hook <name> <dir>` | Add a quality-gate hook |
320
+ | `add-module <name> <dir>` | Scaffold a feature module |
321
+
322
+ ### Common flags
323
+
324
+ ```
325
+ --tags UNIVERSAL API Project classification tags (or read from forgecraft.yaml)
326
+ --tier core|recommended Content depth (default: recommended)
327
+ --targets claude cursor AI assistant targets (default: claude)
328
+ --dry-run Preview without writing files
329
+ --compact Strip explanatory bullet tails and deduplicate lines (~20-40% smaller output)
330
+ --apply Apply changes (for refresh)
331
+ --language typescript typescript | python (default: typescript)
332
+ --scope focused comprehensive | focused (for review)
333
+ ```
334
+
335
+ ## MCP Sentinel
336
+
337
+ Optionally add the ForgeCraft MCP sentinel to let your AI assistant diagnose your project and suggest the right CLI command:
338
+
339
+ The sentinel is a **single minimal tool** (~200 tokens per request, vs ~1,500 for a full tool suite). It checks whether `forgecraft.yaml`, your AI instruction file, and your hooks exist, then returns the targeted CLI command for the project's current state.
340
+
341
+ **The design is intentional.** The full ForgeCraft command surface — 21 actions — lives in the CLI, not the MCP server. The MCP server exposes exactly one tool that reads three artifacts and returns one recommendation. This is the Generative Specification principle in the tool's own architecture: a stateless reader, a bounded artifact set, a derived action. The tool practices what it writes into your instruction files.
342
+
343
+ A side effect: every declared MCP tool is read by the model on every turn whether invoked or not. One tool costs 200 tokens. Twenty-one tools costs 1,500. The sentinel keeps the methodology's recommended MCP budget (≤3 active servers) by design.
344
+
345
+ **Recommended workflow:**
346
+ 1. Add the sentinel to your AI assistant (see config examples below)
347
+ 2. Let your AI assistant run `npx forgecraft-mcp setup .`
348
+ 3. Remove the sentinel from your active MCP config
349
+ 4. Re-add it when you need to refresh or audit
350
+
351
+ <details>
352
+ <summary>Manual MCP config — Claude</summary>
353
+
354
+ Add to `.claude/settings.json`:
355
+ ```json
356
+ {
357
+ "mcpServers": {
358
+ "forgecraft": {
359
+ "command": "npx",
360
+ "args": ["-y", "forgecraft-mcp"]
361
+ }
362
+ }
363
+ }
364
+ ```
365
+ </details>
366
+
367
+ <details>
368
+ <summary>Manual MCP config — GitHub Copilot (VS Code)</summary>
369
+
370
+ Add to `.vscode/mcp.json` in your project root (create it if it doesn't exist):
371
+ ```json
372
+ {
373
+ "servers": {
374
+ "forgecraft": {
375
+ "type": "stdio",
376
+ "command": "npx",
377
+ "args": ["-y", "forgecraft-mcp"]
378
+ }
379
+ }
380
+ }
381
+ ```
382
+
383
+ Then open the Copilot Chat panel, switch to **Agent mode**, and the forgecraft sentinel will appear in the tools list.
384
+ </details>
385
+
386
+ <details>
387
+ <summary>Manual MCP config — Cursor</summary>
388
+
389
+ Add to `.cursor/mcp.json`:
390
+ ```json
391
+ {
392
+ "mcpServers": {
393
+ "forgecraft": {
394
+ "command": "npx",
395
+ "args": ["-y", "forgecraft-mcp"]
396
+ }
397
+ }
398
+ }
399
+ ```
400
+ </details>
401
+
402
+ > **No MCP client?** That's fine — you don't need it. Run `npx forgecraft-mcp setup .` directly in your terminal. The MCP sentinel is optional; the CLI does everything.
403
+
404
+ > **Already ran `claude init`?** Use `npx forgecraft-mcp generate . --merge` to merge with your existing CLAUDE.md, keeping your custom sections while adding production standards.
405
+
406
+ ---
407
+
408
+ ## Free and open source
409
+
410
+ ForgeCraft is free. No limits, no tiers, no API keys.
411
+
412
+ The quality gate library grows through community contribution. If you propose a gate that gets accepted, your name goes in [CONTRIBUTORS.md](CONTRIBUTORS.md) and you helped raise the floor for everyone building with AI.
413
+
414
+ [Open a gate proposal →](.github/ISSUE_TEMPLATE/quality-gate-proposal.md) · [See contributors →](CONTRIBUTORS.md)
415
+
416
+ Running this with a team? → [forgeworkshop.dev](https://forgeworkshop.dev)
417
+
418
+ ---
419
+
420
+ ## Theoretical foundation
421
+
422
+ ForgeCraft implements the **Generative Specification** model — a formal 7-property framework for evaluating AI-generated code quality. The model, the S_realized convergence formula, and the release phase framework are documented in the white paper.
423
+
424
+ > [Generative Specification White Paper](https://github.com/jghiringhelli/argos) — the academic foundation behind the `verify` score
425
+
426
+ The white paper is the theory. ForgeCraft is the toolchain. Quality gates proposed for the library that generalize into theoretical insights may be incorporated into future white paper revisions.
427
+
428
+ ---
429
+
430
+ ## Configuration
431
+
432
+ ### Fine-tune what your AI assistant sees
433
+
434
+ ```yaml
435
+ # forgecraft.yaml
436
+ projectName: my-api
437
+ tags: [UNIVERSAL, API, FINTECH]
438
+ tier: recommended
439
+ outputTargets: [claude, cursor, copilot] # Generate for multiple assistants
440
+ compact: true # Slim output (~20-40% fewer tokens)
441
+
442
+ exclude:
443
+ - cqrs-event-patterns # Don't need this yet
444
+
445
+ variables:
446
+ coverage_minimum: 90 # Override defaults
447
+ max_file_length: 400
448
+ ```
449
+
450
+ ### Community template packs
451
+
452
+ ```yaml
453
+ templateDirs:
454
+ - ./my-company-standards
455
+ - node_modules/@my-org/forgecraft-flutter/templates
456
+ ```
457
+
458
+ ## Keeping Standards Fresh
459
+
460
+ ### Audit (run anytime, or in CI)
461
+
462
+ ```
463
+ Score: 72/100 Grade: C
464
+
465
+ ✅ Instruction files exist
466
+ ✅ Hooks installed (3/3)
467
+ ✅ Test script configured
468
+ 🔴 hardcoded_url: src/auth/service.ts
469
+ 🔴 status_md_current: not updated in 12 days
470
+ 🟡 lock_file: not committed
471
+ ```
472
+
473
+ ### Refresh (project scope changed?)
474
+
475
+ ```bash
476
+ npx forgecraft-mcp refresh . --apply
477
+ ```
478
+
479
+ Or in preview mode first (default):
480
+ ```bash
481
+ npx forgecraft-mcp refresh . # shows before/after diff without writing
482
+ ```
483
+
484
+ ## Contributing
485
+
486
+ Templates are YAML, not code. You can add patterns without writing TypeScript.
487
+
488
+ ```
489
+ templates/your-tag/
490
+ ├── instructions.yaml # Instruction file blocks (with tier metadata)
491
+ ├── structure.yaml # Folder structure
492
+ ├── nfr.yaml # Non-functional requirements
493
+ ├── hooks.yaml # Quality gate scripts
494
+ ├── review.yaml # Code review checklists
495
+ └── mcp-servers.yaml # Recommended MCP servers for this tag
496
+ ```
497
+
498
+ PRs welcome. See [`templates/universal/`](templates/universal/) for the format.
499
+
500
+ ### MCP Server Discovery
501
+
502
+ `npx forgecraft-mcp configure-mcp` dynamically discovers recommended MCP servers matching your project tags. Servers are curated in `mcp-servers.yaml` per tag — community-contributable via PRs.
503
+
504
+ Built-in recommendations include Context7 (docs), Playwright (testing), Chrome DevTools (debugging), Stripe (fintech), Docker/K8s (infra), and more across all 24 tags.
505
+
506
+ Optionally fetch from a remote registry at setup time:
507
+ ```yaml
508
+ # In forgecraft.yaml or via tool parameter
509
+ include_remote: true
510
+ remote_registry_url: https://your-org.com/mcp-registry.json
511
+ ```
512
+
513
+ ## Development
514
+
515
+ ```bash
516
+ git clone https://github.com/jghiringhelli/forgecraft-mcp.git
517
+ cd forgecraft-mcp
518
+ npm install
519
+ npm run build
520
+ npm test # 610 tests, 42 suites
521
+ ```
522
+
523
+ ## License
524
+
525
+ MIT