create-rigel 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/LICENSE +21 -0
- package/README.md +156 -0
- package/cli.js +122 -0
- package/package.json +47 -0
- package/templates/express/.claude/CLAUDE.md +114 -0
- package/templates/express/.claude/agents/arch-validator.md +85 -0
- package/templates/express/.claude/agents/db-optimizer.md +72 -0
- package/templates/express/.claude/agents/doc-gardener.md +67 -0
- package/templates/express/.claude/agents/garbage-collector.md +94 -0
- package/templates/express/.claude/agents/gate-checker.md +176 -0
- package/templates/express/.claude/agents/reviewer.md +84 -0
- package/templates/express/.claude/agents/security-auditor.md +82 -0
- package/templates/express/.claude/hooks/post-write.sh +93 -0
- package/templates/express/.claude/rules/api.md +149 -0
- package/templates/express/.claude/rules/architecture.md +78 -0
- package/templates/express/.claude/rules/database.md +104 -0
- package/templates/express/.claude/rules/jobs.md +81 -0
- package/templates/express/.claude/rules/security.md +92 -0
- package/templates/express/.claude/rules/testing.md +97 -0
- package/templates/express/.claude/settings.json +35 -0
- package/templates/express/.claude/skills/00-infra-setup/SKILL.md +479 -0
- package/templates/express/.claude/skills/01-write-roadmap/SKILL.md +72 -0
- package/templates/express/.claude/skills/02-write-spec/SKILL.md +119 -0
- package/templates/express/.claude/skills/03-write-plan/SKILL.md +124 -0
- package/templates/express/.claude/skills/04-build-layer/SKILL.md +216 -0
- package/templates/express/.claude/skills/05-validate-layer/SKILL.md +43 -0
- package/templates/express/.claude/skills/06-push-layer/SKILL.md +59 -0
- package/templates/express/.claude/skills/07-layer-check/SKILL.md +62 -0
- package/templates/express/.claude/skills/08-garbage-collect/SKILL.md +86 -0
- package/templates/express/.claude/skills/09-doc-garden/SKILL.md +64 -0
- package/templates/express/.claude/skills/10-db-optimize/SKILL.md +96 -0
- package/templates/express/.claude/skills/11-load-test/SKILL.md +77 -0
- package/templates/express/.dockerignore +43 -0
- package/templates/express/.env.example +42 -0
- package/templates/express/.github/CODEOWNERS +22 -0
- package/templates/express/.github/dependabot.yml +48 -0
- package/templates/express/.github/pull_request_template.md +58 -0
- package/templates/express/.github/workflows/ci.yml +278 -0
- package/templates/express/.github/workflows/load-test.yml +41 -0
- package/templates/express/.gitleaks.toml +18 -0
- package/templates/express/.lintstagedrc.json +3 -0
- package/templates/express/.nvmrc +1 -0
- package/templates/express/.prettierrc +8 -0
- package/templates/express/.sequelizerc +8 -0
- package/templates/express/AGENTS.md +94 -0
- package/templates/express/ARCHITECTURE.md +161 -0
- package/templates/express/Dockerfile +40 -0
- package/templates/express/Makefile +79 -0
- package/templates/express/QUICKSTART.md +131 -0
- package/templates/express/docker-compose.yml +114 -0
- package/templates/express/docs/PLANS.md +111 -0
- package/templates/express/docs/QUALITY_SCORE.md +66 -0
- package/templates/express/docs/design-docs/core-beliefs.md +89 -0
- package/templates/express/docs/design-docs/decisions/ADR-000-infrastructure.md +70 -0
- package/templates/express/docs/design-docs/decisions/ADR-001-observability.md +82 -0
- package/templates/express/docs/design-docs/decisions/index.md +23 -0
- package/templates/express/docs/design-docs/index.md +11 -0
- package/templates/express/docs/design-docs/observability.md +194 -0
- package/templates/express/docs/design-docs/team-workflow.md +64 -0
- package/templates/express/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/express/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/express/docs/exec-plans/tech-debt-tracker.md +31 -0
- package/templates/express/docs/generated/.gitkeep +0 -0
- package/templates/express/docs/product-specs/ROADMAP.md +49 -0
- package/templates/express/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/express/docs/product-specs/index.md +21 -0
- package/templates/express/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/express/eslint.config.mjs +94 -0
- package/templates/express/gitignore +36 -0
- package/templates/express/infra/monitoring/alloy/config.alloy +59 -0
- package/templates/express/jest.config.ts +61 -0
- package/templates/express/package.json +45 -0
- package/templates/express/scripts/openapi.export.ts +77 -0
- package/templates/express/tests/architecture/isolation.test.ts +51 -0
- package/templates/express/tests/architecture/layers.test.ts +83 -0
- package/templates/express/tests/integration/health.test.ts +40 -0
- package/templates/express/tests/integration/isolation.test.template.ts +88 -0
- package/templates/express/tests/load/smoke.js +46 -0
- package/templates/express/tests/load/soak.js +45 -0
- package/templates/express/tests/load/stress.js +44 -0
- package/templates/express/tests/unit/utils/response.util.test.ts +53 -0
- package/templates/express/tsconfig.build.json +8 -0
- package/templates/express/tsconfig.json +20 -0
- package/templates/fastapi/.claude/CLAUDE.md +122 -0
- package/templates/fastapi/.claude/agents/arch-validator.md +64 -0
- package/templates/fastapi/.claude/agents/db-optimizer.md +59 -0
- package/templates/fastapi/.claude/agents/doc-gardener.md +55 -0
- package/templates/fastapi/.claude/agents/garbage-collector.md +74 -0
- package/templates/fastapi/.claude/agents/gate-checker.md +133 -0
- package/templates/fastapi/.claude/agents/reviewer.md +74 -0
- package/templates/fastapi/.claude/agents/security-auditor.md +69 -0
- package/templates/fastapi/.claude/hooks/post-write.sh +65 -0
- package/templates/fastapi/.claude/rules/api.md +119 -0
- package/templates/fastapi/.claude/rules/architecture.md +84 -0
- package/templates/fastapi/.claude/rules/database.md +153 -0
- package/templates/fastapi/.claude/rules/jobs.md +85 -0
- package/templates/fastapi/.claude/rules/security.md +102 -0
- package/templates/fastapi/.claude/rules/testing.md +207 -0
- package/templates/fastapi/.claude/settings.json +50 -0
- package/templates/fastapi/.claude/skills/00-infra-setup/SKILL.md +311 -0
- package/templates/fastapi/.claude/skills/01-write-roadmap/SKILL.md +61 -0
- package/templates/fastapi/.claude/skills/02-write-spec/SKILL.md +82 -0
- package/templates/fastapi/.claude/skills/03-write-plan/SKILL.md +83 -0
- package/templates/fastapi/.claude/skills/04-build-layer/SKILL.md +170 -0
- package/templates/fastapi/.claude/skills/05-validate-layer/SKILL.md +20 -0
- package/templates/fastapi/.claude/skills/06-push-layer/SKILL.md +31 -0
- package/templates/fastapi/.claude/skills/07-layer-check/SKILL.md +51 -0
- package/templates/fastapi/.claude/skills/08-garbage-collect/SKILL.md +47 -0
- package/templates/fastapi/.claude/skills/09-doc-garden/SKILL.md +9 -0
- package/templates/fastapi/.claude/skills/10-db-optimize/SKILL.md +53 -0
- package/templates/fastapi/.claude/skills/11-load-test/SKILL.md +81 -0
- package/templates/fastapi/.dockerignore +30 -0
- package/templates/fastapi/.github/dependabot.yml +24 -0
- package/templates/fastapi/AGENTS.md +87 -0
- package/templates/fastapi/ARCHITECTURE.md +141 -0
- package/templates/fastapi/Makefile +42 -0
- package/templates/fastapi/README.md +179 -0
- package/templates/fastapi/docs/PLANS.md +26 -0
- package/templates/fastapi/docs/QUALITY_SCORE.md +26 -0
- package/templates/fastapi/docs/design-docs/core-beliefs.md +46 -0
- package/templates/fastapi/docs/design-docs/decisions/ADR-000-infrastructure.md +79 -0
- package/templates/fastapi/docs/design-docs/decisions/index.md +7 -0
- package/templates/fastapi/docs/design-docs/index.md +9 -0
- package/templates/fastapi/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/fastapi/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/fastapi/docs/exec-plans/tech-debt-tracker.md +19 -0
- package/templates/fastapi/docs/generated/.gitkeep +0 -0
- package/templates/fastapi/docs/product-specs/ROADMAP.md +49 -0
- package/templates/fastapi/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/fastapi/docs/product-specs/index.md +18 -0
- package/templates/fastapi/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/fastapi/gitignore +46 -0
- package/templates/fastapi/scripts/gate.sh +68 -0
- package/templates/nestjs/.claude/CLAUDE.md +121 -0
- package/templates/nestjs/.claude/agents/db-optimizer.md +51 -0
- package/templates/nestjs/.claude/agents/doc-gardener.md +45 -0
- package/templates/nestjs/.claude/agents/garbage-collector.md +50 -0
- package/templates/nestjs/.claude/agents/gate-checker.md +127 -0
- package/templates/nestjs/.claude/agents/reviewer.md +68 -0
- package/templates/nestjs/.claude/agents/security-auditor.md +72 -0
- package/templates/nestjs/.claude/hooks/post-write.sh +91 -0
- package/templates/nestjs/.claude/rules/api.md +87 -0
- package/templates/nestjs/.claude/rules/architecture.md +104 -0
- package/templates/nestjs/.claude/rules/database.md +111 -0
- package/templates/nestjs/.claude/rules/security.md +110 -0
- package/templates/nestjs/.claude/rules/testing.md +145 -0
- package/templates/nestjs/.claude/settings.json +33 -0
- package/templates/nestjs/.claude/skills/00-infra-setup/SKILL.md +222 -0
- package/templates/nestjs/.claude/skills/01-write-spec/SKILL.md +25 -0
- package/templates/nestjs/.claude/skills/02-write-plan/SKILL.md +18 -0
- package/templates/nestjs/.claude/skills/03-build-layer/SKILL.md +242 -0
- package/templates/nestjs/.claude/skills/04-validate-layer/SKILL.md +4 -0
- package/templates/nestjs/.claude/skills/05-push-layer/SKILL.md +6 -0
- package/templates/nestjs/.claude/skills/06-layer-check/SKILL.md +12 -0
- package/templates/nestjs/.claude/skills/07-garbage-collect/SKILL.md +2 -0
- package/templates/nestjs/.claude/skills/08-doc-garden/SKILL.md +4 -0
- package/templates/nestjs/.claude/skills/09-api-sync/SKILL.md +36 -0
- package/templates/nestjs/.claude/skills/10-load-test/SKILL.md +29 -0
- package/templates/nestjs/.env.example +11 -0
- package/templates/nestjs/AGENTS.md +88 -0
- package/templates/nestjs/ARCHITECTURE.md +192 -0
- package/templates/nestjs/docs/PLANS.md +22 -0
- package/templates/nestjs/docs/QUALITY_SCORE.md +27 -0
- package/templates/nestjs/docs/design-docs/core-beliefs.md +18 -0
- package/templates/nestjs/docs/design-docs/decisions/ADR-000-infrastructure.md +58 -0
- package/templates/nestjs/docs/design-docs/decisions/index.md +7 -0
- package/templates/nestjs/docs/design-docs/index.md +7 -0
- package/templates/nestjs/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/nestjs/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/nestjs/docs/exec-plans/tech-debt-tracker.md +16 -0
- package/templates/nestjs/docs/generated/.gitkeep +0 -0
- package/templates/nestjs/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/nestjs/docs/product-specs/index.md +7 -0
- package/templates/nestjs/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/nestjs/gitignore +8 -0
- package/templates/nextjs/.claude/CLAUDE.md +139 -0
- package/templates/nextjs/.claude/agents/arch-validator.md +66 -0
- package/templates/nextjs/.claude/agents/contract-checker.md +78 -0
- package/templates/nextjs/.claude/agents/doc-gardener.md +52 -0
- package/templates/nextjs/.claude/agents/garbage-collector.md +61 -0
- package/templates/nextjs/.claude/agents/gate-checker.md +129 -0
- package/templates/nextjs/.claude/agents/perf-auditor.md +109 -0
- package/templates/nextjs/.claude/agents/reviewer.md +79 -0
- package/templates/nextjs/.claude/agents/security-auditor.md +50 -0
- package/templates/nextjs/.claude/hooks/post-write.sh +121 -0
- package/templates/nextjs/.claude/rules/api-contract.md +166 -0
- package/templates/nextjs/.claude/rules/architecture.md +99 -0
- package/templates/nextjs/.claude/rules/components.md +122 -0
- package/templates/nextjs/.claude/rules/security.md +122 -0
- package/templates/nextjs/.claude/rules/testing.md +187 -0
- package/templates/nextjs/.claude/scripts/infra-setup.sh +550 -0
- package/templates/nextjs/.claude/settings.json +33 -0
- package/templates/nextjs/.claude/skills/00-infra-setup/SKILL.md +471 -0
- package/templates/nextjs/.claude/skills/01-write-roadmap/SKILL.md +77 -0
- package/templates/nextjs/.claude/skills/02-write-spec/SKILL.md +78 -0
- package/templates/nextjs/.claude/skills/03-write-plan/SKILL.md +91 -0
- package/templates/nextjs/.claude/skills/04-build-layer/SKILL.md +141 -0
- package/templates/nextjs/.claude/skills/05-validate-layer/SKILL.md +13 -0
- package/templates/nextjs/.claude/skills/06-push-layer/SKILL.md +20 -0
- package/templates/nextjs/.claude/skills/07-layer-check/SKILL.md +28 -0
- package/templates/nextjs/.claude/skills/08-garbage-collect/SKILL.md +14 -0
- package/templates/nextjs/.claude/skills/09-doc-garden/SKILL.md +12 -0
- package/templates/nextjs/.claude/skills/10-api-sync/SKILL.md +50 -0
- package/templates/nextjs/.claude/skills/11-perf-budget/SKILL.md +51 -0
- package/templates/nextjs/.dockerignore +25 -0
- package/templates/nextjs/.gitattributes +10 -0
- package/templates/nextjs/.github/CODEOWNERS +24 -0
- package/templates/nextjs/.github/dependabot.yml +31 -0
- package/templates/nextjs/.github/pull_request_template.md +59 -0
- package/templates/nextjs/.github/workflows/ci.yml +143 -0
- package/templates/nextjs/.github/workflows/lighthouse.yml +54 -0
- package/templates/nextjs/.github/workflows/load-test.yml +54 -0
- package/templates/nextjs/.husky/pre-commit +1 -0
- package/templates/nextjs/.lintstagedrc.json +4 -0
- package/templates/nextjs/.mcp.json +8 -0
- package/templates/nextjs/.prettierignore +13 -0
- package/templates/nextjs/.prettierrc +9 -0
- package/templates/nextjs/AGENTS.md +88 -0
- package/templates/nextjs/ARCHITECTURE.md +165 -0
- package/templates/nextjs/Dockerfile +38 -0
- package/templates/nextjs/Makefile +50 -0
- package/templates/nextjs/QUICKSTART.md +128 -0
- package/templates/nextjs/docs/PLANS.md +23 -0
- package/templates/nextjs/docs/QUALITY_SCORE.md +27 -0
- package/templates/nextjs/docs/design-docs/core-beliefs.md +43 -0
- package/templates/nextjs/docs/design-docs/decisions/ADR-000-infrastructure.md +72 -0
- package/templates/nextjs/docs/design-docs/decisions/index.md +7 -0
- package/templates/nextjs/docs/design-docs/index.md +7 -0
- package/templates/nextjs/docs/design-docs/team-workflow.md +66 -0
- package/templates/nextjs/docs/exec-plans/active/.gitkeep +0 -0
- package/templates/nextjs/docs/exec-plans/completed/.gitkeep +0 -0
- package/templates/nextjs/docs/exec-plans/tech-debt-tracker.md +19 -0
- package/templates/nextjs/docs/generated/.gitkeep +0 -0
- package/templates/nextjs/docs/product-specs/ROADMAP.md +59 -0
- package/templates/nextjs/docs/product-specs/draft/.gitkeep +0 -0
- package/templates/nextjs/docs/product-specs/index.md +18 -0
- package/templates/nextjs/docs/product-specs/ready/.gitkeep +0 -0
- package/templates/nextjs/eslint.config.mjs +150 -0
- package/templates/nextjs/gitignore +35 -0
- package/templates/nextjs/lighthouserc.js +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shreyassss15
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ✦ rigel
|
|
4
|
+
|
|
5
|
+
**Harness the power of AI coding agents into shipped, gated software.**
|
|
6
|
+
|
|
7
|
+
Scaffold an agent-first, gate-enforced starter project — Next.js · Express · NestJS · FastAPI — each wired for [Claude Code](https://docs.claude.com/en/docs/claude-code) with a mechanical quality gate, path-scoped rules, specialist review agents, and a spec-driven workflow baked in.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/create-rigel)
|
|
10
|
+
[](https://www.npmjs.com/package/create-rigel)
|
|
11
|
+
[](https://github.com/Shreyas1015/create-rigel/actions/workflows/ci.yml)
|
|
12
|
+
[](./LICENSE)
|
|
13
|
+
[](https://nodejs.org)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm create rigel@latest my-app
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> **rigel** — named for the *rig* that harnesses raw power, and for [Rigel](https://en.wikipedia.org/wiki/Rigel), one of the brightest stars in the sky. It rigs your project with guardrails so a powerful agent builds like a pro.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Table of contents
|
|
26
|
+
|
|
27
|
+
- [Why rigel?](#why-rigel)
|
|
28
|
+
- [What you get](#what-you-get)
|
|
29
|
+
- [Quick start](#quick-start)
|
|
30
|
+
- [Templates](#templates)
|
|
31
|
+
- [Inside a scaffolded project](#inside-a-scaffolded-project)
|
|
32
|
+
- [The workflow it enables](#the-workflow-it-enables)
|
|
33
|
+
- [Requirements](#requirements)
|
|
34
|
+
- [FAQ](#faq)
|
|
35
|
+
- [Contributing](#contributing)
|
|
36
|
+
- [Versioning](#versioning)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
|
|
39
|
+
## Why rigel?
|
|
40
|
+
|
|
41
|
+
Coding agents are great at *writing* code and bad at *stopping themselves from drifting*. Point one at an empty repo and you get inconsistent structure, untested code, and "looks done" claims that don't hold up. The fix isn't a better prompt — it's a **repo that constrains the agent**: written rules it must follow, a fixed build order, and a gate that blocks the commit when the code is wrong.
|
|
42
|
+
|
|
43
|
+
`rigel` scaffolds exactly that repo. Every template ships an opinionated architecture plus a `.claude/` workflow so that, from the first commit, an AI agent (or a human) builds through a **spec → plan → layered build → mechanical gate** loop instead of freewheeling. Quality is enforced by checks that fail the build, not by hoping someone remembers the standard.
|
|
44
|
+
|
|
45
|
+
**In one line:** it's `create-next-app` for teams who build *with* AI agents and want the guardrails in the repo, not in their heads.
|
|
46
|
+
|
|
47
|
+
## What you get
|
|
48
|
+
|
|
49
|
+
- 🧱 **Opinionated, layered architecture** per stack — a strict import matrix (types → config → models → repo → service → runtime → …) that keeps business logic testable and isolated.
|
|
50
|
+
- ✅ **A mechanical gate** — `typecheck + lint (zero warnings) + circular-dep check + architecture tests + coverage thresholds` that must pass before every commit. Encode a rule or drop it.
|
|
51
|
+
- 🤖 **A `.claude/` workflow** — path-scoped rules, a numbered skill pipeline, and specialist review agents (reviewer, security-auditor, arch-validator, db-optimizer, …) that run automatically.
|
|
52
|
+
- 📐 **Spec-driven delivery** — a `docs/` taxonomy (product-specs → exec-plans → design-docs/ADRs) so intent lives in the repo and drives the build.
|
|
53
|
+
- 🔒 **Security & correctness defaults** — validate-at-the-boundary, OWASP handler ordering, a mandatory cross-user isolation test (404, not 403), and a pre-write hook that blocks secrets and edits to generated contracts.
|
|
54
|
+
- 🚦 **CI-ready** — pre-commit hooks and CI workflows so the gate runs on every push, not just locally.
|
|
55
|
+
|
|
56
|
+
## Quick start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# interactive — prompts you to pick a stack
|
|
60
|
+
npm create rigel@latest my-app
|
|
61
|
+
|
|
62
|
+
# or choose the stack up front
|
|
63
|
+
npm create rigel@latest my-app -- --template nextjs
|
|
64
|
+
|
|
65
|
+
# scaffold into the current directory
|
|
66
|
+
npm create rigel@latest .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Using another package manager? All of these work:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm create rigel my-app
|
|
73
|
+
yarn create rigel my-app
|
|
74
|
+
bun create rigel my-app
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> **Note:** with npm 7+, flags after the project name need the extra `--` (as shown above).
|
|
78
|
+
|
|
79
|
+
## Templates
|
|
80
|
+
|
|
81
|
+
| Template | Stack | Best for |
|
|
82
|
+
|----------|-------|----------|
|
|
83
|
+
| **`nextjs`** | Next.js + React + TypeScript + Tailwind, TanStack Query, typed API client | Frontends that consume a typed API contract |
|
|
84
|
+
| **`express`** | Express + TypeScript + Sequelize (Postgres) + BullMQ + OpenTelemetry | Backends / REST APIs with jobs and observability |
|
|
85
|
+
| **`nestjs`** | NestJS + TypeScript | Modular, DI-first backends |
|
|
86
|
+
| **`fastapi`** | FastAPI + Python (uv) + SQLAlchemy + ruff/mypy/bandit | Python backends / data services |
|
|
87
|
+
|
|
88
|
+
Pick interactively, or pass `--template <name>`.
|
|
89
|
+
|
|
90
|
+
## Inside a scaffolded project
|
|
91
|
+
|
|
92
|
+
Every template lays down the same shape (adapted per stack):
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
my-app/
|
|
96
|
+
├── .claude/
|
|
97
|
+
│ ├── rules/ # path-scoped rules auto-injected as the agent edits (architecture, api, security, testing, …)
|
|
98
|
+
│ ├── agents/ # specialist reviewers: gate-checker, reviewer, security-auditor, arch-validator, db-optimizer …
|
|
99
|
+
│ ├── skills/ # the numbered pipeline: 00-infra-setup → 01-write-roadmap → … → build-layer → garbage-collect
|
|
100
|
+
│ ├── hooks/ # a post-write hook that warns/blocks (secrets, edits to generated contracts, oversized files)
|
|
101
|
+
│ └── CLAUDE.md # standing instructions the agent reads every session
|
|
102
|
+
├── docs/
|
|
103
|
+
│ ├── product-specs/ # ROADMAP + one spec per feature (draft → ready)
|
|
104
|
+
│ ├── exec-plans/ # layered execution plans (active → completed) + tech-debt tracker
|
|
105
|
+
│ └── design-docs/ # core-beliefs (the constitution) + ADRs (decisions/)
|
|
106
|
+
├── ARCHITECTURE.md # the layer diagram + import matrix
|
|
107
|
+
├── AGENTS.md # navigation map + non-negotiable invariants
|
|
108
|
+
└── src/ # generated on first run by /infra-setup
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The **gate** (`npm run gate` / `scripts/gate.sh`) is the enforcement core: type-clean, lint-clean (zero warnings), no circular deps, no cross-layer imports, no files over the size limit, coverage above per-layer thresholds, and the cross-user isolation test present. It runs after every build layer and in CI.
|
|
112
|
+
|
|
113
|
+
## The workflow it enables
|
|
114
|
+
|
|
115
|
+
After scaffolding, open the project in Claude Code and drive the pipeline:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
/infra-setup # generates src/ and installs dependencies (run once)
|
|
119
|
+
/write-roadmap # decompose the product into an ordered set of feature specs
|
|
120
|
+
/write-spec # write ONE feature spec — you review it and mark it READY
|
|
121
|
+
/write-plan # derive a layered, checkboxed execution plan from the spec
|
|
122
|
+
/build-layer # build ONE layer → gate → auto-fix (max 3) → commit → you confirm → next
|
|
123
|
+
/garbage-collect # end-of-feature cleanup + quality score update
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The agent does the typing; **you own the specs and the merges**; the gate catches mistakes mechanically. You review *decisions*, not lint errors.
|
|
127
|
+
|
|
128
|
+
## Requirements
|
|
129
|
+
|
|
130
|
+
- **Node.js ≥ 18** to run the scaffolder itself.
|
|
131
|
+
- Individual templates may need more:
|
|
132
|
+
- `nextjs` / `express` / `nestjs` — Node (see each template's `.nvmrc`), a package manager.
|
|
133
|
+
- `express` also expects Postgres + Redis for local dev (Docker Compose included).
|
|
134
|
+
- `fastapi` — Python 3.11+ and [`uv`](https://github.com/astral-sh/uv).
|
|
135
|
+
|
|
136
|
+
## FAQ
|
|
137
|
+
|
|
138
|
+
**Do I have to use Claude Code?** No — the templates are normal, runnable projects. The `.claude/` workflow is a bonus that makes AI-assisted development disciplined; the gate and architecture stand on their own.
|
|
139
|
+
|
|
140
|
+
**Why is FastAPI (Python) shipped from an npm package?** The scaffolder only *copies files* — it's language-agnostic. npm is just the delivery mechanism, the same way `create-*` tools scaffold non-JS projects.
|
|
141
|
+
|
|
142
|
+
**Can I add my own template?** Yes — see [CONTRIBUTING.md](./CONTRIBUTING.md). Templates live in [`templates/`](./templates); add a folder and register it in `cli.js`.
|
|
143
|
+
|
|
144
|
+
**Does it modify anything outside the target folder?** No. It creates the project directory (refusing to overwrite a non-empty one) and nothing else.
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Templates are the source of truth and live in [`templates/`](./templates). See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to run, test (`npm test` scaffolds every template), and add a stack. Bugs and ideas → [issues](https://github.com/Shreyas1015/create-rigel/issues).
|
|
149
|
+
|
|
150
|
+
## Versioning
|
|
151
|
+
|
|
152
|
+
This project follows [Semantic Versioning](https://semver.org). See the [CHANGELOG](./CHANGELOG.md) for release notes.
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
[MIT](./LICENSE)
|
package/cli.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// create-harness — scaffold an agent-first, gate-enforced starter project.
|
|
3
|
+
// Zero runtime dependencies (Node builtins only), so it publishes with no build step.
|
|
4
|
+
|
|
5
|
+
import { readdir, cp, rename, mkdir, stat } from "node:fs/promises";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { join, dirname, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { createInterface } from "node:readline/promises";
|
|
10
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
11
|
+
|
|
12
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const TEMPLATES_DIR = join(HERE, "templates");
|
|
14
|
+
|
|
15
|
+
const STACKS = {
|
|
16
|
+
nextjs: "Next.js + React + TypeScript (frontend)",
|
|
17
|
+
express: "Express + TypeScript + Sequelize (backend)",
|
|
18
|
+
nestjs: "NestJS + TypeScript (backend)",
|
|
19
|
+
fastapi: "FastAPI + Python (backend)",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function parseArgs(argv) {
|
|
23
|
+
const args = { name: undefined, template: undefined };
|
|
24
|
+
const rest = argv.slice(2);
|
|
25
|
+
for (let i = 0; i < rest.length; i++) {
|
|
26
|
+
const a = rest[i];
|
|
27
|
+
if (a === "--template" || a === "-t") args.template = rest[++i];
|
|
28
|
+
else if (a.startsWith("--template=")) args.template = a.split("=")[1];
|
|
29
|
+
else if (!a.startsWith("-") && !args.name) args.name = a;
|
|
30
|
+
}
|
|
31
|
+
return args;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function prompt(rl, question) {
|
|
35
|
+
const answer = await rl.question(question);
|
|
36
|
+
return answer.trim();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function chooseStack(rl, preset) {
|
|
40
|
+
if (preset && STACKS[preset]) return preset;
|
|
41
|
+
if (preset) {
|
|
42
|
+
console.error(`\n Unknown template "${preset}". Available: ${Object.keys(STACKS).join(", ")}\n`);
|
|
43
|
+
}
|
|
44
|
+
console.log("\n Which stack?\n");
|
|
45
|
+
const keys = Object.keys(STACKS);
|
|
46
|
+
keys.forEach((k, i) => console.log(` ${i + 1}) ${k.padEnd(11)} ${STACKS[k]}`));
|
|
47
|
+
console.log("");
|
|
48
|
+
while (true) {
|
|
49
|
+
const raw = await prompt(rl, " Enter number (1-4): ");
|
|
50
|
+
const idx = Number(raw) - 1;
|
|
51
|
+
if (Number.isInteger(idx) && keys[idx]) return keys[idx];
|
|
52
|
+
console.log(" Please enter a number between 1 and 4.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function isNonEmptyDir(dir) {
|
|
57
|
+
if (!existsSync(dir)) return false;
|
|
58
|
+
const entries = await readdir(dir);
|
|
59
|
+
return entries.length > 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// npm ships templates with `gitignore` (not `.gitignore`, which npm strips).
|
|
63
|
+
// Restore the leading dot in the scaffolded project.
|
|
64
|
+
async function restoreDotfiles(dir) {
|
|
65
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
66
|
+
for (const e of entries) {
|
|
67
|
+
const full = join(dir, e.name);
|
|
68
|
+
if (e.isDirectory()) {
|
|
69
|
+
await restoreDotfiles(full);
|
|
70
|
+
} else if (e.name === "gitignore") {
|
|
71
|
+
await rename(full, join(dir, ".gitignore"));
|
|
72
|
+
} else if (e.name === "npmignore") {
|
|
73
|
+
await rename(full, join(dir, ".npmignore"));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function main() {
|
|
79
|
+
const args = parseArgs(process.argv);
|
|
80
|
+
const rl = createInterface({ input, output });
|
|
81
|
+
try {
|
|
82
|
+
let name = args.name;
|
|
83
|
+
if (!name) name = await prompt(rl, "\n Project directory (\".\" for current): ");
|
|
84
|
+
if (!name) {
|
|
85
|
+
console.error(" No project directory given. Aborting.");
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
const target = resolve(process.cwd(), name);
|
|
89
|
+
|
|
90
|
+
if (name !== "." && (await isNonEmptyDir(target))) {
|
|
91
|
+
console.error(`\n Target "${name}" already exists and is not empty. Aborting.\n`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const stack = await chooseStack(rl, args.template);
|
|
96
|
+
const source = join(TEMPLATES_DIR, stack);
|
|
97
|
+
if (!existsSync(source)) {
|
|
98
|
+
console.error(`\n Template "${stack}" is missing from this package. Aborting.\n`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
await mkdir(target, { recursive: true });
|
|
103
|
+
await cp(source, target, { recursive: true });
|
|
104
|
+
await restoreDotfiles(target);
|
|
105
|
+
|
|
106
|
+
const rel = name === "." ? "." : name;
|
|
107
|
+
console.log(`\n ✓ Scaffolded a "${stack}" project into ${rel}\n`);
|
|
108
|
+
console.log(" Next steps:");
|
|
109
|
+
if (name !== ".") console.log(` cd ${name}`);
|
|
110
|
+
console.log(" git init");
|
|
111
|
+
console.log(" # open in Claude Code, then run the harness setup skill:");
|
|
112
|
+
console.log(" # /infra-setup (generates src/ and installs deps)");
|
|
113
|
+
console.log(" # /write-roadmap → /write-spec → /write-plan → /build-layer\n");
|
|
114
|
+
} finally {
|
|
115
|
+
rl.close();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
main().catch((err) => {
|
|
120
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-rigel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Scaffold an agent-first, gate-enforced starter project — Next.js, Express+TypeScript, NestJS, or FastAPI — wired for Claude Code.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-rigel": "cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node test/smoke.mjs"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"cli.js",
|
|
14
|
+
"templates",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"rigel",
|
|
22
|
+
"create",
|
|
23
|
+
"harness",
|
|
24
|
+
"template",
|
|
25
|
+
"scaffold",
|
|
26
|
+
"starter",
|
|
27
|
+
"nextjs",
|
|
28
|
+
"express",
|
|
29
|
+
"nestjs",
|
|
30
|
+
"fastapi",
|
|
31
|
+
"claude-code",
|
|
32
|
+
"agentic"
|
|
33
|
+
],
|
|
34
|
+
"author": "Shreyas1015",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/Shreyas1015/create-rigel.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/Shreyas1015/create-rigel/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/Shreyas1015/create-rigel#readme",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# CLAUDE.md — Agent Entry Point
|
|
2
|
+
|
|
3
|
+
You are an agent-first backend engineer working on a TypeScript + Express + Sequelize project.
|
|
4
|
+
Read this file first on every session. Then read the active execution plan before touching any code.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Skill Freshness Check
|
|
9
|
+
|
|
10
|
+
Before following any skill that installs or configures a library (those with a non-empty `libraries:` list in their frontmatter — e.g. `/infra-setup`, `/build-layer`, `/db-optimize`, `/load-test`):
|
|
11
|
+
|
|
12
|
+
1. Read the skill's `verified:` date in its frontmatter.
|
|
13
|
+
2. If `verified:` is more than `staleness-threshold-days` (default 60) old:
|
|
14
|
+
- For each library in `libraries:`, run `npm show <library> version` to confirm the latest stable version.
|
|
15
|
+
- If the latest major version differs from what the skill assumes, check the library's changelog for breaking changes before proceeding.
|
|
16
|
+
- Update the skill's `verified:` date and adjust its instructions if anything changed.
|
|
17
|
+
3. Skills with `libraries: []` are process-only — no freshness check needed.
|
|
18
|
+
|
|
19
|
+
If `npm show` / network is unavailable, fall back to the skill as written (degraded but functional) and note the staleness in your summary.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Cardinal Rules (memorise these)
|
|
24
|
+
|
|
25
|
+
1. **Read the active plan first** — `docs/exec-plans/active/`
|
|
26
|
+
2. **If no plan exists** — run `/write-roadmap` (whole product) or `/write-spec` (one feature), then `/write-plan`, before any code
|
|
27
|
+
3. **Never write code without a plan** — document intent before implementation
|
|
28
|
+
4. **Gate must PASS before commit** — never skip `/validate-layer`
|
|
29
|
+
5. **Auto-fix gate failures** — fix silently, log what was fixed, re-run gate
|
|
30
|
+
6. **One layer at a time** — complete + gate + commit before the next
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Session Start Checklist
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
1. ls docs/exec-plans/active/ → is there an active plan?
|
|
38
|
+
2. If yes → read it, find first unchecked layer, run /build-layer
|
|
39
|
+
3. If no → ask human: whole product or one feature?
|
|
40
|
+
whole product → /write-roadmap | one feature → /write-spec
|
|
41
|
+
4. Never assume — check the repo state first
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## The Layer Build Loop (automated by /build-layer)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Read active plan
|
|
50
|
+
→ find first [ ] unchecked layer
|
|
51
|
+
→ read path-scoped rules for that layer type
|
|
52
|
+
→ write the layer files
|
|
53
|
+
→ run gate-checker agent
|
|
54
|
+
→ if FAIL: auto-fix all items, log fixes, re-run gate (max 3 attempts)
|
|
55
|
+
→ if PASS: update plan checkbox, write ADR if non-obvious decision, commit, push
|
|
56
|
+
→ present summary to human
|
|
57
|
+
→ WAIT for human confirmation before next layer
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Gate Failure = Auto-Fix (not escalation)
|
|
63
|
+
|
|
64
|
+
When the gate fails:
|
|
65
|
+
- Fix it yourself
|
|
66
|
+
- Log exactly what was fixed and why
|
|
67
|
+
- Re-run the gate
|
|
68
|
+
- Only escalate if the fix requires a product/architecture decision
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Observability on Every Boundary
|
|
73
|
+
|
|
74
|
+
Every service method must emit:
|
|
75
|
+
```typescript
|
|
76
|
+
logger.info({ event: 'domain.action', ...context, durationMs })
|
|
77
|
+
span.setAttributes({ ... })
|
|
78
|
+
```
|
|
79
|
+
No silent operations. No fire-and-forget without logging.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick Reference
|
|
84
|
+
|
|
85
|
+
| Thing | Location |
|
|
86
|
+
|---|---|
|
|
87
|
+
| Navigation map | `AGENTS.md` |
|
|
88
|
+
| Layer rules | `ARCHITECTURE.md` |
|
|
89
|
+
| Active plan | `docs/exec-plans/active/` |
|
|
90
|
+
| Slash commands | `AGENTS.md#slash-commands` |
|
|
91
|
+
| Spec format | `docs/PLANS.md` |
|
|
92
|
+
| Quality grades | `docs/QUALITY_SCORE.md` |
|
|
93
|
+
| Tech debt | `docs/exec-plans/tech-debt-tracker.md` |
|
|
94
|
+
| Engineering beliefs | `docs/design-docs/core-beliefs.md` |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Stack Reference
|
|
99
|
+
|
|
100
|
+
Versions are intentionally unpinned — `/infra-setup` installs the latest LTS of each.
|
|
101
|
+
Run the Skill Freshness Check before relying on version-specific behaviour.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Runtime: Node 24 LTS, TypeScript, Express
|
|
105
|
+
ORM: Sequelize + sequelize-typescript, sequelize-cli
|
|
106
|
+
Auth: jose (JWT), argon2 (passwords)
|
|
107
|
+
Queue: BullMQ + ioredis
|
|
108
|
+
Logging: pino
|
|
109
|
+
Tracing: OpenTelemetry SDK
|
|
110
|
+
Validation: zod
|
|
111
|
+
Security: helmet, cors, express-rate-limit + rate-limit-redis
|
|
112
|
+
Testing: jest, ts-jest, supertest
|
|
113
|
+
Tooling: tsx, ESLint, prettier, madge, husky
|
|
114
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arch-validator
|
|
3
|
+
description: Deep architecture compliance scan. More thorough than gate-checker. Use when you suspect drift or before a major refactor.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Bash]
|
|
6
|
+
color: orange
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the architecture validator. Run a comprehensive compliance scan of the entire codebase.
|
|
10
|
+
|
|
11
|
+
## Scans
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
echo "=== Circular Imports ==="
|
|
15
|
+
npx madge --circular src/ --extensions ts
|
|
16
|
+
|
|
17
|
+
echo "=== Cross-Layer Violations ==="
|
|
18
|
+
# Service importing runtime
|
|
19
|
+
grep -rn "from.*runtime" src/services/ --include="*.ts"
|
|
20
|
+
# Repo importing service
|
|
21
|
+
grep -rn "from.*services" src/repo/ --include="*.ts"
|
|
22
|
+
# Utils importing domain
|
|
23
|
+
grep -rn "from.*\.\." src/utils/ --include="*.ts" | grep -Ev "node:|path|crypto|url"
|
|
24
|
+
# Types importing anything
|
|
25
|
+
grep -rn "^import" src/types/ --include="*.ts" | grep -v "from 'zod'"
|
|
26
|
+
|
|
27
|
+
echo "=== File Sizes ==="
|
|
28
|
+
find src/ -name "*.ts" | xargs wc -l | sort -rn | awk '$1 > 350 { print $0 }' | head -20
|
|
29
|
+
|
|
30
|
+
echo "=== console.log ==="
|
|
31
|
+
grep -rn "console\." src/ --include="*.ts" | grep -v "src/config/"
|
|
32
|
+
|
|
33
|
+
echo "=== process.env ==="
|
|
34
|
+
grep -rn "process\.env" src/ --include="*.ts" | grep -v "src/config/env.ts" | grep -v "src/config/sequelize-cli"
|
|
35
|
+
|
|
36
|
+
echo "=== Unsafe casts on DB data ==="
|
|
37
|
+
grep -rn "as [A-Z][a-zA-Z]*\b" src/repo/ --include="*.ts" | grep -v "as const\|as unknown\|as string\|as number"
|
|
38
|
+
|
|
39
|
+
echo "=== Missing Zod parse in repo returns ==="
|
|
40
|
+
# Flag findAll/findByPk/findOne/create calls not followed by .parse
|
|
41
|
+
grep -rn "await.*\.\(findAll\|findByPk\|findOne\|create\|update\)" src/repo/ --include="*.ts" -A2 | grep -v "parse\|Schema\|throw\|if"
|
|
42
|
+
|
|
43
|
+
echo "=== express imports in services ==="
|
|
44
|
+
grep -rn "from 'express'" src/services/ --include="*.ts"
|
|
45
|
+
|
|
46
|
+
echo "=== offset/skip in repo ==="
|
|
47
|
+
grep -rn "offset:\|\.skip(" src/repo/ --include="*.ts"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Architecture Structural Tests
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx jest tests/architecture/ --no-coverage --verbose
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## TypeScript
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx tsc --noEmit 2>&1
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## ESLint
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx eslint src/ --max-warnings=0 2>&1
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Report Format
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
ARCH VALIDATION — {timestamp}
|
|
72
|
+
|
|
73
|
+
VIOLATIONS (must fix):
|
|
74
|
+
[file:line] [description]
|
|
75
|
+
|
|
76
|
+
WARNINGS (should fix):
|
|
77
|
+
[file:line] [description]
|
|
78
|
+
|
|
79
|
+
CLEAN:
|
|
80
|
+
✓ No circular imports
|
|
81
|
+
✓ No cross-layer violations
|
|
82
|
+
✓ TypeScript compiles
|
|
83
|
+
|
|
84
|
+
OVERALL: ✅ CLEAN / ❌ {N} violations
|
|
85
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: db-optimizer
|
|
3
|
+
description: Audits repo layer for N+1 queries, missing indexes, and offset pagination. Run before shipping any feature that adds DB queries.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Bash]
|
|
6
|
+
color: orange
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a PostgreSQL performance engineer reviewing the repository layer.
|
|
10
|
+
|
|
11
|
+
## Checks
|
|
12
|
+
|
|
13
|
+
### N+1 Detection
|
|
14
|
+
|
|
15
|
+
Scan for any `Model.findAll/findOne/findByPk` call inside a `for`/`forEach`/`map` loop.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Flag pattern: await inside loop
|
|
19
|
+
grep -rn "for\|forEach\|\.map" src/repo/ --include="*.ts" -A3 | grep -B2 "await.*\."
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For each N+1 found: provide the single-query `include: [{ model: X }]` fix.
|
|
23
|
+
|
|
24
|
+
### Pagination Audit
|
|
25
|
+
|
|
26
|
+
Every method returning an array must have cursor pagination.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
grep -rn "findAll\|list\|getAll\|search" src/repo/ --include="*.ts"
|
|
30
|
+
# Check each: does it accept cursor? does it use Op.lt on createdAt + id?
|
|
31
|
+
grep -rn "offset:\|\.skip(" src/repo/ # should be empty
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Index Audit
|
|
35
|
+
|
|
36
|
+
For every `where:` clause in repo files, identify the columns filtered.
|
|
37
|
+
Check `src/models/` for index definitions on those columns.
|
|
38
|
+
Flag: any filter column without a corresponding index on a table that will grow.
|
|
39
|
+
|
|
40
|
+
### Zod Parse Audit
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
grep -rn "return raw\|\.toJSON() as\|raw as " src/repo/
|
|
44
|
+
# Every occurrence is a violation
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Soft Delete Audit
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Models should have paranoid: true — findAll auto-filters deleted
|
|
51
|
+
grep -rn "@Table" src/models/ --include="*.ts" | grep -v "paranoid"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Output Format
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
APPROVED — all repo patterns correct.
|
|
58
|
+
|
|
59
|
+
OR
|
|
60
|
+
|
|
61
|
+
CRITICAL:
|
|
62
|
+
1. N+1 in application.repo.ts:45
|
|
63
|
+
Current: loads notes for each application in loop
|
|
64
|
+
Fix: include: [{ model: Note }] on the parent findAll
|
|
65
|
+
|
|
66
|
+
HIGH:
|
|
67
|
+
2. Missing index in application.repo.ts:89
|
|
68
|
+
Query: WHERE user_id = ? AND stage = ?
|
|
69
|
+
Missing: composite index (user_id, stage)
|
|
70
|
+
Add to model: indexes: [{ fields: ['user_id', 'stage'] }]
|
|
71
|
+
Migration: CREATE INDEX CONCURRENTLY idx_applications_user_stage ON applications(user_id, stage)
|
|
72
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-gardener
|
|
3
|
+
description: Scans documentation for staleness and fixes it. Called by /doc-garden skill. Use when docs feel out of sync with reality.
|
|
4
|
+
model: claude-opus-4-8
|
|
5
|
+
tools: [Read, Write, Bash]
|
|
6
|
+
color: green
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are the documentation gardener. Your job is to keep docs in sync with reality.
|
|
10
|
+
|
|
11
|
+
## What to Check
|
|
12
|
+
|
|
13
|
+
### AGENTS.md
|
|
14
|
+
|
|
15
|
+
- Skills table matches files in `.claude/skills/`?
|
|
16
|
+
- Agents table matches files in `.claude/agents/`?
|
|
17
|
+
- Navigation table matches actual `docs/` folders?
|
|
18
|
+
|
|
19
|
+
### ARCHITECTURE.md
|
|
20
|
+
|
|
21
|
+
- Source directory structure shown matches actual `src/` layout?
|
|
22
|
+
- Layer definitions match what's in the actual source?
|
|
23
|
+
|
|
24
|
+
### docs/product-specs/index.md
|
|
25
|
+
|
|
26
|
+
- Every spec in `draft/` and `ready/` has a row?
|
|
27
|
+
- Status of each row matches the `Status:` field inside the file?
|
|
28
|
+
|
|
29
|
+
### .env.example
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Find all vars in env.ts schema
|
|
33
|
+
grep -o "z\.\(string\|number\|enum\|coerce\)" src/config/env.ts | wc -l
|
|
34
|
+
# Compare with vars in .env.example
|
|
35
|
+
grep -c "^[A-Z]" .env.example
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Every variable in `EnvSchema` has a corresponding line in `.env.example`?
|
|
39
|
+
|
|
40
|
+
### docs/design-docs/decisions/index.md
|
|
41
|
+
|
|
42
|
+
- Every `.md` file in `decisions/` is listed in the index table?
|
|
43
|
+
|
|
44
|
+
## For Each Stale Item
|
|
45
|
+
|
|
46
|
+
1. Update the document to match reality
|
|
47
|
+
2. Note: `Updated: {file} — {what changed}`
|
|
48
|
+
|
|
49
|
+
## Output
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
DOC GARDEN — {timestamp}
|
|
53
|
+
|
|
54
|
+
Updated:
|
|
55
|
+
- [file]: [what changed]
|
|
56
|
+
|
|
57
|
+
No changes needed:
|
|
58
|
+
- [file] ✓
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If anything changed:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git add docs/ AGENTS.md ARCHITECTURE.md .env.example
|
|
65
|
+
git commit -m "docs: doc garden — sync stale documentation"
|
|
66
|
+
git push origin main
|
|
67
|
+
```
|