@heihei0299/matt-skills 1.0.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/.agents/skills/ask-matt/SKILL.md +78 -0
- package/.agents/skills/ask-matt/agents/openai.yaml +5 -0
- package/.agents/skills/code-review/SKILL.md +94 -0
- package/.agents/skills/code-review/agents/openai.yaml +3 -0
- package/.agents/skills/codebase-design/DEEPENING.md +37 -0
- package/.agents/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/.agents/skills/codebase-design/SKILL.md +114 -0
- package/.agents/skills/codebase-design/agents/openai.yaml +3 -0
- package/.agents/skills/commit-check/SKILL.md +65 -0
- package/.agents/skills/commit-check/agents/openai.yaml +5 -0
- package/.agents/skills/commit-check/scripts/scan-sensitive.sh +36 -0
- package/.agents/skills/diagnose-fix/SKILL.md +66 -0
- package/.agents/skills/diagnose-fix/agents/openai.yaml +5 -0
- package/.agents/skills/diagnose-fix/references/anti-patterns.md +20 -0
- package/.agents/skills/diagnosing-bugs/SKILL.md +134 -0
- package/.agents/skills/diagnosing-bugs/agents/openai.yaml +3 -0
- package/.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/.agents/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/.agents/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/.agents/skills/domain-modeling/SKILL.md +74 -0
- package/.agents/skills/domain-modeling/agents/openai.yaml +3 -0
- package/.agents/skills/grill-me/SKILL.md +7 -0
- package/.agents/skills/grill-me/agents/openai.yaml +5 -0
- package/.agents/skills/grill-to-spec/SKILL.md +83 -0
- package/.agents/skills/grill-to-spec/agents/openai.yaml +5 -0
- package/.agents/skills/grill-to-spec/references/rules.md +33 -0
- package/.agents/skills/grill-with-docs/SKILL.md +7 -0
- package/.agents/skills/grill-with-docs/agents/openai.yaml +5 -0
- package/.agents/skills/grilling/SKILL.md +12 -0
- package/.agents/skills/grilling/agents/openai.yaml +3 -0
- package/.agents/skills/handoff/SKILL.md +16 -0
- package/.agents/skills/handoff/agents/openai.yaml +5 -0
- package/.agents/skills/implement/SKILL.md +15 -0
- package/.agents/skills/implement/agents/openai.yaml +5 -0
- package/.agents/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/.agents/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/.agents/skills/improve-codebase-architecture/agents/openai.yaml +5 -0
- package/.agents/skills/prototype/LOGIC.md +79 -0
- package/.agents/skills/prototype/SKILL.md +26 -0
- package/.agents/skills/prototype/UI.md +112 -0
- package/.agents/skills/prototype/agents/openai.yaml +3 -0
- package/.agents/skills/research/SKILL.md +12 -0
- package/.agents/skills/research/agents/openai.yaml +3 -0
- package/.agents/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/.agents/skills/resolving-merge-conflicts/agents/openai.yaml +3 -0
- package/.agents/skills/setup-matt-pocock-skills/SKILL.md +116 -0
- package/.agents/skills/setup-matt-pocock-skills/agents/openai.yaml +5 -0
- package/.agents/skills/setup-matt-pocock-skills/domain.md +51 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +45 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/.agents/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/.agents/skills/tdd/SKILL.md +36 -0
- package/.agents/skills/tdd/agents/openai.yaml +3 -0
- package/.agents/skills/tdd/mocking.md +59 -0
- package/.agents/skills/tdd/tests.md +77 -0
- package/.agents/skills/tdd-implement/SKILL.md +143 -0
- package/.agents/skills/tdd-implement/agents/openai.yaml +5 -0
- package/.agents/skills/tdd-implement/references/stages.md +315 -0
- package/.agents/skills/teach/GLOSSARY-FORMAT.md +35 -0
- package/.agents/skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/.agents/skills/teach/MISSION-FORMAT.md +31 -0
- package/.agents/skills/teach/RESOURCES-FORMAT.md +32 -0
- package/.agents/skills/teach/SKILL.md +140 -0
- package/.agents/skills/teach/agents/openai.yaml +5 -0
- package/.agents/skills/to-spec/SKILL.md +75 -0
- package/.agents/skills/to-spec/agents/openai.yaml +5 -0
- package/.agents/skills/to-tickets/SKILL.md +105 -0
- package/.agents/skills/to-tickets/agents/openai.yaml +5 -0
- package/.agents/skills/triage/AGENT-BRIEF.md +207 -0
- package/.agents/skills/triage/OUT-OF-SCOPE.md +105 -0
- package/.agents/skills/triage/SKILL.md +112 -0
- package/.agents/skills/triage/agents/openai.yaml +5 -0
- package/.agents/skills/wayfinder/SKILL.md +128 -0
- package/.agents/skills/wayfinder/agents/openai.yaml +5 -0
- package/.agents/skills/writing-great-skills/GLOSSARY.md +201 -0
- package/.agents/skills/writing-great-skills/SKILL.md +83 -0
- package/.agents/skills/writing-great-skills/agents/openai.yaml +5 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/bin/cli.js +353 -0
- package/package.json +26 -0
- package/template/.opencode/CONTEXT.md +47 -0
- package/template/.opencode/agents/issue-audit.md +52 -0
- package/template/.opencode/commands/grill-to-spec.md +13 -0
- package/template/.opencode/commands/handoff.md +12 -0
- package/template/.opencode/commands/improve-codebase-architecture.md +13 -0
- package/template/.opencode/commands/issue-audit.md +115 -0
- package/template/.opencode/commands/teach.md +12 -0
- package/template/.opencode/commands/to-spec.md +13 -0
- package/template/.opencode/commands/to-tickets.md +12 -0
- package/template/.opencode/commands/triage.md +12 -0
- package/template/.opencode/commands/wayfinder.md +13 -0
- package/template/.opencode/commands/writing-great-skills.md +12 -0
- package/template/.opencode/docs/agents/domain.md +51 -0
- package/template/.opencode/docs/agents/issue-tracker.md +30 -0
- package/template/.opencode/docs/agents/runtime-discipline.md +36 -0
- package/template/.opencode/docs/agents/skill-design.md +32 -0
- package/template/.opencode/docs/agents/triage-labels.md +15 -0
- package/template/.opencode/skills/commit-check/SKILL.md +65 -0
- package/template/.opencode/skills/commit-check/agents/openai.yaml +5 -0
- package/template/.opencode/skills/commit-check/scripts/scan-sensitive.sh +36 -0
- package/template/.opencode/skills/diagnose-fix/SKILL.md +66 -0
- package/template/.opencode/skills/diagnose-fix/agents/openai.yaml +5 -0
- package/template/.opencode/skills/diagnose-fix/references/anti-patterns.md +20 -0
- package/template/.opencode/skills/grill-to-spec/SKILL.md +83 -0
- package/template/.opencode/skills/grill-to-spec/agents/openai.yaml +5 -0
- package/template/.opencode/skills/grill-to-spec/references/rules.md +33 -0
- package/template/.opencode/skills/tdd-implement/SKILL.md +143 -0
- package/template/.opencode/skills/tdd-implement/agents/openai.yaml +5 -0
- package/template/.opencode/skills/tdd-implement/references/stages.md +315 -0
- package/template/.pi/agents/issue-audit.md +52 -0
- package/template/.pi/docs/agents/domain.md +51 -0
- package/template/.pi/docs/agents/issue-tracker.md +30 -0
- package/template/.pi/docs/agents/runtime-discipline.md +36 -0
- package/template/.pi/docs/agents/skill-design.md +32 -0
- package/template/.pi/docs/agents/triage-labels.md +15 -0
- package/template/.pi/prompts/issue-audit.md +114 -0
- package/template/.pi/skills/commit-check/SKILL.md +65 -0
- package/template/.pi/skills/commit-check/agents/openai.yaml +5 -0
- package/template/.pi/skills/commit-check/scripts/scan-sensitive.sh +36 -0
- package/template/.pi/skills/diagnose-fix/SKILL.md +66 -0
- package/template/.pi/skills/diagnose-fix/agents/openai.yaml +5 -0
- package/template/.pi/skills/diagnose-fix/references/anti-patterns.md +20 -0
- package/template/.pi/skills/grill-to-spec/SKILL.md +83 -0
- package/template/.pi/skills/grill-to-spec/agents/openai.yaml +5 -0
- package/template/.pi/skills/grill-to-spec/references/rules.md +33 -0
- package/template/.pi/skills/tdd-implement/SKILL.md +143 -0
- package/template/.pi/skills/tdd-implement/agents/openai.yaml +5 -0
- package/template/.pi/skills/tdd-implement/references/stages.md +315 -0
- package/template/AGENTS.md +59 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-matt
|
|
3
|
+
description: Ask which skill or flow fits your situation. A router over the skills in this repo.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ask Matt
|
|
8
|
+
|
|
9
|
+
You don't remember every skill, so ask.
|
|
10
|
+
|
|
11
|
+
A **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.
|
|
12
|
+
|
|
13
|
+
## The main flow: idea → ship
|
|
14
|
+
|
|
15
|
+
The route most work travels. You have an idea and want it built.
|
|
16
|
+
|
|
17
|
+
1. **`/grill-with-docs`** — sharpen the idea by interview. Start here when you **have a codebase**: it's stateful, retaining what it learns in `CONTEXT.md` and ADRs. (No codebase? Use `/grill-me` — see Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail.)
|
|
18
|
+
2. **Branch — can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (see Crossing sessions):
|
|
19
|
+
- **`/handoff`** out, then open a fresh session against that file,
|
|
20
|
+
- **`/prototype`** to answer the question with throwaway code,
|
|
21
|
+
- **`/handoff`** back what you learned, and reference it from the original idea thread.
|
|
22
|
+
3. **Branch — is this a multi-session build?**
|
|
23
|
+
- **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed — kick off **`/implement`** per ticket, **clearing context between each one**.
|
|
24
|
+
- **No** → **`/implement`** right here, in the same context window.
|
|
25
|
+
|
|
26
|
+
Either way, **`/implement`** builds each issue by driving **`/tdd`** internally — one red-green slice at a time — then closes out by running **`/code-review`**, a two-axis review (Standards + Spec) of the diff, before committing. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.
|
|
27
|
+
|
|
28
|
+
### Context hygiene
|
|
29
|
+
|
|
30
|
+
Keep steps 1–3 in **one unbroken context window** — don't compact or clear until after `/to-tickets` — so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket.
|
|
31
|
+
|
|
32
|
+
The limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~120k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded — `/handoff` and continue in a fresh thread.
|
|
33
|
+
|
|
34
|
+
## On-ramps
|
|
35
|
+
|
|
36
|
+
A starting situation that generates work, then merges onto the main flow.
|
|
37
|
+
|
|
38
|
+
- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.
|
|
39
|
+
|
|
40
|
+
Triage is only for issues **you didn't create** — bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.
|
|
41
|
+
|
|
42
|
+
- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** — one command that already goes red on *this* bug — then fixes with a regression test. Its post-mortem hands off to **`/improve-codebase-architecture`** when the real finding is that there's no good seam to lock the bug down.
|
|
43
|
+
|
|
44
|
+
- **A huge, foggy effort — a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time — producing **decisions, not deliverables** — until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't — and it's slower and denser, so save it for exactly that, never a well-scoped feature.
|
|
45
|
+
|
|
46
|
+
When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away — go straight to `/implement` only when the effort turned out genuinely small.
|
|
47
|
+
|
|
48
|
+
## Codebase health
|
|
49
|
+
|
|
50
|
+
Not feature work — upkeep.
|
|
51
|
+
|
|
52
|
+
- **`/improve-codebase-architecture`** — run whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.
|
|
53
|
+
|
|
54
|
+
## Vocabulary underneath
|
|
55
|
+
|
|
56
|
+
Two model-invoked references that run *beneath* the other skills — each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.
|
|
57
|
+
|
|
58
|
+
- **`/domain-modeling`** — sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `CONTEXT.md` a clean glossary.
|
|
59
|
+
- **`/codebase-design`** — the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
|
|
60
|
+
|
|
61
|
+
## Crossing sessions
|
|
62
|
+
|
|
63
|
+
- **`/handoff`** — when a thread is full or you need to branch off (e.g. into a `/prototype` session), this compacts the conversation into a markdown file. You don't continue in place — you **open a new session and reference that file** to carry the context across. It's the bridge between context windows, in either direction. Use it when you want a **fresh session** but need the **current conversation preserved**.
|
|
64
|
+
- **`/compact`** (built-in) — stay in the **same conversation**, letting the earlier turns be summarized. Use it at **intentional breaks between phases**, when you don't mind losing the verbatim history. Don't compact mid-phase — the agent can lose its way. `/handoff` forks; `/compact` continues.
|
|
65
|
+
|
|
66
|
+
## Standalone
|
|
67
|
+
|
|
68
|
+
Off the main flow entirely.
|
|
69
|
+
|
|
70
|
+
- **`/grill-me`** — the same relentless interview as `/grill-with-docs`, but for when you have **no codebase**. Stateless: it saves nothing locally, builds no `CONTEXT.md`. Reach for it to sharpen any plan or design that doesn't live in a repo.
|
|
71
|
+
- **`/prototype`** — a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway from day one — keep the answer, delete the code. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.
|
|
72
|
+
- **`/research`** — delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs` — research feeds the thinking, it doesn't replace it.
|
|
73
|
+
- **`/teach`** — learn a concept over multiple sessions, using the current directory as a stateful workspace.
|
|
74
|
+
- **`/writing-great-skills`** — reference for writing and editing skills well.
|
|
75
|
+
|
|
76
|
+
## Precondition
|
|
77
|
+
|
|
78
|
+
**`/setup-matt-pocock-skills`** — run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
|
|
7
|
+
|
|
8
|
+
- **Standards** — does the code conform to this repo's documented coding standards?
|
|
9
|
+
- **Spec** — does the code faithfully implement the originating issue / PRD / spec?
|
|
10
|
+
|
|
11
|
+
Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
|
|
12
|
+
|
|
13
|
+
The issue tracker should have been provided to you — run `/setup-matt-pocock-skills` if `docs/agents/issue-tracker.md` is missing.
|
|
14
|
+
|
|
15
|
+
## Process
|
|
16
|
+
|
|
17
|
+
### 1. Pin the fixed point
|
|
18
|
+
|
|
19
|
+
Whatever the user said is the fixed point — a commit SHA, branch name, tag, `main`, `HEAD~5`, etc. If they didn't specify one, ask for it.
|
|
20
|
+
|
|
21
|
+
Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
|
|
22
|
+
|
|
23
|
+
Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here — not inside two parallel sub-agents.
|
|
24
|
+
|
|
25
|
+
### 2. Identify the spec source
|
|
26
|
+
|
|
27
|
+
Look for the originating spec, in this order:
|
|
28
|
+
|
|
29
|
+
1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.) — fetch via the workflow in `docs/agents/issue-tracker.md`.
|
|
30
|
+
2. A path the user passed as an argument.
|
|
31
|
+
3. A PRD/spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
|
|
32
|
+
4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
|
|
33
|
+
|
|
34
|
+
### 3. Identify the standards sources
|
|
35
|
+
|
|
36
|
+
Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
|
|
37
|
+
|
|
38
|
+
On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below — a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
|
|
39
|
+
|
|
40
|
+
- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
|
|
41
|
+
- **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation — and, like any standard here, skip anything tooling already enforces.
|
|
42
|
+
|
|
43
|
+
Each smell reads *what it is* → *how to fix*; match it against the diff:
|
|
44
|
+
|
|
45
|
+
- **Mysterious Name** — a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
|
|
46
|
+
- **Duplicated Code** — the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
|
|
47
|
+
- **Feature Envy** — a method that reaches into another object's data more than its own. → move the method onto the data it envies.
|
|
48
|
+
- **Data Clumps** — the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
|
|
49
|
+
- **Primitive Obsession** — a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
|
|
50
|
+
- **Repeated Switches** — the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
|
|
51
|
+
- **Shotgun Surgery** — one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
|
|
52
|
+
- **Divergent Change** — one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
|
|
53
|
+
- **Speculative Generality** — abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
|
|
54
|
+
- **Message Chains** — long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
|
|
55
|
+
- **Middle Man** — a class or function that mostly just delegates onward. → cut it, call the real target direct.
|
|
56
|
+
- **Refused Bequest** — a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
|
|
57
|
+
|
|
58
|
+
### 4. Spawn both sub-agents in parallel
|
|
59
|
+
|
|
60
|
+
Send a single message with two `Agent` tool calls. Use the `general-purpose` subagent for both.
|
|
61
|
+
|
|
62
|
+
**Standards sub-agent prompt** — include:
|
|
63
|
+
|
|
64
|
+
- The full diff command and commit list.
|
|
65
|
+
- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full — the sub-agent has no other access to it.
|
|
66
|
+
- The brief: "Report — per file/hunk where relevant — (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls — documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
|
|
67
|
+
|
|
68
|
+
**Spec sub-agent prompt** — include:
|
|
69
|
+
|
|
70
|
+
- The diff command and commit list.
|
|
71
|
+
- The path or fetched contents of the spec.
|
|
72
|
+
- The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
|
|
73
|
+
|
|
74
|
+
If the spec is missing, skip the Spec sub-agent and note this in the final report.
|
|
75
|
+
|
|
76
|
+
### 5. Aggregate
|
|
77
|
+
|
|
78
|
+
Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings — the two axes are deliberately separate (see _Why two axes_).
|
|
79
|
+
|
|
80
|
+
End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes — that's the reranking the separation exists to prevent.
|
|
81
|
+
|
|
82
|
+
### 6. 输出形式
|
|
83
|
+
|
|
84
|
+
- 审查结论**只在对话输出**,不生成任何书面报告文件(不落盘 `review-spec.md`、`review-standards.md`、`review-*.md` 类文件)
|
|
85
|
+
- 被 tdd-implement 阶段⑤编排时同样适用
|
|
86
|
+
|
|
87
|
+
## Why two axes
|
|
88
|
+
|
|
89
|
+
A change can pass one axis and fail the other:
|
|
90
|
+
|
|
91
|
+
- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
|
|
92
|
+
- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
|
|
93
|
+
|
|
94
|
+
Reporting them separately stops one axis from masking the other.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.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.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Design It Twice
|
|
2
|
+
|
|
3
|
+
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best.
|
|
4
|
+
|
|
5
|
+
Uses the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Frame the problem space
|
|
10
|
+
|
|
11
|
+
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
|
12
|
+
|
|
13
|
+
- The constraints any new interface would need to satisfy
|
|
14
|
+
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
|
15
|
+
- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete
|
|
16
|
+
|
|
17
|
+
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
|
18
|
+
|
|
19
|
+
### 2. Spawn sub-agents
|
|
20
|
+
|
|
21
|
+
Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.
|
|
22
|
+
|
|
23
|
+
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
|
24
|
+
|
|
25
|
+
- Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point."
|
|
26
|
+
- Agent 2: "Maximise flexibility — support many use cases and extension."
|
|
27
|
+
- Agent 3: "Optimise for the most common caller — make the default case trivial."
|
|
28
|
+
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
|
29
|
+
|
|
30
|
+
Include both [SKILL.md](SKILL.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
|
31
|
+
|
|
32
|
+
Each sub-agent outputs:
|
|
33
|
+
|
|
34
|
+
1. Interface (types, methods, params — plus invariants, ordering, error modes)
|
|
35
|
+
2. Usage example showing how callers use it
|
|
36
|
+
3. What the implementation hides behind the seam
|
|
37
|
+
4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
|
|
38
|
+
5. Trade-offs — where leverage is high, where it's thin
|
|
39
|
+
|
|
40
|
+
### 3. Present and compare
|
|
41
|
+
|
|
42
|
+
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
|
43
|
+
|
|
44
|
+
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-design
|
|
3
|
+
description: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Design
|
|
7
|
+
|
|
8
|
+
Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
|
|
9
|
+
|
|
10
|
+
## Glossary
|
|
11
|
+
|
|
12
|
+
Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
|
13
|
+
|
|
14
|
+
**Module** — anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
|
|
15
|
+
|
|
16
|
+
**Interface** — everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow — they refer only to the type-level surface).
|
|
17
|
+
|
|
18
|
+
**Implementation** — what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
|
19
|
+
|
|
20
|
+
**Depth** — leverage at the interface: the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
|
|
21
|
+
|
|
22
|
+
**Seam** _(Michael Feathers)_ — a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
|
|
23
|
+
|
|
24
|
+
**Adapter** — a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
|
25
|
+
|
|
26
|
+
**Leverage** — what callers get from depth: more capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
|
|
27
|
+
|
|
28
|
+
**Locality** — what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
|
|
29
|
+
|
|
30
|
+
## Deep vs shallow
|
|
31
|
+
|
|
32
|
+
**Deep module** = small interface + lots of implementation:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
┌─────────────────────┐
|
|
36
|
+
│ Small Interface │ ← Few methods, simple params
|
|
37
|
+
├─────────────────────┤
|
|
38
|
+
│ │
|
|
39
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
40
|
+
│ │
|
|
41
|
+
└─────────────────────┘
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Shallow module** = large interface + little implementation (avoid):
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────┐
|
|
48
|
+
│ Large Interface │ ← Many methods, complex params
|
|
49
|
+
├─────────────────────────────────┤
|
|
50
|
+
│ Thin Implementation │ ← Just passes through
|
|
51
|
+
└─────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When designing an interface, ask:
|
|
55
|
+
|
|
56
|
+
- Can I reduce the number of methods?
|
|
57
|
+
- Can I simplify the parameters?
|
|
58
|
+
- Can I hide more complexity inside?
|
|
59
|
+
|
|
60
|
+
## Principles
|
|
61
|
+
|
|
62
|
+
- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts — they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
|
|
63
|
+
- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
|
|
64
|
+
- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
|
|
65
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
|
66
|
+
|
|
67
|
+
## Designing for testability
|
|
68
|
+
|
|
69
|
+
Good interfaces make testing natural:
|
|
70
|
+
|
|
71
|
+
1. **Accept dependencies, don't create them.**
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Testable
|
|
75
|
+
function processOrder(order, paymentGateway) {}
|
|
76
|
+
|
|
77
|
+
// Hard to test
|
|
78
|
+
function processOrder(order) {
|
|
79
|
+
const gateway = new StripeGateway();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Return results, don't produce side effects.**
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Testable
|
|
87
|
+
function calculateDiscount(cart): Discount {}
|
|
88
|
+
|
|
89
|
+
// Hard to test
|
|
90
|
+
function applyDiscount(cart): void {
|
|
91
|
+
cart.total -= discount;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
|
|
96
|
+
|
|
97
|
+
## Relationships
|
|
98
|
+
|
|
99
|
+
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
|
100
|
+
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
|
101
|
+
- A **Seam** is where a **Module**'s **Interface** lives.
|
|
102
|
+
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
|
103
|
+
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
|
104
|
+
|
|
105
|
+
## Rejected framings
|
|
106
|
+
|
|
107
|
+
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
|
108
|
+
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.
|
|
109
|
+
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
|
110
|
+
|
|
111
|
+
## Going deeper
|
|
112
|
+
|
|
113
|
+
- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
|
|
114
|
+
- **Exploring alternative interfaces** — see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit-check
|
|
3
|
+
description: "Run the pre-commit gate before any commit: verify docs match the implementation, align README, keep the directory clean, and write a clear commit message. Use whenever the user is about to commit or asks to check anything about the commit — e.g. verifying docs/README are in sync, cleaning up temp files, scanning for secrets/keys/.env in the change, or having you write the commit message. Not for general PR/code review (that's code-review), and not for explaining git/commit conventions (that's a teach task)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Commit Check
|
|
7
|
+
|
|
8
|
+
提交前的**门禁检查**:审查文档 → 对齐 README → 保持目录卫生 → 规范 commit message,四项全过才允许 commit。本技能是轻量检查清单,不重写 code-review 的审查语义([code-review](.agents/skills/code-review/SKILL.md) 是唯一事实源),也不替代任何完整实现流程——它是任何 commit 前的通用门禁,无论改动来自哪个流程。
|
|
9
|
+
|
|
10
|
+
## 四项检查(全部通过才 commit)
|
|
11
|
+
|
|
12
|
+
### ① 审查文档
|
|
13
|
+
|
|
14
|
+
- 本次改动涉及的行为/接口/配置/命令是否有对应文档(README、`docs/`、技能正文)描述
|
|
15
|
+
- 文档描述与实现一致:无过期信息、无声称未实现的功能、无遗留的旧接口描述
|
|
16
|
+
- 涉及技能/模板/配置改动时,检查正文引用的路径与实际一致(如相对路径、目录结构)
|
|
17
|
+
- 发现不一致 → 先修文档(或更新实现),再进入下一步
|
|
18
|
+
|
|
19
|
+
### ② 对齐 README
|
|
20
|
+
|
|
21
|
+
- 改动涉及项目结构、分发文件、技能/命令清单时,检查 README 中对应的结构说明、映射表、清单是否同步
|
|
22
|
+
- 改动涉及用法/CLI/配置/示例时,检查 README 对应描述与实际一致
|
|
23
|
+
- 存在模板镜像/分发副本时,确认源文件与副本同步(如有守护测试,跑一遍确认)
|
|
24
|
+
|
|
25
|
+
### ③ 保持目录卫生
|
|
26
|
+
|
|
27
|
+
- `git status` 确认工作区只含预期改动:无残留未跟踪文件、无临时产物(调试脚本、日志、备份文件、`[DEBUG-...]` 残留)
|
|
28
|
+
- 清理本次改动产生的临时文件(一次性脚本、转储、探针)——删除或移入明确的非提交位置
|
|
29
|
+
- 确认没有敏感信息进入改动(密钥、token、`.env`、私钥)——跑 `scripts/scan-sensitive.sh`,不用手写扫描
|
|
30
|
+
- 提交后工作区应为干净状态(`git status` 无输出)
|
|
31
|
+
|
|
32
|
+
### ④ 规范 commit message
|
|
33
|
+
|
|
34
|
+
- 格式遵循仓库约定(常见:`<type>(<scope>): <subject>`,type 用 feat/fix/docs/chore/refactor/test)
|
|
35
|
+
- subject 描述变更内容而非过程(不说"我做了什么",说"改成了什么")
|
|
36
|
+
- 需要时补充 body:动机、影响范围、验收证据(测试结果、同步确认)
|
|
37
|
+
- 一次 commit 只含一个逻辑变更;多主题拆多个 commit
|
|
38
|
+
|
|
39
|
+
## 不做什么
|
|
40
|
+
|
|
41
|
+
- 不做全量 code review:审查语义以 [code-review](.agents/skills/code-review/SKILL.md) 为唯一事实源,本技能不重写
|
|
42
|
+
- 不替代实现流程的收尾:`tdd-implement` 阶段⑦已含文档对齐与目录卫生,本技能只管独立 commit 的门禁
|
|
43
|
+
- 不顺手重构:只检查与本次改动直接相关的内容,不扩权到无关文档/目录
|
|
44
|
+
- 不发明扫描规则:敏感信息检测跑 `scripts/scan-sensitive.sh`,不每次重写 grep 模式
|
|
45
|
+
|
|
46
|
+
## 执行顺序(回合内串行)
|
|
47
|
+
|
|
48
|
+
1. 跑 ① 审查文档 → ② 对齐 README → ③ 保持目录卫生 → ④ 写 commit message
|
|
49
|
+
2. 任一项发现问题:修复后重跑该项,全部通过才 commit
|
|
50
|
+
3. commit 后确认 `git status` 干净,工作结束
|
|
51
|
+
|
|
52
|
+
**回合连续性**:四项检查在一个回合内串行完成,不等用户"继续";发现问题立即修复并重查,直到四项全过或遇到外部阻塞(权限/授权缺失)。
|
|
53
|
+
|
|
54
|
+
## 出口条件
|
|
55
|
+
|
|
56
|
+
- [ ] 文档审查通过(无过期/不一致描述)
|
|
57
|
+
- [ ] README 对齐(涉及结构/分发改动时已同步)
|
|
58
|
+
- [ ] 目录卫生(`git status` 干净,无临时产物/敏感信息)
|
|
59
|
+
- [ ] commit message 规范(遵循仓库格式)
|
|
60
|
+
- 四项全过 → commit
|
|
61
|
+
|
|
62
|
+
## 引用
|
|
63
|
+
|
|
64
|
+
- 代码审查语义:[code-review](.agents/skills/code-review/SKILL.md)(唯一事实源,本技能不重写)
|
|
65
|
+
- 完整实现流程:[tdd-implement](.agents/skills/tdd-implement/SKILL.md)(含流程内收尾的文档对齐与目录卫生)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Deterministic secret scan for commit-check check ③.
|
|
3
|
+
# The grep patterns are fragile to freehand — run this instead of re-writing
|
|
4
|
+
# the scan every time. Two confidence tiers:
|
|
5
|
+
# FAIL — structured secrets (KEY=value assignments, private key blocks)
|
|
6
|
+
# WARN — bare keywords (may legitimately appear in docs that mention them)
|
|
7
|
+
# Checks the staged diff (fail) and, unless --staged-only is passed, reports
|
|
8
|
+
# matches in the unstaged diff (warn).
|
|
9
|
+
#
|
|
10
|
+
# Usage:
|
|
11
|
+
# scripts/scan-sensitive.sh # staged (fail) + unstaged (warn)
|
|
12
|
+
# scripts/scan-sensitive.sh --staged-only
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
|
|
15
|
+
fail_patterns='(api[_-]?key|secret|token|passwd|password)[[:space:]]*[=:][[:space:]]*[^[:space:]]{8,}|BEGIN (RSA|OPENSSH|EC|DSA) PRIVATE KEY'
|
|
16
|
+
warn_patterns='(api[_-]?key|secret|token|passwd|password|\.env)'
|
|
17
|
+
|
|
18
|
+
fail=0
|
|
19
|
+
|
|
20
|
+
if git diff --cached -U0 | grep -inE "$fail_patterns"; then
|
|
21
|
+
echo "❌ Structured secrets found in STAGED diff — remove them before committing." >&2
|
|
22
|
+
fail=1
|
|
23
|
+
else
|
|
24
|
+
echo "✅ No structured secrets in staged diff."
|
|
25
|
+
if git diff --cached -U0 | grep -inE "$warn_patterns"; then
|
|
26
|
+
echo "⚠ Keyword matches in STAGED diff — eyeball whether they are real secrets." >&2
|
|
27
|
+
fi
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [[ "${1:-}" != "--staged-only" ]]; then
|
|
31
|
+
if git diff -U0 | grep -inE "$fail_patterns"; then
|
|
32
|
+
echo "⚠ Structured-secret matches in UNSTAGED diff — decide whether they belong in the commit." >&2
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
exit "$fail"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose-fix
|
|
3
|
+
description: "Complete diagnosis→fix→regression channel for bugs: diagnose, then fix via a TDD red-green loop with a hard gate (no fix code before a failing regression test). Use when the user says diagnose/debug/fix this, or reports something broken/throwing/failing/slow — prefer this over diagnosing-bugs when a fix is wanted, not just a diagnosis."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose Fix
|
|
7
|
+
|
|
8
|
+
诊断 **bug** 并修复的编排技能:诊断语义以 [diagnosing-bugs](.agents/skills/diagnosing-bugs/SKILL.md) 为唯一事实源,修复语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源;本技能只编排三个阶段并设一道**硬门槛**,不重写两个上游技能的规则。
|
|
9
|
+
|
|
10
|
+
本技能是**长程任务**(Long-Horizon Skill):诊断 → 修复 → 回归在**一个回合内串行完成**,自带**回合连续性**(Turn Continuity)规则(见下文)。术语定义见 `CONTEXT.md`,技能设计规则见 `docs/agents/skill-design.md`。
|
|
11
|
+
|
|
12
|
+
## 流程速览
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
① 诊断 → ② TDD 修复(硬门槛)→ ③ 回归验证
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ① 诊断
|
|
19
|
+
|
|
20
|
+
按 [diagnosing-bugs](.agents/skills/diagnosing-bugs/SKILL.md) 的 Phase 1-4 执行:
|
|
21
|
+
|
|
22
|
+
1. **反馈回路**(Phase 1):构建能对 _这个 bug_ 变红的紧致 pass/fail 信号——优先失败测试,其次 curl/CLI/浏览器脚本/重放/一次性 harness 等;没有回路不进入假设。
|
|
23
|
+
2. **复现 + 最小化**(Phase 2):跑回路看它红,确认失败模式与用户描述一致;逐步删减输入/调用方/配置,只保留 load-bearing 元素。
|
|
24
|
+
3. **假设**(Phase 3):生成 3-5 个可证伪的排名假设,先展示给用户。
|
|
25
|
+
4. **探针**(Phase 4):一次只改一个变量,临时探针用 `[DEBUG-...]` 前缀标记。
|
|
26
|
+
|
|
27
|
+
**出口条件**:反馈回路已红(已实际跑过并确认捕捉到该 bug)、复现已最小化。诊断完成前不写任何修复代码。
|
|
28
|
+
|
|
29
|
+
## ② TDD 修复(硬门槛)
|
|
30
|
+
|
|
31
|
+
**TDD 语义(红-绿循环、seam 定义、好测试标准、anti-patterns)以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源**——本技能不重写;进入本阶段前先读取 tdd 技能。
|
|
32
|
+
|
|
33
|
+
**硬门槛**:写任何修复代码之前,必须已存在一个**失败**的回归测试——把最小复现转写为正确 seam 上的测试,先运行看它红,然后才允许写修复代码让它变绿。
|
|
34
|
+
|
|
35
|
+
- **无逃生舱**:不存在正确 seam 时,**本身即 finding**——向用户明确说明"架构阻止锁定该 bug",请求 seam 决策或记录为架构改进建议(可转交 `/improve-codebase-architecture`);**不得**绕过测试直接改代码。
|
|
36
|
+
- **轻量声明**:本技能不套用 tdd-implement 的重流程——不做逐 todo 的循环编排、不设 seams 确认步骤、无 typecheck/commit 前置门禁;单 seam 修复场景直走红-绿。
|
|
37
|
+
|
|
38
|
+
**出口条件**:回归测试先红 → 写最小修复 → 回归测试变绿。
|
|
39
|
+
|
|
40
|
+
## ③ 回归验证
|
|
41
|
+
|
|
42
|
+
1. 重跑诊断阶段①的**原始反馈回路**(未最小化场景)确认症状消失。
|
|
43
|
+
2. 清理:删除所有 `[DEBUG-...]` 标记的临时探针与一次性 harness(`grep` 前缀确认无残留)。
|
|
44
|
+
3. 在 commit / PR 消息中写明**验证正确的假设**(诊断阶段哪个假设被证实),让下一个调试者受益。
|
|
45
|
+
|
|
46
|
+
**出口条件**:原始症状消失 + 回归测试绿 + 临时探针清理完成。
|
|
47
|
+
|
|
48
|
+
## 反模式(不做什么)
|
|
49
|
+
|
|
50
|
+
完整反模式清单见 [references/anti-patterns.md](references/anti-patterns.md)——正文各阶段规则是正面约束,反模式清单是负向边界;细节只在一处存在,本文件不重复。
|
|
51
|
+
|
|
52
|
+
## 回合连续性规则
|
|
53
|
+
|
|
54
|
+
诊断 → 修复 → 回归**在一个回合内串行完成**,不等用户"继续":构建回路 → 复现 → 假设 → 探针 → 失败测试 → 修复 → 回归 → 清理整条链一气呵成,中途不停顿。
|
|
55
|
+
|
|
56
|
+
输出只允许发生在以下三种情况:
|
|
57
|
+
- **合规交互点**:技能要求的用户确认——阶段①假设清单展示、阶段②无 seam finding 上报或 seam 决策请求
|
|
58
|
+
- **外部阻塞**:权限拒绝、缺失授权、依赖不可用——明确说明所需授权或替代路径,不静默停止
|
|
59
|
+
- **阶段出口**:整个阶段的出口条件满足(阶段①回路已红 + 复现最小化;阶段②失败测试已红 → 修复变绿;阶段③症状消失 + 回归绿 + 清理完成)
|
|
60
|
+
|
|
61
|
+
预告下一步后立即执行该步骤,回合终点仅为合规交互点、外部阻塞或阶段出口条件满足。进度输出本身不结束回合——输出后继续执行,直到三类终点之一达成。
|
|
62
|
+
|
|
63
|
+
## 引用
|
|
64
|
+
|
|
65
|
+
- 诊断:[diagnosing-bugs](.agents/skills/diagnosing-bugs/SKILL.md)
|
|
66
|
+
- TDD 修复:[tdd 技能](.agents/skills/tdd/SKILL.md)、[tdd/tests.md](.agents/skills/tdd/tests.md)、[tdd/mocking.md](.agents/skills/tdd/mocking.md)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 反模式清单(Diagnose-Fix)
|
|
2
|
+
|
|
3
|
+
SKILL.md 正文各阶段规则是正面约束;本文件是负向边界(不做什么),为细节唯一出处。SKILL.md 只引用本文件,不重复内容。
|
|
4
|
+
|
|
5
|
+
## 诊断阶段
|
|
6
|
+
|
|
7
|
+
- 不跳过反馈回路直接猜根因:回路未红之前不进入假设、不写修复代码
|
|
8
|
+
- 不把最小复现留在 harness 里:必须转写为正确 seam 上的回归测试,harness 只作诊断工具
|
|
9
|
+
- 不一次改多个变量:探针一次只改一个,`[DEBUG-...]` 前缀标记
|
|
10
|
+
|
|
11
|
+
## 修复阶段
|
|
12
|
+
|
|
13
|
+
- 不绕过测试直接改代码(见 SKILL.md ②无逃生舱)——没有 seam 是 finding,不是豁免
|
|
14
|
+
- 不套用 tdd-implement 重流程:见 SKILL.md ②轻量声明——单 seam 修复直走红-绿,不引入重流程编排
|
|
15
|
+
- 不重写 tdd 技能的红-绿语义:seam 定义、好测试标准、mocking 边界一律查上游技能
|
|
16
|
+
|
|
17
|
+
## 回归阶段
|
|
18
|
+
|
|
19
|
+
- 不遗留探针:`[DEBUG-...]` 前缀的临时改动在回归验证后全部清理
|
|
20
|
+
- 不跳过原始反馈回路的重跑:最小化场景绿 ≠ 原始症状消失
|