@quanticjs/create-app 0.1.1
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/dist/deps.d.ts +4 -0
- package/dist/deps.js +97 -0
- package/dist/deps.js.map +1 -0
- package/dist/generators/backend.d.ts +2 -0
- package/dist/generators/backend.js +20 -0
- package/dist/generators/backend.js.map +1 -0
- package/dist/generators/bff.d.ts +2 -0
- package/dist/generators/bff.js +9 -0
- package/dist/generators/bff.js.map +1 -0
- package/dist/generators/claude.d.ts +2 -0
- package/dist/generators/claude.js +45 -0
- package/dist/generators/claude.js.map +1 -0
- package/dist/generators/docker.d.ts +2 -0
- package/dist/generators/docker.js +10 -0
- package/dist/generators/docker.js.map +1 -0
- package/dist/generators/e2e.d.ts +2 -0
- package/dist/generators/e2e.js +8 -0
- package/dist/generators/e2e.js.map +1 -0
- package/dist/generators/frontend.d.ts +2 -0
- package/dist/generators/frontend.js +28 -0
- package/dist/generators/frontend.js.map +1 -0
- package/dist/generators/module.d.ts +2 -0
- package/dist/generators/module.js +35 -0
- package/dist/generators/module.js.map +1 -0
- package/dist/generators/root.d.ts +2 -0
- package/dist/generators/root.js +7 -0
- package/dist/generators/root.js.map +1 -0
- package/dist/generators/scripts.d.ts +2 -0
- package/dist/generators/scripts.js +10 -0
- package/dist/generators/scripts.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +8 -0
- package/dist/prompts.js +53 -0
- package/dist/prompts.js.map +1 -0
- package/dist/scaffold.d.ts +2 -0
- package/dist/scaffold.js +79 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/utils/exec.d.ts +2 -0
- package/dist/utils/exec.js +14 -0
- package/dist/utils/exec.js.map +1 -0
- package/dist/utils/template.d.ts +10 -0
- package/dist/utils/template.js +20 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/validate.d.ts +4 -0
- package/dist/utils/validate.js +27 -0
- package/dist/utils/validate.js.map +1 -0
- package/package.json +50 -0
- package/templates/backend/app.module.ts.ejs +61 -0
- package/templates/backend/bff.controller.ts.ejs +60 -0
- package/templates/backend/bff.module.ts.ejs +10 -0
- package/templates/backend/bff.service.ts.ejs +6 -0
- package/templates/backend/create-schema.migration.ts.ejs +15 -0
- package/templates/backend/data-source.ts.ejs +13 -0
- package/templates/backend/env.example.ejs +30 -0
- package/templates/backend/main.ts.ejs +43 -0
- package/templates/backend/module.ts.ejs +14 -0
- package/templates/backend/nest-cli.json.ejs +8 -0
- package/templates/backend/package.json.ejs +23 -0
- package/templates/backend/tsconfig.build.json.ejs +4 -0
- package/templates/backend/tsconfig.json.ejs +24 -0
- package/templates/claude/CLAUDE.md.ejs +86 -0
- package/templates/claude/hooks/auto-format.sh +22 -0
- package/templates/claude/hooks/check-secrets.sh +49 -0
- package/templates/claude/hooks/guard-destructive.sh +42 -0
- package/templates/claude/hooks/on-compaction.sh +29 -0
- package/templates/claude/mcp.json +10 -0
- package/templates/claude/rules/api-patterns.md +86 -0
- package/templates/claude/rules/auth-patterns.md +109 -0
- package/templates/claude/rules/backend-patterns.md +421 -0
- package/templates/claude/rules/database-patterns.md +96 -0
- package/templates/claude/rules/docker-patterns.md +86 -0
- package/templates/claude/rules/frontend-patterns.md +262 -0
- package/templates/claude/rules/observability-backend.md +132 -0
- package/templates/claude/rules/observability-frontend.md +49 -0
- package/templates/claude/rules/playwright-mcp.md +80 -0
- package/templates/claude/rules/resilience-ops.md +103 -0
- package/templates/claude/rules/testing-e2e-ui.md +190 -0
- package/templates/claude/rules/testing-patterns.md +94 -0
- package/templates/claude/rules/workflow-backend.md +64 -0
- package/templates/claude/rules/workflow-frontend.md +60 -0
- package/templates/claude/settings.json +68 -0
- package/templates/claude/skills/add-api-endpoint/SKILL.md +59 -0
- package/templates/claude/skills/add-auth-endpoint/SKILL.md +68 -0
- package/templates/claude/skills/add-entity/SKILL.md +56 -0
- package/templates/claude/skills/add-event/SKILL.md +127 -0
- package/templates/claude/skills/add-feature/SKILL.md +20 -0
- package/templates/claude/skills/add-frontend-page/SKILL.md +75 -0
- package/templates/claude/skills/add-handler/SKILL.md +105 -0
- package/templates/claude/skills/add-integration/SKILL.md +176 -0
- package/templates/claude/skills/add-migration/SKILL.md +20 -0
- package/templates/claude/skills/add-module/SKILL.md +89 -0
- package/templates/claude/skills/add-realtime/SKILL.md +119 -0
- package/templates/claude/skills/audit-rules/SKILL.md +120 -0
- package/templates/claude/skills/debugging/SKILL.md +105 -0
- package/templates/claude/skills/docker-dev/SKILL.md +86 -0
- package/templates/claude/skills/e2e-audit/SKILL.md +85 -0
- package/templates/claude/skills/e2e-full/SKILL.md +132 -0
- package/templates/claude/skills/e2e-scan/SKILL.md +171 -0
- package/templates/claude/skills/e2e-verify/SKILL.md +145 -0
- package/templates/claude/skills/fix-bug/SKILL.md +33 -0
- package/templates/claude/skills/implement-spec/SKILL.md +98 -0
- package/templates/claude/skills/review-code/SKILL.md +109 -0
- package/templates/claude/skills/review-spec/SKILL.md +216 -0
- package/templates/claude/skills/run-tests/SKILL.md +37 -0
- package/templates/claude/skills/specify/SKILL.md +87 -0
- package/templates/claude/skills/write-backend-tests/SKILL.md +182 -0
- package/templates/claude/skills/write-ui-tests/SKILL.md +118 -0
- package/templates/docker/Dockerfile.client.ejs +14 -0
- package/templates/docker/Dockerfile.ejs +28 -0
- package/templates/docker/docker-compose.test.yml.ejs +54 -0
- package/templates/docker/docker-compose.yml.ejs +76 -0
- package/templates/docker/nginx.conf.ejs +21 -0
- package/templates/frontend/App.tsx.ejs +64 -0
- package/templates/frontend/DashboardPage.tsx.ejs +37 -0
- package/templates/frontend/LoginPage.tsx.ejs +20 -0
- package/templates/frontend/NotFoundPage.tsx.ejs +15 -0
- package/templates/frontend/api-client.ts.ejs +15 -0
- package/templates/frontend/index.css.ejs +57 -0
- package/templates/frontend/index.html.ejs +13 -0
- package/templates/frontend/main.tsx.ejs +10 -0
- package/templates/frontend/package.json.ejs +16 -0
- package/templates/frontend/playwright.config.ts.ejs +20 -0
- package/templates/frontend/postcss.config.js.ejs +3 -0
- package/templates/frontend/smoke.spec.ts.ejs +37 -0
- package/templates/frontend/tailwind.config.ts.ejs +56 -0
- package/templates/frontend/tsconfig.json.ejs +25 -0
- package/templates/frontend/tsconfig.node.json.ejs +15 -0
- package/templates/frontend/utils.ts.ejs +6 -0
- package/templates/frontend/vite-env.d.ts.ejs +1 -0
- package/templates/frontend/vite.config.ts.ejs +20 -0
- package/templates/root/gitignore.ejs +9 -0
- package/templates/root/prettierrc.ejs +7 -0
- package/templates/scripts/init-db.sh.ejs +8 -0
- package/templates/scripts/save-auth-state.ts.ejs +24 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Implement Spec
|
|
2
|
+
|
|
3
|
+
Implement a feature from an existing spec file, dynamically selecting only the sub-skills required by the spec's technical design.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```
|
|
7
|
+
/implement-spec SPEC-brd-analyzer.md
|
|
8
|
+
/implement-spec SPEC-project-items.md
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
### Step 1: Load and Parse Spec
|
|
14
|
+
1. Read the spec file from `docs/specs/<argument>` (or the full path if provided)
|
|
15
|
+
2. If the argument is ambiguous or missing, list all files in `docs/specs/` and ask the user to pick one using AskUserQuestion
|
|
16
|
+
3. Extract these sections:
|
|
17
|
+
- **Acceptance Criteria** — what "done" looks like
|
|
18
|
+
- **Technical Design** — modules, data model, API, events
|
|
19
|
+
- **Edge Cases** — error handling requirements
|
|
20
|
+
- **Test Plan** — what tests are needed
|
|
21
|
+
|
|
22
|
+
### Step 2: Plan Implementation
|
|
23
|
+
|
|
24
|
+
**Architecture check (MANDATORY first step):** This is a modular monolith. Before planning anything else, answer: does this spec introduce new domain areas that need their own NestJS module? Each distinct bounded context (e.g., "definition storage", "role registry", "billing", "notifications") must be its own module with its own directory, its own NestJS `@Module()`, and communication via `CommandBus`/`QueryBus`. Do NOT dump new domain logic into an existing module as subdirectories with loose services. If the spec introduces new domain areas, `/add-module` is the FIRST sub-skill to invoke.
|
|
25
|
+
|
|
26
|
+
Based on the spec's Technical Design section, determine which sub-skills are needed. Only include what the spec calls for:
|
|
27
|
+
|
|
28
|
+
| Spec mentions... | Run |
|
|
29
|
+
|---|---|
|
|
30
|
+
| New bounded context / module | `/add-module` |
|
|
31
|
+
| New entities or data model changes | `/add-entity` |
|
|
32
|
+
| Database schema changes | `/add-migration` |
|
|
33
|
+
| Commands or queries | `/add-handler` |
|
|
34
|
+
| REST endpoints | `/add-api-endpoint` |
|
|
35
|
+
| Authenticated/role-gated endpoints | `/add-auth-endpoint` |
|
|
36
|
+
| Frontend pages or components | `/add-frontend-page` |
|
|
37
|
+
| External API integration (AI, payment, etc.) | `/add-integration` |
|
|
38
|
+
| Domain events / async messaging | `/add-event` |
|
|
39
|
+
| WebSocket / real-time updates | `/add-realtime` |
|
|
40
|
+
| Backend tests | `/write-backend-tests` |
|
|
41
|
+
| E2E / UI tests | `/write-ui-tests` |
|
|
42
|
+
|
|
43
|
+
Present the plan to the user: which sub-skills will run, in what order, and why. Wait for confirmation before proceeding.
|
|
44
|
+
|
|
45
|
+
### Step 3: Execute Implementation
|
|
46
|
+
**Invoke each selected sub-skill via the Skill tool** in dependency order. Each sub-skill enforces the project's architectural rules (CQRS, validators, thin controllers, etc.) — those rules are the reason sub-skills exist. Writing code directly instead of invoking the skill bypasses every guardrail.
|
|
47
|
+
|
|
48
|
+
Execution order:
|
|
49
|
+
1. Module structure → invoke `/add-module`
|
|
50
|
+
2. Entities → invoke `/add-entity` for each entity
|
|
51
|
+
3. Migrations → invoke `/add-migration`
|
|
52
|
+
4. Handlers → invoke `/add-handler` for each command/query (this creates the Command class, Handler, `.validator.ts` with Zod, and wires `@Validate`)
|
|
53
|
+
5. API endpoints → invoke `/add-api-endpoint` or `/add-auth-endpoint` (this creates thin controllers that only dispatch to CommandBus/QueryBus)
|
|
54
|
+
6. Frontend pages → invoke `/add-frontend-page`
|
|
55
|
+
7. Integrations / events / realtime → invoke `/add-integration`, `/add-event`, `/add-realtime`
|
|
56
|
+
8. Tests → invoke `/write-backend-tests` then `/write-ui-tests`
|
|
57
|
+
|
|
58
|
+
Pass context from the spec into each sub-skill invocation — entity names, field types, endpoint paths, role requirements, etc. come from the spec, not guesswork.
|
|
59
|
+
|
|
60
|
+
**Between sub-skill invocations**, you may write glue code that no sub-skill covers (e.g., a shared service, a converter utility, a parser). But any code that a sub-skill is responsible for (entities, commands, handlers, validators, controllers, tests) MUST be generated by invoking that sub-skill.
|
|
61
|
+
|
|
62
|
+
### Step 4: Verify Against Acceptance Criteria
|
|
63
|
+
1. Run `npm run build && npm test`
|
|
64
|
+
2. Walk through each acceptance criterion from the spec
|
|
65
|
+
3. For any criterion that isn't covered by the implementation, flag it to the user
|
|
66
|
+
4. If E2E tests are in the test plan, run `/write-ui-tests`
|
|
67
|
+
|
|
68
|
+
### Step 5: Create Implementation PR
|
|
69
|
+
1. Create branch: `git checkout -b feat/<feature-slug>`
|
|
70
|
+
2. Stage all implementation files (NOT the spec file — it's already merged)
|
|
71
|
+
3. Commit with a message referencing the spec: `feat(<module>): implement <feature-name>`
|
|
72
|
+
4. Push and open PR:
|
|
73
|
+
```bash
|
|
74
|
+
gh pr create \
|
|
75
|
+
--title "feat(<module>): <feature-name>" \
|
|
76
|
+
--body "## Summary
|
|
77
|
+
Implements \`docs/specs/SPEC-<feature-slug>.md\`
|
|
78
|
+
|
|
79
|
+
## Changes
|
|
80
|
+
<bullet list of what was added>
|
|
81
|
+
|
|
82
|
+
## Acceptance Criteria
|
|
83
|
+
<checklist copied from spec>
|
|
84
|
+
|
|
85
|
+
## Test Coverage
|
|
86
|
+
- [ ] Unit tests pass
|
|
87
|
+
- [ ] E2E tests pass (if applicable)
|
|
88
|
+
- [ ] All acceptance criteria verified"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Rules
|
|
92
|
+
- NEVER guess what to build — every decision comes from the spec
|
|
93
|
+
- NEVER skip sub-skills that the spec's Technical Design requires
|
|
94
|
+
- NEVER run sub-skills the spec doesn't call for
|
|
95
|
+
- NEVER write code directly that a sub-skill is responsible for — always invoke the sub-skill via the Skill tool. Sub-skills enforce architectural rules (CQRS pipeline, `@Validate` + `.validator.ts`, thin controllers dispatching to CommandBus/QueryBus, `Result<T>`, `getTransactionalRepo`). Writing the code yourself bypasses all of these guardrails. If you find yourself writing a Command class, a Handler, a `.validator.ts`, a Controller, an Entity, or a test file without having invoked the corresponding sub-skill, STOP — you are doing it wrong.
|
|
96
|
+
- If the spec is incomplete or ambiguous, ask the user BEFORE implementing
|
|
97
|
+
- Always present the implementation plan and get confirmation before step 3
|
|
98
|
+
- The spec file itself is never modified or committed by this skill
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-code
|
|
3
|
+
description: Multi-dimensional code review (quality, security, app logic) grounded in .claude/rules/. Classifies findings as Blocker, Suggestion, or Nit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review Code — Quality, Security, Logic
|
|
7
|
+
|
|
8
|
+
Senior-engineer review across three dimensions, grounded in the project's rules in `.claude/rules/`. Every finding must cite a rule or a concrete reason, reference `file:line`, and carry a severity.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
```
|
|
12
|
+
/review-code # review all uncommitted + unpushed changes
|
|
13
|
+
/review-code <path> # review a file or directory
|
|
14
|
+
/review-code main...HEAD # review a branch vs main
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### Step 1: Scope
|
|
20
|
+
- Default: `git diff --name-only HEAD` + `git diff --name-only main...HEAD`
|
|
21
|
+
- If a path/range is provided, scope the review to that
|
|
22
|
+
- Read every changed file in full — do NOT rely on the diff alone
|
|
23
|
+
|
|
24
|
+
### Step 2: Load Applicable Rules
|
|
25
|
+
Only load the rules that match the changed surface area:
|
|
26
|
+
|
|
27
|
+
| Changed area | Rules to apply |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `src/**/*.ts` | `backend-patterns.md`, `database-patterns.md` (if entity/migration) |
|
|
30
|
+
| `client/src/**/*.{ts,tsx}` | `frontend-patterns.md` |
|
|
31
|
+
| `*.spec.ts` / `*.test.tsx` | `testing-patterns.md` |
|
|
32
|
+
| `Dockerfile*`, `docker-compose*.yml` | `docker-patterns.md` |
|
|
33
|
+
| Auth-related | `auth-patterns.md` |
|
|
34
|
+
|
|
35
|
+
### Step 3: Three Review Passes
|
|
36
|
+
|
|
37
|
+
#### Pass A — Code Quality
|
|
38
|
+
- Controllers thin? `@Validate` present? `getTransactionalRepo` used? `Result<T>` returned?
|
|
39
|
+
- Validation logic misplaced in handlers?
|
|
40
|
+
- Entity inheritance correct? camelCase columns? no duplicate `@Index`?
|
|
41
|
+
- `.forRoot()` modules only in `app.module.ts`?
|
|
42
|
+
- Frontend: React Query for server state? No tokens in localStorage? No `NodeJS.*` types?
|
|
43
|
+
- Dead code, `console.log`, unused imports, missing error/empty/loading states
|
|
44
|
+
|
|
45
|
+
#### Pass B — Security
|
|
46
|
+
- Auth: JWT guard on every non-`@Public()` route? No token returned to browser?
|
|
47
|
+
- Input: DTO class-validator decorators? Zod in `.validator.ts`? No raw SQL concatenation?
|
|
48
|
+
- Secrets: no hardcoded keys, tokens, passwords?
|
|
49
|
+
- Frontend XSS: no `dangerouslySetInnerHTML`? No tokens in URL params?
|
|
50
|
+
- Logging: no PII, tokens, or secrets in logs?
|
|
51
|
+
|
|
52
|
+
#### Pass C — Application Logic
|
|
53
|
+
- Does the implementation satisfy the intent?
|
|
54
|
+
- Transaction boundaries: multi-step writes in one UoW?
|
|
55
|
+
- Concurrency: race windows protected with `@DistributedLock`?
|
|
56
|
+
- Edge cases: empty input, pagination, null vs undefined
|
|
57
|
+
- Frontend: loading/empty/error states rendered? optimistic update reverts on failure?
|
|
58
|
+
|
|
59
|
+
### Step 4: Classify Every Finding
|
|
60
|
+
|
|
61
|
+
| Severity | Definition |
|
|
62
|
+
|---|---|
|
|
63
|
+
| **Blocker** | Must fix before merge. Breaks a mandatory rule, security hole, or corrupts data. |
|
|
64
|
+
| **Suggestion** | Should fix. Correct but suboptimal — missed caching, weak test coverage, unclear naming. |
|
|
65
|
+
| **Nit** | Optional polish. Style, wording, micro-refactor. |
|
|
66
|
+
|
|
67
|
+
Rules of thumb:
|
|
68
|
+
- If a `.claude/rules/` file says **NEVER** or **MANDATORY** → Blocker
|
|
69
|
+
- If it is a **security** or **data-integrity** concern → Blocker
|
|
70
|
+
- If behavior is correct but surprising to a future reader → Suggestion
|
|
71
|
+
- If removing the finding wouldn't change approval → Nit
|
|
72
|
+
|
|
73
|
+
### Step 5: Output
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
## Code Review — <scope>
|
|
77
|
+
|
|
78
|
+
**Files reviewed:** N **Passes:** Quality · Security · Logic
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### BLOCKERS (must fix) — <count>
|
|
83
|
+
|
|
84
|
+
1. `file:line` · Dimension · rule reference
|
|
85
|
+
One-line description and fix.
|
|
86
|
+
|
|
87
|
+
### SUGGESTIONS (should fix) — <count>
|
|
88
|
+
|
|
89
|
+
2. `file:line` · Dimension
|
|
90
|
+
One-line description.
|
|
91
|
+
|
|
92
|
+
### NITS (optional) — <count>
|
|
93
|
+
|
|
94
|
+
3. `file:line` · Dimension
|
|
95
|
+
One-line description.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### Verdict
|
|
100
|
+
- **N Blockers** — do not merge until resolved
|
|
101
|
+
- **M Suggestions** — address in this PR if cheap
|
|
102
|
+
- **K Nits** — author's discretion
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Rules
|
|
106
|
+
- NEVER invent a rule — every Blocker cites `.claude/rules/` or a concrete security reason
|
|
107
|
+
- NEVER mark a style preference as Blocker
|
|
108
|
+
- NEVER review files you haven't read in full
|
|
109
|
+
- Keep each finding to 1-2 sentences
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Review Spec
|
|
2
|
+
|
|
3
|
+
Review an existing spec against `.claude/rules/` and the `/implement-spec` contract. Produces a gap report, then writes a corrected copy that a developer can implement without surprises.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```
|
|
7
|
+
/review-spec SPEC-brd-analyzer.md
|
|
8
|
+
/review-spec --all # batch — review every spec in docs/specs/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Process
|
|
12
|
+
|
|
13
|
+
### Step 1: Load Spec(s)
|
|
14
|
+
|
|
15
|
+
1. Read the spec file from `docs/specs/<argument>` (or the full path if provided)
|
|
16
|
+
2. If `--all`, list every `SPEC-*.md` in `docs/specs/` and process each one sequentially
|
|
17
|
+
3. If the argument is ambiguous or missing, list all files in `docs/specs/` and ask the user to pick one using AskUserQuestion
|
|
18
|
+
|
|
19
|
+
### Step 2: Load Rules
|
|
20
|
+
|
|
21
|
+
Read **all** rule files from `.claude/rules/` in parallel:
|
|
22
|
+
|
|
23
|
+
| File | Covers |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `backend-patterns.md` | CQRS, validators, thin controllers, Result\<T\>, UoW, module boundaries, Redis Streams, feature flags |
|
|
26
|
+
| `frontend-patterns.md` | State management, TanStack Query, Zustand, error handling, provider stack, shadcn/ui, TypeScript strict |
|
|
27
|
+
| `auth-patterns.md` | BFF flow, cookie config, token storage, permission model, Socket.IO auth |
|
|
28
|
+
| `database-patterns.md` | TypeORM code-first, camelCase columns, schema-per-module, migration rules |
|
|
29
|
+
| `api-patterns.md` | OpenAPI decorators, DTO patterns, Result→HTTP mapping, RFC 9457 |
|
|
30
|
+
| `testing-patterns.md` | Three backend layers, three frontend layers, CI pipeline |
|
|
31
|
+
| `testing-e2e-ui.md` | Playwright 4-state coverage, auth mocking, semantic locators |
|
|
32
|
+
| `docker-patterns.md` | Compose architecture, Vite proxy, port mapping, E2E isolation |
|
|
33
|
+
| `observability-backend.md` | Pino structured logging, LogBehavior, PII masking, metrics, alerts |
|
|
34
|
+
| `observability-frontend.md` | Sentry, web vitals, correlation IDs |
|
|
35
|
+
| `resilience-ops.md` | Health probes, graceful shutdown, circuit breaker |
|
|
36
|
+
| `playwright-mcp.md` | MCP browser control, snapshot vs screenshot, auth state |
|
|
37
|
+
|
|
38
|
+
Also read the `/specify` skill (`SKILL.md`) and `/implement-spec` skill (`SKILL.md`) to know the spec format contract.
|
|
39
|
+
|
|
40
|
+
### Step 3: Four Review Passes
|
|
41
|
+
|
|
42
|
+
Run each pass against the loaded spec. Track every finding with a severity.
|
|
43
|
+
|
|
44
|
+
#### Pass 1 — Structural Completeness (vs. `/implement-spec` contract)
|
|
45
|
+
|
|
46
|
+
`/implement-spec` expects these sections. Flag any that are missing or empty:
|
|
47
|
+
|
|
48
|
+
| Required Section | What `/implement-spec` extracts from it |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `## Problem` | Context for the implementer |
|
|
51
|
+
| `## Solution` | What to build |
|
|
52
|
+
| `## Acceptance Criteria` | Checklist items — each becomes a verification step |
|
|
53
|
+
| `## Technical Design` | Drives sub-skill selection |
|
|
54
|
+
| `### Affected Modules` | Determines if `/add-module` is needed |
|
|
55
|
+
| `### Data Model Changes` | Drives `/add-entity` + `/add-migration` |
|
|
56
|
+
| `### API Changes` | Drives `/add-api-endpoint` or `/add-auth-endpoint` |
|
|
57
|
+
| `### Events` | Drives `/add-event` |
|
|
58
|
+
| `## Edge Cases` | Error handling requirements |
|
|
59
|
+
| `## Test Plan` | Drives `/write-backend-tests` + `/write-ui-tests` |
|
|
60
|
+
|
|
61
|
+
Also check:
|
|
62
|
+
- Does `### Affected Modules` name specific existing modules or propose new bounded contexts? Vague references like "the backend" are not actionable.
|
|
63
|
+
- Does `### Data Model Changes` list entity names, fields, and types? `/add-entity` needs these.
|
|
64
|
+
- Does `### API Changes` specify HTTP method, path, request/response shape, and auth requirements?
|
|
65
|
+
- Does `## Test Plan` distinguish unit, integration, and E2E tests?
|
|
66
|
+
|
|
67
|
+
#### Pass 2 — Rule Violations
|
|
68
|
+
|
|
69
|
+
Check the spec's technical design against every NEVER and MANDATORY rule. Common violations:
|
|
70
|
+
|
|
71
|
+
**Backend (`backend-patterns.md`):**
|
|
72
|
+
- Proposes injecting services/repositories into controllers (must use CommandBus/QueryBus only)
|
|
73
|
+
- Describes validation logic in handlers (must use `@Validate` + `.validator.ts`)
|
|
74
|
+
- Uses Joi/Yup instead of Zod
|
|
75
|
+
- Proposes throwing HttpException from handlers (must return `Result<T>`)
|
|
76
|
+
- Puts business logic in controllers
|
|
77
|
+
- Imports `.forRoot()` modules in feature modules
|
|
78
|
+
- Proposes direct module-to-module service imports (must use CommandBus/QueryBus)
|
|
79
|
+
|
|
80
|
+
**Auth (`auth-patterns.md`):**
|
|
81
|
+
- Stores tokens in localStorage/sessionStorage
|
|
82
|
+
- Sets Authorization headers from frontend code
|
|
83
|
+
- Reads token claims in frontend JS (must call `/auth/me`)
|
|
84
|
+
- Implements token refresh in frontend (BFF handles it)
|
|
85
|
+
- Adds 401 retry/intercept logic in frontend API client
|
|
86
|
+
|
|
87
|
+
**Database (`database-patterns.md`):**
|
|
88
|
+
- Uses snake_case column names (must be camelCase)
|
|
89
|
+
- Writes manual CREATE TABLE for entities with TypeORM (must use migration:generate)
|
|
90
|
+
- Uses `synchronize: true`
|
|
91
|
+
- Accesses another module's tables directly
|
|
92
|
+
|
|
93
|
+
**Frontend (`frontend-patterns.md`):**
|
|
94
|
+
- Fetches data with useEffect + useState (must use TanStack Query)
|
|
95
|
+
- Copies query data into useState
|
|
96
|
+
- Puts server data in Zustand
|
|
97
|
+
- Uses console.log instead of Sentry
|
|
98
|
+
- Uses `any` type
|
|
99
|
+
- Omits `onError` on mutations
|
|
100
|
+
- Uses react-hook-form directly instead of `@quanticjs/react-forms`
|
|
101
|
+
|
|
102
|
+
**Testing (`testing-patterns.md`, `testing-e2e-ui.md`):**
|
|
103
|
+
- Happy-path-only test plan (must cover error, empty, loading states)
|
|
104
|
+
- Mocks database in integration tests (must use real DB)
|
|
105
|
+
- Uses localStorage for auth in tests (must mock `/auth/me`)
|
|
106
|
+
- Uses CSS selectors in E2E (must use semantic locators)
|
|
107
|
+
|
|
108
|
+
**Resilience (`resilience-ops.md`):**
|
|
109
|
+
- External HTTP calls without circuit breaker
|
|
110
|
+
- Missing health probes
|
|
111
|
+
- Missing graceful shutdown for custom resources
|
|
112
|
+
|
|
113
|
+
**Observability (`observability-backend.md`):**
|
|
114
|
+
- Uses console.log (must use Pino)
|
|
115
|
+
- Logs sensitive data without `logExclude` or `@Log({ logPayload: false })`
|
|
116
|
+
|
|
117
|
+
#### Pass 3 — Missing Edge Cases
|
|
118
|
+
|
|
119
|
+
Check the `## Edge Cases` section against what the rules require:
|
|
120
|
+
|
|
121
|
+
- **Auth edge cases:** unauthenticated access, expired session, insufficient permissions, role escalation
|
|
122
|
+
- **API edge cases:** invalid input (400), not found (404), conflict (409), server error (500)
|
|
123
|
+
- **Frontend edge cases:** loading state, empty state, error state (mandatory per `testing-e2e-ui.md`)
|
|
124
|
+
- **Concurrency:** race conditions on write operations — does the spec mention `@DistributedLock` where needed?
|
|
125
|
+
- **Transaction boundaries:** multi-step writes — does the spec clarify what should be atomic?
|
|
126
|
+
- **Partial failures:** what happens if step 2 of a 3-step operation fails?
|
|
127
|
+
- **Data boundaries:** empty arrays, null values, max-length strings, pagination edge cases
|
|
128
|
+
- **Inter-module:** what if a cross-module command fails? How does the caller handle `Result.failure`?
|
|
129
|
+
|
|
130
|
+
#### Pass 4 — Acceptance Criteria Quality
|
|
131
|
+
|
|
132
|
+
Each criterion must be:
|
|
133
|
+
- **Specific** — names the exact behavior, not vague ("it works")
|
|
134
|
+
- **Testable** — can be turned into an automated test assertion
|
|
135
|
+
- **Complete** — covers the happy path AND at least one failure mode
|
|
136
|
+
- **Measurable** — includes concrete values where applicable (response time, field limits, etc.)
|
|
137
|
+
|
|
138
|
+
Flag criteria that:
|
|
139
|
+
- Use vague language: "should work correctly", "handles errors", "is secure"
|
|
140
|
+
- Are duplicates of other criteria
|
|
141
|
+
- Cannot be verified without manual testing (rephrase so they can be automated)
|
|
142
|
+
- Miss the error/empty/loading states that `testing-e2e-ui.md` mandates for every UI feature
|
|
143
|
+
|
|
144
|
+
### Step 4: Report
|
|
145
|
+
|
|
146
|
+
Output a structured report:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
## Spec Review — SPEC-<name>.md
|
|
150
|
+
|
|
151
|
+
### Pass 1: Structural Completeness
|
|
152
|
+
- [ ] or [x] for each required section
|
|
153
|
+
- Details on what's missing or incomplete
|
|
154
|
+
|
|
155
|
+
### Pass 2: Rule Violations — <count>
|
|
156
|
+
For each violation:
|
|
157
|
+
- **Rule:** <rule-file.md> — <quoted NEVER/MANDATORY>
|
|
158
|
+
- **Spec says:** <what the spec proposes>
|
|
159
|
+
- **Should say:** <what it should propose instead>
|
|
160
|
+
|
|
161
|
+
### Pass 3: Missing Edge Cases — <count>
|
|
162
|
+
For each missing case:
|
|
163
|
+
- **Category:** auth / API / frontend / concurrency / transaction / data
|
|
164
|
+
- **Missing:** <what's not covered>
|
|
165
|
+
- **Required by:** <rule-file.md> or <general best practice>
|
|
166
|
+
|
|
167
|
+
### Pass 4: Acceptance Criteria — <count> issues
|
|
168
|
+
For each issue:
|
|
169
|
+
- **Criterion:** <the problematic criterion>
|
|
170
|
+
- **Problem:** vague / untestable / incomplete / missing failure mode
|
|
171
|
+
- **Suggested rewrite:** <improved criterion>
|
|
172
|
+
|
|
173
|
+
### Summary
|
|
174
|
+
- Structural: X/10 sections present
|
|
175
|
+
- Rule violations: X found
|
|
176
|
+
- Missing edge cases: X found
|
|
177
|
+
- Criteria issues: X found
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Step 5: Write Corrected Spec
|
|
181
|
+
|
|
182
|
+
After presenting the report:
|
|
183
|
+
|
|
184
|
+
1. Write the corrected spec to `docs/specs/SPEC-<slug>-v2.md`
|
|
185
|
+
2. The corrected spec:
|
|
186
|
+
- Fills in all missing sections with actionable content derived from the rules
|
|
187
|
+
- Fixes every rule violation (replaces the violating design with the rule-compliant pattern)
|
|
188
|
+
- Adds missing edge cases with handling strategies
|
|
189
|
+
- Rewrites weak acceptance criteria to be specific and testable
|
|
190
|
+
- Preserves the original spec's intent — only fix what's wrong, don't redesign the feature
|
|
191
|
+
- Adds a comment at the top: `<!-- Reviewed version of SPEC-<slug>.md — see review report for changes -->`
|
|
192
|
+
3. Tell the user: "Corrected spec written to `docs/specs/SPEC-<slug>-v2.md`. Review the changes — if it looks good, replace the original."
|
|
193
|
+
|
|
194
|
+
### Step 6 (batch mode only): Summary Table
|
|
195
|
+
|
|
196
|
+
If `--all` was used, after processing all specs output a summary:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
## Batch Review Summary
|
|
200
|
+
|
|
201
|
+
| Spec | Structural | Violations | Edge Cases | Criteria | Output |
|
|
202
|
+
|---|---|---|---|---|---|
|
|
203
|
+
| SPEC-foo.md | 8/10 | 3 | 2 | 1 | SPEC-foo-v2.md |
|
|
204
|
+
| SPEC-bar.md | 10/10 | 0 | 1 | 0 | SPEC-bar-v2.md |
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Rules
|
|
208
|
+
|
|
209
|
+
- NEVER modify the original spec file — always write to `-v2.md`
|
|
210
|
+
- NEVER invent features or requirements — only fix what violates rules or is structurally incomplete
|
|
211
|
+
- NEVER remove content from the original spec unless it directly contradicts a rule
|
|
212
|
+
- Every rule violation finding MUST cite the specific rule file and the NEVER/MANDATORY clause
|
|
213
|
+
- When filling missing sections, use information from the existing spec — don't fabricate business requirements
|
|
214
|
+
- If a section cannot be filled without domain knowledge (e.g., "what should the empty state say?"), write a `TODO:` placeholder and flag it in the report
|
|
215
|
+
- Preserve the original spec's formatting style and voice
|
|
216
|
+
- If the original spec is already compliant, say so — don't create a `-v2.md` that's identical to the original
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Run Tests
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
- All backend tests: `npm test`
|
|
5
|
+
- Specific file: `npx jest --testPathPattern=<pattern>`
|
|
6
|
+
- Watch mode: `npx jest --watch`
|
|
7
|
+
- Coverage: `npm run test:cov`
|
|
8
|
+
- Frontend unit tests: `cd client && npx vitest run`
|
|
9
|
+
- Frontend E2E tests: `cd client && npx playwright test`
|
|
10
|
+
|
|
11
|
+
## Prerequisites (E2E tests)
|
|
12
|
+
E2E tests run against the Docker stack. Start it before running:
|
|
13
|
+
```bash
|
|
14
|
+
docker compose up -d
|
|
15
|
+
# Wait for healthy
|
|
16
|
+
docker compose ps
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Test Conventions
|
|
20
|
+
| Type | Pattern | Location |
|
|
21
|
+
|------|---------|----------|
|
|
22
|
+
| Backend unit | `*.spec.ts` | Next to the file they test |
|
|
23
|
+
| Backend integration | `test/*.e2e-spec.ts` | `test/` directory |
|
|
24
|
+
| Frontend unit | `*.test.tsx` | `client/src/<path>/__tests__/` |
|
|
25
|
+
| Frontend E2E | `*.spec.ts` | `client/e2e/` |
|
|
26
|
+
|
|
27
|
+
## Test Order
|
|
28
|
+
1. `npm run build` — ensure compilation succeeds
|
|
29
|
+
2. `npm test` — backend unit + integration
|
|
30
|
+
3. `cd client && npx vitest run` — frontend unit
|
|
31
|
+
4. `cd client && npx playwright test` — E2E (requires Docker stack)
|
|
32
|
+
|
|
33
|
+
## Rules
|
|
34
|
+
- Fix test failures before moving on — never skip broken tests
|
|
35
|
+
- Every new handler needs a spec (happy path + failure paths)
|
|
36
|
+
- Frontend tests mock APIs — never depend on running backend
|
|
37
|
+
- E2E tests cover: happy, error, empty, loading states
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Specify Feature
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
`/specify <brief-feature-description>`
|
|
5
|
+
|
|
6
|
+
## Process
|
|
7
|
+
|
|
8
|
+
### Step 1: Interview
|
|
9
|
+
Interview the user about the feature using AskUserQuestion. Cover:
|
|
10
|
+
- **What** — exact behavior, inputs, outputs, edge cases
|
|
11
|
+
- **Why** — business value, who benefits, what problem it solves
|
|
12
|
+
- **Constraints** — performance, security, compatibility, deadlines
|
|
13
|
+
- **UX** — user flow, error states, empty states, loading states
|
|
14
|
+
- **Technical** — which modules are affected, data model changes, API surface
|
|
15
|
+
- **Edge cases** — what happens when things go wrong, concurrent access, partial failures
|
|
16
|
+
- **Testing** — how do we verify this works, what are the acceptance criteria
|
|
17
|
+
|
|
18
|
+
Do not ask obvious questions. Dig into the hard parts the user might not have considered.
|
|
19
|
+
Keep interviewing until all ambiguity is resolved.
|
|
20
|
+
|
|
21
|
+
### Step 2: Write Spec
|
|
22
|
+
Write the complete spec to `docs/specs/SPEC-<feature-slug>.md`:
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
# Feature: <name>
|
|
26
|
+
|
|
27
|
+
## Problem
|
|
28
|
+
<why this feature is needed>
|
|
29
|
+
|
|
30
|
+
## Solution
|
|
31
|
+
<what we are building>
|
|
32
|
+
|
|
33
|
+
## Acceptance Criteria
|
|
34
|
+
- [ ] <measurable criterion>
|
|
35
|
+
- [ ] ...
|
|
36
|
+
|
|
37
|
+
## Technical Design
|
|
38
|
+
### Affected Modules
|
|
39
|
+
### Data Model Changes
|
|
40
|
+
### API Changes
|
|
41
|
+
### Events
|
|
42
|
+
|
|
43
|
+
## Edge Cases
|
|
44
|
+
<each edge case and how it is handled>
|
|
45
|
+
|
|
46
|
+
## Test Plan
|
|
47
|
+
- Unit tests: <what to test>
|
|
48
|
+
- Integration tests: <what to test>
|
|
49
|
+
- E2E tests: <what to test>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 3: Create Spec PR
|
|
53
|
+
After the user confirms the spec:
|
|
54
|
+
|
|
55
|
+
1. Create a feature slug from the spec name (lowercase, hyphenated)
|
|
56
|
+
2. Create branch: `git checkout -b spec/<feature-slug>`
|
|
57
|
+
3. Add only the spec file: `git add docs/specs/SPEC-<feature-slug>.md`
|
|
58
|
+
4. Commit: `git commit -m "spec: <feature-name>"`
|
|
59
|
+
5. Push: `git push -u origin spec/<feature-slug>`
|
|
60
|
+
6. Open PR:
|
|
61
|
+
```bash
|
|
62
|
+
gh pr create \
|
|
63
|
+
--title "Spec: <feature-name>" \
|
|
64
|
+
--body "## Feature Spec: <feature-name>
|
|
65
|
+
|
|
66
|
+
<1-2 sentence summary>
|
|
67
|
+
|
|
68
|
+
**Spec file:** \`docs/specs/SPEC-<feature-slug>.md\`
|
|
69
|
+
|
|
70
|
+
## Review Checklist
|
|
71
|
+
- [ ] Acceptance criteria are clear and testable
|
|
72
|
+
- [ ] Technical design covers all affected modules
|
|
73
|
+
- [ ] Edge cases are addressed
|
|
74
|
+
- [ ] Test plan is complete
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
Once this PR is merged, implementation can begin." \
|
|
78
|
+
--base main \
|
|
79
|
+
--head "spec/<feature-slug>"
|
|
80
|
+
```
|
|
81
|
+
7. Tell the user: "Spec PR created. Once approved and merged, implementation starts."
|
|
82
|
+
|
|
83
|
+
## Rules
|
|
84
|
+
- NEVER start implementing before the spec PR is merged
|
|
85
|
+
- The spec must be detailed enough that someone with no project context can implement it correctly
|
|
86
|
+
- Include acceptance criteria that can be turned into tests
|
|
87
|
+
- Only the spec file goes in the spec/ branch — no code changes
|