@ecc-hgy/ae 0.2.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/bin/ae.js +2 -0
  4. package/package.json +43 -0
  5. package/skills/brainstorming/SKILL.md +133 -0
  6. package/skills/diagnose/SKILL.md +146 -0
  7. package/skills/diagnose/assets/issue-7-sections.md +35 -0
  8. package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
  9. package/skills/grill-me/SKILL.md +10 -0
  10. package/skills/handoff/SKILL.md +19 -0
  11. package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
  12. package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  13. package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
  14. package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
  15. package/skills/improve-codebase-architecture/SKILL.md +101 -0
  16. package/skills/review/SKILL.md +119 -0
  17. package/skills/tdd/SKILL.md +157 -0
  18. package/skills/tdd/deep-modules.md +33 -0
  19. package/skills/tdd/interface-design.md +31 -0
  20. package/skills/tdd/mocking.md +59 -0
  21. package/skills/tdd/refactoring.md +10 -0
  22. package/skills/tdd/tests.md +61 -0
  23. package/skills/to-issues/SKILL.md +79 -0
  24. package/skills/to-issues/todo-template.md +25 -0
  25. package/skills/to-prd/SKILL.md +108 -0
  26. package/skills/verification-before-completion/SKILL.md +153 -0
  27. package/skills/writing-plans/SKILL.md +115 -0
  28. package/skills/zoom-out/SKILL.md +7 -0
  29. package/src/cli.js +62 -0
  30. package/src/commands/init.js +190 -0
  31. package/src/commands/setup.js +111 -0
  32. package/src/skeleton.js +209 -0
  33. package/src/utils/copy.js +100 -0
  34. package/src/utils/paths.js +60 -0
  35. package/src/utils/report.js +31 -0
  36. package/templates/ae-rules.md +17 -0
  37. package/templates/entries/AGENTS.md +21 -0
  38. package/templates/entries/CLAUDE.md +21 -0
  39. package/templates/entries/README.md +18 -0
  40. package/templates/entries/handoff.md +1 -0
  41. package/templates/entries/spec/INDEX.md +15 -0
  42. package/templates/entries/spec/README.md +19 -0
@@ -0,0 +1,31 @@
1
+ # Interface Design for Testability
2
+
3
+ Good interfaces make testing natural:
4
+
5
+ 1. **Accept dependencies, don't create them**
6
+
7
+ ```typescript
8
+ // Testable
9
+ function processOrder(order, paymentGateway) {}
10
+
11
+ // Hard to test
12
+ function processOrder(order) {
13
+ const gateway = new StripeGateway();
14
+ }
15
+ ```
16
+
17
+ 2. **Return results, don't produce side effects**
18
+
19
+ ```typescript
20
+ // Testable
21
+ function calculateDiscount(cart): Discount {}
22
+
23
+ // Hard to test
24
+ function applyDiscount(cart): void {
25
+ cart.total -= discount;
26
+ }
27
+ ```
28
+
29
+ 3. **Small surface area**
30
+ - Fewer methods = fewer tests needed
31
+ - Fewer params = simpler test setup
@@ -0,0 +1,59 @@
1
+ # When to Mock
2
+
3
+ Mock at **system boundaries** only:
4
+
5
+ - External APIs (payment, email, etc.)
6
+ - Databases (sometimes - prefer test DB)
7
+ - Time/randomness
8
+ - File system (sometimes)
9
+
10
+ Don't mock:
11
+
12
+ - Your own classes/modules
13
+ - Internal collaborators
14
+ - Anything you control
15
+
16
+ ## Designing for Mockability
17
+
18
+ At system boundaries, design interfaces that are easy to mock:
19
+
20
+ **1. Use dependency injection**
21
+
22
+ Pass external dependencies in rather than creating them internally:
23
+
24
+ ```typescript
25
+ // Easy to mock
26
+ function processPayment(order, paymentClient) {
27
+ return paymentClient.charge(order.total);
28
+ }
29
+
30
+ // Hard to mock
31
+ function processPayment(order) {
32
+ const client = new StripeClient(process.env.STRIPE_KEY);
33
+ return client.charge(order.total);
34
+ }
35
+ ```
36
+
37
+ **2. Prefer SDK-style interfaces over generic fetchers**
38
+
39
+ Create specific functions for each external operation instead of one generic function with conditional logic:
40
+
41
+ ```typescript
42
+ // GOOD: Each function is independently mockable
43
+ const api = {
44
+ getUser: (id) => fetch(`/users/${id}`),
45
+ getOrders: (userId) => fetch(`/users/${userId}/orders`),
46
+ createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
47
+ };
48
+
49
+ // BAD: Mocking requires conditional logic inside the mock
50
+ const api = {
51
+ fetch: (endpoint, options) => fetch(endpoint, options),
52
+ };
53
+ ```
54
+
55
+ The SDK approach means:
56
+ - Each mock returns one specific shape
57
+ - No conditional logic in test setup
58
+ - Easier to see which endpoints a test exercises
59
+ - Type safety per endpoint
@@ -0,0 +1,10 @@
1
+ # Refactor Candidates
2
+
3
+ After TDD cycle, look for:
4
+
5
+ - **Duplication** → Extract function/class
6
+ - **Long methods** → Break into private helpers (keep tests on public interface)
7
+ - **Shallow modules** → Combine or deepen
8
+ - **Feature envy** → Move logic to where data lives
9
+ - **Primitive obsession** → Introduce value objects
10
+ - **Existing code** the new code reveals as problematic
@@ -0,0 +1,61 @@
1
+ # Good and Bad Tests
2
+
3
+ ## Good Tests
4
+
5
+ **Integration-style**: Test through real interfaces, not mocks of internal parts.
6
+
7
+ ```typescript
8
+ // GOOD: Tests observable behavior
9
+ test("user can checkout with valid cart", async () => {
10
+ const cart = createCart();
11
+ cart.add(product);
12
+ const result = await checkout(cart, paymentMethod);
13
+ expect(result.status).toBe("confirmed");
14
+ });
15
+ ```
16
+
17
+ Characteristics:
18
+
19
+ - Tests behavior users/callers care about
20
+ - Uses public API only
21
+ - Survives internal refactors
22
+ - Describes WHAT, not HOW
23
+ - One logical assertion per test
24
+
25
+ ## Bad Tests
26
+
27
+ **Implementation-detail tests**: Coupled to internal structure.
28
+
29
+ ```typescript
30
+ // BAD: Tests implementation details
31
+ test("checkout calls paymentService.process", async () => {
32
+ const mockPayment = jest.mock(paymentService);
33
+ await checkout(cart, payment);
34
+ expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
35
+ });
36
+ ```
37
+
38
+ Red flags:
39
+
40
+ - Mocking internal collaborators
41
+ - Testing private methods
42
+ - Asserting on call counts/order
43
+ - Test breaks when refactoring without behavior change
44
+ - Test name describes HOW not WHAT
45
+ - Verifying through external means instead of interface
46
+
47
+ ```typescript
48
+ // BAD: Bypasses interface to verify
49
+ test("createUser saves to database", async () => {
50
+ await createUser({ name: "Alice" });
51
+ const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
52
+ expect(row).toBeDefined();
53
+ });
54
+
55
+ // GOOD: Verifies through interface
56
+ test("createUser makes user retrievable", async () => {
57
+ const user = await createUser({ name: "Alice" });
58
+ const retrieved = await getUser(user.id);
59
+ expect(retrieved.name).toBe("Alice");
60
+ });
61
+ ```
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: to-issues
3
+ description: Break a design (and supporting spec context) into vertical-slice tasks and save them as `spec/needs/<need-name>/todo.md`. Use when user wants to convert a design into actionable tasks (S1 node A4).
4
+ ---
5
+
6
+ # To Issues
7
+
8
+ Break a plan into independently-grabbable issues using vertical slices (tracer bullets).
9
+
10
+ ## Process
11
+
12
+ ### 1. Gather context
13
+
14
+ **Primary input:** `spec/needs/<need-name>/design.md` (produced by A3 `writing-plans`).
15
+
16
+ If the design is insufficient on its own (acceptance criteria not concrete enough, scope boundaries unclear, or a slice references behavior that's defined elsewhere), supplement with:
17
+
18
+ - The sibling `spec/needs/<need-name>/prd.md` — for user-facing acceptance criteria, out-of-scope notes
19
+ - The `related-needs` field in `design.md` frontmatter — read those needs' `design.md` for shared module decisions
20
+ - `spec/INDEX.md` and `spec/ADR/` — for vocabulary and accepted cross-need decisions
21
+
22
+ If a design gap is severe enough that you can't draft a slice, STOP and surface it as a finding — go back to A3 (`writing-plans`) to patch `design.md` first, rather than guessing.
23
+
24
+ ### 2. Explore the codebase (optional)
25
+
26
+ If you have not already explored the codebase, do so to understand the current state of the code. Task titles and descriptions should use vocabulary from `spec/INDEX.md` and existing `spec/needs/*/`, and respect ADRs under `spec/ADR/`.
27
+
28
+ ### 3. Draft vertical slices
29
+
30
+ Break the plan into **tracer bullet** issues. Each issue is a thin vertical slice that cuts through ALL integration layers end-to-end, NOT a horizontal slice of one layer.
31
+
32
+ <vertical-slice-rules>
33
+ - Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)
34
+ - A completed slice is demoable or verifiable on its own
35
+ - Prefer many thin slices over few thick ones
36
+ </vertical-slice-rules>
37
+
38
+ ### 4. Quiz the user
39
+
40
+ Present the proposed breakdown as a numbered list. For each slice, show:
41
+
42
+ - **Title**: short descriptive name
43
+ - **Acceptance**: one-line acceptance criterion (the observable behavior that proves it's done)
44
+ - **Blocked by**: which other slices (if any) must complete first; reference by slice number (e.g. "T2")
45
+
46
+ Ask the user:
47
+
48
+ - Does the granularity feel right? (too coarse / too fine)
49
+ - Are the dependency relationships correct?
50
+ - Should any slices be merged or split further?
51
+
52
+ Iterate until the user approves the breakdown.
53
+
54
+ ### 5. Save the task list to `todo.md`
55
+
56
+ Save the approved breakdown to `spec/needs/<need-name>/todo.md`, using [`todo-template.md`](todo-template.md) as the starting structure. The template encodes the format and the maintenance rules; copy it, fill in the slices, then save.
57
+
58
+ `todo.md` has NO frontmatter — it is a rolling working artifact, not a stateful spec document.
59
+
60
+ Format summary (full rules live in [`todo-template.md`](todo-template.md)):
61
+
62
+ - Two sections: `## 实施` (executable slices) and `## 阻塞 / 待澄清` (open blockers)
63
+ - Slice IDs: `T<n>` for tasks, `B<n>` for blockers; stable across the life of the need
64
+ - Each `## 实施` line: `- [ ] T<n> <title> — <one-line acceptance>[; blocked by T<m>]`
65
+ - Each slice MUST trace back to a section in `design.md`; if it can't, that's a signal to patch `design.md`, not to smuggle scope into `todo.md`
66
+
67
+ ## After Saving
68
+
69
+ 1. Update `spec/INDEX.md`:
70
+ - Set the `todo` column to `0/N` (where N = total tasks in `## 实施`)
71
+ - Recompute the `当前节点` column per the rules in `spec-framework.md` §INDEX 推导规则 (likely now `A5 执行`)
72
+ - If unsure, run `/ae-index-rebuild` for an idempotent rescan
73
+ 2. Hand off to the next S1 node: A5 `tdd` will read this `todo.md` (plus `design.md`) and drive the red-green-refactor loop. Tell the user the task list is ready and recommend invoking `tdd` next.
74
+
75
+ ## Boundaries
76
+
77
+ - This skill writes ONLY `spec/needs/<need-name>/todo.md` (plus the INDEX row). It does NOT modify `prd.md` or `design.md`.
78
+ - A task in `todo.md` MUST trace back to a section in `design.md`. New scope discovered here is a signal to patch `design.md` first.
79
+ - This skill does NOT execute tasks — that is A5 `tdd`.
@@ -0,0 +1,25 @@
1
+ # Todo - <need-name>
2
+
3
+ > Derived from: prd.md + design.md
4
+
5
+ ## 实施
6
+
7
+ - [ ] T1 <title> — <one-line acceptance>
8
+ - [ ] T2 <title> — <one-line acceptance>; blocked by T1
9
+ - [ ] T3 <title> — <one-line acceptance>
10
+
11
+ ## 阻塞 / 待澄清
12
+
13
+ - B1 <blocker description, link back to the design section that needs sharpening>
14
+
15
+ <!--
16
+ Rules for maintaining this file (see also `spec-framework.md` §frontmatter / todo.md):
17
+
18
+ - NO frontmatter — this is a rolling working artifact, not a stateful spec document.
19
+ - Use `- [ ]` for unfinished, `- [x]` for finished. Never delete completed items — they are visible history.
20
+ - Sort by dependency order (blockers first); within the same level, sort by suggested execution order.
21
+ - If a slice depends on a design decision that is still open, put it in `## 阻塞 / 待澄清` instead of `## 实施`.
22
+ - Each slice MUST be traceable to a section in `design.md`. If a new slice has no traceable design section, that itself is a finding — go back and patch `design.md` rather than smuggling new scope into `todo.md` (matches `spec-framework.md` §边界规则: "todo 不应该出现 design 里没提的事").
23
+ - Slice identifiers: `T<n>` for execution tasks, `B<n>` for blockers. Stable across the life of the need; do not renumber.
24
+ - Acceptance criteria: a single observable behavior that proves the slice is done. If it needs multiple lines, the slice is probably too coarse — split it.
25
+ -->
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: to-prd
3
+ description: Turn the current conversation context into a PRD and save it to `spec/needs/<need-name>/prd.md` with frontmatter. Use when user wants to create a PRD from the current context (S1 node A2).
4
+ ---
5
+
6
+ This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.
7
+
8
+ ## Process
9
+
10
+ 1. Explore the repo to understand the current state of the codebase, if you haven't already. Use vocabulary from `spec/INDEX.md` and existing `spec/needs/*/prd.md` throughout the PRD, and respect ADRs under `spec/ADR/`.
11
+
12
+ 2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can.
13
+
14
+ Check with the user that these seams match their expectations.
15
+
16
+ 2.5. Align the `need-name` (kebab-case) with the user. This is the slug used to create `spec/needs/<need-name>/`. Surface a concrete suggestion derived from the PRD topic and confirm before writing.
17
+
18
+ 3. Write the PRD using the template below. Save it to `spec/needs/<need-name>/prd.md` with the frontmatter block shown below the template. After saving, update `spec/INDEX.md` (add or update the row for this need) — or run `/ae-index-rebuild` to recompute.
19
+
20
+ <prd-template>
21
+
22
+ ## Problem Statement
23
+
24
+ The problem that the user is facing, from the user's perspective.
25
+
26
+ ## Solution
27
+
28
+ The solution to the problem, from the user's perspective.
29
+
30
+ ## User Stories
31
+
32
+ A LONG, numbered list of user stories. Each user story should be in the format of:
33
+
34
+ 1. As an <actor>, I want a <feature>, so that <benefit>
35
+
36
+ <user-story-example>
37
+ 1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
38
+ </user-story-example>
39
+
40
+ This list of user stories should be extremely extensive and cover all aspects of the feature.
41
+
42
+ ## Implementation Decisions
43
+
44
+ A list of implementation decisions that were made. This can include:
45
+
46
+ - The modules that will be built/modified
47
+ - The interfaces of those modules that will be modified
48
+ - Technical clarifications from the developer
49
+ - Architectural decisions
50
+ - Schema changes
51
+ - API contracts
52
+ - Specific interactions
53
+
54
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
55
+
56
+ Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts — not a working demo, just the important bits.
57
+
58
+ ## Testing Decisions
59
+
60
+ A list of testing decisions that were made. Include:
61
+
62
+ - A description of what makes a good test (only test external behavior, not implementation details)
63
+ - Which modules will be tested
64
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
65
+
66
+ ## Out of Scope
67
+
68
+ A description of the things that are out of scope for this PRD.
69
+
70
+ ## Further Notes
71
+
72
+ Any further notes about the feature.
73
+
74
+ </prd-template>
75
+
76
+ ## Frontmatter (prepend to `prd.md`)
77
+
78
+ Every `prd.md` MUST start with this frontmatter block:
79
+
80
+ ```yaml
81
+ ---
82
+ status: draft # draft | active | archived
83
+ last-aligned: YYYY-MM-DD # ISO date of the most recent alignment with the user
84
+ related-needs: [] # other need-names that share scope; omit if none
85
+ ---
86
+ ```
87
+
88
+ State transitions:
89
+
90
+ - `draft` → `active` when the user has explicitly approved the PRD content (A1 alignment confirmed)
91
+ - `active` → `archived` when superseded or the need is dropped (do not delete the file)
92
+
93
+ `last-aligned` MUST be updated every time the PRD is edited after user re-alignment.
94
+
95
+ ## After Saving
96
+
97
+ 1. Update `spec/INDEX.md`:
98
+ - If the need is new: add a row under `## 需求`
99
+ - If updating: set the `prd` column to `active`
100
+ - Recompute the `当前节点` column per the rules in `spec-framework.md` §INDEX 推导规则
101
+ - If unsure, run `/ae-index-rebuild` for an idempotent rescan
102
+ 2. Hand off to the next S1 node: A3 `writing-plans` will read this `prd.md` and produce `spec/needs/<need-name>/design.md`. Tell the user the PRD is ready and recommend invoking `writing-plans` next.
103
+
104
+ ## Boundaries
105
+
106
+ - This skill writes ONLY `spec/needs/<need-name>/prd.md` (plus the INDEX row). It does NOT write `design.md` or `todo.md`.
107
+ - The PRD captures WHAT and WHY (business / product language). It does NOT capture HOW (technical decisions, file paths, code) — those belong in `design.md` (A3).
108
+ - If the alignment surfaces a decision that affects MULTIPLE needs (e.g. "globally use Postgres"), flag it for promotion to `spec/ADR/` rather than embedding it in this PRD.
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: verification-before-completion
3
+ description: Use at S1 node A6 - end-to-end verification on the real user path before claiming the need is complete, and before A -> B user acceptance. Requires running real-path verification (NOT mocked) and confirming output before any success claim. Evidence before assertions always. Failing this is the most common A-loop self-deception.
4
+ ---
5
+
6
+ # Verification Before Completion
7
+
8
+ ## Overview
9
+
10
+ Claiming work is complete without verification is dishonesty, not efficiency.
11
+
12
+ **Core principle:** Evidence before claims, always.
13
+
14
+ **Violating the letter of this rule is violating the spirit of this rule.**
15
+
16
+ ## The Iron Law
17
+
18
+ ```
19
+ NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
20
+ ```
21
+
22
+ If you haven't run the verification command in this message, you cannot claim it passes.
23
+
24
+ ## The Gate Function
25
+
26
+ ```
27
+ BEFORE claiming any status or expressing satisfaction:
28
+
29
+ 1. IDENTIFY: What command proves this claim?
30
+ 2. RUN: Execute the FULL command (fresh, complete)
31
+ 3. READ: Full output, check exit code, count failures
32
+ 4. VERIFY: Does output confirm the claim?
33
+ - If NO: State actual status with evidence
34
+ - If YES: State claim WITH evidence
35
+ 5. ONLY THEN: Make the claim
36
+
37
+ Skip any step = lying, not verifying
38
+ ```
39
+
40
+ ## Common Failures
41
+
42
+ | Claim | Requires | Not Sufficient |
43
+ |-------|----------|----------------|
44
+ | Tests pass | Test command output: 0 failures | Previous run, "should pass" |
45
+ | Linter clean | Linter output: 0 errors | Partial check, extrapolation |
46
+ | Build succeeds | Build command: exit 0 | Linter passing, logs look good |
47
+ | Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
48
+ | Regression test works | Red-green cycle verified | Test passes once |
49
+ | Agent completed | VCS diff shows changes | Agent reports "success" |
50
+ | Requirements met | Line-by-line checklist | Tests passing |
51
+ | **Need complete (A6)** | **End-to-end run of the real user path described in `prd.md` Solution / User Stories - observe expected outputs at every step** | Unit + integration tests green; lint clean; mocked end-to-end pass |
52
+
53
+ ## Red Flags - STOP
54
+
55
+ - Using "should", "probably", "seems to"
56
+ - Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
57
+ - About to commit/push/PR without verification
58
+ - Trusting agent success reports
59
+ - Relying on partial verification
60
+ - Thinking "just this once"
61
+ - Tired and wanting work over
62
+ - **ANY wording implying success without having run verification**
63
+
64
+ ## Rationalization Prevention
65
+
66
+ | Excuse | Reality |
67
+ |--------|---------|
68
+ | "Should work now" | RUN the verification |
69
+ | "I'm confident" | Confidence ≠ evidence |
70
+ | "Just this once" | No exceptions |
71
+ | "Linter passed" | Linter ≠ compiler |
72
+ | "Agent said success" | Verify independently |
73
+ | "I'm tired" | Exhaustion ≠ excuse |
74
+ | "Partial check is enough" | Partial proves nothing |
75
+ | "Different words so rule doesn't apply" | Spirit over letter |
76
+
77
+ ## Key Patterns
78
+
79
+ **Tests:**
80
+ ```
81
+ ✅ [Run test command] [See: 34/34 pass] "All tests pass"
82
+ ❌ "Should pass now" / "Looks correct"
83
+ ```
84
+
85
+ **Regression tests (TDD Red-Green):**
86
+ ```
87
+ ✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
88
+ ❌ "I've written a regression test" (without red-green verification)
89
+ ```
90
+
91
+ **Build:**
92
+ ```
93
+ ✅ [Run build] [See: exit 0] "Build passes"
94
+ ❌ "Linter passed" (linter doesn't check compilation)
95
+ ```
96
+
97
+ **Requirements:**
98
+ ```
99
+ ✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
100
+ ❌ "Tests pass, phase complete"
101
+ ```
102
+
103
+ **Agent delegation:**
104
+ ```
105
+ ✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
106
+ ❌ Trust agent report
107
+ ```
108
+
109
+ ## When To Apply
110
+
111
+ **ALWAYS before:**
112
+ - ANY variation of success/completion claims
113
+ - ANY expression of satisfaction
114
+ - ANY positive statement about work state
115
+ - Committing, PR creation, task completion
116
+ - Moving to next task
117
+ - Delegating to agents
118
+
119
+ **Rule applies to:**
120
+ - Exact phrases
121
+ - Paraphrases and synonyms
122
+ - Implications of success
123
+ - ANY communication suggesting completion/correctness
124
+
125
+ ## The Bottom Line
126
+
127
+ **No shortcuts for verification.**
128
+
129
+ Run the command. Read the output. THEN claim the result.
130
+
131
+ This is non-negotiable.
132
+
133
+ ## After Verification (S1 node A6)
134
+
135
+ If verification passes:
136
+
137
+ 1. Update `spec/INDEX.md`:
138
+ - Recompute `当前节点` per `spec-framework.md` INDEX rules - for a fresh need this becomes "B1 user acceptance" (the next node is user-driven, not skill-driven)
139
+ - If unsure, run `/ae-index-rebuild`
140
+ 2. Hand off to B1: tell the user the need is ready for their hands-on acceptance test. Do NOT mark anything `archived` - `archived` is reserved for needs that get superseded, not completed.
141
+
142
+ If verification fails:
143
+
144
+ 1. Do NOT update INDEX.
145
+ 2. Return to A5 `tdd` with the failing evidence; if the failure reveals a design gap, escalate to A3 `writing-plans` to patch `design.md`.
146
+
147
+ ## Distinction from B-side verification
148
+
149
+ - **A6 (this skill)** = developer self-verification on the real user path; runs BEFORE handing the need to the user
150
+ - **B1** = user-driven hands-on verification; user uses the product per `prd.md`, reports back
151
+ - **B6** = user re-verification after a B5 fix; same nature as B1, just post-fix
152
+
153
+ A6 passing does NOT mean the need is done. Only B1 (or B6 in a B-loop) closes the need.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: writing-plans
3
+ description: Use when you have a PRD (`spec/needs/<need-name>/prd.md`) approved at S1 node A2, before touching code. Produces ONLY `design.md` — the task list lives in `todo.md` (A4 to-issues).
4
+ ---
5
+
6
+ # Writing Plans
7
+
8
+ ## Hard Constraint (S1 node A3)
9
+
10
+ This skill produces ONLY `spec/needs/<need-name>/design.md`. It MUST NOT produce a `todo.md` or any task-level checklist — that is the job of A4 `to-issues`, which reads this `design.md` and breaks it into `todo.md`.
11
+
12
+ If the plan is not yet aligned with the user on key technical trade-offs (e.g. library choice, data model, integration seam), STOP and align before writing the design. A3 has a hard gate: undecided key trade-offs ⇒ do not advance to A4.
13
+
14
+ ## Overview
15
+
16
+ Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
17
+
18
+ Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.
19
+
20
+ **Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
21
+
22
+ **Input:** `spec/needs/<need-name>/prd.md` (produced by A2 `to-prd`). Also read `spec/INDEX.md`, related `spec/needs/*/design.md` if `related-needs` is set, and any `spec/ADR/` decisions that constrain this design.
23
+
24
+ **Save design to:** `spec/needs/<need-name>/design.md` (overwriting if present and `status: draft`; if `status: active`, ask the user before overwriting).
25
+
26
+ ## Scope Check
27
+
28
+ If the spec covers multiple independent subsystems, it should have been broken into sub-project specs during brainstorming. If it wasn't, suggest breaking this into separate plans — one per subsystem. Each plan should produce working, testable software on its own.
29
+
30
+ ## File Structure
31
+
32
+ Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in.
33
+
34
+ - Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility.
35
+ - You reason best about code you can hold in context at once, and your edits are more reliable when files are focused. Prefer smaller, focused files over large ones that do too much.
36
+ - Files that change together should live together. Split by responsibility, not by technical layer.
37
+ - In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure - but if a file you're modifying has grown unwieldy, including a split in the plan is reasonable.
38
+
39
+ This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.
40
+
41
+ ## Design Document Header
42
+
43
+ Every `design.md` MUST start with this frontmatter block followed by the header:
44
+
45
+ ```yaml
46
+ ---
47
+ status: draft # draft | active | archived
48
+ last-aligned: YYYY-MM-DD # ISO date of the most recent alignment with the user
49
+ related-needs: [] # other need-names whose design constrains this one; omit if none
50
+ ---
51
+ ```
52
+
53
+ ```markdown
54
+ # [Need Name] Design
55
+
56
+ **Goal:** [One sentence describing what this builds — should match `prd.md` Problem/Solution]
57
+
58
+ **Architecture:** [2-3 sentences about approach]
59
+
60
+ **Tech Stack:** [Key technologies/libraries]
61
+
62
+ **Out of scope:** [Things this design explicitly does not address — usually inherited from `prd.md` Out of Scope]
63
+
64
+ ---
65
+ ```
66
+
67
+ State transitions:
68
+
69
+ - `draft` → `active` when the user has explicitly approved key technical trade-offs (A3 gate cleared)
70
+ - `active` → `archived` when superseded or the need is dropped (do not delete the file)
71
+
72
+ ## No Placeholders
73
+
74
+ Every step must contain the actual content an engineer needs. These are **plan failures** — never write them:
75
+ - "TBD", "TODO", "implement later", "fill in details"
76
+ - "Add appropriate error handling" / "add validation" / "handle edge cases"
77
+ - "Write tests for the above" (without actual test code)
78
+ - "Similar to Task N" (repeat the code — the engineer may be reading tasks out of order)
79
+ - Steps that describe what to do without showing how (code blocks required for code steps)
80
+ - References to types, functions, or methods not defined in any task
81
+
82
+ ## Remember
83
+ - Exact file paths always
84
+ - Complete code in every step — if a step changes code, show the code
85
+ - Exact commands with expected output
86
+ - DRY, YAGNI, TDD, frequent commits
87
+
88
+ ## Self-Review
89
+
90
+ After writing the complete plan, look at the spec with fresh eyes and check the plan against it. This is a checklist you run yourself — not a subagent dispatch.
91
+
92
+ **1. PRD coverage:** Skim each section/requirement in `prd.md`. Can you point to a section of `design.md` that addresses it? List any gaps.
93
+
94
+ **2. Placeholder scan:** Search your design for red flags — any of the patterns from the "No Placeholders" section above. Fix them.
95
+
96
+ **3. Type consistency:** Do the types, method signatures, and property names you used across sections match? A function called `clearLayers()` in §3 but `clearFullLayers()` in §7 is a bug.
97
+
98
+ **4. ADR promotion check:** Does any decision in this design affect MORE THAN ONE need? If yes, it does not belong in `design.md` — promote it to `spec/ADR/NNNN-<title>.md` (frontmatter `status: proposed`) and reference the ADR from this design. Typical signals: "globally use X", "all needs share Y", "the project standard for Z is...".
99
+
100
+ If you find issues, fix them inline. No need to re-review — just fix and move on. If you find a spec requirement with no task, add the task.
101
+
102
+ ## After Saving
103
+
104
+ 1. Update `spec/INDEX.md`:
105
+ - Set the `design` column to `active` (or `draft` if key trade-offs still need user approval)
106
+ - Recompute the `当前节点` column per the rules in `spec-framework.md` §INDEX 推导规则
107
+ - If unsure, run `/ae-index-rebuild` for an idempotent rescan
108
+ 2. If you promoted any decision to `spec/ADR/`, also add a row under `## ADR` in `INDEX.md`.
109
+ 3. Hand off to the next S1 node: A4 `to-issues` will read this `design.md` and produce `spec/needs/<need-name>/todo.md`. Tell the user the design is ready and recommend invoking `to-issues` next.
110
+
111
+ ## Boundaries
112
+
113
+ - This skill writes ONLY `spec/needs/<need-name>/design.md` (plus the INDEX row, and optionally a new ADR). It does NOT write `todo.md` or any task-level checklist — that is A4.
114
+ - The design captures HOW (technical decisions, modules, interfaces, data flow, key trade-offs). It does NOT re-capture WHAT — refer back to `prd.md` instead.
115
+ - Decisions affecting MORE THAN ONE need belong in `spec/ADR/`, not here (see Self-Review step 4).
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: zoom-out
3
+ description: Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ I don't know this area of code well. Go up a layer of abstraction. Give me a map of all the relevant modules and callers, using the project's domain glossary vocabulary.