@gtrabanco/pi-agentic-workflow 0.1.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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.es.md +154 -0
  3. package/README.md +148 -0
  4. package/dist/config/defaults.d.ts +8 -0
  5. package/dist/config/defaults.js +11 -0
  6. package/dist/config/load.d.ts +19 -0
  7. package/dist/config/load.js +76 -0
  8. package/dist/config/merge.d.ts +4 -0
  9. package/dist/config/merge.js +43 -0
  10. package/dist/config/schema.d.ts +21 -0
  11. package/dist/config/schema.js +144 -0
  12. package/dist/config/types.d.ts +53 -0
  13. package/dist/config/types.js +12 -0
  14. package/dist/extension/factory.d.ts +47 -0
  15. package/dist/extension/factory.js +49 -0
  16. package/dist/extension/index.d.ts +4 -0
  17. package/dist/extension/index.js +84 -0
  18. package/dist/routing/catalogue.d.ts +35 -0
  19. package/dist/routing/catalogue.js +79 -0
  20. package/dist/routing/dispatch.d.ts +34 -0
  21. package/dist/routing/dispatch.js +191 -0
  22. package/dist/routing/state.d.ts +13 -0
  23. package/dist/routing/state.js +65 -0
  24. package/dist/routing/types.d.ts +90 -0
  25. package/dist/routing/types.js +3 -0
  26. package/dist/settings/console.d.ts +55 -0
  27. package/dist/settings/console.js +266 -0
  28. package/dist/settings/store.d.ts +3 -0
  29. package/dist/settings/store.js +24 -0
  30. package/dist/settings/view.d.ts +11 -0
  31. package/dist/settings/view.js +46 -0
  32. package/package.json +59 -0
  33. package/skills/audit-docs/SKILL.md +171 -0
  34. package/skills/audit-pr/SKILL.md +201 -0
  35. package/skills/audit-pr/references/01_MERGE_GATES.md +24 -0
  36. package/skills/audit-pr/references/02_CLOSURE_AND_SCOPE_GATES.md +83 -0
  37. package/skills/audit-pr/references/03_AUDIT_PROCESS.md +69 -0
  38. package/skills/audit-pr/references/04_VERDICT.md +69 -0
  39. package/skills/audit-pr/references/05_ROUTING_AND_GUARDRAILS.md +58 -0
  40. package/skills/audit-pr/references/PORTABILITY.md +17 -0
  41. package/skills/design-feature/SKILL.md +162 -0
  42. package/skills/design-feature/references/INTERVIEW.md +52 -0
  43. package/skills/design-feature/references/PORTABILITY.md +15 -0
  44. package/skills/design-feature/references/UPSERT_EXAMPLE.md +8 -0
  45. package/skills/design-feature/references/WRITE_AND_UPSERT.md +92 -0
  46. package/skills/discover-repository-state/SKILL.md +83 -0
  47. package/skills/execute-phase/SKILL.md +115 -0
  48. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +54 -0
  49. package/skills/execute-phase/references/CLOSEOUT.md +74 -0
  50. package/skills/execute-phase/references/DESCOPE.md +35 -0
  51. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +147 -0
  52. package/skills/execute-phase/references/FOLDING.md +73 -0
  53. package/skills/execute-phase/references/FORGE_BODY.md +24 -0
  54. package/skills/execute-phase/references/HANDOFF.md +21 -0
  55. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +45 -0
  56. package/skills/execute-phase/references/PREFLIGHT.md +152 -0
  57. package/skills/execute-phase/references/UNIT_LOOP.md +88 -0
  58. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +37 -0
  59. package/skills/execute-phase/references/WORKFLOWS_FIX.md +43 -0
  60. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +26 -0
  61. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +38 -0
  62. package/skills/fold-findings/SKILL.md +141 -0
  63. package/skills/fold-findings/references/FOLD_POLICY.md +43 -0
  64. package/skills/fold-findings/references/FOLD_PROCESS.md +41 -0
  65. package/skills/generate-docs/SKILL.md +145 -0
  66. package/skills/generate-docs/references/ADAPTERS.md +15 -0
  67. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +33 -0
  68. package/skills/generate-docs/references/GENERATION_PROCESS.md +90 -0
  69. package/skills/init-workspace/SKILL.md +152 -0
  70. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +70 -0
  71. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +58 -0
  72. package/skills/init-workspace/references/PORTABILITY.md +16 -0
  73. package/skills/init-workspace/references/UPGRADE.md +83 -0
  74. package/skills/log-session/SKILL.md +159 -0
  75. package/skills/loop-review-fold/SKILL.md +168 -0
  76. package/skills/orchestration-envelope/SKILL.md +81 -0
  77. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +21 -0
  78. package/skills/phase-contract/SKILL.md +82 -0
  79. package/skills/plan-feature/SKILL.md +179 -0
  80. package/skills/plan-feature/references/ROUTING.md +83 -0
  81. package/skills/plan-feature-from-issue/SKILL.md +140 -0
  82. package/skills/plan-feature-scaffold/SKILL.md +93 -0
  83. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +76 -0
  84. package/skills/plan-fix/SKILL.md +115 -0
  85. package/skills/plan-fix/references/PLANNING_PROCESS.md +118 -0
  86. package/skills/plan-fix/references/SPEC_CONTRACT.md +22 -0
  87. package/skills/planning-preflight/SKILL.md +130 -0
  88. package/skills/product-audit/SKILL.md +225 -0
  89. package/skills/product-audit/references/AUDIT_DIMENSIONS.md +24 -0
  90. package/skills/product-audit/references/AUDIT_PROCESS.md +85 -0
  91. package/skills/resolve-repository-state/SKILL.md +79 -0
  92. package/skills/review-a11y/SKILL.md +60 -0
  93. package/skills/review-brand/SKILL.md +65 -0
  94. package/skills/review-change/SKILL.md +156 -0
  95. package/skills/review-change/references/ADVERSARIAL_RECOMMENDATION.md +31 -0
  96. package/skills/review-change/references/ADVERSARIAL_SETUP.md +86 -0
  97. package/skills/review-change/references/ADVERSARIAL_SYNTHESIS.md +53 -0
  98. package/skills/review-change/references/OUTPUT_AND_GUARDRAILS.md +85 -0
  99. package/skills/review-change/references/PERSIST_AND_DECIDE.md +151 -0
  100. package/skills/review-change/references/PORTABILITY.md +74 -0
  101. package/skills/review-change/references/REVIEW_PROCESS.md +86 -0
  102. package/skills/review-code/SKILL.md +69 -0
  103. package/skills/review-debt/SKILL.md +72 -0
  104. package/skills/review-design/SKILL.md +60 -0
  105. package/skills/review-implementation/SKILL.md +108 -0
  106. package/skills/review-implementation/references/CLASSIFY.md +96 -0
  107. package/skills/review-implementation/references/FIND.md +35 -0
  108. package/skills/review-perf/SKILL.md +79 -0
  109. package/skills/review-security/SKILL.md +65 -0
  110. package/skills/review-seo/SKILL.md +65 -0
  111. package/skills/review-verify/SKILL.md +66 -0
  112. package/skills/ship-roadmap/SKILL.md +120 -0
  113. package/skills/ship-roadmap/references/ADVANCE.md +90 -0
  114. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +64 -0
  115. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +26 -0
  116. package/skills/ship-roadmap/references/FOUNDING.md +101 -0
  117. package/skills/ship-roadmap/references/GUARDRAILS.md +56 -0
  118. package/skills/ship-roadmap/references/MODEL_ROUTING.md +14 -0
  119. package/skills/ship-roadmap/references/PORTABILITY.md +34 -0
  120. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +93 -0
  121. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +9 -0
  122. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +34 -0
  123. package/skills/triage-issue/SKILL.md +148 -0
  124. package/skills/triage-issue/references/AUDIT_FINDINGS.md +35 -0
  125. package/skills/triage-issue/references/FOLD_LEDGER.md +32 -0
  126. package/skills/triage-issue/references/ISSUE_PROCESS.md +101 -0
  127. package/skills/triage-issue/references/LABELS.md +83 -0
  128. package/skills/triage-issue/references/REVIEW_FINDING_PROCESS.md +41 -0
  129. package/skills/verification-contract/SKILL.md +77 -0
  130. package/skills/workflow-status/SKILL.md +143 -0
  131. package/skills/workflow-status/references/CRASH_RECOVERY.md +66 -0
  132. package/skills/workflow-status/references/ENVELOPE_CORE.md +107 -0
  133. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +77 -0
  134. package/skills/workflow-status/references/GUARDRAILS.md +17 -0
  135. package/skills/workflow-status/references/PORTABILITY.md +14 -0
  136. package/skills/workflow-status/references/SENSOR_CORE.md +95 -0
  137. package/skills/workflow-status/references/SENSOR_SIGNALS.md +128 -0
@@ -0,0 +1,58 @@
1
+ ## Routing (blockers, by kind)
2
+
3
+ - **Missing/stale review receipt** → `/review-change` (re-review at the head, then
4
+ re-run `audit-pr`) — never re-review from here.
5
+ - **Incomplete in-scope work** → fold into this branch via `execute-phase`
6
+ (the relevant phase or `--fix`); re-run `audit-pr` after.
7
+ - **Out-of-scope defect surfaced** → `plan-fix` (new fix entry), not this PR.
8
+ - **Deferred finding lacking a home** → `triage-issue` to file + classify it.
9
+ - **Stale/missing docs** → update per the doc map (often a quick `execute-phase`
10
+ doc commit), then re-audit.
11
+ - **Red CI / failing gate** → report the failing check; the dev fixes on-branch.
12
+
13
+ ## Guardrails
14
+
15
+ - **Read-first verdict. Never push, edit, refactor, or merge.** Its only forge
16
+ write is the **MERGE-READY comment** (Process step 7 — idempotent,
17
+ comment-only, never a commit tag). Fullauto merge execution belongs only to
18
+ the active `ship-roadmap --fullauto` conductor.
19
+ - **Never re-review the diff.** The `REVIEW-PASS` receipt is the review evidence;
20
+ a missing/stale receipt is a blocker routed to `/review-change`. The audit does
21
+ not compose `review-change`, rescan axes, judge test quality, remap diff hunks
22
+ to acceptance criteria, or reclassify architectural invariants (AC 13).
23
+ - **Forge bodies are Markdown, not shell — never hand-escape.** The comment's
24
+ backticks are formatting; a `\` before them renders literally. Write the
25
+ body to a file and pass `--body-file <path>` — never inline `--body "…"` or
26
+ a quoted heredoc. Verify with `gh pr view <N> --json comments` that no
27
+ literal `` \` `` survived.
28
+ - **Never imply that MERGE-READY is permission.** It is evidence bound to one
29
+ SHA; pending work makes it stale, and merge ownership remains external.
30
+ - Never report MERGE-READY on an unconfirmed gate — absence of evidence is a blocker.
31
+ - Honor the project's **Workflow conventions** (gate, docs-language, evidence —
32
+ every blocker cites file:line/check/criterion/issue — track-don't-inline:
33
+ out-of-scope problems become issues/fix entries, never silent additions here).
34
+
35
+ ## Normalized Repository State
36
+
37
+ Audit against frozen NRS facts in `docs/workflow/REPOSITORY_STATE.md` and report conflicts as contradictions. This audit
38
+ is read-only: only `resolve-repository-state` may update a frozen fact or decision.
39
+
40
+ ## Architectural invariants
41
+
42
+ The invariant result is part of the review evidence the receipt carries
43
+ (`- Architectural invariants: pass | blocker | n/a`). This audit **does not
44
+ reclassify** invariants (AC 13) — it confirms the receipt records an explicit
45
+ result and mirrors it into the verdict:
46
+
47
+ - `n/a: no project invariants declared` (the review recorded no applicable
48
+ document) → pass, not a blocker.
49
+ - `pass` (the review evidenced every applicable rule as preserved, or an
50
+ explicit architectural decision is recorded) → pass.
51
+ - `blocker` / `violates` / `introduces` / `changes` in the receipt → **merge
52
+ blocker** routed to the decision the review surfaced; the PR's head cannot be
53
+ merged until the project's declared authority applies the decision and the
54
+ review re-runs.
55
+
56
+ State `Architectural invariants: pass | blocker | n/a` in the verdict. A decision
57
+ record alone does not pass; never accept a SPEC, implementation, or passing test
58
+ as the missing decision.
@@ -0,0 +1,17 @@
1
+ ## Portability (agents other than Claude Code)
2
+
3
+ The workflow is the contract; Claude Code features are conveniences. On an
4
+ agent that lacks one, apply the fallback — never skip the step the feature
5
+ enables:
6
+
7
+ - **No slash-command menu** — where this skill says `/<skill>`, open that
8
+ skill's `SKILL.md` (wherever your agent installed the skills) and follow it
9
+ literally, in a fresh conversation: hand-offs assume a clean context.
10
+ - **No per-skill `model:`/`effort:`** — on the `#claude` branch the frontmatter pins these tiers; here, pick tiers yourself:
11
+ the merge gate is the highest-stakes automated verdict — run it on your
12
+ **strongest** model, never on the cheap tier that wrote the code.
13
+ - **Receipt consumption is comment-based, not forge-branded.** The
14
+ `review-change:pass` marker lives in PR comments (`gh pr view <N> --json
15
+ comments` on GitHub). On a forge without a native comments list, use its
16
+ closest equivalent (MR notes, review threads); the newest-marker-wins and
17
+ head-SHA comparison semantics are forge-independent.
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: design-feature
3
+ user-invocable: true
4
+ version: 2.6.0
5
+ argument-hint: <idea | NN-slug> [<instruction>]
6
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
7
+ license: MIT
8
+ description: >
9
+ Turn a raw idea or existing feature into a designed product SPEC by completing
10
+ entity, integration, role, and expectation closure. Upserts never destroy
11
+ recorded decisions. Triggers: "design-feature", "design this feature",
12
+ "define product scope".
13
+ ---
14
+
15
+ # Design Feature
16
+
17
+ Product definition — the stage that turns an idea or a feature request into an
18
+ exhaustive, checkable set of acceptance criteria, before any engineering
19
+ planning happens. **Docs only — no code, no branch.**
20
+
21
+ ## Turn contract
22
+
23
+ Load and verify the **canonical** [Turn contract](.claude/skills/orchestration-envelope/references/TURN_CONTRACT.md) (11 boxes) before ending every turn. Design-specific closure boxes (product half, capability/role matrix, expectation sweep, upsert) live only in [INTERVIEW.md](references/INTERVIEW.md). Missing reference → STOP.
24
+
25
+ ## When to use
26
+
27
+ - A rough idea, no issue yet, and no SPEC: `design-feature "<idea>"`.
28
+ - An existing feature slug whose SPEC is not yet marked `designed`:
29
+ `design-feature <NN-slug>`.
30
+ - Revising an already-designed feature's product definition:
31
+ `design-feature <NN-slug> "<change>"` (instruction mode), or bare
32
+ `design-feature <NN-slug>` for review mode (see *Interaction & upsert*).
33
+ - `plan-feature` redirects here automatically when it detects an undesigned
34
+ feature — you don't have to notice the gap yourself.
35
+
36
+ ## Step 0 — Discover the project (always first)
37
+
38
+ Per the agent guide's **Workflow conventions** + **documentation map**, then
39
+ read what THIS skill needs: `docs/features/_TEMPLATE/SPEC.md` (the two-halves
40
+ layout + `## Design status` marker), the roadmap (`docs/features/ROADMAP.md`),
41
+ the **capability inventory** (`docs/CAPABILITIES.md` — the substrate the
42
+ Integration closure walks; if the project has none, derive an ad-hoc inventory
43
+ from the architecture doc + codebase during step 5 and offer to seed the file
44
+ from the template), and — if the slug already has a folder — its existing
45
+ `SPEC.md` and `decisions.md` in full (upsert never starts blind). Skim the
46
+ architecture doc
47
+ and domain/style docs relevant to the idea's area only far enough to ground
48
+ capability closure in the project's real entities and roles — deep engineering
49
+ research is the Engineering half's job, not this one.
50
+
51
+
52
+ ## Progressive loading — resolve status before product detail
53
+
54
+ The reference allowlist is exactly the four paths linked below. Never invent or
55
+ read another `references/` path.
56
+
57
+ **Hard stop for an incomplete raw-idea interview:** LOAD exactly
58
+ `references/INTERVIEW.md` and no other reference. Ask its one next
59
+ question, return `NEEDS_INPUT`, and end the turn. `WRITE_AND_UPSERT.md` is
60
+ forbidden until every mandatory interview slot is resolved; that resource then
61
+ owns closure rows and writing.
62
+
63
+ | Condition now | LOAD now | DEFER / SKIP now |
64
+ |---|---|---|
65
+ | Bare existing slug, no instruction | [interview](references/INTERVIEW.md) through its interaction rule; report status and stop | `references/WRITE_AND_UPSERT.md`, `references/UPSERT_EXAMPLE.md`, `references/PORTABILITY.md` |
66
+ | Brand-new idea with any mandatory interview slot unresolved | [interview](references/INTERVIEW.md) only; ask exactly its next question and stop | `references/WRITE_AND_UPSERT.md`, `references/UPSERT_EXAMPLE.md`, `references/PORTABILITY.md` |
67
+ | New idea after every mandatory interview slot resolves | [interview](references/INTERVIEW.md), then [closure, write, and upsert](references/WRITE_AND_UPSERT.md) | `references/UPSERT_EXAMPLE.md` unless shape is ambiguous; `references/PORTABILITY.md` |
68
+ | Existing slug plus instruction | interview, then closure/write/upsert | [upsert example](references/UPSERT_EXAMPLE.md) unless shape is ambiguous; `references/PORTABILITY.md` |
69
+ | A named platform primitive is absent | the selected row above plus [portability](references/PORTABILITY.md) | only unrelated rows |
70
+
71
+ Do not load write/upsert while an interview slot is unresolved. A supported
72
+ primitive is not absent merely because the current task does not use it.
73
+
74
+ All resources are one hop from this file. Closure rows, role matrices,
75
+ expectation counts, fixed status blocks, and Spec-lint are normative. A missing
76
+ required resource or unresolved mandatory slot returns NEEDS_INPUT; never guess.
77
+
78
+ ## Guardrails
79
+
80
+ - Docs only — no code, no branch (that is `execute-phase`), no engineering
81
+ content (architecture, design, phases, testing — that is `plan-feature`'s
82
+ Engineering half; do not pre-fill it here even if the answer seems obvious).
83
+ - Never stamp `## Design status: designed` with a blank Capability closure row,
84
+ a skipped inventory subsystem, an incomplete role matrix, or an unresolved
85
+ Expectation sweep row — a skipped row silently un-does the entire point of
86
+ this skill.
87
+ - The Expectation sweep enumerates **domain conventions**, not new scope: it
88
+ may only route each expectation to in-scope / out-of-scope / deferred — it
89
+ never silently grows the feature beyond what the user confirms.
90
+ - No systematic per-feature market research; no global skill/MCP discovery
91
+ sweep (`product-audit`'s job); no `--update` flag — upsert is always the
92
+ default behavior, not an opt-in.
93
+ - Don't build a separate `DESIGN.md` — one SPEC, two halves, always.
94
+ - **Composition tier.** This skill is planning-class (judgment work — run it
95
+ on your strongest model / highest effort). `plan-feature-from-issue`
96
+ composing this skill in-turn for a thin issue is allowed only when it runs
97
+ at ≥ this skill's tier; otherwise it must hand off (`run /design-feature
98
+ <slug>`) rather than under-power it.
99
+ - Otherwise per the project's **Workflow conventions** (docs-language).
100
+
101
+ ## Normalized Repository State
102
+
103
+ Consume frozen facts and decisions from `docs/workflow/REPOSITORY_STATE.md`.
104
+ An absent fact may be inspected; a conflict becomes a resolver contradiction.
105
+ Documentation and inference are never implementation evidence.
106
+
107
+ ## Architectural invariants
108
+
109
+ Discover the optional project invariant document declared in the documentation
110
+ map (normally `docs/architecture/ARCHITECTURAL_INVARIANTS.md`) before defining a
111
+ capability. If absent, record `n/a: no project invariants declared` in the SPEC
112
+ and continue. For every applicable rule, cite its ID and repository evidence and
113
+ classify the proposal as `preserves`, `violates`, `introduces`, or `changes`.
114
+ Only `preserves` may proceed to capability closure. A violation, new rule, or
115
+ changed rule stops design for an explicit architectural decision through the
116
+ project's declared authority; never make a SPEC, implementation plan, or test
117
+ retroactively authorize it. When NRS exists, consume its frozen facts first;
118
+ the repository remains authoritative and a conflict routes to the resolver.
119
+
120
+
121
+ ## Portability
122
+
123
+ Do not read [portability](references/PORTABILITY.md) on a supported platform.
124
+ Read it only after detecting that a named interaction primitive is absent. The
125
+ interview, closure, upsert, and fixed output contracts stay identical.
126
+
127
+ ## Relationship to other skills
128
+
129
+ - `plan-feature` **redirects here** (no bypass flag) when a feature's product
130
+ half is not marked `designed`; once this skill hands off, `plan-feature`
131
+ fills the Engineering half and scaffolds the artifacts.
132
+ - `plan-feature-from-issue` may compose this skill in-turn for a thin issue
133
+ (only at ≥ tier — see *Guardrails*), or hand off to it directly.
134
+ - `triage-issue`'s `promote-to-feature` verdict routes through `plan-feature`,
135
+ which redirects here if the promoted issue is still undesigned.
136
+ - `execute-phase` never calls this skill — it only executes an already-planned
137
+ SPEC's Engineering half.
138
+
139
+ ## Done when
140
+
141
+ - The Product half of the SPEC is filled and every Capability closure row is
142
+ resolved (filled surface or explicit `n/a`).
143
+ - `## Design status` accurately reflects the outcome (`designed` only when
144
+ closure is complete).
145
+ - The roadmap row exists (created at `idea` if this was a brand-new feature)
146
+ and its status matches the outcome — `defined` when `designed`, left at
147
+ `idea` on `NEEDS_INPUT`.
148
+ - **The closing `→ Next:` block is printed:**
149
+
150
+ ```
151
+ → Next: /plan-feature <slug> — product half designed, ready for engineering planning
152
+ · more to design → re-run /design-feature <slug> "<instruction>" (upsert, destroys nothing)
153
+ · recurring gap in this project's capability closure → /product-audit (a systemic pattern,
154
+ not a one-off design fix)
155
+ ```
156
+
157
+ When ending `NEEDS_INPUT` instead:
158
+
159
+ ```
160
+ → Next: answer the pending question, then re-run /design-feature <slug>
161
+ · unsure how to scope it → propose the smallest version and confirm
162
+ ```
@@ -0,0 +1,52 @@
1
+ ## Process
2
+
3
+ 1. **Resolve the slug.** A raw idea with no existing folder → propose a number
4
+ (next free roadmap slot) and a kebab-case slug; confirm before writing. An
5
+ existing `NN-slug` → that folder's `SPEC.md` (create the folder + copy the
6
+ template if the roadmap has the row but no folder yet).
7
+ 2. **Interaction rule (fixed — no interpretation):**
8
+ - **Bare `design-feature <slug>`** (existing SPEC/decisions found): print a
9
+ summary of what the feature currently does (or would do, from a fresh
10
+ idea) → ask what to add / remove / change. This doubles as review mode.
11
+ - **`design-feature <slug> <instruction>`**: apply the instruction
12
+ directly, no questions — touch only what the instruction implies. Still
13
+ re-reads the existing SPEC/decisions first (upsert, never blind).
14
+ - **Nothing exists yet** (brand-new idea, no prior SPEC): go straight to
15
+ step 3 (interview), since there is nothing to review or upsert.
16
+ 3. **Raw-idea interview (folded in, only when starting from zero or the
17
+ instruction leaves genuine gaps).** Fixed protocol — structural, not
18
+ judgement:
19
+ - **One question per turn, never batched.** Each question carries a
20
+ recommended default the user can accept with one word. Ask nothing the
21
+ docs or the instruction already answer.
22
+ - **Vagueness rubric (fixed slots — the question list IS this list).**
23
+ Probe each slot until it is filled or explicitly `n/a: <reason>`:
24
+ 1. **Affected users/roles** — who uses it; who must not.
25
+ 2. **Error & edge states** — what happens on failure / empty / invalid.
26
+ 3. **Data shape** — what is stored and shown, roughly.
27
+ 4. **Boundaries & limits** — sizes, counts, rates, thresholds.
28
+ 5. **Out of scope** — what this deliberately does NOT do.
29
+ 6. **Success criteria** — how we verify it worked.
30
+ - **Mandatory-question rule.** A stated requirement that has no verifiable
31
+ acceptance criterion yet is automatically the next question — no
32
+ requirement enters the SPEC without one.
33
+ - **Reframe, don't interrogate.** Restate each vague requirement as
34
+ measurable criteria ("fast" → "list renders < 200 ms at 1k rows") and
35
+ ask: "are these the right targets?" — a yes converts directly into
36
+ acceptance criteria.
37
+ - **Deferred decisions.** An answer of "decide later" is recorded as a row
38
+ in the SPEC's `### Deferred decisions` (with a decide-by trigger) —
39
+ never dropped, never silently guessed.
40
+ - **Escalation (structural).** If, after the interview, **≥ 3 rubric slots
41
+ remain empty** (neither filled nor `n/a`), do not guess: end the turn
42
+ `NEEDS_INPUT`, listing the empty slots verbatim as the pending
43
+ questions — the feature is not designable yet.
44
+ - The identity questions ride the same one-per-turn protocol: problem &
45
+ goal, business goals, size estimate (`XS/S/M/L` — XS/S stays SPEC-only,
46
+ M/L gets the full artifact set), non-goals / future work, traceability
47
+ (offer a tracking issue; if created, the eventual PR will `Closes #n`).
48
+ 4. **Proportional research.** Capability closure (step 5) is cheap and comes
49
+ first. Reach for external or domain research **only** when the feature
50
+ touches a domain genuinely new to the project (a regulation, an unfamiliar
51
+ integration, an industry convention with no precedent in the codebase) —
52
+ never as a systematic per-feature step.
@@ -0,0 +1,15 @@
1
+ ## Portability (agents other than Claude Code)
2
+
3
+ The workflow is the contract; Claude Code features are conveniences. On an
4
+ agent that lacks one, apply the fallback — never skip the step the feature
5
+ enables:
6
+
7
+ - **No slash-command menu** — where this skill says `/<skill>`, open that
8
+ skill's `SKILL.md` (wherever your agent installed the skills) and follow it
9
+ literally, in a fresh conversation: hand-offs assume a clean context.
10
+ - **No per-skill `model:`/`effort:`** — on the `#claude` branch the
11
+ frontmatter pins these tiers; here, pick tiers yourself: capability closure
12
+ is judgment work — run it on your **strongest** model available.
13
+ - **No `/loop`** — re-invoke this skill by hand when a review round or an
14
+ instruction-mode revision is needed; follow the closing `→ Next:` block each
15
+ time.
@@ -0,0 +1,8 @@
1
+ ## Interaction & upsert (worked shape)
2
+
3
+ ```
4
+ design-feature <slug> → print summary → ask what to add/remove/change
5
+ design-feature <slug> "<instruction>" → apply directly, no questions, scoped to the instruction
6
+ design-feature "<new idea>" → interview from zero (no prior SPEC to review)
7
+ design-feature <slug> "delete and redesign, <new direction>" → the only from-zero reset path
8
+ ```
@@ -0,0 +1,92 @@
1
+ ## Closure, write, and upsert
2
+
3
+ 5. **Capability closure (the core).** Walk the SPEC template's **three fixed
4
+ checklists** (`docs/features/_TEMPLATE/SPEC.md` → `### Capability closure`
5
+ is the authoritative block — instantiate it, never paraphrase it) and write
6
+ the result into the SPEC's `### Capability closure` section. Every row
7
+ resolves to a filled surface **or** an explicit `n/a: <reason>` — a blank
8
+ row is not a valid state, it is an unfinished design:
9
+ 1. **Entity closure** — for every entity the feature introduces or
10
+ touches: Create/Read/Update/Delete/state-transitions, each with UI
11
+ entry point + API surface + test.
12
+ 2. **Integration closure** — reconcile the feature against **every**
13
+ subsystem in the capability inventory (`docs/CAPABILITIES.md`), one row
14
+ per subsystem, none skipped: how does this feature touch auth, ACL,
15
+ navigation, notifications, search, audit, settings, …? ("blog" ⇒ ACL
16
+ gets a `blog:write` permission; the dashboard gets an "Articles" link
17
+ with drafts above published and a "New article" button; auth is
18
+ required to write.) **No inventory file** → derive the inventory from
19
+ the architecture doc + codebase, record it in the section, walk it, and
20
+ offer to seed `docs/CAPABILITIES.md` from the template (upsert-safe,
21
+ user confirms).
22
+ 3. **Role matrix** — for every capability, EVERY role in the inventory is
23
+ explicitly `allowed` or `denied` — no role unlisted, no "admins
24
+ obviously can" left implicit.
25
+
26
+ The filled rows **become the Acceptance criteria** — copy each resolved row
27
+ (or its `n/a` line) into `## Acceptance criteria` as an objective, checkable
28
+ condition. Do not restate them loosely; the checklist row *is* the
29
+ criterion.
30
+ 6. **Expectation sweep (the implicit-knowledge gate).** Enumerate **≥ 10
31
+ candidate expectations** (M/L; **≥ 5** for XS/S) a competent human would
32
+ assume ship with a feature of this kind without being told — domain
33
+ conventions, not project specifics ("a blog has drafts and a publish
34
+ action", "a list has an empty state", "a delete asks for confirmation").
35
+ Fill the SPEC's `### Expectation sweep` table: each row resolves to exactly
36
+ one of `in-scope` (add/point to an acceptance criterion), `out-of-scope`
37
+ (add to *Out of scope / non-goals*), or `deferred` (row in *Deferred
38
+ decisions*) — **never left unmentioned**. Rows the user rejects are
39
+ recorded as out-of-scope, not dropped: a rejected expectation is a future
40
+ surprise defused. When a resolution genuinely needs the user's call, it
41
+ rides the step-3 interview protocol (one question per turn, recommended
42
+ default).
43
+ 7. **Scale-down for XS features.** The gate stays uniform — every closure row
44
+ and inventory subsystem is still walked, the sweep still runs (≥ 5 rows) —
45
+ but for a small feature most rows resolve to `n/a: out of scope for this
46
+ slice` in one pass, and the interview (step 3) may be a single confirming
47
+ question. Passing the gate is cheap; the gate itself never opens.
48
+ 9. **Per-feature tooling notes.** Check which installed skills/MCPs are
49
+ relevant to *this* feature (e.g. a payments MCP for a billing feature) and
50
+ record them in `## Tooling`. This is not a global discovery sweep — that is
51
+ `product-audit`'s job; record only what this feature will actually use.
52
+ 10. **Write the Product half.** Fill `Context`, `Business goals`, `Scope`
53
+ (in/out), `Capability closure`, `Acceptance criteria`, `Tooling`,
54
+ `Product decisions`, and `Deferred decisions` (`none` if empty) in the
55
+ SPEC. When instantiating the closure, **replace** the template's fenced
56
+ example block with the filled rows (keeping it fails the spec-lint's
57
+ placeholder box). Record every non-obvious call in `Product decisions`
58
+ with its rationale, and log any residual unknown as an open question in
59
+ `decisions.md` rather than guessing.
60
+ 11. **Run the Spec-lint product boxes, then stamp.** Mechanically check the
61
+ SPEC template's `### Spec-lint` **product boxes**
62
+ (`docs/features/_TEMPLATE/SPEC.md`) and paste the box results. All
63
+ product boxes tick → set the marker to `designed` **and**
64
+ set this feature's `docs/features/ROADMAP.md` row status to `defined` (the
65
+ `idea → defined` transition this skill owns — see the roadmap's Status
66
+ legend). If the row doesn't exist yet (brand-new feature, no prior `idea`
67
+ row), add it first at `idea` (number, slug, dependencies), then promote it
68
+ to `defined` in the same edit — no feature is ever registered directly at
69
+ `defined` without passing through `idea`. Any spec-lint product box FAILing
70
+ (a blank closure row, an unlabelled prose criterion, an in-scope item with
71
+ no criterion, …), or an unresolved question blocking closure → leave
72
+ `## Design status` at `not designed`, leave the roadmap row at `idea` (or
73
+ unadded), and end the turn with the failed boxes / pending question stated
74
+ plainly instead of a false `designed` stamp or a premature `defined` write.
75
+ 12. **Confirm the roadmap row.** The row from step 11 carries the right number,
76
+ slug, dependencies, and status (`defined`). Beyond `defined`, status
77
+ transitions (`planned`, `in-progress`, `done`) are `plan-feature-scaffold`'s
78
+ and `execute-phase`'s job — this skill never writes past `defined`.
79
+ 13. **Upsert semantics (never destroy).** Re-running on an existing slug
80
+ re-reads the SPEC and `decisions.md` first; a revision **appends** to
81
+ `decisions.md` (dated, with what changed and why) — it never rewrites or
82
+ deletes a prior decision. The only path that starts the product half from
83
+ zero is an explicit "delete and redesign" in the prompt; even then, record
84
+ that reset itself in `decisions.md`. **This is the retrofit path
85
+ `audit-pr`'s closure-integrity gate routes to:** a legacy SPEC with no
86
+ `Capability closure` block trips that gate's dated `design-debt:
87
+ closure absent, SPEC predates the rule` warning (never a blocker) on the
88
+ next PR touching the feature; re-running `design-feature <slug>` there
89
+ fills only the missing closure rows via this same upsert — it never
90
+ rewrites what's already recorded.
91
+ 14. **Hand off.** Once `designed`, print the closing block (see *Done when*)
92
+ recommending `/plan-feature <slug>`.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: discover-repository-state
3
+ user-invocable: true
4
+ version: 1.2.0
5
+ description: >
6
+ Discover repository evidence and write a frozen Normalized Repository State.
7
+ Produces verified repository evidence and keeps facts, decisions, planned
8
+ work, documentation, and inference separate. It does not make
9
+ recommendations or infer implementation from documentation. Triggers: "discover
10
+ repository state", "normalize repository state", "freeze repository facts".
11
+ ---
12
+
13
+ # Discover Repository State
14
+
15
+ Create a reviewable evidence snapshot before planning or implementation.
16
+
17
+ ## Turn contract
18
+
19
+ ```
20
+ ✓ Repository evidence was read or commands were run for every fact
21
+ ✓ Facts, documentation, planned work, decisions, and inference are separated
22
+ ✓ Snapshot status is frozen unless a contradiction was recorded
23
+ ✓ No accepted decision or existing frozen fact was silently changed
24
+ ✓ The closing → Next: block is printed last
25
+ ```
26
+
27
+ ## Step 0 — Discover the project (always first)
28
+
29
+ Read the agent guide, documentation map, and any existing repository-state
30
+ ledger before collecting evidence.
31
+
32
+ ## Process
33
+
34
+ 1. Read the project guide, documentation map, and any existing
35
+ `docs/workflow/REPOSITORY_STATE.md`.
36
+ 2. Inspect repository files, tests, git state, and declared tooling. Record only
37
+ directly observed statements in **Repository Facts**, each with file:line or
38
+ command evidence.
39
+ 3. Record design records under **Accepted Decisions**, roadmap entries under
40
+ **Planned work**, and document-only claims under **Documentation**. Do not
41
+ copy them into facts without separate implementation evidence.
42
+ 4. Place reasoning under **Inference** and unresolved ambiguity under **Open
43
+ Questions**.
44
+ 5. If the existing snapshot is already `contradicted`, preserve that status and
45
+ do not alter its unresolved contradiction; hand off to
46
+ `resolve-repository-state`. Otherwise, if new evidence conflicts with a
47
+ frozen fact, append a **Contradiction**, set snapshot status to
48
+ `contradicted`, and do not alter the fact. Hand off to
49
+ `resolve-repository-state`.
50
+ 6. Only if neither an existing nor a newly recorded contradiction is present,
51
+ set the snapshot status to `frozen`. Commit the artifact and cite the source
52
+ revision.
53
+
54
+ ## Guardrails
55
+
56
+ - Discovery records repository facts and preserves decisions, planned work,
57
+ documentation, inference, questions, and contradictions in their own sections.
58
+ - The repository remains authoritative; refresh when the snapshot is stale.
59
+ - Never create implementation recommendations or silently accept decisions.
60
+
61
+ ## Portability
62
+
63
+ Without a slash menu, open this file and follow its process in a fresh turn.
64
+
65
+ ## Relationship to other skills
66
+
67
+ `resolve-repository-state` resolves contradictions; planners and executors
68
+ consume the frozen result.
69
+
70
+ ## Done when
71
+
72
+ The ledger is frozen or explicitly contradicted, and every fact carries direct
73
+ evidence.
74
+
75
+ If a contradiction was recorded:
76
+
77
+ → Next: /resolve-repository-state <contradiction-id> — resolve the contradicted snapshot first
78
+ · provide missing evidence → rerun /discover-repository-state
79
+
80
+ Otherwise:
81
+
82
+ → Next: /plan-feature <slug> — plan from frozen facts
83
+ · implementation-ready feature → /execute-phase <NN>
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: execute-phase
3
+ user-invocable: true
4
+ version: 3.0.1
5
+ argument-hint: <NN> [P<k>] | --fix <n> [P<k>] | [--max-attempts N] [--force]
6
+ allowed-tools: [Bash, Read, Edit, Write, MultiEdit]
7
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
8
+ license: MIT
9
+ description: >
10
+ Implement all remaining phases of a planned feature/fix by default, or one
11
+ explicit P<n>, with frozen acceptance, phase-local gates, commits, recovery,
12
+ and final PR close-out. Use --fix for fix SPECs; --force is user-only.
13
+ ---
14
+
15
+ # Execute Phase
16
+
17
+ Modes: **unit loop** (default when `P<n>` is omitted) executes every remaining phase through close-out,
18
+ with one gate/commit per phase; **explicit phase** `P<n>` executes exactly that phase;
19
+ legacy SPECs without `## Phases` run once. `--fix` selects a fix unit.
20
+
21
+ First matching row wins:
22
+
23
+ | Invocation shape | Queue |
24
+ |---|---|
25
+ | target + explicit `P<n>` | only the literal `P<n>` argument; ignore other unfinished phases |
26
+ | target, no phase | only the literal unfinished phase IDs found in the ledger, in order |
27
+ | legacy SPEC without phases | one legacy pass |
28
+
29
+ Never infer a phase ID absent from the invocation/ledger.
30
+
31
+ ## Turn contract
32
+
33
+ Load and verify the **canonical** [Turn contract](.claude/skills/orchestration-envelope/references/TURN_CONTRACT.md) (11 boxes) before ending every turn. Skill-specific additions and push policy live only in [PREFLIGHT.md](references/PREFLIGHT.md). Missing reference → STOP.
34
+
35
+ ## Hard rules
36
+
37
+ - Honor Workflow conventions (branch/PR, gate-before-commit, docs language). Run
38
+ `git branch --show-current` before editing/committing; if `main`, create the
39
+ working branch first (unless the user explicitly uses `main`).
40
+ - **Phases are `P1, P2, …`.** The `<phase>` argument and every reference in `PLAN.md`/`TASKS.md`/`progress.md`/commits is `P1, P2, …` ("phase N") — **never** `S1`/`S2`/"Step N". If a plan you're handed uses `S1`-style labels, normalize it to `P1, …` before executing and note it in `decisions.md`.
41
+ - Implement only the requested scope: all remaining ledger phases when omitted,
42
+ or exactly `P<n>`. Never invent/bundle across phase boundaries; unit-loop mode
43
+ still gates and commits each phase.
44
+ - Stop after the gate passes; keep commits small and reviewable.
45
+ - Feature mode: update `TASKS.md`, `progress.md`, `testing.md`, `known-issues.md` each phase (and `decisions.md` if architecture moved).
46
+ - **Plan conflict:** update `TASKS.md`/`PLAN.md` and record why in `decisions.md`;
47
+ never silently diverge.
48
+ - **Dependency gate before any work** — the preflight resource owns it. No edit,
49
+ branch, or commit for an unmerged dependency closure unless the user passed `--force`.
50
+ - **Phase-lint before any edit** — the preflight resource runs it after
51
+ dependency/own-status gates. Any FAIL stops unless the user passed `--force`.
52
+
53
+ ## Context budget (hard rule — context is repaid every turn)
54
+
55
+ - **File cap:** read at most 10 full files per phase beyond `SPEC.md`, the phase
56
+ `TASKS.md` section and `progress.md`. Targeted ≤50-line reads and greps do not
57
+ count. If the cap would be exceeded, stop, record known/unknown facts in
58
+ `Gotchas:`, then proceed only with targeted evidence or report the blocker.
59
+ - **Summarize:** record needed facts with `file:line`; never re-read summarized
60
+ files or quote whole files.
61
+ - **Step 0:** read only Workflow conventions, the architecture section for the
62
+ phase `Layer:`, and the optional invariant document named by the map.
63
+ - **Unit-loop reset:** after each commit retain only the `progress.md` receipt;
64
+ use a fresh worker per phase where possible, otherwise never re-read prior files.
65
+
66
+ ## Progressive loading — mandatory route before acting
67
+
68
+ This entrypoint carries the universal turn contract and handoff schema. Load only
69
+ the listed one-hop route resource immediately before its step.
70
+
71
+ 1. Every invocation: consume [verification contract](<../verification-contract/SKILL.md>),
72
+ read/run [preflight gates](references/PREFLIGHT.md), and stop on a contracted
73
+ blocker before editing. This route owns NRS and Architectural invariants gates.
74
+ 2. Without explicit `P<n>`, read [unit loop](references/UNIT_LOOP.md), then
75
+ [execution contract](references/EXECUTION_CONTRACT.md), then exactly one
76
+ workflow: [feature](references/WORKFLOWS_FEATURE.md),
77
+ [small/phased](references/WORKFLOWS_SMALL_PHASED.md),
78
+ [`--fix`](references/WORKFLOWS_FIX.md), or [legacy](references/WORKFLOWS_LEGACY.md).
79
+ Never load another mode.
80
+ 3. Read only the needed policy:
81
+ - writing a forge body → [forge body policy](references/FORGE_BODY.md)
82
+ - creating an issue → [descope guard](references/DESCOPE.md) first
83
+ - finding out-of-scope work → [opportunistic finding policy](references/OPPORTUNISTIC_FINDING.md)
84
+ 4. Before `progress.md`, read [handoff schema](references/HANDOFF.md).
85
+ 5. For implementation/finish, read [closeout](references/CLOSEOUT.md); for a
86
+ folded finding also [folding](references/FOLDING.md).
87
+ 6. Only for `/loop`, external drivers, manual batching, or missing vendor
88
+ primitives, read [batch and portability](references/BATCH_AND_PORTABILITY.md).
89
+
90
+ Fixed blocks in selected resources are normative and copied exactly. Missing or
91
+ unreadable required resource → STOP; never reconstruct from memory.
92
+
93
+ ## Portability
94
+
95
+ The contract is vendor-neutral. When slash commands, tiers or a loop primitive
96
+ are absent, read [batch and portability](references/BATCH_AND_PORTABILITY.md) and
97
+ use its fallback; never skip the workflow step.
98
+
99
+ ## Relationship to other skills
100
+
101
+ Planned by `plan-feature`/`plan-fix`; executes their SPEC. Explicit phases may
102
+ hand off to `review-change` at layer/accumulation/sensitivity checkpoints and must
103
+ at unit end. Unit-loop skips intermediate checkpoints and recommends
104
+ `loop-review-fold` after opening the PR; direct `review-change` remains manual.
105
+ Independent work stays a proposal. A finished unit always opens its PR and flips
106
+ to `done`; `audit-pr` gates merge. Every invocation prints the next step.
107
+
108
+ ## Done when
109
+
110
+ - Requested scope is implemented (all remaining phases, one explicit phase, or
111
+ legacy pass), gate is green, per-phase docs are updated, and the work is
112
+ committed on the correct branch with nothing bundled beyond scope.
113
+ - `git status --porcelain` is empty and an open-PR branch has nothing unpushed.
114
+ - A finished unit is `done`, has an opened PR (URL printed), and recommends the
115
+ mandatory `/loop-review-fold` hand-off with direct `/review-change` as manual alternative.