@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.
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/bin/ae.js +2 -0
- package/package.json +43 -0
- package/skills/brainstorming/SKILL.md +133 -0
- package/skills/diagnose/SKILL.md +146 -0
- package/skills/diagnose/assets/issue-7-sections.md +35 -0
- package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
- package/skills/grill-me/SKILL.md +10 -0
- package/skills/handoff/SKILL.md +19 -0
- package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
- package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
- package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
- package/skills/improve-codebase-architecture/SKILL.md +101 -0
- package/skills/review/SKILL.md +119 -0
- package/skills/tdd/SKILL.md +157 -0
- package/skills/tdd/deep-modules.md +33 -0
- package/skills/tdd/interface-design.md +31 -0
- package/skills/tdd/mocking.md +59 -0
- package/skills/tdd/refactoring.md +10 -0
- package/skills/tdd/tests.md +61 -0
- package/skills/to-issues/SKILL.md +79 -0
- package/skills/to-issues/todo-template.md +25 -0
- package/skills/to-prd/SKILL.md +108 -0
- package/skills/verification-before-completion/SKILL.md +153 -0
- package/skills/writing-plans/SKILL.md +115 -0
- package/skills/zoom-out/SKILL.md +7 -0
- package/src/cli.js +62 -0
- package/src/commands/init.js +190 -0
- package/src/commands/setup.js +111 -0
- package/src/skeleton.js +209 -0
- package/src/utils/copy.js +100 -0
- package/src/utils/paths.js +60 -0
- package/src/utils/report.js +31 -0
- package/templates/ae-rules.md +17 -0
- package/templates/entries/AGENTS.md +21 -0
- package/templates/entries/CLAUDE.md +21 -0
- package/templates/entries/README.md +18 -0
- package/templates/entries/handoff.md +1 -0
- package/templates/entries/spec/INDEX.md +15 -0
- package/templates/entries/spec/README.md +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 huguiyuan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Agentic Engineering
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ecc-hgy/ae)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Agentic Engineering is a lightweight personal software lifecycle method: SDD records what to build, TDD drives how to prove it works. It is delivered as a zero-dependency npm CLI plus agent skills for Claude Code and Codex.
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
cd /your/project
|
|
12
|
+
npx @ecc-hgy/ae setup
|
|
13
|
+
# Optional: edit config/ae-rules.md
|
|
14
|
+
npx @ecc-hgy/ae init "one-line project goal"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`ae setup` installs reusable method assets:
|
|
18
|
+
|
|
19
|
+
- `skills/` -> `.claude/skills/`
|
|
20
|
+
- `skills/` -> `.codex/skills/`
|
|
21
|
+
- `templates/ae-rules.md` -> `config/ae-rules.md`
|
|
22
|
+
|
|
23
|
+
`ae init` creates the platform-neutral project skeleton, renders entry files, and syncs the contents of `config/ae-rules.md` into the managed `AE:RULES` block in `AGENTS.md` and `CLAUDE.md`.
|
|
24
|
+
|
|
25
|
+
## CLI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ae setup
|
|
29
|
+
ae init "one-line project goal"
|
|
30
|
+
ae init "goal" --rules /path/to/rules.md
|
|
31
|
+
ae --help
|
|
32
|
+
ae --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Both commands are idempotent. They create missing files, skip existing files, and never overwrite user edits outside the managed `AE:RULES` block. There is no `--force` mode.
|
|
36
|
+
|
|
37
|
+
`ae init` requires `ae setup` to have run first. This keeps the two-step workflow explicit so you can edit `config/ae-rules.md` before it is injected.
|
|
38
|
+
|
|
39
|
+
## Platform Scope
|
|
40
|
+
|
|
41
|
+
Current target platforms:
|
|
42
|
+
|
|
43
|
+
- Claude Code: skills installed to `.claude/skills/`
|
|
44
|
+
- Codex: skills installed to `.codex/skills/`
|
|
45
|
+
|
|
46
|
+
Cursor and Trae support is intentionally deferred until their stable local skill/rule loading conventions are confirmed.
|
|
47
|
+
|
|
48
|
+
## Method Overview
|
|
49
|
+
|
|
50
|
+
| Scenario | Purpose | Main output |
|
|
51
|
+
|----------|---------|-------------|
|
|
52
|
+
| S0 Bootstrap | Initialize project structure and entry files | `spec/`, `AGENTS.md`, `CLAUDE.md`, `handoff.md` |
|
|
53
|
+
| S1A Need | Turn an idea into spec, design, tasks, code, and verification | `prd.md`, `design.md`, `todo.md`, tested code |
|
|
54
|
+
| S1B Acceptance | Let user acceptance drive debug, fix, re-verification, and sedimentation | `issues/<topic>.md`, PRD/design/ADR updates |
|
|
55
|
+
| S2 Evolution | Promote repeated working habits into reusable method assets | rule or skill proposals |
|
|
56
|
+
|
|
57
|
+
The two hard gates are:
|
|
58
|
+
|
|
59
|
+
- No aligned requirement, no `prd.md`.
|
|
60
|
+
- No aligned expected behavior, no bug fix.
|
|
61
|
+
|
|
62
|
+
## Skills
|
|
63
|
+
|
|
64
|
+
| Skill | Role |
|
|
65
|
+
|-------|------|
|
|
66
|
+
| `brainstorming` | Coarse requirement alignment before writing PRD. |
|
|
67
|
+
| `grill-me` | Fine-grained questioning for interface, field, parameter, or expected-state ambiguity. |
|
|
68
|
+
| `to-prd` | Writes `spec/needs/<need-name>/prd.md`. |
|
|
69
|
+
| `writing-plans` | Writes `spec/needs/<need-name>/design.md`. |
|
|
70
|
+
| `to-issues` | Breaks design into `todo.md` vertical slices. |
|
|
71
|
+
| `tdd` | Drives A5 development and B5 bug fixes by red-green-refactor. |
|
|
72
|
+
| `verification-before-completion` | Requires fresh real-path evidence before completion claims. |
|
|
73
|
+
| `diagnose` | Builds a reproducible feedback loop and identifies root cause. |
|
|
74
|
+
| `review` | Reviews against standards and spec, then routes findings into PRD, design, ADR, or S2 candidates. |
|
|
75
|
+
| `handoff` | Writes the latest session snapshot to `handoff.md`. |
|
|
76
|
+
| `improve-codebase-architecture` | User-triggered architecture deepening review. |
|
|
77
|
+
| `zoom-out` | User-triggered higher-level codebase map. |
|
|
78
|
+
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
- [Framework](docs/framework.md)
|
|
82
|
+
- [Spec Framework](docs/spec-framework.md)
|
|
83
|
+
- [S0 Bootstrap](docs/scenarios/s0-bootstrap.md)
|
|
84
|
+
- [S1 Main Loop](docs/scenarios/s1-main-loop.md)
|
|
85
|
+
- [Skill Candidate Design Notes](design/skill-candidates/README.md)
|
|
86
|
+
|
|
87
|
+
## Repository Layout
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
bin/ npm executable entry
|
|
91
|
+
src/ zero-dependency CLI implementation
|
|
92
|
+
skills/ Selected Agentic Engineering skills
|
|
93
|
+
templates/ Entry file templates and the ae-rules.md starter
|
|
94
|
+
docs/ User-facing methodology docs
|
|
95
|
+
design/ Design records for this repository
|
|
96
|
+
tests/ node:test coverage for CLI behavior
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Roadmap
|
|
100
|
+
|
|
101
|
+
1. Stage 2: npm CLI asset distribution with `init` and `ingest-mother`. Superseded by v0.2.
|
|
102
|
+
2. v0.2: split CLI into `setup` + `init`, remove slash command assets, and move rule sync into `ae init`.
|
|
103
|
+
3. Stage 3: design `ae update` for skill/template upgrades and implement `ae index-rebuild`.
|
|
104
|
+
4. Add CI and Windows path validation before broader distribution.
|
|
105
|
+
|
|
106
|
+
## Limits
|
|
107
|
+
|
|
108
|
+
`ae index-rebuild` and `ae update` are referenced by the roadmap but not implemented yet. Publishing to npm still requires `npm login`, scope validation, and `npm publish --access public`.
|
package/bin/ae.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ecc-hgy/ae",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Agentic Engineering is a lightweight personal software lifecycle method: SDD records what to build, TDD drives how to prove it works.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ae": "bin/ae.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"src",
|
|
12
|
+
"skills",
|
|
13
|
+
"templates",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --test tests/*.test.js"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"claude-code",
|
|
25
|
+
"agentic",
|
|
26
|
+
"skills",
|
|
27
|
+
"tdd",
|
|
28
|
+
"sdd"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/huguiyuan/agentic-engineering.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/huguiyuan/agentic-engineering#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/huguiyuan/agentic-engineering/issues"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"author": "huguiyuan",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation. Used at S1 node A1 for coarse alignment; pair with grill-me for fine-grained interface/field/parameter alignment; output is conversation alignment, NOT a written PRD (PRD writing is A2 to-prd)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brainstorming Ideas Into Designs
|
|
7
|
+
|
|
8
|
+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
9
|
+
|
|
10
|
+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
|
|
11
|
+
|
|
12
|
+
<HARD-GATE>
|
|
13
|
+
Do NOT advance to A2 (`to-prd`), write any `prd.md`, scaffold any directories, or take any implementation action until the user has explicitly approved the alignment summary. This is the first of S1's two hard gates: requirement not aligned ⇒ no `prd.md`. Applies to EVERY need regardless of perceived simplicity.
|
|
14
|
+
</HARD-GATE>
|
|
15
|
+
|
|
16
|
+
## Anti-Pattern: "This Is Too Simple To Need A Design"
|
|
17
|
+
|
|
18
|
+
Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval.
|
|
19
|
+
|
|
20
|
+
## Checklist (S1 node A1)
|
|
21
|
+
|
|
22
|
+
Complete in order:
|
|
23
|
+
|
|
24
|
+
1. **Explore project context** — read `spec/INDEX.md`, `spec/README.md`, and any existing `spec/needs/*/prd.md` to understand vocabulary and adjacent needs; check recent commits if useful
|
|
25
|
+
2. **Surface scope sizing** — if the request describes multiple independent subsystems, flag it (see "Working in existing codebases" below); each subsystem becomes its own need
|
|
26
|
+
3. **Ask clarifying questions** — one at a time; cover purpose, constraints, success criteria, what is NOT in scope
|
|
27
|
+
4. **If interface / field / parameter details surface** — switch to `grill-me` for that branch, then return here for the rest
|
|
28
|
+
5. **Propose 2-3 approaches** at requirement level (NOT technical) — with trade-offs and your recommendation
|
|
29
|
+
6. **Present alignment summary** — a short structured recap (problem / proposed solution / scope / out-of-scope / success criteria); get user approval
|
|
30
|
+
7. **Confirm hand-off to A2** — once approved, tell the user the next step is `to-prd` (which will write `spec/needs/<need-name>/prd.md`)
|
|
31
|
+
|
|
32
|
+
## Process Flow
|
|
33
|
+
|
|
34
|
+
```dot
|
|
35
|
+
digraph brainstorming {
|
|
36
|
+
"Explore project context" [shape=box];
|
|
37
|
+
"Ask clarifying questions" [shape=box];
|
|
38
|
+
"Interface/field/parameter detail?" [shape=diamond];
|
|
39
|
+
"Switch to grill-me\n(return here after)" [shape=box];
|
|
40
|
+
"Propose 2-3 approaches" [shape=box];
|
|
41
|
+
"Present alignment summary" [shape=box];
|
|
42
|
+
"User approves alignment?" [shape=diamond];
|
|
43
|
+
"Hand off to A2 (to-prd)" [shape=doublecircle];
|
|
44
|
+
|
|
45
|
+
"Explore project context" -> "Ask clarifying questions";
|
|
46
|
+
"Ask clarifying questions" -> "Interface/field/parameter detail?";
|
|
47
|
+
"Interface/field/parameter detail?" -> "Switch to grill-me\n(return here after)" [label="yes"];
|
|
48
|
+
"Interface/field/parameter detail?" -> "Propose 2-3 approaches" [label="no"];
|
|
49
|
+
"Switch to grill-me\n(return here after)" -> "Propose 2-3 approaches";
|
|
50
|
+
"Propose 2-3 approaches" -> "Present alignment summary";
|
|
51
|
+
"Present alignment summary" -> "User approves alignment?";
|
|
52
|
+
"User approves alignment?" -> "Present alignment summary" [label="no, revise"];
|
|
53
|
+
"User approves alignment?" -> "Hand off to A2 (to-prd)" [label="yes"];
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**The terminal state is hand-off to A2 (`to-prd`), NOT directly to implementation.** Do NOT invoke `writing-plans`, `tdd`, or any other implementation skill from here. A2 produces the `prd.md`; A3 (`writing-plans`) consumes the `prd.md` to produce `design.md`. The boundary is strict.
|
|
58
|
+
|
|
59
|
+
## The Process
|
|
60
|
+
|
|
61
|
+
**Understanding the idea:**
|
|
62
|
+
|
|
63
|
+
- Check out the current project state first (files, docs, recent commits)
|
|
64
|
+
- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
|
|
65
|
+
- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
|
|
66
|
+
- For appropriately-scoped projects, ask questions one at a time to refine the idea
|
|
67
|
+
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
68
|
+
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
69
|
+
- Focus on understanding: purpose, constraints, success criteria
|
|
70
|
+
|
|
71
|
+
**Exploring approaches:**
|
|
72
|
+
|
|
73
|
+
- Propose 2-3 different approaches with trade-offs
|
|
74
|
+
- Present options conversationally with your recommendation and reasoning
|
|
75
|
+
- Lead with your recommended option and explain why
|
|
76
|
+
|
|
77
|
+
**Presenting the design:**
|
|
78
|
+
|
|
79
|
+
- Once you believe you understand what you're building, present the design
|
|
80
|
+
- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
|
|
81
|
+
- Ask after each section whether it looks right so far
|
|
82
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
83
|
+
- Be ready to go back and clarify if something doesn't make sense
|
|
84
|
+
|
|
85
|
+
**Design for isolation and clarity:**
|
|
86
|
+
|
|
87
|
+
- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
|
|
88
|
+
- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
|
|
89
|
+
- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
|
|
90
|
+
- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
|
|
91
|
+
|
|
92
|
+
**Working in existing codebases:**
|
|
93
|
+
|
|
94
|
+
- Explore the current structure before proposing changes. Follow existing patterns.
|
|
95
|
+
- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
|
|
96
|
+
- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
|
|
97
|
+
|
|
98
|
+
## After Alignment
|
|
99
|
+
|
|
100
|
+
**Alignment summary (in conversation only — do NOT write a file):**
|
|
101
|
+
|
|
102
|
+
- Problem (from user's perspective)
|
|
103
|
+
- Proposed solution (at requirement level, not technical)
|
|
104
|
+
- In scope / Out of scope
|
|
105
|
+
- Success criteria
|
|
106
|
+
- Open questions (if any) — must be empty before the hard gate passes
|
|
107
|
+
|
|
108
|
+
**Quick self-check before declaring alignment:**
|
|
109
|
+
|
|
110
|
+
1. **Placeholder scan:** Any "TBD" or vague success criteria? Sharpen them.
|
|
111
|
+
2. **Scope check:** Is this a single need, or does it need decomposition into multiple needs?
|
|
112
|
+
3. **Ambiguity check:** Could any requirement be interpreted two ways? Pick one explicitly.
|
|
113
|
+
|
|
114
|
+
**User approval gate:**
|
|
115
|
+
|
|
116
|
+
Present the alignment summary. Ask:
|
|
117
|
+
|
|
118
|
+
> "Does this capture what you want? If yes, the next step is `to-prd` (A2), which will write `spec/needs/<need-name>/prd.md`. If anything is off, point me at it and I'll re-align."
|
|
119
|
+
|
|
120
|
+
Wait for explicit approval. If the user requests changes, iterate. Do NOT advance to A2 until approved (HARD-GATE above).
|
|
121
|
+
|
|
122
|
+
**Hand-off to A2:**
|
|
123
|
+
|
|
124
|
+
Once approved, recommend `to-prd` as the next step. Do NOT invoke `writing-plans`, `tdd`, or any other skill. The strict chain is: A1 (brainstorming) → A2 (to-prd) → A3 (writing-plans) → A4 (to-issues) → A5 (tdd) → A6 (verification-before-completion).
|
|
125
|
+
|
|
126
|
+
## Key Principles
|
|
127
|
+
|
|
128
|
+
- **One question at a time** - Don't overwhelm with multiple questions
|
|
129
|
+
- **Multiple choice preferred** - Easier to answer than open-ended when possible
|
|
130
|
+
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
|
|
131
|
+
- **Explore alternatives** - Always propose 2-3 approaches before settling
|
|
132
|
+
- **Incremental validation** - Present design, get approval before moving on
|
|
133
|
+
- **Be flexible** - Go back and clarify when something doesn't make sense
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose
|
|
3
|
+
description: Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose
|
|
7
|
+
|
|
8
|
+
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
9
|
+
|
|
10
|
+
## Entry Gate (S1 node B3)
|
|
11
|
+
|
|
12
|
+
This skill activates AFTER B2 expectation alignment has passed. Inputs:
|
|
13
|
+
|
|
14
|
+
- A reproduction lead from B2 (what the user did, what they saw, what they expected)
|
|
15
|
+
- The owning need: `spec/needs/<need-name>/{prd.md, design.md, todo.md}` (locate `<need-name>` by reading `spec/INDEX.md` or asking the user)
|
|
16
|
+
|
|
17
|
+
If B2 has NOT been completed (the expected behavior is still ambiguous), STOP and run `grill-me` to re-align. Do NOT proceed to Phase 1 - diagnosing the wrong symptom is the most common B-loop failure.
|
|
18
|
+
|
|
19
|
+
## Exit Contract (hand-off to B4)
|
|
20
|
+
|
|
21
|
+
After Phase 6, do NOT write the issue file inline - that is B4's job. Instead, hand off a structured summary so B4 can write `spec/needs/<need-name>/issues/<topic>.md` in one pass, using the 7-section format in [assets/issue-7-sections.md](assets/issue-7-sections.md).
|
|
22
|
+
|
|
23
|
+
Sections this skill is expected to populate:
|
|
24
|
+
|
|
25
|
+
1. **问题描述** - from B2 + the loop's repro one-liner
|
|
26
|
+
2. **当前态** - observed symptom (Phase 2)
|
|
27
|
+
3. **期望态** - from B2
|
|
28
|
+
4. **分析与解决** - ranked hypotheses (Phase 3), instrumentation findings (Phase 4), root cause confirmed (Phase 5)
|
|
29
|
+
|
|
30
|
+
Sections B5/B6 will roll forward later:
|
|
31
|
+
|
|
32
|
+
5. **to-issues** - follow-up tasks discovered during fix (added by B5 if any)
|
|
33
|
+
6. **bug** - fix progress notes (B5)
|
|
34
|
+
7. **验收** - user re-verification result (B6)
|
|
35
|
+
|
|
36
|
+
When exploring the codebase, use vocabulary from `spec/INDEX.md` and the owning need's `prd.md` + `design.md` to get a clear mental model of the relevant modules. Check ADRs under `spec/ADR/` before forming hypotheses.
|
|
37
|
+
|
|
38
|
+
## Phase 1 — Build a feedback loop
|
|
39
|
+
|
|
40
|
+
**This is the skill.** Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause — bisection, hypothesis-testing, and instrumentation all just consume that signal. If you don't have one, no amount of staring at code will save you.
|
|
41
|
+
|
|
42
|
+
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
43
|
+
|
|
44
|
+
### Ways to construct one — try them in roughly this order
|
|
45
|
+
|
|
46
|
+
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
47
|
+
2. **Curl / HTTP script** against a running dev server.
|
|
48
|
+
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
49
|
+
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
50
|
+
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
51
|
+
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
52
|
+
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
53
|
+
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
54
|
+
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
55
|
+
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
|
56
|
+
|
|
57
|
+
Build the right feedback loop, and the bug is 90% fixed.
|
|
58
|
+
|
|
59
|
+
### Iterate on the loop itself
|
|
60
|
+
|
|
61
|
+
Treat the loop as a product. Once you have _a_ loop, ask:
|
|
62
|
+
|
|
63
|
+
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
64
|
+
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
65
|
+
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
66
|
+
|
|
67
|
+
A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.
|
|
68
|
+
|
|
69
|
+
### Non-deterministic bugs
|
|
70
|
+
|
|
71
|
+
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
72
|
+
|
|
73
|
+
### When you genuinely cannot build a loop
|
|
74
|
+
|
|
75
|
+
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
76
|
+
|
|
77
|
+
Do not proceed to Phase 2 until you have a loop you believe in.
|
|
78
|
+
|
|
79
|
+
## Phase 2 — Reproduce
|
|
80
|
+
|
|
81
|
+
Run the loop. Watch the bug appear.
|
|
82
|
+
|
|
83
|
+
Confirm:
|
|
84
|
+
|
|
85
|
+
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
86
|
+
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
87
|
+
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
88
|
+
|
|
89
|
+
Do not proceed until you reproduce the bug.
|
|
90
|
+
|
|
91
|
+
## Phase 3 — Hypothesise
|
|
92
|
+
|
|
93
|
+
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
94
|
+
|
|
95
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
96
|
+
|
|
97
|
+
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
98
|
+
|
|
99
|
+
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
100
|
+
|
|
101
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
102
|
+
|
|
103
|
+
## Phase 4 — Instrument
|
|
104
|
+
|
|
105
|
+
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
106
|
+
|
|
107
|
+
Tool preference:
|
|
108
|
+
|
|
109
|
+
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
110
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
111
|
+
3. Never "log everything and grep".
|
|
112
|
+
|
|
113
|
+
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
114
|
+
|
|
115
|
+
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
116
|
+
|
|
117
|
+
## Phase 5 — Fix + regression test
|
|
118
|
+
|
|
119
|
+
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
120
|
+
|
|
121
|
+
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
122
|
+
|
|
123
|
+
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
124
|
+
|
|
125
|
+
If a correct seam exists:
|
|
126
|
+
|
|
127
|
+
1. Turn the minimised repro into a failing test at that seam.
|
|
128
|
+
2. Watch it fail.
|
|
129
|
+
3. Apply the fix.
|
|
130
|
+
4. Watch it pass.
|
|
131
|
+
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
132
|
+
|
|
133
|
+
## Phase 6 — Cleanup + post-mortem
|
|
134
|
+
|
|
135
|
+
Required before declaring done:
|
|
136
|
+
|
|
137
|
+
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
138
|
+
- [ ] Regression test passes (or absence of seam is documented)
|
|
139
|
+
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
140
|
+
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
141
|
+
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
142
|
+
- [ ] Hand off to B4: emit the structured summary (sections 1-4 from the Exit Contract above) so B4 can write the issue file at `spec/needs/<need-name>/issues/<topic>.md`
|
|
143
|
+
|
|
144
|
+
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
145
|
+
|
|
146
|
+
Also hand this observation to B7 `review` for sedimentation routing first. B7 decides whether the lesson should become a `prd.md` rule, a `design.md` amendment, an ADR under `spec/ADR/`, a reusable S2 candidate, or a user-triggered `improve-codebase-architecture` follow-up. Do not invoke `improve-codebase-architecture` directly from B3; make the architectural-change recommendation and let B7/user decide whether to schedule it.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Issue 7-Section Template
|
|
2
|
+
|
|
3
|
+
Use this template at B4 to write `spec/needs/<need-name>/issues/<topic>.md`.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# <issue title>
|
|
7
|
+
|
|
8
|
+
## 问题描述
|
|
9
|
+
|
|
10
|
+
<From B2 expectation alignment + B3 reproduction one-liner.>
|
|
11
|
+
|
|
12
|
+
## 当前态
|
|
13
|
+
|
|
14
|
+
<Observed symptom, exact error/output/timing, reproduction confidence.>
|
|
15
|
+
|
|
16
|
+
## 期望态
|
|
17
|
+
|
|
18
|
+
<Expected behavior aligned with the user at B2.>
|
|
19
|
+
|
|
20
|
+
## 分析与解决
|
|
21
|
+
|
|
22
|
+
<Ranked hypotheses, instrumentation findings, confirmed root cause, and fix direction.>
|
|
23
|
+
|
|
24
|
+
## to-issues
|
|
25
|
+
|
|
26
|
+
<Follow-up implementation tasks discovered during B5, if any. Leave empty at B4 if none.>
|
|
27
|
+
|
|
28
|
+
## bug
|
|
29
|
+
|
|
30
|
+
<B5 fix progress notes: failing test, root-cause one-liner, fix commit/reference.>
|
|
31
|
+
|
|
32
|
+
## 验收
|
|
33
|
+
|
|
34
|
+
<B6 user re-verification result.>
|
|
35
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Human-in-the-loop reproduction loop.
|
|
3
|
+
# Copy this file, edit the steps below, and run it.
|
|
4
|
+
# The agent runs the script; the user follows prompts in their terminal.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# bash hitl-loop.template.sh
|
|
8
|
+
#
|
|
9
|
+
# Two helpers:
|
|
10
|
+
# step "<instruction>" → show instruction, wait for Enter
|
|
11
|
+
# capture VAR "<question>" → show question, read response into VAR
|
|
12
|
+
#
|
|
13
|
+
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
step() {
|
|
18
|
+
printf '\n>>> %s\n' "$1"
|
|
19
|
+
read -r -p " [Enter when done] " _
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
capture() {
|
|
23
|
+
local var="$1" question="$2" answer
|
|
24
|
+
printf '\n>>> %s\n' "$question"
|
|
25
|
+
read -r -p " > " answer
|
|
26
|
+
printf -v "$var" '%s' "$answer"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# --- edit below ---------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
step "Open the app at http://localhost:3000 and sign in."
|
|
32
|
+
|
|
33
|
+
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
34
|
+
|
|
35
|
+
capture ERROR_MSG "Paste the error message (or 'none'):"
|
|
36
|
+
|
|
37
|
+
# --- edit above ---------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
printf '\n--- Captured ---\n'
|
|
40
|
+
printf 'ERRORED=%s\n' "$ERRORED"
|
|
41
|
+
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grill-me
|
|
3
|
+
description: Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
|
7
|
+
|
|
8
|
+
Ask the questions one at a time.
|
|
9
|
+
|
|
10
|
+
If a question can be answered by exploring the codebase, explore the codebase instead.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handoff
|
|
3
|
+
description: Compact the current conversation into a handoff document for another agent to pick up.
|
|
4
|
+
argument-hint: "What will the next session be used for?"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS - not the current workspace.
|
|
8
|
+
|
|
9
|
+
Unless the user asks for a different destination, also save the handoff to `handoff.md` at the project root.
|
|
10
|
+
|
|
11
|
+
When saving to project-root `handoff.md`, overwrite the file. Do not append: `handoff.md` is the latest handoff snapshot, not a history log.
|
|
12
|
+
|
|
13
|
+
Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
|
|
14
|
+
|
|
15
|
+
Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
|
|
16
|
+
|
|
17
|
+
Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
|
|
18
|
+
|
|
19
|
+
If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors — they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|