draht-codex 2026.6.11
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/.codex-plugin/plugin.json +44 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/agents/architect.md +56 -0
- package/agents/debugger.md +67 -0
- package/agents/git-committer.md +61 -0
- package/agents/implementer.md +45 -0
- package/agents/reviewer.md +67 -0
- package/agents/security-auditor.md +119 -0
- package/agents/spec-reviewer.md +65 -0
- package/agents/verifier.md +55 -0
- package/bin/draht-tools.cjs +4875 -0
- package/cli.mjs +452 -0
- package/commands/atomic-commit.md +73 -0
- package/commands/discuss-phase.md +55 -0
- package/commands/execute-phase.md +173 -0
- package/commands/fix.md +121 -0
- package/commands/init-project.md +66 -0
- package/commands/map-codebase.md +73 -0
- package/commands/new-project.md +73 -0
- package/commands/next-milestone.md +50 -0
- package/commands/orchestrate.md +83 -0
- package/commands/pause-work.md +38 -0
- package/commands/plan-phase.md +142 -0
- package/commands/progress.md +30 -0
- package/commands/quick.md +95 -0
- package/commands/resume-work.md +35 -0
- package/commands/review.md +87 -0
- package/commands/verify-work.md +122 -0
- package/hooks/hooks.json +26 -0
- package/package.json +55 -0
- package/scripts/gsd-post-phase.cjs +144 -0
- package/scripts/gsd-post-task.cjs +165 -0
- package/scripts/gsd-pre-execute.cjs +146 -0
- package/scripts/gsd-quality-gate.cjs +252 -0
- package/scripts/prompt-context.cjs +36 -0
- package/scripts/session-start.cjs +52 -0
- package/skills/atomic-commit/SKILL.md +14 -0
- package/skills/atomic-reasoning/SKILL.md +107 -0
- package/skills/brainstorming/SKILL.md +120 -0
- package/skills/ddd-workflow/SKILL.md +111 -0
- package/skills/debugging-workflow/SKILL.md +101 -0
- package/skills/discuss-phase/SKILL.md +14 -0
- package/skills/execute-phase/SKILL.md +14 -0
- package/skills/fix/SKILL.md +14 -0
- package/skills/init-project/SKILL.md +14 -0
- package/skills/map-codebase/SKILL.md +14 -0
- package/skills/new-project/SKILL.md +14 -0
- package/skills/next-milestone/SKILL.md +14 -0
- package/skills/orchestrate/SKILL.md +14 -0
- package/skills/pause-work/SKILL.md +14 -0
- package/skills/plan-phase/SKILL.md +14 -0
- package/skills/progress/SKILL.md +14 -0
- package/skills/quick/SKILL.md +14 -0
- package/skills/resume-work/SKILL.md +14 -0
- package/skills/review/SKILL.md +14 -0
- package/skills/tdd-workflow/SKILL.md +117 -0
- package/skills/verification-gate/SKILL.md +82 -0
- package/skills/verify-work/SKILL.md +14 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ddd-workflow
|
|
3
|
+
description: Domain-driven design discipline — bounded contexts, ubiquitous language, aggregates, domain events, context maps, and how the .planning/DOMAIN.md file drives code structure and naming. Use whenever the user is modelling a new domain, extracting domain concepts from existing code, deciding where code should live, or naming things.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DDD Workflow
|
|
7
|
+
|
|
8
|
+
Draht embeds domain-driven design into project initialization, planning, and execution. The `.planning/DOMAIN.md` file is the single source of truth for domain concepts.
|
|
9
|
+
|
|
10
|
+
## .planning/DOMAIN.md Structure
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
## Bounded Contexts
|
|
14
|
+
- **Billing** — everything about invoices, payments, subscriptions
|
|
15
|
+
- **Catalog** — products, pricing, availability
|
|
16
|
+
- **Fulfillment** — order processing, shipping, returns
|
|
17
|
+
|
|
18
|
+
## Ubiquitous Language
|
|
19
|
+
- **Invoice** — a document requesting payment for delivered goods or services
|
|
20
|
+
- **Order** — a customer's request to purchase goods, before fulfillment
|
|
21
|
+
- **Line Item** — a single row on an invoice or order
|
|
22
|
+
- **SKU** — a unique identifier for a product variant in the catalog
|
|
23
|
+
|
|
24
|
+
## Context Map
|
|
25
|
+
- Billing ← Catalog (downstream — billing reads product info)
|
|
26
|
+
- Fulfillment ← Billing (downstream — fulfillment needs invoice status)
|
|
27
|
+
- Shared kernel: Money, TaxRate (used by Billing and Fulfillment)
|
|
28
|
+
|
|
29
|
+
## Aggregates
|
|
30
|
+
### Billing
|
|
31
|
+
- Invoice (root) — LineItem, Payment
|
|
32
|
+
- Subscription (root) — BillingCycle
|
|
33
|
+
|
|
34
|
+
### Catalog
|
|
35
|
+
- Product (root) — Variant, Price
|
|
36
|
+
|
|
37
|
+
## Domain Events
|
|
38
|
+
- `InvoiceIssued` — Billing → Fulfillment, Notification
|
|
39
|
+
- `PaymentReceived` — Billing → Notification
|
|
40
|
+
- `OrderShipped` — Fulfillment → Notification, Customer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## The Five Rules
|
|
44
|
+
|
|
45
|
+
### 1. Bounded contexts shape the code
|
|
46
|
+
- File/module structure mirrors bounded contexts: `src/billing/`, `src/catalog/`, `src/fulfillment/`
|
|
47
|
+
- Each context owns its aggregates, value objects, services, and domain events
|
|
48
|
+
- Cross-context imports are suspicious — prefer domain events or ACL adapters
|
|
49
|
+
|
|
50
|
+
### 2. Code uses the ubiquitous language
|
|
51
|
+
- Class names, method names, variable names must match the glossary
|
|
52
|
+
- If you need a new term, update `DOMAIN.md` **first**, then write the code
|
|
53
|
+
- Never invent terms in code that aren't in the glossary
|
|
54
|
+
|
|
55
|
+
### 3. Aggregates enforce invariants
|
|
56
|
+
- Each aggregate has one root entity
|
|
57
|
+
- All writes go through the root — never modify child entities directly from outside
|
|
58
|
+
- Aggregate boundaries align with transaction boundaries
|
|
59
|
+
- Aggregates reference each other by ID, not by reference
|
|
60
|
+
|
|
61
|
+
### 4. Domain events cross context boundaries
|
|
62
|
+
- Upstream context publishes an event (`InvoiceIssued`)
|
|
63
|
+
- Downstream contexts subscribe and react (Notification sends email, Fulfillment releases order)
|
|
64
|
+
- No direct function call from Billing into Fulfillment — always via event
|
|
65
|
+
|
|
66
|
+
### 5. Shared kernel is explicit
|
|
67
|
+
- If two contexts must share a type (e.g. `Money`, `TaxRate`), put it in `src/shared/` and document it in the Context Map
|
|
68
|
+
- Shared kernel changes are high-cost — they affect multiple contexts
|
|
69
|
+
- Prefer duplication over coupling when in doubt
|
|
70
|
+
|
|
71
|
+
## The Post-Phase Domain Health Check
|
|
72
|
+
|
|
73
|
+
The `gsd-post-phase.cjs` hook checks `DOMAIN.md` after each phase:
|
|
74
|
+
- Is `## Bounded Contexts` section present?
|
|
75
|
+
- Is `## Ubiquitous Language` section present?
|
|
76
|
+
- Count of unique PascalCase terms (proxy for glossary size)
|
|
77
|
+
|
|
78
|
+
The `gsd-quality-gate.cjs` script also runs a domain validator that compares identifiers in code against the glossary and flags unknown terms.
|
|
79
|
+
|
|
80
|
+
Drift check: after each phase, run `draht-tools graph-clusters` and compare the map's clusters/contexts against `DOMAIN.md` — a new cluster or a cluster spanning two contexts means the code drifted from the model. Reconcile `DOMAIN.md` first, then the code.
|
|
81
|
+
|
|
82
|
+
## Extracting Domain from Existing Code
|
|
83
|
+
|
|
84
|
+
When running `/init-project` or `/map-codebase` on a codebase that wasn't built with DDD:
|
|
85
|
+
|
|
86
|
+
0. Surface CANDIDATE contexts from the map: `draht-tools graph-clusters` for code groupings + `draht-tools graph-context <dir>` to orient each. Clusters are STRUCTURAL (import topology), not semantic — confirm with a human before equating a cluster with a bounded context.
|
|
87
|
+
1. List top-level `src/` subdirectories — candidates for bounded contexts
|
|
88
|
+
2. Scan PascalCase class / interface / type names — seed from `modules[*].symbols` / GRAPH_REPORT.md instead of grepping — candidates for entities and value objects
|
|
89
|
+
3. Scan repeated nouns in function names — candidates for domain concepts
|
|
90
|
+
4. Look for cross-directory imports — candidates for context coupling to fix
|
|
91
|
+
5. Write `DOMAIN.md` with what you found + what should exist
|
|
92
|
+
6. Use subsequent phases to refactor toward the target model
|
|
93
|
+
|
|
94
|
+
## Anti-patterns
|
|
95
|
+
|
|
96
|
+
**Anemic domain model** — entities that are just data bags with no behaviour. Push logic into the entities.
|
|
97
|
+
|
|
98
|
+
**Scattered aggregates** — one aggregate's logic spread across multiple contexts. Consolidate or introduce an ACL.
|
|
99
|
+
|
|
100
|
+
**Terminology drift** — the same concept called different things in different files. Fix in `DOMAIN.md` first, rename code second.
|
|
101
|
+
|
|
102
|
+
**Shared database** — multiple contexts writing to the same tables without explicit shared-kernel agreement. Break the coupling.
|
|
103
|
+
|
|
104
|
+
**Direct cross-context imports** — `import { ... } from '../billing/...'` in `src/fulfillment/`. Use domain events or ACL adapters.
|
|
105
|
+
|
|
106
|
+
## When to Update DOMAIN.md
|
|
107
|
+
|
|
108
|
+
- Before writing code that introduces a new term → add it to the glossary first
|
|
109
|
+
- During `/discuss-phase` when gray areas reveal missing concepts
|
|
110
|
+
- After `/verify-work` when the reviewer agent flags domain language drift
|
|
111
|
+
- Whenever a refactor reveals that existing names don't match reality
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debugging-workflow
|
|
3
|
+
description: Four-phase systematic debugging — root cause investigation → pattern analysis → single-hypothesis testing → reproducing-test-first implementation. Use whenever investigating a bug, test failure, error, stack trace, regression, build break, or unexpected behaviour. Auto-triggers on phrases like "broken", "doesn't work", "failing", "error", "bug", "regression", "why is X", "what's wrong with". The same protocol that `/fix` enforces, available transversally.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging Workflow
|
|
7
|
+
|
|
8
|
+
Random fixes create new bugs. This skill enforces the four-phase systematic debugging protocol whenever Codex is investigating any technical failure — independent of whether the user invoked `/fix`.
|
|
9
|
+
|
|
10
|
+
## The Iron Law
|
|
11
|
+
|
|
12
|
+
> **NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.**
|
|
13
|
+
|
|
14
|
+
A symptom fix is a failure. If you patch the visible error without understanding why it occurred, you've created the next bug.
|
|
15
|
+
|
|
16
|
+
## When to Apply
|
|
17
|
+
|
|
18
|
+
Any time you encounter:
|
|
19
|
+
- Failing tests
|
|
20
|
+
- Production errors
|
|
21
|
+
- Unexpected behaviour
|
|
22
|
+
- Performance regressions
|
|
23
|
+
- Build failures
|
|
24
|
+
- Integration issues
|
|
25
|
+
- "Why is X doing Y?"
|
|
26
|
+
|
|
27
|
+
**Especially** when under time pressure, when a "quick fix" seems obvious, after multiple failed attempts, or when you don't fully understand the issue.
|
|
28
|
+
|
|
29
|
+
## Phase 1 — Root Cause Investigation (before ANY fix)
|
|
30
|
+
|
|
31
|
+
1. **Read error messages carefully.** Don't skip past the trace — read line numbers and file paths. Stack traces often contain the exact answer.
|
|
32
|
+
2. **Reproduce consistently.** What are the exact steps? If you can't reproduce, gather more data — do not guess.
|
|
33
|
+
3. **Check recent changes.** `git log --oneline -20`, `git diff HEAD~N` on the affected paths. What was the last thing that touched this?
|
|
34
|
+
4. **Trace data flow.** Where does the bad value originate? What called the function with that value? Keep tracing **upward** until you find the source. Fix at source, not at the symptom site.
|
|
35
|
+
5. **State the root cause in one sentence:** "X happens because Y at <file:line>."
|
|
36
|
+
|
|
37
|
+
If you cannot state the root cause clearly, you do not understand the bug yet. Do not proceed.
|
|
38
|
+
|
|
39
|
+
## Phase 1.5 — Orient on the failing file
|
|
40
|
+
|
|
41
|
+
Before walking the tree, orient via the living map. Run `draht-tools graph-context <failing-file>` for pkg/layer/cluster/importers/imports/sinks and `draht-tools graph-callers <failing-file>` to see who feeds bad values in (supports the "trace UPWARD" step above). If `.planning/codebase/MAP.json` is absent, run `draht-tools map-graph` first.
|
|
42
|
+
|
|
43
|
+
## Phase 2 — Pattern Analysis
|
|
44
|
+
|
|
45
|
+
1. **Find working examples.** Use `draht-tools graph-query "<concept>"` instead of grep to locate reference implementations in this repo that do the same kind of thing correctly.
|
|
46
|
+
2. **Read references completely.** Not skimmed — read every line of the working version.
|
|
47
|
+
3. **List every difference** between working and broken, however small.
|
|
48
|
+
4. **Note dependencies.** What config / env / call-order does the working version assume?
|
|
49
|
+
|
|
50
|
+
If Phase 2 contradicts Phase 1, go back to Phase 1. Don't paper over disagreement.
|
|
51
|
+
|
|
52
|
+
## Phase 3 — Single Hypothesis Test
|
|
53
|
+
|
|
54
|
+
1. State ONE hypothesis: "I think X is the root cause because Y."
|
|
55
|
+
2. Design the **smallest possible change** to test it — one variable, ideally one line. Before applying, run `draht-tools graph-impact <file-to-change>` to scope the blast radius (reverse-dependents, affected entry points, crossed boundaries) and avoid regressions.
|
|
56
|
+
3. Apply it. Did it fix the issue?
|
|
57
|
+
- Yes → proceed to Phase 4.
|
|
58
|
+
- No → form a NEW hypothesis. Revert. Do not pile changes on top.
|
|
59
|
+
4. **After 3 failed hypotheses, STOP.** This is an architectural problem, not a hypothesis problem. Discuss before continuing.
|
|
60
|
+
|
|
61
|
+
## Phase 4 — Implementation
|
|
62
|
+
|
|
63
|
+
1. **Write the reproducing test FIRST.** Confirm it FAILS for the right reason (not syntax, not missing import).
|
|
64
|
+
- Commit: `red: reproduce <bug>`
|
|
65
|
+
2. **Apply the single fix** from Phase 3. No other changes.
|
|
66
|
+
- Failing test now PASSES.
|
|
67
|
+
- Full test suite — no regressions.
|
|
68
|
+
- Commit: `green: fix <bug>`
|
|
69
|
+
3. **Refactor (optional)** — only if clear improvement. Tests stay green.
|
|
70
|
+
- Commit: `refactor: <description>`
|
|
71
|
+
4. **Verify the original symptom is gone** — run the user-level reproduction, not just the unit test.
|
|
72
|
+
|
|
73
|
+
## Red Flags — STOP
|
|
74
|
+
|
|
75
|
+
Stop immediately if you catch yourself:
|
|
76
|
+
- "Quick fix for now, investigate later"
|
|
77
|
+
- Multiple changes simultaneously
|
|
78
|
+
- Skipping the reproducing test
|
|
79
|
+
- Proposing solutions before understanding data flow
|
|
80
|
+
- "One more attempt" after 2+ failures
|
|
81
|
+
- Each fix revealing new problems elsewhere
|
|
82
|
+
- Proposing solutions before you can state the root cause in one sentence
|
|
83
|
+
|
|
84
|
+
## Rationalization Table
|
|
85
|
+
|
|
86
|
+
| Excuse | Reality |
|
|
87
|
+
|--------|---------|
|
|
88
|
+
| "Simple bug, skip the process" | Simple bugs have root causes too. The process is fast for them. |
|
|
89
|
+
| "Emergency, no time for process" | Systematic debugging is *faster* than thrashing. |
|
|
90
|
+
| "I'll write the test after I confirm the fix" | Untested fixes don't stick. Test-first proves the bug existed. |
|
|
91
|
+
| "Let me try a few things" | Can't isolate what worked. Creates new bugs. |
|
|
92
|
+
| "I already manually tested it" | A reproducing test is the only durable proof. |
|
|
93
|
+
| "I can see what's wrong, I don't need Phase 1" | "See" is not "understand". Trace it. |
|
|
94
|
+
|
|
95
|
+
## Relationship to /fix
|
|
96
|
+
|
|
97
|
+
This skill is the *protocol*. `/fix` is the *command* that runs it with subagent delegation, commit conventions, and state updates. Use the skill transversally; use `/fix` when you want the full workflow with tracking.
|
|
98
|
+
|
|
99
|
+
## Relationship to verification-gate
|
|
100
|
+
|
|
101
|
+
After Phase 4, verification-gate kicks in: don't claim "bug fixed" without running the proving command and seeing the output.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: discuss-phase
|
|
3
|
+
description: Draht command prompt wrapper for discuss-phase. Use when the user selects the Draht discuss-phase workflow or wants to capture implementation decisions before planning a phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: discuss-phase
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/discuss-phase.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execute-phase
|
|
3
|
+
description: Draht command prompt wrapper for execute-phase. Use when the user selects the Draht execute-phase workflow or wants to execute phase plans with atomic commits, TDD, and review gates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: execute-phase
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/execute-phase.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix
|
|
3
|
+
description: Draht command prompt wrapper for fix. Use when the user selects the Draht fix workflow or wants systematic root-cause debugging with TDD discipline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: fix
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/fix.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-project
|
|
3
|
+
description: Draht command prompt wrapper for init-project. Use when the user selects the Draht init-project workflow or wants to initialize GSD planning for an existing codebase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: init-project
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/init-project.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: map-codebase
|
|
3
|
+
description: Draht command prompt wrapper for map-codebase. Use when the user selects the Draht map-codebase workflow or wants architecture, domain, and test strategy extracted from an existing codebase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: map-codebase
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/map-codebase.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: new-project
|
|
3
|
+
description: Draht command prompt wrapper for new-project. Use when the user selects the Draht new-project workflow or wants greenfield GSD planning from questioning through roadmap.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: new-project
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/new-project.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: next-milestone
|
|
3
|
+
description: Draht command prompt wrapper for next-milestone. Use when the user selects the Draht next-milestone workflow or wants to plan the next milestone after all current phases are complete.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: next-milestone
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/next-milestone.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orchestrate
|
|
3
|
+
description: Draht command prompt wrapper for orchestrate. Use when the user selects the Draht orchestrate workflow or wants to decompose a task and coordinate specialist subagents.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: orchestrate
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/orchestrate.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pause-work
|
|
3
|
+
description: Draht command prompt wrapper for pause-work. Use when the user selects the Draht pause-work workflow or wants to create a CONTINUE-HERE handoff document.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: pause-work
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/pause-work.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-phase
|
|
3
|
+
description: Draht command prompt wrapper for plan-phase. Use when the user selects the Draht plan-phase workflow or wants to create atomic execution plans for a roadmap phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: plan-phase
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/plan-phase.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: progress
|
|
3
|
+
description: Draht command prompt wrapper for progress. Use when the user selects the Draht progress workflow or wants current GSD project status.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: progress
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/progress.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quick
|
|
3
|
+
description: Draht command prompt wrapper for quick. Use when the user selects the Draht quick workflow or wants to execute a small ad-hoc task with tracking and review discipline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: quick
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/quick.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: resume-work
|
|
3
|
+
description: Draht command prompt wrapper for resume-work. Use when the user selects the Draht resume-work workflow or wants to resume from a CONTINUE-HERE handoff document.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: resume-work
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/resume-work.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review
|
|
3
|
+
description: Draht command prompt wrapper for review. Use when the user selects the Draht review workflow or wants code review and security audit of recent changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: review
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/review.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-workflow
|
|
3
|
+
description: Test-driven development discipline — red→green→refactor cycle, commit conventions (red:, green:, refactor:), TDD cycle violations, reproducing tests before fixes, and how to write tests that actually drive design. Use whenever the user is writing code that has testable behaviour, fixing bugs, or asks about TDD.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TDD Workflow
|
|
7
|
+
|
|
8
|
+
Draht enforces strict test-driven development through commit conventions, post-task hooks, and the plan task format.
|
|
9
|
+
|
|
10
|
+
## The Cycle
|
|
11
|
+
|
|
12
|
+
### RED — Write a failing test
|
|
13
|
+
1. Write a test that describes the behaviour you want
|
|
14
|
+
2. Run the test runner — it MUST fail for the right reason (not a syntax error, not a missing import)
|
|
15
|
+
3. Commit with prefix `red:`
|
|
16
|
+
```
|
|
17
|
+
git add <test-files>
|
|
18
|
+
git commit -m "red: <what the test proves>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### GREEN — Make it pass with the smallest possible change
|
|
22
|
+
1. Write the minimum implementation that makes the failing test pass
|
|
23
|
+
2. Run the test — confirm it passes
|
|
24
|
+
3. Run the full test suite — confirm no regressions
|
|
25
|
+
4. Commit with prefix `green:`
|
|
26
|
+
```
|
|
27
|
+
git add <impl-files>
|
|
28
|
+
git commit -m "green: <task name>"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### REFACTOR — Improve structure while staying green
|
|
32
|
+
1. Tests must stay green after every change — run them often
|
|
33
|
+
2. Extract value objects, push logic into domain layer, remove duplication
|
|
34
|
+
3. Keep to the ubiquitous language from `.planning/DOMAIN.md`
|
|
35
|
+
4. Commit with prefix `refactor:`
|
|
36
|
+
```
|
|
37
|
+
git add <files>
|
|
38
|
+
git commit -m "refactor: <what was improved>"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
1. **Never write implementation before a failing test.** If you find yourself writing code that doesn't have a failing test waiting for it, stop and write the test first.
|
|
44
|
+
|
|
45
|
+
2. **A test that passes on first run is suspect.** It means you're not testing what you think. Make it fail by breaking the implementation temporarily — does it fail? If not, the test is useless.
|
|
46
|
+
|
|
47
|
+
3. **One red → one green → optional refactor.** Keep cycles small. A red commit with 20 failing tests is too big.
|
|
48
|
+
|
|
49
|
+
4. **Test behaviour, not implementation.** Write tests against the public API. Tests that mock everything are tests of the mocks.
|
|
50
|
+
|
|
51
|
+
5. **Domain tests use domain language.** Class names, test names, fixture names must match `.planning/DOMAIN.md` if it exists. Domain tests read like specs.
|
|
52
|
+
|
|
53
|
+
6. **Fix bugs with a reproducing test first.** No exceptions. The test must fail before the fix, pass after.
|
|
54
|
+
|
|
55
|
+
## TDD Cycle Violations
|
|
56
|
+
|
|
57
|
+
The post-task hook (`gsd-post-task.cjs`) checks commit history for cycle violations:
|
|
58
|
+
|
|
59
|
+
- A `green:` commit with no preceding `red:` commit for the same task → violation
|
|
60
|
+
- In `strict` mode: the hook aborts execution
|
|
61
|
+
- In `advisory` mode: the hook logs a warning to `.planning/execution-log.jsonl`
|
|
62
|
+
|
|
63
|
+
Set the mode in `.planning/config.json`:
|
|
64
|
+
```json
|
|
65
|
+
{ "hooks": { "tddMode": "strict" } }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## When to Skip the Cycle
|
|
69
|
+
|
|
70
|
+
Only skip TDD for:
|
|
71
|
+
- Pure configuration (tsconfig, biome, prettier)
|
|
72
|
+
- Documentation-only changes
|
|
73
|
+
- Generated code (auto-generated clients, schema bindings)
|
|
74
|
+
- Mechanical refactors with no behaviour change (e.g., rename)
|
|
75
|
+
|
|
76
|
+
Never skip for:
|
|
77
|
+
- Bug fixes
|
|
78
|
+
- New features
|
|
79
|
+
- Changes to domain logic
|
|
80
|
+
- Changes to APIs
|
|
81
|
+
|
|
82
|
+
## The Plan Task Format Drives TDD
|
|
83
|
+
|
|
84
|
+
Plan tasks use `<test>`, `<action>`, `<refactor>` sections precisely to force the cycle:
|
|
85
|
+
|
|
86
|
+
```xml
|
|
87
|
+
<task type="auto">
|
|
88
|
+
<n>Add user authentication</n>
|
|
89
|
+
<test>
|
|
90
|
+
RED phase: Write failing tests FIRST.
|
|
91
|
+
- test/auth.test.ts: valid credentials → returns session token
|
|
92
|
+
- test/auth.test.ts: invalid password → throws UnauthorizedError
|
|
93
|
+
- test/auth.test.ts: expired token → returns null
|
|
94
|
+
</test>
|
|
95
|
+
<action>
|
|
96
|
+
GREEN phase: Minimal implementation.
|
|
97
|
+
- src/auth/login.ts: verify password hash, return token
|
|
98
|
+
- src/auth/session.ts: read/write session store
|
|
99
|
+
</action>
|
|
100
|
+
<refactor>
|
|
101
|
+
Extract password verification into domain layer. Keep session IO at the boundary.
|
|
102
|
+
</refactor>
|
|
103
|
+
</task>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
When executing, the implementer subagent follows this order strictly. Commits get the `red:` / `green:` / `refactor:` prefixes automatically.
|
|
107
|
+
|
|
108
|
+
## Coverage Goals
|
|
109
|
+
|
|
110
|
+
`.planning/config.json` sets the threshold:
|
|
111
|
+
```json
|
|
112
|
+
{ "hooks": { "coverageThreshold": 80 } }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The `gsd-quality-gate.cjs` script enforces this at verification time. Coverage is a floor, not a target — aim for the meaningful paths.
|
|
116
|
+
|
|
117
|
+
Target coverage by layer, not by line count: run `draht-tools graph-hotspots` / `draht-tools graph-clusters` against `.planning/codebase/MAP.json` and cover the domain/application layers (and god nodes) first. A task's `<files>` should sit in one bounded context — confirm with `draht-tools graph-context <files>` before writing tests; files spanning contexts mean the task is too broad to test cleanly.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-gate
|
|
3
|
+
description: Evidence before claims — before stating that work is done, fixed, passing, working, ready, complete, or successful, run the command that proves it and read the output. Triggers on language like "done", "fixed", "should work", "looks good", "passing", "ready to ship", "complete", or whenever Codex is about to assert positive state. Applies everywhere — feature work, bug fixes, refactors, infra, docs that depend on code state.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verification Gate
|
|
7
|
+
|
|
8
|
+
A transversal discipline: never claim positive state without empirical proof. This skill applies to every conversation — not just /verify-work or /execute-phase.
|
|
9
|
+
|
|
10
|
+
## The Iron Rule
|
|
11
|
+
|
|
12
|
+
> **Evidence before claims, always.**
|
|
13
|
+
|
|
14
|
+
Before you say *done*, *fixed*, *works*, *passes*, *ready*, *complete*, or any equivalent, you must:
|
|
15
|
+
|
|
16
|
+
1. **IDENTIFY** the command that would prove the claim
|
|
17
|
+
2. **RUN** it fully and fresh — not from memory of a previous run
|
|
18
|
+
3. **READ** the full output and the exit code
|
|
19
|
+
4. **VERIFY** the output actually supports the claim (not just "no error visible")
|
|
20
|
+
5. **ONLY THEN** state the result, with the evidence inline
|
|
21
|
+
|
|
22
|
+
## What Requires Empirical Verification
|
|
23
|
+
|
|
24
|
+
| Claim | Required Evidence |
|
|
25
|
+
|---|---|
|
|
26
|
+
| "Tests pass" | Output of the test command showing zero failures, exit 0 |
|
|
27
|
+
| "Build works" | Build command output, exit 0 |
|
|
28
|
+
| "Lint is clean" | Lint command output showing zero errors |
|
|
29
|
+
| "Typecheck passes" | `tsc --noEmit` (or equivalent) output, exit 0 |
|
|
30
|
+
| "Bug is fixed" | A reproducing test that previously failed now passes, AND the original user-level reproduction succeeds |
|
|
31
|
+
| "Feature works" | Manual reproduction of the user-visible behaviour, or an end-to-end test |
|
|
32
|
+
| "Migration is safe" | Dry-run output OR equivalent staging verification |
|
|
33
|
+
| "Deployment succeeded" | Deploy command output AND a live check (curl, health endpoint, etc.) |
|
|
34
|
+
| "Refactor is non-breaking" | Full test suite green AND a behaviour-equivalence check |
|
|
35
|
+
| "Architecture is sound" | `draht-tools map-graph` rebuilt, then `draht-tools graph-clusters --surprising` showing no new cross-context / layer-direction violations |
|
|
36
|
+
|
|
37
|
+
## Red Flag Phrases — STOP and Verify
|
|
38
|
+
|
|
39
|
+
If you are about to use any of these phrases without inline evidence, STOP and run the proving command first:
|
|
40
|
+
|
|
41
|
+
- "should work"
|
|
42
|
+
- "should pass"
|
|
43
|
+
- "probably works"
|
|
44
|
+
- "seems to work"
|
|
45
|
+
- "looks good"
|
|
46
|
+
- "looks fine"
|
|
47
|
+
- "appears to be"
|
|
48
|
+
- "Done!" / "Perfect!" / "All set!"
|
|
49
|
+
- "ready to ship"
|
|
50
|
+
- "no issues" / "no problems"
|
|
51
|
+
|
|
52
|
+
These phrases signal optimism, not verification. Replace them with the command output.
|
|
53
|
+
|
|
54
|
+
## Rationalization Table
|
|
55
|
+
|
|
56
|
+
| Excuse | Reality |
|
|
57
|
+
|--------|---------|
|
|
58
|
+
| "I'm confident this works" | Confidence is not evidence. Run the command. |
|
|
59
|
+
| "It's a one-line change, can't break anything" | One-line changes break things all the time. Run the tests. |
|
|
60
|
+
| "I just ran the tests two messages ago" | The state may have changed. If in doubt, run again. |
|
|
61
|
+
| "The user can verify themselves" | The user asked Codex to do the work. The work isn't done until proven. |
|
|
62
|
+
| "Partial verification is good enough" | Either prove the claim or don't make the claim. |
|
|
63
|
+
| "It compiled, so it works" | Compilation is not behaviour. Run the behaviour test. |
|
|
64
|
+
|
|
65
|
+
## Verification of Subagent Reports
|
|
66
|
+
|
|
67
|
+
Subagents return `STATUS: DONE` and may claim work is complete. **You must independently verify**, not just relay the status. If a subagent says tests pass, run the tests yourself before reporting up.
|
|
68
|
+
|
|
69
|
+
## Interaction With TDD
|
|
70
|
+
|
|
71
|
+
Verification gate and TDD reinforce each other:
|
|
72
|
+
- TDD makes the proving command obvious (the reproducing test)
|
|
73
|
+
- Verification gate prevents the "I'll run tests later" failure mode
|
|
74
|
+
- A `green:` commit without observing the test pass first is a TDD violation AND a verification gate violation
|
|
75
|
+
|
|
76
|
+
## Scope
|
|
77
|
+
|
|
78
|
+
This skill is auto-loading. It applies whenever the agent is in a position to claim positive state. It does not need to be explicitly invoked.
|
|
79
|
+
|
|
80
|
+
## Exception
|
|
81
|
+
|
|
82
|
+
You may say "I expect this to work because..." (forward-looking, with reasoning) before running the command. You may NOT say "this works" without running the command. The difference is tense and evidence.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-work
|
|
3
|
+
description: Draht command prompt wrapper for verify-work. Use when the user selects the Draht verify-work workflow or wants acceptance testing of completed phase work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Draht Command: verify-work
|
|
7
|
+
|
|
8
|
+
This skill exposes the Draht prompt command template to Codex's `$draht` and `/skills` surfaces.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Read `../../commands/verify-work.md` relative to this `SKILL.md`.
|
|
12
|
+
2. Treat the user's text after the skill mention as `$ARGUMENTS`. If the template uses `$1`, use the first positional argument.
|
|
13
|
+
3. Follow that command template as the active workflow.
|
|
14
|
+
4. Use Draht support skills such as `atomic-reasoning`, `tdd-workflow`, `verification-gate`, or `debugging-workflow` when the command template calls for that discipline.
|