@haposoft/cafekit 0.7.22 → 0.7.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -862
- package/bin/install.js +4 -3
- package/package.json +2 -3
- package/src/claude/agents/code-auditor.md +25 -1
- package/src/claude/agents/spec-maker.md +17 -2
- package/src/claude/agents/test-runner.md +22 -3
- package/src/claude/hooks/spec-state.cjs +4 -4
- package/src/claude/migration-manifest.json +1 -1
- package/src/claude/rules/state-sync.md +7 -5
- package/src/claude/skills/code-review/references/spec-compliance-review.md +8 -1
- package/src/claude/skills/develop/SKILL.md +26 -4
- package/src/claude/skills/develop/references/quality-gate.md +23 -13
- package/src/claude/skills/generate-graph/LICENSE +21 -0
- package/src/claude/skills/generate-graph/README.md +523 -0
- package/src/claude/skills/generate-graph/SKILL.md +427 -0
- package/src/claude/skills/generate-graph/agentloop-core.svg +101 -0
- package/src/claude/skills/generate-graph/agents/openai.yaml +4 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style1-flat.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style2-dark.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style3-blueprint.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style4-notion.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style5-glass.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style6-claude.png +0 -0
- package/src/claude/skills/generate-graph/assets/samples/sample-style7-openai.png +0 -0
- package/src/claude/skills/generate-graph/fixtures/agent-memory-types-style4.json +181 -0
- package/src/claude/skills/generate-graph/fixtures/api-flow-style7.json +40 -0
- package/src/claude/skills/generate-graph/fixtures/mem0-style1.json +297 -0
- package/src/claude/skills/generate-graph/fixtures/microservices-style3.json +64 -0
- package/src/claude/skills/generate-graph/fixtures/multi-agent-style5.json +45 -0
- package/src/claude/skills/generate-graph/fixtures/system-architecture-style6.json +48 -0
- package/src/claude/skills/generate-graph/fixtures/tool-call-style2.json +182 -0
- package/src/claude/skills/generate-graph/package.json +42 -0
- package/src/claude/skills/generate-graph/references/icons.md +281 -0
- package/src/claude/skills/generate-graph/references/style-1-flat-icon.md +108 -0
- package/src/claude/skills/generate-graph/references/style-2-dark-terminal.md +107 -0
- package/src/claude/skills/generate-graph/references/style-3-blueprint.md +113 -0
- package/src/claude/skills/generate-graph/references/style-4-notion-clean.md +94 -0
- package/src/claude/skills/generate-graph/references/style-5-glassmorphism.md +125 -0
- package/src/claude/skills/generate-graph/references/style-6-claude-official.md +209 -0
- package/src/claude/skills/generate-graph/references/style-7-openai.md +215 -0
- package/src/claude/skills/generate-graph/references/style-diagram-matrix.md +135 -0
- package/src/claude/skills/generate-graph/references/svg-layout-best-practices.md +100 -0
- package/src/claude/skills/generate-graph/scripts/generate-diagram.sh +157 -0
- package/src/claude/skills/generate-graph/scripts/generate-from-template.py +1556 -0
- package/src/claude/skills/generate-graph/scripts/test-all-styles.sh +135 -0
- package/src/claude/skills/generate-graph/scripts/validate-svg.sh +292 -0
- package/src/claude/skills/generate-graph/templates/agent-architecture.svg +28 -0
- package/src/claude/skills/generate-graph/templates/architecture.svg +23 -0
- package/src/claude/skills/generate-graph/templates/comparison-matrix.svg +14 -0
- package/src/claude/skills/generate-graph/templates/data-flow.svg +28 -0
- package/src/claude/skills/generate-graph/templates/er-diagram.svg +21 -0
- package/src/claude/skills/generate-graph/templates/flowchart.svg +21 -0
- package/src/claude/skills/generate-graph/templates/sequence.svg +20 -0
- package/src/claude/skills/generate-graph/templates/state-machine.svg +20 -0
- package/src/claude/skills/generate-graph/templates/timeline.svg +19 -0
- package/src/claude/skills/generate-graph/templates/use-case.svg +21 -0
- package/src/claude/skills/specs/SKILL.md +38 -7
- package/src/claude/skills/specs/references/codebase-analysis.md +26 -9
- package/src/claude/skills/specs/references/research-strategy.md +3 -3
- package/src/claude/skills/specs/references/review.md +1 -1
- package/src/claude/skills/specs/rules/tasks-generation.md +17 -0
- package/src/claude/skills/specs/templates/design.md +13 -0
- package/src/claude/skills/specs/templates/init.json +4 -1
- package/src/claude/skills/specs/templates/requirements.md +21 -8
- package/src/claude/skills/specs/templates/task.md +16 -3
|
@@ -19,7 +19,7 @@ Analyze → Dependency Scan → Complexity Assessment → Init → Requirements
|
|
|
19
19
|
|
|
20
20
|
**CRITICAL:** Before starting, the system MUST:
|
|
21
21
|
1. Scan `specs/` directory for incomplete specs
|
|
22
|
-
2. If any spec is `in-progress` → ask user whether to continue or create new
|
|
22
|
+
2. If any spec is `in_progress` (accept legacy `in-progress` when reading) → ask user whether to continue or create new
|
|
23
23
|
3. Detect cross-spec dependencies (see `references/cross-spec-dependency.md`)
|
|
24
24
|
|
|
25
25
|
## Core Responsibilities & Rules
|
|
@@ -40,6 +40,12 @@ Analyze → Dependency Scan → Complexity Assessment → Init → Requirements
|
|
|
40
40
|
- Never silently expand or shrink scope
|
|
41
41
|
- If scope change needed → ask user, record reason in `spec.json`
|
|
42
42
|
|
|
43
|
+
### State & Integrity Rules
|
|
44
|
+
- Canonical active status string is `in_progress`. Legacy `in-progress` may be READ for compatibility but MUST NOT be generated in new specs.
|
|
45
|
+
- `current_phase` is required for live work and must track the active phase (`init`, `requirements`, `design`, `tasks`, `develop`, `test`, `review`).
|
|
46
|
+
- `task_files` in `spec.json` MUST exactly match the real files under `tasks/` after Step 7.
|
|
47
|
+
- `ready_for_implementation` is a hard gate, not a convenience flag. Never set it before the finalization audit passes.
|
|
48
|
+
|
|
43
49
|
### Output Criteria
|
|
44
50
|
- Never implement code — only create spec documents
|
|
45
51
|
- Return file paths and a brief summary
|
|
@@ -66,7 +72,7 @@ Display selection menu via `AskUserQuestion`:
|
|
|
66
72
|
"options": [
|
|
67
73
|
{ "label": "Create new spec", "description": "Initialize spec from a feature description" },
|
|
68
74
|
{ "label": "status", "description": "View status of all specs in specs/" },
|
|
69
|
-
{ "label": "resume", "description": "Continue an
|
|
75
|
+
{ "label": "resume", "description": "Continue an active spec" },
|
|
70
76
|
{ "label": "--validate", "description": "Review spec (auto-decides: red team or validation)" },
|
|
71
77
|
{ "label": "archive", "description": "Archive completed specs + write journal" }
|
|
72
78
|
],
|
|
@@ -120,7 +126,7 @@ flowchart TD
|
|
|
120
126
|
K --> L
|
|
121
127
|
L --> M["Step 5: Requirements — write EARS"]
|
|
122
128
|
M --> N{Need deep research?}
|
|
123
|
-
N -->|Yes| O["Research: researchers +
|
|
129
|
+
N -->|Yes| O["Research: researchers + inspector + docs"]
|
|
124
130
|
O --> P["Write research.md"]
|
|
125
131
|
N -->|No| P
|
|
126
132
|
P --> Q["Step 6: Design — pick discovery mode"]
|
|
@@ -202,6 +208,7 @@ Load: `references/scope-inquiry.md`
|
|
|
202
208
|
- Record findings in `research.md` before finalizing design
|
|
203
209
|
- Write `design.md` from template `templates/design.md` (see `rules/design-principles.md`)
|
|
204
210
|
- Add diagrams only when design has multi-step or cross-boundary flows
|
|
211
|
+
- For auth/session, transport/entrypoint, persistence/schema, generated-artifact, or runtime-sensitive work, the design MUST fill the `Canonical Contracts & Invariants` section and tasks MUST inherit the same decisions verbatim.
|
|
205
212
|
- Update `spec.json` phase, timestamps, discovery mode
|
|
206
213
|
|
|
207
214
|
### Step 7: Task Breakdown
|
|
@@ -210,6 +217,7 @@ Load: `references/scope-inquiry.md`
|
|
|
210
217
|
- Load `rules/tasks-generation.md` for core principles
|
|
211
218
|
- Load `rules/tasks-parallel-analysis.md` for parallel markers (default: enabled)
|
|
212
219
|
- Each task file follows template `templates/task.md`
|
|
220
|
+
- Each task file MUST include `Completion Criteria` and `Verification & Evidence` sections detailed enough that a downstream quality gate can prove the task is truly done.
|
|
213
221
|
- Update `spec.json` phase + task metadata
|
|
214
222
|
|
|
215
223
|
#### Requirement-Driven Task Grouping (MANDATORY)
|
|
@@ -240,6 +248,7 @@ tasks/
|
|
|
240
248
|
- If a requirement has only 1 natural task, create 1 file (no forced splitting)
|
|
241
249
|
- If a requirement has many acceptance criteria spanning different concerns → split into multiple task files
|
|
242
250
|
- After generating all tasks: verify **every requirement ID** appears as primary in at least one task file — gaps = failure
|
|
251
|
+
- **Legacy Protection:** If the `research.md` identified existing codebase files or tests that will be broken (Blast Radius), you MUST generate explicitly tasked files (e.g., `task-R5-01-update-legacy-tests.md`) to fix those breakages. Do not leave broken tests out of scope.
|
|
243
252
|
|
|
244
253
|
**Dependency ordering:** Tasks within the same requirement are ordered by natural implementation flow. Cross-requirement dependencies use `Dependencies:` field referencing other task file names.
|
|
245
254
|
|
|
@@ -278,10 +287,20 @@ Load: `references/review.md` + `rules/design-review.md`
|
|
|
278
287
|
- **< 3 task files, no security concerns** → Validate only (lightweight interview)
|
|
279
288
|
- **>= 5 task files OR security/migration keywords** → Red Team first, then Validate
|
|
280
289
|
- **User explicit request** → respect user's intent
|
|
290
|
+
- Set `design_context.validation_recommended = true` if the spec includes any of: auth/session, privacy, deletion, migration, schema change, external AI/provider switching, browser extension permissions, or 5+ task files.
|
|
281
291
|
- When both run: Red Team ALWAYS before Validate (red team may change the spec)
|
|
282
292
|
- **PROHIBITION:** The system MUST NOT skip Red Team because of a prior code-auditor review. Code review ≠ Spec review.
|
|
283
293
|
- **PROHIBITION:** The system MUST NOT create `.ts`, `.js`, `.py` or any implementation files during validation. Spec-only outputs.
|
|
284
294
|
|
|
295
|
+
### Step 9.5: Finalization Audit (MANDATORY)
|
|
296
|
+
- Re-scan the `tasks/` directory and rebuild `spec.json.task_files` from the real filesystem (sorted, relative paths)
|
|
297
|
+
- FAIL if any task file exists on disk but is missing from `task_files`
|
|
298
|
+
- FAIL if any path in `task_files` does not exist on disk
|
|
299
|
+
- FAIL if any requirement or NFR mapping uses non-numeric labels (`NFR-1`, `SEC-1`, etc.)
|
|
300
|
+
- FAIL if a task lacks `Completion Criteria` or `Verification & Evidence`
|
|
301
|
+
- If `validation_recommended = true` and `validation.status` is not `completed` (or an explicit accepted-risk state recorded by the user), `ready_for_implementation` MUST remain `false`
|
|
302
|
+
- Only after this audit passes may the system mark `progress.tasks = "done"` and `ready_for_implementation = true`
|
|
303
|
+
|
|
285
304
|
### Step 10: Completion — Context Reminder (MANDATORY)
|
|
286
305
|
After completing the spec, output a short summary of what was generated, then you MUST output the following block EXACTLY as written. DO NOT use awkward translations like "Điểm đã phản ánh đúng quyết định của bạn", keep it professional or just output the block directly:
|
|
287
306
|
|
|
@@ -299,7 +318,7 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
299
318
|
|
|
300
319
|
| Situation | Action |
|
|
301
320
|
|---|---|
|
|
302
|
-
| A spec is `
|
|
321
|
+
| A spec is `in_progress` | Ask: "You have spec `<name>` at phase `<phase>`. Continue? [Y/n]" |
|
|
303
322
|
| A spec matches current git branch | Ask: "Branch `feature/X` has spec `X`. Activate or create new?" |
|
|
304
323
|
| Nothing found | Create new spec or show menu |
|
|
305
324
|
|
|
@@ -317,17 +336,25 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
317
336
|
|
|
318
337
|
### spec.json Update Rules (MANDATORY)
|
|
319
338
|
|
|
339
|
+
**Canonical status vocabulary:** Use `in_progress`, `blocked`, `done`, and `archived`. New specs MUST NOT emit `in-progress`.
|
|
340
|
+
|
|
320
341
|
**Timestamps:** Each `timestamps.*_done` field MUST use the **actual current time** (ISO 8601 with timezone) when that specific phase completes. Do NOT reuse the `init` timestamp for later phases. If running the full pipeline end-to-end, capture a fresh timestamp at each phase transition.
|
|
321
342
|
|
|
322
343
|
**Approvals (auto-approval behavior):**
|
|
323
344
|
- When running the **full pipeline end-to-end** (init → tasks in one session): set `approvals.{phase}.generated = true` AND `approvals.{phase}.approved = true` for each completed phase before proceeding to the next.
|
|
324
345
|
- When running a **single phase**: set `generated = true` but leave `approved = false` — user must explicitly approve before continuing.
|
|
325
346
|
|
|
347
|
+
**Task inventory:** `task_files` MUST be present and MUST list every real task file exactly once using relative paths like `tasks/task-R1-01-example.md`.
|
|
348
|
+
|
|
349
|
+
**Validation recommendation:** `design_context.validation_recommended` MUST be `true` for auth, privacy, delete-data, migration, schema-change, browser-extension-permission, external-provider, or 5+ task file specs.
|
|
350
|
+
|
|
326
351
|
**`ready_for_implementation`:** This field MUST only be set to `true` when ALL of the following conditions are met:
|
|
327
352
|
1. `approvals.requirements.approved = true`
|
|
328
353
|
2. `approvals.design.approved = true`
|
|
329
354
|
3. `approvals.tasks.approved = true`
|
|
330
355
|
4. `progress.tasks = "done"`
|
|
356
|
+
5. `task_files` matches the real filesystem
|
|
357
|
+
6. If `design_context.validation_recommended = true`, `validation.status = "completed"` (or another explicit user-accepted risk state that is recorded)
|
|
331
358
|
|
|
332
359
|
If any approval is `false`, `ready_for_implementation` MUST remain `false`.
|
|
333
360
|
|
|
@@ -349,7 +376,7 @@ specs/
|
|
|
349
376
|
│ └── ...
|
|
350
377
|
└── reports/ # Auxiliary reports
|
|
351
378
|
├── researcher-01.md
|
|
352
|
-
├──
|
|
379
|
+
├── inspect-report.md
|
|
353
380
|
└── red-team-report.md
|
|
354
381
|
```
|
|
355
382
|
|
|
@@ -358,7 +385,7 @@ specs/
|
|
|
358
385
|
| Command | Purpose | Reference |
|
|
359
386
|
|---|---|---|
|
|
360
387
|
| `/hapo:specs status` | View status of all specs | — |
|
|
361
|
-
| `/hapo:specs resume <feature>` | Continue an
|
|
388
|
+
| `/hapo:specs resume <feature>` | Continue an active spec | — |
|
|
362
389
|
| `/hapo:specs --validate <feature>` | Validate spec (auto: red team + validate based on complexity) | `references/review.md` |
|
|
363
390
|
| `/hapo:specs archive` | Archive completed specs + write journal | `references/archive-workflow.md` |
|
|
364
391
|
|
|
@@ -392,12 +419,16 @@ Before finalizing any specification, assert all the following:
|
|
|
392
419
|
- [ ] **Numeric requirement IDs** assigned to every requirement
|
|
393
420
|
- [ ] **Discovery mode** selected and recorded in spec.json.design_context
|
|
394
421
|
- [ ] **Requirements traceability** matrix present in design.md
|
|
422
|
+
- [ ] **Canonical Contracts & Invariants** filled for auth/transport/persistence/artifact-sensitive work
|
|
395
423
|
- [ ] **Every task file** maps to at least 1 valid in-scope requirement ID
|
|
424
|
+
- [ ] **Every task file** includes `Verification & Evidence` with executable or inspectable proof
|
|
396
425
|
- [ ] **State Machine Blueprint:** design.md contains Mermaid diagrams for non-trivial flows
|
|
397
426
|
- [ ] **Dependency graph complete**: no task can start before its blockers are listed
|
|
398
427
|
- [ ] **Risk matrix filled**: likelihood × impact, with mitigation for High items
|
|
399
428
|
- [ ] **Test strategy defined**: what gets unit tested, integration tested, e2e validated
|
|
400
|
-
- [ ] **
|
|
429
|
+
- [ ] **task_files inventory synced**: no missing or orphaned task references
|
|
430
|
+
- [ ] **Validation gate consistent**: validation_recommended and validation.status agree with spec risk
|
|
431
|
+
- [ ] **spec.json fully updated**: phase, current_phase, progress, timestamps, approvals, design_context
|
|
401
432
|
|
|
402
433
|
## When TO Use
|
|
403
434
|
|
|
@@ -6,7 +6,7 @@ Understand the current codebase before designing solutions — ensure the new sp
|
|
|
6
6
|
|
|
7
7
|
## Skip Conditions
|
|
8
8
|
|
|
9
|
-
- Already provided with
|
|
9
|
+
- Already provided with inspector reports → skip, use directly
|
|
10
10
|
|
|
11
11
|
## 4 Mandatory Files to Read First
|
|
12
12
|
|
|
@@ -17,7 +17,12 @@ Understand the current codebase before designing solutions — ensure the new sp
|
|
|
17
17
|
| 3 | `./docs/code-standards.md` | Coding conventions, language-specific patterns | High |
|
|
18
18
|
| 4 | `./docs/design-guidelines.md` | Design system, branding, UI/UX conventions | If exists |
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Validation & Fallback Protocol (MANDATORY)
|
|
21
|
+
1. **Trust but Verify:** If `codebase-summary.md` or `code-standards.md` exists, you MUST verify their technical claims by cross-checking `package.json`, `go.mod`, etc. (e.g., if Docs say Redux but package.json only has Zustand → Flag documentation as STALE in your research).
|
|
22
|
+
2. **The "Blind Flight" Halt:** If ALL 4 mandatory docs are missing in a non-empty repository:
|
|
23
|
+
- **DO NOT** blindly use `inspector` to scan the whole repo.
|
|
24
|
+
- **HALT** the spec process immediately.
|
|
25
|
+
- Ask the User: *"No codebase documentation found. Exploring blind will drain tokens and produce inaccurate specs. Shall I trigger `docs-keeper` or `/hapo:docs` to generate a baseline `codebase-summary.md` first?"*
|
|
21
26
|
|
|
22
27
|
## Analysis Activities
|
|
23
28
|
|
|
@@ -27,28 +32,40 @@ Understand the current codebase before designing solutions — ensure the new sp
|
|
|
27
32
|
- Identify required dependencies
|
|
28
33
|
- Understand build and deployment processes
|
|
29
34
|
|
|
35
|
+
### 2. Core Data Structures (MANDATORY for Enhancements)
|
|
36
|
+
Before designing any logic, you must identify and read the existing schemas:
|
|
37
|
+
- Tell `inspector` to grep for database schema files (`schema.ts`, `schema.prisma`, entities, migrations).
|
|
38
|
+
- Identify Global State setups (Redux stores, Zustand, React Context).
|
|
39
|
+
- Output the relational impact: How will the new feature alter existing tables or state structures?
|
|
40
|
+
|
|
30
41
|
### 2. Pattern Recognition
|
|
31
42
|
- Study existing patterns in codebase
|
|
32
43
|
- Identify conventions and architectural decisions
|
|
33
44
|
- Note consistency in implementation approaches
|
|
34
45
|
- Understand error handling patterns
|
|
35
46
|
|
|
36
|
-
###
|
|
47
|
+
### 4. Integration Planning
|
|
37
48
|
- Identify how new features integrate with existing architecture
|
|
38
49
|
- Map dependencies between components
|
|
39
50
|
- Understand data flow and state management
|
|
40
51
|
- Consider backward compatibility
|
|
41
52
|
|
|
42
|
-
###
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
53
|
+
### 5. Blast Radius & Regression Check
|
|
54
|
+
Write a "Collateral Damage" section in your `research.md`:
|
|
55
|
+
- List EXACTLY which existing files will need to be modified.
|
|
56
|
+
- **Test Invalidation:** Identify which existing `.test.ts` or `.spec.ts` files will break because of these modifications.
|
|
57
|
+
- Ensure the mitigation for these breaking changes is passed downstream to the Task generation phase.
|
|
58
|
+
|
|
59
|
+
### 6. Inspector Usage (when needed)
|
|
60
|
+
- Use inspector agents for targeted file discovery in large codebases
|
|
61
|
+
- Each inspector targets a specific aspect of the task
|
|
62
|
+
- Wait for all inspectors to report before analysis
|
|
63
|
+
- Save results to `reports/inspect-report.md`
|
|
47
64
|
|
|
48
65
|
## Best Practices
|
|
49
66
|
|
|
50
67
|
- Start with documentation before diving into code
|
|
51
|
-
- Use
|
|
68
|
+
- Use inspectors for targeted file discovery
|
|
52
69
|
- Document patterns found for consistency
|
|
53
70
|
- Note any inconsistencies or technical debt
|
|
54
71
|
- Consider impact on existing features
|
|
@@ -18,7 +18,7 @@ Provide tools and methods to gather necessary information before writing require
|
|
|
18
18
|
| 3 | **Docs seeker** | Look up framework/package docs from official sources | Need to understand external APIs/libraries, find best practices |
|
|
19
19
|
| 4 | **GitHub analysis** (`gh`) | Read action logs, PRs, issues, discussions | Need context from project history, understand past decisions |
|
|
20
20
|
| 5 | **Repomix remote** (`repomix --remote <url>`) | Generate codebase summary from remote repo | Reference how other repos solve similar problems. *(If not installed, use WebFetch as fallback)* |
|
|
21
|
-
| 6 | **
|
|
21
|
+
| 6 | **Inspector agents** | Search for files across large codebases | Find relevant files faster than grep in large projects |
|
|
22
22
|
| 7 | **Debugger delegation** | Hand off to debugger agent for analysis | Investigate root cause of bugs |
|
|
23
23
|
|
|
24
24
|
## Workflow
|
|
@@ -32,7 +32,7 @@ Before detailing requirements, list unanswered questions:
|
|
|
32
32
|
|
|
33
33
|
### 2. Pick the Right Tool
|
|
34
34
|
- Framework/API questions → Docs seeker
|
|
35
|
-
- Current codebase questions →
|
|
35
|
+
- Current codebase questions → Inspector agents
|
|
36
36
|
- Architecture/approach questions → Researcher agents
|
|
37
37
|
- Complex multi-step reasoning → Sequential thinking
|
|
38
38
|
- Historical decision questions → GitHub analysis
|
|
@@ -46,7 +46,7 @@ Before detailing requirements, list unanswered questions:
|
|
|
46
46
|
### 4. Record Findings
|
|
47
47
|
- Write to `research.md` using template `templates/research.md`
|
|
48
48
|
- Save researcher reports to `reports/researcher-{NN}.md`
|
|
49
|
-
- Save
|
|
49
|
+
- Save inspector reports to `reports/inspect-report.md`
|
|
50
50
|
|
|
51
51
|
## Best Practices
|
|
52
52
|
|
|
@@ -7,7 +7,7 @@ Review a spec before implementation. The system auto-decides the review depth ba
|
|
|
7
7
|
## Spec Resolution
|
|
8
8
|
|
|
9
9
|
1. If `<feature>` argument provided → use `specs/<feature>/`
|
|
10
|
-
2. If not → check active spec (spec with `in-progress`
|
|
10
|
+
2. If not → check active spec (spec with `in_progress` status; accept legacy `in-progress` when reading existing files)
|
|
11
11
|
3. If nothing found → ask user to specify path
|
|
12
12
|
|
|
13
13
|
## Auto-Decision: When to Red Team vs Validate
|
|
@@ -32,6 +32,7 @@ Detail bullets must include:
|
|
|
32
32
|
- Validate core functionality early in sequence
|
|
33
33
|
- Respect architecture boundaries defined in design.md (Architecture Pattern & Boundary Map)
|
|
34
34
|
- Honor interface contracts documented in design.md
|
|
35
|
+
- Translate completion criteria into concrete proof (commands, artifacts, routes, manifests, schema objects, UI states)
|
|
35
36
|
- Use major task summaries sparingly—omit detail bullets if the work is fully captured by child tasks.
|
|
36
37
|
|
|
37
38
|
**End with integration tasks** to wire everything together.
|
|
@@ -131,6 +132,22 @@ Every task file MUST contain the Risk Assessment table, even if no risks are ide
|
|
|
131
132
|
- When the design already guarantees functional coverage and rapid MVP delivery is prioritized, mark purely test-oriented follow-up work (e.g., baseline rendering/unit tests) as **optional** using the `- [ ]*` checkbox form.
|
|
132
133
|
- Only apply the optional marker when the sub-task directly references acceptance criteria from requirements.md in its detail bullets.
|
|
133
134
|
- Never mark implementation work or integration-critical verification as optional—reserve `*` for auxiliary/deferrable test coverage that can be revisited post-MVP.
|
|
135
|
+
- Never mark auth, permissions, privacy, data deletion, migration, schema, or contract verification work as optional.
|
|
136
|
+
|
|
137
|
+
### Mandatory Verification & Evidence
|
|
138
|
+
|
|
139
|
+
Every task file MUST include a `## Verification & Evidence` section.
|
|
140
|
+
|
|
141
|
+
That section MUST contain:
|
|
142
|
+
1. **Automated proof** — exact command(s) for typecheck, tests, build, or explicit `N/A`
|
|
143
|
+
2. **Artifact/runtime proof** — exact files, routes, UI surfaces, generated outputs, or persisted state to inspect
|
|
144
|
+
3. **Contract/negative-path proof** — at least one contract-preserving check for unauthorized, invalid, missing-permission, rollback, or failure-path behavior when relevant
|
|
145
|
+
|
|
146
|
+
Rules:
|
|
147
|
+
- If the task produces a build artifact or generated file, name the exact artifact path to inspect.
|
|
148
|
+
- If the task wires entrypoints (popup, content script, route, worker, CLI command), name the exact runtime surface that must exist after implementation.
|
|
149
|
+
- If verification depends on environment or manual setup, document the blocker explicitly instead of implying success.
|
|
150
|
+
- Build success alone is NEVER enough evidence for a completed task.
|
|
134
151
|
|
|
135
152
|
## Task Hierarchy Rules
|
|
136
153
|
|
|
@@ -65,6 +65,19 @@ When modifying existing systems:
|
|
|
65
65
|
|
|
66
66
|
> Keep rationale concise here and, when more depth is required (trade-offs, benchmarks), add a short summary plus pointer to the Supporting References section and `research.md` for raw investigation notes.
|
|
67
67
|
|
|
68
|
+
## Canonical Contracts & Invariants
|
|
69
|
+
|
|
70
|
+
Capture only the contracts whose inconsistency would break downstream implementation or verification. If the feature touches auth/session, transport/entrypoints, persistence/schema, generated artifacts, or runtime outputs, this section is mandatory.
|
|
71
|
+
|
|
72
|
+
| Contract Area | Canonical Decision | Applies To | Must Stay Consistent In |
|
|
73
|
+
|---------------|--------------------|------------|-------------------------|
|
|
74
|
+
| Auth / session | | | |
|
|
75
|
+
| Transport / entrypoints | | | |
|
|
76
|
+
| Data / persistence | | | |
|
|
77
|
+
| Generated artifacts / runtime outputs | | | |
|
|
78
|
+
|
|
79
|
+
> Task files must reuse the same contract wording. If implementation later needs a different contract, update this section first before generating or editing tasks.
|
|
80
|
+
|
|
68
81
|
## System Flows
|
|
69
82
|
|
|
70
83
|
Provide only the diagrams needed to explain non-trivial flows. Use pure Mermaid syntax. Common patterns:
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
"created_at": "{{TIMESTAMP}}",
|
|
4
4
|
"updated_at": "{{TIMESTAMP}}",
|
|
5
5
|
"language": "vi",
|
|
6
|
-
"status": "
|
|
6
|
+
"status": "in_progress",
|
|
7
7
|
"phase": "initialized",
|
|
8
|
+
"current_phase": "init",
|
|
8
9
|
"priority": "P2",
|
|
9
10
|
"effort": null,
|
|
10
11
|
"tags": [],
|
|
@@ -32,6 +33,8 @@
|
|
|
32
33
|
"blockedBy": [],
|
|
33
34
|
"blocks": []
|
|
34
35
|
},
|
|
36
|
+
"task_files": [],
|
|
37
|
+
"blocker": null,
|
|
35
38
|
"progress": {
|
|
36
39
|
"init": "done",
|
|
37
40
|
"requirements": "pending",
|
|
@@ -25,14 +25,27 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- Additional requirements follow the same pattern -->
|
|
27
27
|
|
|
28
|
-
## Non-Functional Requirements
|
|
28
|
+
## Non-Functional Requirements
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
- The [system] shall [measurable performance metric, e.g. "respond within 500ms"]
|
|
32
|
-
- The [system] shall [measurable scale metric, e.g. "support 100 concurrent users"]
|
|
30
|
+
<!-- Continue the SAME numeric sequence as functional requirements. Do NOT switch to labels like NFR-1, SEC-1, PERF-1. -->
|
|
33
31
|
|
|
34
|
-
###
|
|
35
|
-
|
|
32
|
+
### Requirement {{NEXT_REQ_NUMBER}}: Performance & Scalability
|
|
33
|
+
**Objective:** As a system owner, I want predictable performance characteristics, so that the feature remains usable under expected load.
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
#### Acceptance Criteria
|
|
36
|
+
{{NEXT_REQ_NUMBER}}.1 The [system] shall [measurable performance metric, e.g. "respond within 500ms"]
|
|
37
|
+
{{NEXT_REQ_NUMBER}}.2 The [system] shall [measurable scale metric, e.g. "support 100 concurrent users"]
|
|
38
|
+
|
|
39
|
+
### Requirement {{NEXT_REQ_NUMBER_PLUS_ONE}}: Security & Privacy
|
|
40
|
+
**Objective:** As a security/compliance stakeholder, I want the feature to protect sensitive data and enforce access boundaries, so that the system is safe to ship.
|
|
41
|
+
|
|
42
|
+
#### Acceptance Criteria
|
|
43
|
+
{{NEXT_REQ_NUMBER_PLUS_ONE}}.1 The [system] shall [measurable security behavior, e.g. "encrypt data at rest using AES-256"]
|
|
44
|
+
{{NEXT_REQ_NUMBER_PLUS_ONE}}.2 If [unauthorized or invalid condition], the [system] shall [deny or recover with explicit behavior]
|
|
45
|
+
|
|
46
|
+
### Requirement {{NEXT_REQ_NUMBER_PLUS_TWO}}: Reliability & Availability
|
|
47
|
+
**Objective:** As an operator, I want predictable failure handling, so that incidents remain diagnosable and recoverable.
|
|
48
|
+
|
|
49
|
+
#### Acceptance Criteria
|
|
50
|
+
{{NEXT_REQ_NUMBER_PLUS_TWO}}.1 If [failure condition], the [system] shall [recovery behavior]
|
|
51
|
+
{{NEXT_REQ_NUMBER_PLUS_TWO}}.2 The [system] shall [durability / retry / fallback expectation]
|
|
@@ -54,9 +54,21 @@
|
|
|
54
54
|
|
|
55
55
|
## Completion Criteria
|
|
56
56
|
|
|
57
|
-
- [ ] {{Criteria 1 — observable
|
|
58
|
-
- [ ] {{Criteria 2 — measurable
|
|
59
|
-
- [ ] {{Criteria 3 — maps directly to acceptance criteria from requirements.md}}
|
|
57
|
+
- [ ] {{Criteria 1 — observable output or artifact, maps to acceptance criteria R{{REQ_NUMBER}}}}
|
|
58
|
+
- [ ] {{Criteria 2 — measurable behavior or negative-path outcome}}
|
|
59
|
+
- [ ] {{Criteria 3 — maps directly to acceptance criteria from requirements.md and can be proven below}}
|
|
60
|
+
|
|
61
|
+
## Verification & Evidence
|
|
62
|
+
|
|
63
|
+
- [ ] Automated verification
|
|
64
|
+
- Command(s): `{{TYPECHECK / TEST / BUILD COMMANDS OR N/A}}`
|
|
65
|
+
- Expected proof: {{What output, exit code, or report proves success}}
|
|
66
|
+
- [ ] Artifact / runtime verification
|
|
67
|
+
- Inspect: `{{artifact path | route | UI state | DB object | manifest entry}}`
|
|
68
|
+
- Expect: {{Observable result that proves the task is really wired}}
|
|
69
|
+
- [ ] Contract / negative-path verification
|
|
70
|
+
- Check: {{Unauthorized path, validation error, permission omission, missing env behavior, deletion effect, etc.}}
|
|
71
|
+
- Expect: {{Concrete failure mode or contract-preserving behavior}}
|
|
60
72
|
|
|
61
73
|
## Risk Assessment
|
|
62
74
|
|
|
@@ -70,3 +82,4 @@
|
|
|
70
82
|
> **Parallel marker**: Append `(P)` to the title if this task can run concurrently with another (usually when serving different requirements).
|
|
71
83
|
> **Test note**: If a test coverage sub-task can be deferred post-MVP, mark it with `- [ ]*`.
|
|
72
84
|
> **Requirement mapping**: Every sub-task MUST end with `_Requirements: X.X_`. No mapping = invalid task file.
|
|
85
|
+
> **Verification rule**: No `## Verification & Evidence` section = invalid task file.
|