@jualopezmo/codeforge 0.4.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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +368 -0
  3. package/VERSION +1 -0
  4. package/bin/codeforge.mjs +64 -0
  5. package/install.ps1 +317 -0
  6. package/install.sh +326 -0
  7. package/package.json +39 -0
  8. package/src/CLAUDE.md +88 -0
  9. package/src/CONTINUITY.template.md +16 -0
  10. package/src/PROJECT.template.md +27 -0
  11. package/src/configs/claude/settings.json +6 -0
  12. package/src/configs/codex/config.toml +17 -0
  13. package/src/configs/opencode.json +14 -0
  14. package/src/docs/CHANGELOG.md +9 -0
  15. package/src/docs/adr/.gitkeep +0 -0
  16. package/src/docs/e2e/reports/.gitkeep +0 -0
  17. package/src/docs/e2e/use-cases/.gitkeep +0 -0
  18. package/src/docs/extending.md +134 -0
  19. package/src/docs/plans/.gitkeep +0 -0
  20. package/src/docs/prds/.gitkeep +0 -0
  21. package/src/docs/research/.gitkeep +0 -0
  22. package/src/docs/solutions/.gitkeep +0 -0
  23. package/src/shared/rules/approach-comparison.md +29 -0
  24. package/src/shared/rules/continuity.md +32 -0
  25. package/src/shared/rules/docs-layout.md +23 -0
  26. package/src/shared/rules/memory.md +34 -0
  27. package/src/shared/rules/models.md +59 -0
  28. package/src/shared/rules/project-rules.md +31 -0
  29. package/src/shared/rules/research.md +30 -0
  30. package/src/shared/rules/severity.md +17 -0
  31. package/src/shared/rules/ship-gates.md +164 -0
  32. package/src/shared/rules/tdd.md +20 -0
  33. package/src/shared/rules/workflow.md +38 -0
  34. package/src/shared/scripts/check-gates.ps1 +197 -0
  35. package/src/shared/scripts/check-gates.sh +201 -0
  36. package/src/shared/scripts/claude-gate-hook.ps1 +35 -0
  37. package/src/shared/scripts/claude-gate-hook.sh +43 -0
  38. package/src/shared/state.template.md +33 -0
  39. package/src/skills/adr/SKILL.md +63 -0
  40. package/src/skills/checkpoint/SKILL.md +50 -0
  41. package/src/skills/council/SKILL.md +87 -0
  42. package/src/skills/finish-branch/SKILL.md +85 -0
  43. package/src/skills/fix-bug/SKILL.md +84 -0
  44. package/src/skills/index/SKILL.md +52 -0
  45. package/src/skills/new-feature/SKILL.md +84 -0
  46. package/src/skills/plan/SKILL.md +63 -0
  47. package/src/skills/prd/SKILL.md +62 -0
  48. package/src/skills/quick-fix/SKILL.md +60 -0
  49. package/src/skills/research/SKILL.md +61 -0
  50. package/src/skills/review/SKILL.md +66 -0
  51. package/src/skills/simplify/SKILL.md +59 -0
  52. package/src/skills/verify-e2e/SKILL.md +102 -0
  53. package/src/sync.ps1 +69 -0
  54. package/src/sync.sh +69 -0
@@ -0,0 +1,43 @@
1
+ #!/bin/sh
2
+ # claude-gate-hook.sh — Claude Code PreToolUse adapter (opt-in Tier-C hardening).
3
+ #
4
+ # Installed only by `install.sh --with-hooks` into .claude/settings.local.json. On a
5
+ # Bash ship action (git commit / git push / gh pr create) it runs check-gates.sh; if
6
+ # the ship-gate boxes are incomplete it exits 2, which Claude Code treats as a BLOCK.
7
+ # This is the one place codeforge can HARD-block — Claude Code only, per-developer opt-in,
8
+ # not portable. The default install stays advisory. See shared/rules/ship-gates.md.
9
+ #
10
+ # Reads the tool call as JSON on stdin. Fails OPEN (never blocks) if it can't verify —
11
+ # an opt-in convenience must not brick a commit when the install is incomplete.
12
+ set -eu
13
+
14
+ input="$(cat)"
15
+
16
+ # Only gate outward ship actions. Match the raw payload (escaping-robust); the
17
+ # PreToolUse matcher already scopes this to Bash calls.
18
+ case "$input" in
19
+ *'git commit'*|*'git push'*|*'gh pr create'*) : ;;
20
+ *) exit 0 ;;
21
+ esac
22
+
23
+ hook_dir="$(cd "$(dirname "$0")" && pwd)"
24
+ gates="$hook_dir/check-gates.sh"
25
+ if [ ! -f "$gates" ]; then
26
+ echo "codeforge gate-hook: check-gates.sh not found next to the hook; allowing (fail-open)." >&2
27
+ exit 0
28
+ fi
29
+
30
+ rc=0
31
+ sh "$gates" >/dev/null 2>&1 || rc=$?
32
+ if [ "$rc" -eq 0 ]; then exit 0; fi # gates complete → allow
33
+ if [ "$rc" -ne 1 ]; then # can't verify (e.g. no state, exit 3) → fail OPEN
34
+ echo "codeforge gate-hook: could not verify gates (check-gates exit $rc); allowing (fail-open)." >&2
35
+ exit 0
36
+ fi
37
+
38
+ # rc == 1: ship-gate incomplete → block with the detail.
39
+ echo "codeforge gate: ship BLOCKED — ship-gate boxes are not complete." >&2
40
+ sh "$gates" 2>&1 | sed 's/^/ /' >&2 || true
41
+ echo " (opt-in --with-hooks gate; Claude Code only. Finish the boxes in" >&2
42
+ echo " .workflow/state.md, then retry. This checks the record, not the work.)" >&2
43
+ exit 2
@@ -0,0 +1,33 @@
1
+ # Workflow State — <feature-name>
2
+
3
+ > Copy this file to `.workflow/state.md` when a workflow starts. It is the source of truth
4
+ > the ship-gate reads. Keep it updated as you progress.
5
+
6
+ ## Active workflow
7
+
8
+ - **Skill:** new-feature
9
+ - **Profile:** standard <!-- standard (new-feature, fix-bug) | light (quick-fix) — see shared/rules/ship-gates.md -->
10
+ - **Feature:** <name>
11
+ - **Branch:** <feat/...>
12
+ - **Driver:** <claude | codex | opencode>
13
+ - **Phase:** <brainstorm | plan | design-review | tdd | code-review | verify | ship>
14
+
15
+ ## Ship-gate checklist (boxes for the Profile above — see shared/rules/ship-gates.md)
16
+
17
+ <!-- `standard` profile shown below; for the `light` profile (quick-fix) use its shorter list. -->
18
+
19
+ - [ ] On a feature branch (not `main`)
20
+ - [ ] Plan written and design-reviewed by the other engine — `N/A: <reason>` allowed for a simple fix-bug (see ship-gates.md)
21
+ - [ ] Tests written (TDD) and passing
22
+ - [ ] Code review clean — no open P0/P1/P2
23
+ - [ ] E2E verified via verify-e2e (report: docs/e2e/reports/<...>.md)
24
+ - [ ] State updated
25
+
26
+ ## Review log
27
+
28
+ - Design review iteration 1 — <engine> — findings: <P0/P1/P2 counts or "clean">
29
+ - Code review iteration 1 — <engine> — findings: <...>
30
+
31
+ ## Notes
32
+
33
+ <decisions, assumptions, what was verified>
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: adr
3
+ description: Record an architecture decision as an ADR (`docs/adr/<NNN>-<slug>.md`) — capture the context, the decision, the alternatives considered, and the consequences, so the reasoning survives. Use after making a significant, hard-to-reverse choice (a dependency, a boundary, a data model, a protocol) under Claude Code, Codex, or OpenCode.
4
+ ---
5
+
6
+ # adr
7
+
8
+ Write down *why*, not just *what*. An Architecture Decision Record captures a significant
9
+ choice and the reasoning behind it so the next session — or the next engine, or a teammate —
10
+ doesn't re-litigate a settled question or undo it without knowing the cost. This records a
11
+ decision already made (by `plan`, `council`, or you); it doesn't make one.
12
+
13
+ ## 1. Decide if it warrants an ADR
14
+
15
+ Write one when the choice is **significant and hard to reverse**: a framework/dependency, a
16
+ module boundary, a data model, an API/protocol, a security or migration strategy. Skip it for
17
+ reversible, local, or obvious choices — an ADR for those is noise.
18
+
19
+ ## 2. Number and name it
20
+
21
+ Find the highest existing `docs/adr/<NNN>-*.md` and use the next sequential number. Name it
22
+ `docs/adr/<NNN>-<slug>.md` (`shared/rules/docs-layout.md`), slug after the decision
23
+ (`012-event-sourcing-for-orders.md`).
24
+
25
+ ## 3. Write it
26
+
27
+ Keep it short and specific:
28
+
29
+ - **Status** — `accepted` (or `proposed` / `superseded by NNN`).
30
+ - **Context** — the forces at play: constraints, requirements, what made this a real fork.
31
+ - **Decision** — what you're doing, in active voice ("We will …").
32
+ - **Alternatives considered** — the other real options and **why each lost**. This is the part
33
+ that stops a future re-litigation.
34
+ - **Consequences** — the trade-offs: what becomes easier, what becomes harder, what you accept.
35
+
36
+ ## 4. Link it
37
+
38
+ Reference the ADR from the plan and/or `.workflow/state.md` so it's discoverable. If it
39
+ replaces an earlier decision, mark the old ADR `superseded by <NNN>` and link both ways —
40
+ ADRs are append-only history, never rewritten.
41
+
42
+ ## Common rationalizations
43
+
44
+ | Rationalization | Reality |
45
+ | --- | --- |
46
+ | "The decision is obvious — no need to write it down." | It's obvious *today*. The ADR is for whoever asks "why is it this way?" six months from now with none of today's context. |
47
+ | "I'll just capture it in the commit message." | Commit messages aren't browsable as decisions. ADRs live in `docs/adr/` where the next session actually looks. |
48
+ | "I'll state the decision but skip the alternatives." | The alternatives and why they lost are the most valuable part — without them the ADR can't defend itself when someone wants to reverse it. |
49
+ | "We changed our mind — I'll edit the old ADR." | ADRs are append-only. Supersede the old one and write a new one; don't rewrite the past. |
50
+
51
+ ## Red flags
52
+
53
+ - The ADR states the decision but not the context/forces that drove it.
54
+ - No alternatives, or alternatives with no reason they lost.
55
+ - You edited a prior ADR's decision instead of superseding it.
56
+ - It's recording a trivial, easily-reversed choice (ADR overkill).
57
+
58
+ ## Verification
59
+
60
+ `docs/adr/<NNN>-<slug>.md` exists with the next sequential number and states Status, Context,
61
+ Decision, Alternatives (with why each lost), and Consequences. If it replaces an earlier
62
+ decision, that ADR is marked superseded and linked. The record is referenced from the plan or
63
+ `.workflow/state.md`. An ADR missing its alternatives or consequences is incomplete — finish it.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: checkpoint
3
+ description: Write a clean session handoff to CONTINUITY.md before closing a session or resetting context, so the next session knows the current state and the exact next step. Use when wrapping up under Claude Code, Codex, or OpenCode.
4
+ ---
5
+
6
+ # checkpoint
7
+
8
+ Capture enough that a fresh session (or a different engine) can pick up without you
9
+ re-explaining. See `shared/rules/continuity.md`.
10
+
11
+ ## 1. Assess current state
12
+
13
+ In one pass, determine: what's done, what's in progress, the **single next action** to
14
+ take on resume, and any blocker. Be concrete — "continue the feature" is useless; "write
15
+ the failing test for the empty-cart case in `cart_test`" is a handoff.
16
+
17
+ ## 2. Update CONTINUITY.md
18
+
19
+ Write `CONTINUITY.md` at the repo root (create it from `CONTINUITY.template.md` if
20
+ missing) with: Focus, Next step, Blockers, Active-workflow pointer, Updated date, and 2–4
21
+ handoff notes (where we are, why, key context/decisions). Keep it tiny.
22
+
23
+ ## 3. Sync the workflow pointer
24
+
25
+ If a workflow is active, make sure `.workflow/state.md` is current too, and that
26
+ `CONTINUITY.md`'s "Active workflow" points to it. Don't copy state.md's content into
27
+ `CONTINUITY.md` — just point.
28
+
29
+ ## 4. Confirm
30
+
31
+ State a one-line summary of what the next session will pick up.
32
+
33
+ ## Common rationalizations
34
+
35
+ | Rationalization | Reality |
36
+ | --- | --- |
37
+ | "'Continue the feature' is a fine next step." | A vague handoff defeats the purpose. The Next step must be a specific action ("write the failing test for the empty-cart case"). |
38
+ | "I'll copy state.md into CONTINUITY.md." | Point at state.md, don't duplicate it — two copies drift. Keep CONTINUITY.md tiny. |
39
+ | "No need to note the blocker." | The next session inherits the blocker blind if you don't record it. |
40
+
41
+ ## Red flags
42
+
43
+ - The Next step is generic ("keep going", "finish it").
44
+ - CONTINUITY.md duplicates state.md instead of pointing at it.
45
+ - No Updated date, or it isn't today's.
46
+
47
+ ## Verification
48
+
49
+ `CONTINUITY.md` exists with a **concrete Next step** (a specific action, not "continue")
50
+ and an Updated date of today. A vague handoff defeats the purpose — rewrite it.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: council
3
+ description: Multi-perspective decision analysis — consult two or more engines (Claude, Codex, OpenCode) as independent advisors on one hard, expensive decision, then synthesize a verdict with a mandatory minority report. Use for architecture choices, approach forks, or any fork-in-the-road where being wrong is costly. Not for routine choices with an obvious default.
4
+ ---
5
+
6
+ # council
7
+
8
+ Turn an expensive, hard-to-reverse decision into a diverse, auditable vote. The value is
9
+ **model diversity**: independent advisors from *different* engines, synthesized by the
10
+ driver acting as chairman.
11
+
12
+ ## When to use
13
+
14
+ - Architecture decisions, approach forks, tech/tradeoff choices where being wrong is
15
+ costly or hard to undo.
16
+
17
+ **Do NOT use** for routine choices with an obvious default — that's just the driver
18
+ deciding. Council is for genuine ambiguity with real stakes.
19
+
20
+ ## 1. Frame the question
21
+
22
+ Write ONE decision-shaped question with the concrete options and the constraints that
23
+ matter. Not "how do I do X" — rather "should we do A or B, given C, D?". List the options
24
+ explicitly. A vague prompt produces vague advice.
25
+
26
+ ## 2. Pick the advisors (must span engines)
27
+
28
+ Choose **at least two distinct engines** as advisors; the more model diversity, the
29
+ better. The driver may include itself as one voice, but the panel must not be a single
30
+ engine talking to itself. Optionally assign each advisor a different lens so they don't
31
+ all reason the same way, e.g.:
32
+
33
+ - **Simplicity** — the least-moving-parts option.
34
+ - **Blast radius / risk** — what breaks, how reversible.
35
+ - **Longevity** — maintainability and cost over time.
36
+
37
+ ## 3. Consult each advisor independently
38
+
39
+ Send each advisor the **same framed question** (plus its lens), and do it
40
+ **independently** — an advisor must not see another's answer, or you lose the diversity.
41
+ Use each engine's **non-interactive** mode (Codex `codex exec`, Claude `claude -p`, OpenCode
42
+ `opencode run`), spanning all three engines for max diversity. The exact **model IDs, effort,
43
+ and read-only invocation** for each engine live in one place — `shared/rules/models.md` —
44
+ so use them from there; do not hard-code them here. Advisors must run **read-only** (they
45
+ advise, they don't edit) per the read-only invocation in `models.md`.
46
+
47
+ Capture from each: its position, key reasoning, and a one-line recommendation. If an
48
+ advisor's output is missing or unparseable, re-run it — do not invent a position for it.
49
+
50
+ ## 4. Synthesize (chairman)
51
+
52
+ As the driver, produce the verdict:
53
+
54
+ - **Agreement** — where advisors converge (the strongest signal).
55
+ - **Divergence** — where and why they differ.
56
+ - **Verdict** — the recommended decision and the reason.
57
+ - **Minority report (mandatory)** — the strongest dissenting view, stated fairly. If every
58
+ advisor agreed, say so explicitly and note the biggest residual risk. Never drop this —
59
+ it is the guard against groupthink.
60
+
61
+ ## 5. Record
62
+
63
+ Write the framed question, each advisor's one-line position, the verdict, and the minority
64
+ report into `.workflow/state.md` (or the relevant plan/decision doc), so the decision is
65
+ auditable later.
66
+
67
+ ## Common rationalizations
68
+
69
+ | Rationalization | Reality |
70
+ | --- | --- |
71
+ | "I'll ask one engine twice for the two views." | A panel of one engine is groupthink. Advisors must span ≥2 distinct engines or it isn't a council. |
72
+ | "Let the advisors see each other's answers to build on them." | Independence is the whole point — shared answers collapse the diversity into one view. Consult each blind. |
73
+ | "They all agreed, so I'll drop the minority report." | The minority report is mandatory. If all agreed, state the biggest residual risk — it's the guard against groupthink. |
74
+ | "This is a routine call — run a council to be safe." | Council is for expensive, hard-to-reverse forks. For an obvious default, just decide; don't burn the ceremony. |
75
+
76
+ ## Red flags
77
+
78
+ - All advisors are the same engine.
79
+ - Advisors saw each other's positions before answering.
80
+ - The verdict has no minority report / residual-risk note.
81
+ - You convened a council for a decision that had an obvious default.
82
+
83
+ ## Verification
84
+
85
+ Before returning, confirm the output contains: the framed question, ≥2 distinct-engine
86
+ advisor positions, a verdict, and a non-empty minority report. Missing any of these means
87
+ the council did not actually run — redo it rather than presenting a thin verdict.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: finish-branch
3
+ description: Wrap up a completed branch — confirm the ship-gate profile is green, do a final verify, record durable docs, then commit, push, and open the PR. Use to close out work under Claude Code, Codex, or OpenCode after the feature/fix workflow is done.
4
+ ---
5
+
6
+ # finish-branch
7
+
8
+ Close out a branch cleanly. This does not replace the feature/fix workflow — it's the
9
+ final step after one.
10
+
11
+ ## 1. Confirm the gates
12
+
13
+ Run the deterministic checker — don't just eyeball the file:
14
+
15
+ ```sh
16
+ sh shared/scripts/check-gates.sh # pwsh shared/scripts/check-gates.ps1 on Windows
17
+ ```
18
+
19
+ It reads `.workflow/state.md`, confirms **every box for the active profile** is checked (or
20
+ N/A), and exits non-zero listing any that aren't (`shared/rules/ship-gates.md`). If it fails,
21
+ go back and finish those boxes — do not ship.
22
+
23
+ This is **Tier B**: it verifies the *record*, not the work. A checked box is an
24
+ *attestation* (you claimed it), not independent proof — so also spot-confirm the underlying
25
+ work is real (tests actually ran, the change was actually exercised). See the
26
+ Verified / Attested / Advisory distinction in `shared/rules/ship-gates.md`.
27
+
28
+ `check-gates` now also enforces the `E2E verified` marker — if it's checked (not `N/A:`),
29
+ a fresh `VERDICT: PASS` report must exist under `docs/e2e/reports/`. finish-branch relies on
30
+ the report produced during the workflow; it does not re-run the journeys.
31
+
32
+ ## 2. Final verify
33
+
34
+ Run the test suite and exercise the change once more end-to-end. Confirm the working tree
35
+ is otherwise clean and the branch is up to date.
36
+
37
+ ## 3. Record durable docs — BEFORE shipping
38
+
39
+ Do this **before** the ship commit so the documentation ships *with* the change (not left
40
+ uncommitted, and never as a second unreviewed commit):
41
+
42
+ - Add a newest-first entry to `docs/CHANGELOG.md` (`shared/rules/docs-layout.md`).
43
+ - Save any reusable learning per `shared/rules/memory.md` (solved bugs → `docs/solutions/`,
44
+ decisions → `docs/adr/`).
45
+
46
+ ## 4. Commit
47
+
48
+ Commit all intended changes **including the docs from step 3** with a clear message.
49
+ Nothing uncommitted, no stray files.
50
+
51
+ ## 5. Push + open PR
52
+
53
+ Push the branch and open the PR. Both hit the **native prompt** (a commit-confirmation, not
54
+ a gate — `shared/rules/ship-gates.md`) — approve only because you just confirmed the gates
55
+ in step 1. Write a PR description stating what changed, why, and how it was verified.
56
+
57
+ ## 6. Update transient state
58
+
59
+ Only now — after shipping — record the PR link / merge outcome in `.workflow/state.md` so
60
+ the workflow state reflects reality. (This is the one thing that legitimately comes after
61
+ the ship commit.)
62
+
63
+ ## Common rationalizations
64
+
65
+ | Rationalization | Reality |
66
+ | --- | --- |
67
+ | "The gates are basically green — ship it." | "Basically" isn't checked. Any open required box means go back and finish it; the native prompt is not the gate. |
68
+ | "I'll add the changelog / ADR in a follow-up commit." | Docs ship *with* the change, in the same commit. A second unreviewed commit is exactly how they get lost. |
69
+ | "The push prompt appeared, so I'm cleared to ship." | The prompt is a commit-confirmation that reads no gate state (`shared/rules/ship-gates.md`). It proves nothing — you are the gate. |
70
+ | "I'll record the PR outcome later." | Update `.workflow/state.md` with the PR link / merge outcome now, so the workflow reflects reality. |
71
+
72
+ ## Red flags
73
+
74
+ - An open box in `.workflow/state.md` and you're pushing anyway.
75
+ - The CHANGELOG / ADR is uncommitted or slated for "later."
76
+ - You approved the push prompt without re-confirming the gates in step 1.
77
+ - Stray or unintended files in the working tree at commit time.
78
+
79
+ ## Verification
80
+
81
+ - [ ] Every required box for the active profile is checked in `.workflow/state.md`.
82
+ - [ ] Full suite run and the change exercised end-to-end once more.
83
+ - [ ] CHANGELOG entry (+ ADR / solution where applicable) committed *with* the change.
84
+ - [ ] Working tree clean — nothing stray, nothing uncommitted.
85
+ - [ ] PR opened stating what changed, why, and how it was verified; outcome recorded in state.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: fix-bug
3
+ description: Bug-fix workflow with systematic debugging — reproduce with a failing test, isolate root cause, fix minimally, cross-review, verify, and ship behind the ship-gate. Use when correcting incorrect behavior under Claude Code, Codex, or OpenCode.
4
+ ---
5
+
6
+ # fix-bug
7
+
8
+ Fix a defect with evidence, not guesses. Works identically under all three engines.
9
+
10
+ ## 0. Set up tracking
11
+
12
+ - Confirm you are **not on `main`** — create a branch (`fix/<name>`).
13
+ - Copy `shared/state.template.md` to `.workflow/state.md`; set skill = `fix-bug`, **Profile:
14
+ standard**, feature/bug name, branch, and driver.
15
+
16
+ ## 1. Reproduce
17
+
18
+ Reproduce the bug deterministically. Capture the exact input, expected vs actual, and the
19
+ smallest failing case. Do not propose a fix until you can trigger it on demand.
20
+
21
+ ## 2. Root cause (systematic debugging)
22
+
23
+ Form a hypothesis, add logging/assertions to test it, and confirm the actual cause before
24
+ touching the fix. Read the relevant code and cite `file:line`. Distinguish what you
25
+ verified from what you infer.
26
+
27
+ ## 3. Failing test first (TDD)
28
+
29
+ Write a test that fails **because of the bug** (red) — see `shared/rules/tdd.md`. This
30
+ proves the repro and prevents regression. For a high-impact surface, also design-review
31
+ the fix approach with the `review` skill (a different engine) before implementing.
32
+
33
+ ## 4. Fix minimally
34
+
35
+ Make the smallest change that turns the test green. Refactor only if it clarifies. Fix
36
+ the real cause, not the symptom.
37
+
38
+ ## 5. Code review (cross-engine)
39
+
40
+ Review the diff with the **other** engine (`review` skill; models per
41
+ `shared/rules/models.md`) + a self-pass; resolve all P0/P1/P2 (`shared/rules/severity.md`).
42
+ Record iterations in `.workflow/state.md`.
43
+
44
+ ## 6. Verify
45
+
46
+ Exercise the original repro and confirm it's gone; check you didn't break neighbors.
47
+ Note what you observed. Then run the `verify-e2e` skill to confirm the fix through the
48
+ user-facing interface (API/CLI). Internal-only fixes record
49
+ `E2E verified — N/A: <reason>`. Record the fix (symptom → root cause → fix → how
50
+ verified) in `docs/solutions/<slug>.md` (`shared/rules/memory.md`).
51
+
52
+ ## 7. Ship
53
+
54
+ Only when every required box in `.workflow/state.md` is checked
55
+ (`shared/rules/ship-gates.md`). Commit, then push / open PR — approve the native prompt
56
+ only if the gates are green.
57
+
58
+ ## Common rationalizations
59
+
60
+ | Rationalization | Reality |
61
+ | --- | --- |
62
+ | "The cause is obvious — I'll just fix it." | A fix without a reproduced failing test is a guess. Reproduce first; read the code and cite `file:line`. |
63
+ | "A failing test is overkill for this bug." | The failing test proves the repro and blocks regression — it *is* the fix's evidence. Red before green. |
64
+ | "It's late / the lead said skip the regression test." | Time and authority pressure don't change that an unproven fix regresses. The failing test is non-negotiable. |
65
+ | "The suite passes, so it's verified." | Re-exercise the *original* repro and check neighbors. Green tests ≠ the user's bug is gone. |
66
+ | "This patch makes the symptom go away." | Fix the root cause, not the symptom, or it comes back. |
67
+
68
+ ## Red flags
69
+
70
+ - You're writing the fix before you can trigger the bug on demand.
71
+ - No test fails *because of the bug*.
72
+ - You changed code you haven't read (no `file:line` cited).
73
+ - You're patching the symptom, not the cause.
74
+ - You skipped the cross-engine review to "save time."
75
+
76
+ ## Verification
77
+
78
+ - [ ] Bug reproduced deterministically before any fix.
79
+ - [ ] A test failed because of the bug (red) and passes after (green).
80
+ - [ ] Root cause identified and cited (`file:line`) — not the symptom.
81
+ - [ ] Cross-engine review clean; all P0/P1/P2 resolved.
82
+ - [ ] Original repro re-exercised and gone; neighbors intact.
83
+ - [ ] Fix recorded (symptom → root cause → fix → how verified) in `docs/solutions/`.
84
+ - [ ] Every required ship-gate box checked.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: index
3
+ description: Generate or refresh docs/index.md — a high-level project map (structure, key locations, entry points, conventions) so an agent orients fast without re-scanning the whole tree. Use when onboarding to a project or after a significant structural change, under Claude Code, Codex, or OpenCode.
4
+ ---
5
+
6
+ # index
7
+
8
+ Give the agent a curated map instead of re-scanning the tree every session. Keep it
9
+ **high-level** so it stays fresh — structure and conventions change slowly; line-level
10
+ detail churns and goes stale fast.
11
+
12
+ ## 1. Scan the shape
13
+
14
+ List the top-level layout, the key directories, and the notable files. Identify the
15
+ **entry points** (how you run / build / test / install it) and the main modules or areas.
16
+
17
+ ## 2. Find the conventions
18
+
19
+ Note the conventions an agent must know to work here: naming, where each kind of thing
20
+ lives, patterns, and gotchas. Pull them from `PROJECT.md`, `README.md`, and the code —
21
+ don't invent them.
22
+
23
+ ## 3. Write docs/index.md
24
+
25
+ Write a concise map: what the project is (one line + link to `README.md`), entry points, a
26
+ "where things live" table (directory → purpose), the key files, and the conventions. Do
27
+ **not** enumerate every file or go line-level — that is what goes stale.
28
+
29
+ ## 4. Note freshness
30
+
31
+ Add an `Updated:` date. Refresh after a **significant structural change** (a new top-level
32
+ area, moved/renamed modules) — not on every edit.
33
+
34
+ ## Common rationalizations
35
+
36
+ | Rationalization | Reality |
37
+ | --- | --- |
38
+ | "I'll list every file so the map is complete." | Line-level detail goes stale fast. Keep the map high-level — structure and conventions, not an inventory. |
39
+ | "I'll infer the conventions." | Pull conventions from `PROJECT.md` / `README.md` / the code — don't invent them. |
40
+ | "No need to check the paths are real." | An index that lists paths that don't exist is worse than none. Spot-check they exist. |
41
+
42
+ ## Red flags
43
+
44
+ - The map enumerates individual files or drops to line-level detail.
45
+ - Conventions are asserted with no source in the repo.
46
+ - Listed paths don't exist, or there's no `Updated:` date.
47
+
48
+ ## Verification
49
+
50
+ `docs/index.md` names **real, current** top-level paths and entry points (spot-check they
51
+ exist), stays high-level, and carries an `Updated:` date. If it lists paths that don't
52
+ exist, it's stale — regenerate it.
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: new-feature
3
+ description: Full feature workflow — research, plan, cross-engine design review, TDD, code review, verify, and ship behind the ship-gate. Use when starting or implementing any new feature or behavior change — build it end to end with tests and review — under Claude Code, Codex, or OpenCode.
4
+ ---
5
+
6
+ # new-feature
7
+
8
+ Drive a feature from idea to shipped change with cross-engine review discipline. Works
9
+ identically under Claude Code, Codex, and OpenCode.
10
+
11
+ ## 0. Set up tracking
12
+
13
+ - Confirm you are **not on `main`** — create a branch (`feat/<name>`).
14
+ - Copy `shared/state.template.md` to `.workflow/state.md`; set **Profile: standard**, the feature name, and branch.
15
+
16
+ ## 1. Research (when external tech is involved)
17
+
18
+ If the feature touches an unfamiliar or external library/API/protocol, run the `research`
19
+ skill first and write a sourced brief (`shared/rules/research.md`). Skip only for changes
20
+ fully contained in code you already understand.
21
+
22
+ ## 2. Plan
23
+
24
+ Clarify intent, then compare 2–3 approaches and pick one — use the `plan` skill and the
25
+ fixed axes in `shared/rules/approach-comparison.md`. Capture the goal, chosen approach,
26
+ files/units to touch, edge cases, the test plan, and acceptance criteria. Keep units
27
+ small. Do not write implementation code yet.
28
+
29
+ ## 3. Design review (cross-engine)
30
+
31
+ Validate the plan with the `review` skill (a *different* engine reviews) — or `council`
32
+ for a hard fork. Reviewer/advisor models come from `shared/rules/models.md`. Collect
33
+ findings by severity (`shared/rules/severity.md`); resolve P0/P1/P2; record the iteration
34
+ in `.workflow/state.md`.
35
+
36
+ ## 4. TDD
37
+
38
+ Red → green → refactor (`shared/rules/tdd.md`). Write the failing test first, make it pass
39
+ minimally, then refactor. Never write implementation before a failing test exists.
40
+
41
+ ## 5. Code review (cross-engine)
42
+
43
+ Review the diff with the `review` skill (the other engine) + a self-pass. Fix all
44
+ P0/P1/P2. Repeat until a single pass is clean. Record iterations in `.workflow/state.md`.
45
+ Then run `simplify` for a behavior-preserving cleanup pass while the suite is green.
46
+
47
+ ## 6. Verify
48
+
49
+ Run the `verify-e2e` skill: design/execute API & CLI user-journey use cases, and let it
50
+ write the evidence report the ship-gate checks. For purely internal or UI-only changes,
51
+ record `E2E verified — N/A: <reason>` in `.workflow/state.md`.
52
+
53
+ ## 7. Ship
54
+
55
+ Only when every required box in `.workflow/state.md` is checked (`shared/rules/ship-gates.md`).
56
+ Commit, then push / open PR — approve the native prompt **only if the gates are green**.
57
+ Record the change in `docs/CHANGELOG.md` and save any reusable learning
58
+ (`shared/rules/memory.md`). Or run `finish-branch` to do the wrap-up.
59
+
60
+ ## Common rationalizations
61
+
62
+ | Rationalization | Reality |
63
+ | --- | --- |
64
+ | "I understand this — skip the plan." | Even familiar work benefits from comparing approaches and a written plan the reviewer can check. A plan gap that builds the wrong thing is a P1 (`shared/rules/severity.md`). |
65
+ | "I'll write the tests after the code." | TDD is red → green → refactor. Implementation before a failing test isn't TDD and silently skips cases. |
66
+ | "The reviewer is just another AI — its findings don't count." | The whole point is a second, differently-trained model catching what you miss. Resolve P0/P1/P2 before shipping. |
67
+ | "I'll do the design review after I've built it." | Reviewing after implementation only sees code consistent with an *unreviewed* plan. Review the plan first, where the cheap fixes are. |
68
+ | "Tests pass, no need to actually run it." | Exercise the real change — tests alone miss integration, wiring, and UX defects. |
69
+
70
+ ## Red flags
71
+
72
+ - No plan file, or a plan with a single approach and no comparison.
73
+ - Implementation code exists before any failing test.
74
+ - You reviewed with the same engine that wrote the code (no cross-engine pass).
75
+ - You're about to ship on green tests without exercising the change end-to-end.
76
+
77
+ ## Verification
78
+
79
+ - [ ] Plan written with a compared, chosen approach + acceptance criteria.
80
+ - [ ] Design reviewed cross-engine; P0/P1/P2 resolved.
81
+ - [ ] TDD followed — a failing test preceded each piece of implementation.
82
+ - [ ] Code review clean on a single pass (cross-engine + self-pass).
83
+ - [ ] Change exercised for real; outcome observed and noted.
84
+ - [ ] Every required ship-gate box checked; `docs/CHANGELOG.md` updated.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: plan
3
+ description: Turn an idea into a reviewed design — clarify intent, compare 2–3 approaches on fixed axes, pick one with rationale, and write a plan the implementation follows. Use before building a non-trivial change under Claude Code, Codex, or OpenCode. Feeds new-feature / fix-bug.
4
+ ---
5
+
6
+ # plan
7
+
8
+ Design before you build. Produces a written plan that `new-feature` / `fix-bug`
9
+ implements against. Pairs with `research` (run it first when external tech is involved).
10
+
11
+ ## 1. Clarify intent
12
+
13
+ Pin down purpose, constraints, and success criteria. Ask the user one question at a time
14
+ only when something is genuinely ambiguous; otherwise state your assumptions and proceed.
15
+ Do not write implementation code in this phase.
16
+
17
+ ## 2. Compare approaches
18
+
19
+ List **2–3 genuinely different** approaches and score them on the fixed axes in
20
+ `shared/rules/approach-comparison.md` (complexity, blast radius, reversibility, time to
21
+ validate, correctness/user risk). Name the default winner and why — prefer the simplest
22
+ option that clears the bar.
23
+
24
+ ## 3. Validate the choice (don't self-certify)
25
+
26
+ Run `review` or `council` on the chosen approach before locking it in. If the cheapest
27
+ falsifying experiment is quick, spike it first and let evidence decide. Resolve any
28
+ P0/P1/P2 the reviewer raises (`shared/rules/severity.md`).
29
+
30
+ ## 4. Write the plan
31
+
32
+ Capture: the goal, the chosen approach + the comparison table, the files/units to touch,
33
+ edge cases, the tests that will prove it (TDD — `shared/rules/tdd.md`), and acceptance
34
+ criteria. Keep units small and single-purpose. Save to `docs/plans/<feature>.md`
35
+ (`shared/rules/docs-layout.md`) and reference it from `.workflow/state.md`. Record any
36
+ significant architecture decision as an ADR (the `adr` skill) in `docs/adr/`.
37
+
38
+ ## 5. Hand off to implementation
39
+
40
+ `new-feature` / `fix-bug` build from this plan. A gap here propagates downstream, so a
41
+ missing required behavior or acceptance criterion is a P1, not a nit.
42
+
43
+ ## Common rationalizations
44
+
45
+ | Rationalization | Reality |
46
+ | --- | --- |
47
+ | "I already know the best approach — skip the comparison." | Comparing 2–3 genuinely different options is how you catch the cheaper one you didn't consider, and it gives the reviewer something to check. |
48
+ | "One approach is enough to write down." | A plan with a single option and no trade-offs is a decision with no audit trail. Name the alternatives and why they lost. |
49
+ | "I'll validate the choice by just building it." | Self-certifying skips the cross-engine check where design flaws are cheapest to fix. Review the choice (or spike it) before locking in. |
50
+ | "The acceptance criteria are obvious — leave them out." | Implementation builds from the plan; a missing criterion becomes the wrong feature. Spec-loss is a P1, not a nit. |
51
+
52
+ ## Red flags
53
+
54
+ - The plan lists one approach, or "alternatives" that aren't genuinely different.
55
+ - You picked the most complex option without justifying it over the simplest.
56
+ - No test plan or acceptance criteria.
57
+ - You locked the choice with no second-engine review and no spike evidence.
58
+
59
+ ## Verification
60
+
61
+ The plan states the goal, a compared-and-chosen approach (with rationale), the test plan,
62
+ and acceptance criteria; the choice was reviewed by another engine. Missing any of these
63
+ means it's not ready to implement.