@workit-dev/claude-code 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +19 -0
- package/README.md +48 -2
- package/agents/implementer.md +56 -0
- package/agents/reviewer.md +33 -0
- package/agents/verifier.md +40 -0
- package/assets/templates/headers.md +3 -0
- package/assets/templates/hygiene/.editorconfig +8 -0
- package/assets/templates/hygiene/.gitattributes +3 -0
- package/assets/templates/hygiene/CHANGELOG.md +14 -0
- package/assets/templates/hygiene/CONTRIBUTING.md +3 -0
- package/assets/templates/hygiene/LICENSE +21 -0
- package/assets/templates/hygiene/README.md +3 -0
- package/assets/templates/issue-update.md +5 -0
- package/assets/templates/plan-template.md +26 -0
- package/assets/templates/spec-template.md +64 -0
- package/assets/templates/workit-contract.md +13 -0
- package/bin/node-resolve.mjs +249 -0
- package/bin/workit +82 -0
- package/bin/workit-hook.mjs +552 -0
- package/bin/workit-paths.mjs +242 -0
- package/dist/workit-hook.js +248 -0
- package/dist/workit.js +122606 -0
- package/hooks/hooks.json +147 -0
- package/package.json +47 -4
- package/skills/architecture/SKILL.md +72 -0
- package/skills/architecture/agents/openai.yaml +3 -0
- package/skills/architecture/references/instruction-files.md +52 -0
- package/skills/architecture/references/vocabulary.md +53 -0
- package/skills/bdd/SKILL.md +53 -0
- package/skills/continue/SKILL.md +54 -0
- package/skills/debug/SKILL.md +45 -0
- package/skills/deslop/SKILL.md +58 -0
- package/skills/fanout/SKILL.md +71 -0
- package/skills/fanout/references/brief.md +141 -0
- package/skills/fanout/references/orchestration.md +169 -0
- package/skills/implement/SKILL.md +71 -0
- package/skills/retro/SKILL.md +72 -0
- package/skills/retro/agents/openai.yaml +3 -0
- package/skills/retro/references/sources.md +35 -0
- package/skills/retro/references/steering.md +39 -0
- package/skills/review/SKILL.md +66 -0
- package/skills/review/references/impact.md +24 -0
- package/skills/shape/SKILL.md +71 -0
- package/skills/shape/references/diagrams.md +17 -0
- package/skills/shape/references/knowledge.md +61 -0
- package/skills/shape/references/mockups.md +15 -0
- package/skills/shape/references/slicing.md +44 -0
- package/skills/ship/SKILL.md +71 -0
- package/skills/ship/references/changelog.md +44 -0
- package/skills/ship/references/pr-body.md +32 -0
- package/skills/ship/references/release.md +39 -0
- package/skills/test-audit/SKILL.md +54 -0
- package/skills/verify-app/SKILL.md +68 -0
- package/skills/verify-app/references/template.md +51 -0
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Workit host hooks: task context on session start (incl. compaction restore and forks) and when it changes per turn, branch policy and raw git/forge steering (deny gate bypasses, nudge routine commands) on shell commands, the heavy-command gate (a heavy shell command runs under the machine-wide heavy-check lease, a chain with heavy parts is split, a command a permission rule names is left to Claude Code), the before-write gate on file edits and shell writes, recording raw git commits for the session after they run, worktree guidance for subagents, the role's default model and effort on a subagent spawn that names none, one continuation when the agent stops with a provable unmet delivery obligation, a one-line skill nudge on prompts and delivery commands, and recording each Workit skill load, and counting a budgeted worker's tool calls (Read, Grep and Glob included) so its brief's tool-call budget is told once (its budget files go when it stops). Only events that change Claude's behavior are registered.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"matcher": "startup|resume|clear|compact|fork",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"type": "command",
|
|
10
|
+
"command": "node",
|
|
11
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
12
|
+
"timeout": 20
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"UserPromptSubmit": [
|
|
18
|
+
{
|
|
19
|
+
"hooks": [
|
|
20
|
+
{
|
|
21
|
+
"type": "command",
|
|
22
|
+
"command": "node",
|
|
23
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
24
|
+
"timeout": 15
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"PreToolUse": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "Bash",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": "node",
|
|
36
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
37
|
+
"timeout": 15
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"matcher": "PowerShell",
|
|
43
|
+
"hooks": [
|
|
44
|
+
{
|
|
45
|
+
"type": "command",
|
|
46
|
+
"command": "node",
|
|
47
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
48
|
+
"timeout": 15
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"matcher": "Edit|Write|MultiEdit|NotebookEdit",
|
|
54
|
+
"hooks": [
|
|
55
|
+
{
|
|
56
|
+
"type": "command",
|
|
57
|
+
"command": "node",
|
|
58
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
59
|
+
"timeout": 15
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"matcher": "Agent|Task",
|
|
65
|
+
"hooks": [
|
|
66
|
+
{
|
|
67
|
+
"type": "command",
|
|
68
|
+
"command": "node",
|
|
69
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
70
|
+
"timeout": 15
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"matcher": "Read|Grep|Glob",
|
|
76
|
+
"hooks": [
|
|
77
|
+
{
|
|
78
|
+
"type": "command",
|
|
79
|
+
"command": "node",
|
|
80
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
81
|
+
"timeout": 15
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"matcher": "Skill",
|
|
87
|
+
"hooks": [
|
|
88
|
+
{
|
|
89
|
+
"type": "command",
|
|
90
|
+
"command": "node",
|
|
91
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
92
|
+
"timeout": 15
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"PostToolUse": [
|
|
98
|
+
{
|
|
99
|
+
"matcher": "Bash|PowerShell",
|
|
100
|
+
"hooks": [
|
|
101
|
+
{
|
|
102
|
+
"type": "command",
|
|
103
|
+
"command": "node",
|
|
104
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
105
|
+
"timeout": 15
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"Stop": [
|
|
111
|
+
{
|
|
112
|
+
"hooks": [
|
|
113
|
+
{
|
|
114
|
+
"type": "command",
|
|
115
|
+
"command": "node",
|
|
116
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
117
|
+
"timeout": 20
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"SubagentStart": [
|
|
123
|
+
{
|
|
124
|
+
"hooks": [
|
|
125
|
+
{
|
|
126
|
+
"type": "command",
|
|
127
|
+
"command": "node",
|
|
128
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
129
|
+
"timeout": 15
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"SubagentStop": [
|
|
135
|
+
{
|
|
136
|
+
"hooks": [
|
|
137
|
+
{
|
|
138
|
+
"type": "command",
|
|
139
|
+
"command": "node",
|
|
140
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/workit-hook.mjs"],
|
|
141
|
+
"timeout": 15
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/claude-code",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Workit Claude Code plugin — session and per-turn task context, branch policy on git shell commands, workit method skills, and verifier/reviewer/implementer agents",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"agentic-coding",
|
|
8
|
+
"ai-agents",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"hooks",
|
|
11
|
+
"plugin",
|
|
12
|
+
"skills",
|
|
13
|
+
"workflow"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/BrainerVirus/workit#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/BrainerVirus/workit/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/BrainerVirus/workit.git",
|
|
23
|
+
"directory": "packages/workit-claude-code"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
".claude-plugin/",
|
|
27
|
+
"hooks/hooks.json",
|
|
28
|
+
"bin/",
|
|
29
|
+
"agents/",
|
|
30
|
+
"skills/",
|
|
31
|
+
"assets/",
|
|
32
|
+
"dist/",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "bun scripts/build.ts"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@workit-dev/cli": "^1.0.0",
|
|
44
|
+
"@workit-dev/core": "^1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=24"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture
|
|
3
|
+
description: Rank cited deepening refactors from churn and ledger friction; never applied unapproved. Use for architecture.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Architecture: deepen the modules that cause friction
|
|
8
|
+
|
|
9
|
+
User-invoked: offer it, never start it yourself. It proposes and grills; it
|
|
10
|
+
never refactors without the user's approval. Use the words in
|
|
11
|
+
`references/vocabulary.md` exactly and the domain words in `GLOSSARY.md`.
|
|
12
|
+
|
|
13
|
+
## Deepening
|
|
14
|
+
|
|
15
|
+
1. **Scope by YAGNI.** A direction the user names wins. Otherwise find hot
|
|
16
|
+
spots: churn (`git log --since=6.months --name-only --format=`, counted per
|
|
17
|
+
file, skipping lockfiles, version-bump manifests, generated files, docs and
|
|
18
|
+
`chore(release)` commits), friction in `workit ledger list --last 200`
|
|
19
|
+
(failed checks and verdicts, rulings, `retro:` decisions) and
|
|
20
|
+
`workit test-audit <paths> --json`. State the window and paths in one line.
|
|
21
|
+
2. **Settled decisions stand.** Read `GLOSSARY.md`, `CODING_STANDARDS.md` and
|
|
22
|
+
ADRs when present. Never re-litigate an ADR without new evidence.
|
|
23
|
+
3. **Explore organically.** A read-only explorer (Claude Code: Explore; or
|
|
24
|
+
you) walks the hot spots under the limits in `references/vocabulary.md`
|
|
25
|
+
and returns cited friction. Run the deletion test on every suspect.
|
|
26
|
+
4. **Report 3-5 ranked candidates, then stop and wait for approval.** Each:
|
|
27
|
+
- files and modules;
|
|
28
|
+
- the friction, with **2 or more cited occurrences** (commit, ledger row,
|
|
29
|
+
PR, test-audit finding); a one-off is not a candidate;
|
|
30
|
+
- an interface sketch: what callers see, what moves behind the seam;
|
|
31
|
+
- what gets simpler and what becomes testable through that interface;
|
|
32
|
+
- **merge danger**: one-way or two-way door, plus blast radius (callers,
|
|
33
|
+
packages, public surface).
|
|
34
|
+
The text list is primary; offer an HTML report only if the host renders one.
|
|
35
|
+
5. **Grill the chosen one**: numbered questions, each with a recommended
|
|
36
|
+
answer; challenge a weak premise with evidence first. Settle the interface,
|
|
37
|
+
the seam, the tests to replace and the migration order; a module named for
|
|
38
|
+
a new concept gets its glossary entry (call the Skill tool with `workit:shape`).
|
|
39
|
+
6. **Hand off on approval.** Several slices go into a plan for
|
|
40
|
+
`workit fanout plan <plan.json>`, with scopes and dependencies
|
|
41
|
+
(call the Skill tool with `workit:fanout`). One slice goes to a build (call the Skill tool with `workit:implement`). Record the
|
|
42
|
+
choice with `workit ledger decision "architecture: <id>" --why "<why>"`;
|
|
43
|
+
offer an ADR for a lasting rejection so the next run does not repeat it.
|
|
44
|
+
|
|
45
|
+
## Instruction files
|
|
46
|
+
|
|
47
|
+
Restructure AGENTS.md or CLAUDE.md in three escalating passes, **each its own
|
|
48
|
+
commit in one PR**, so the user can drop the later ones: remove no-ops;
|
|
49
|
+
progressive disclosure into topic files; coding rules to `CODING_STANDARDS.md`
|
|
50
|
+
and mechanical rules to checks. No commit adds a `workit knowledge lint`
|
|
51
|
+
finding. Never scaffold an empty file (`references/instruction-files.md`).
|
|
52
|
+
|
|
53
|
+
## Test sweep
|
|
54
|
+
|
|
55
|
+
Run `workit test-audit <paths> --json` over the suite or one hot spot and
|
|
56
|
+
report findings by module, worst first. On approval, the bad tests are
|
|
57
|
+
replaced (call the Skill tool with `workit:test-audit`).
|
|
58
|
+
|
|
59
|
+
## Example
|
|
60
|
+
|
|
61
|
+
Bad: "The CLI is messy, so I split router.ts in five." Uncited, unapproved.
|
|
62
|
+
|
|
63
|
+
Good: "1. Check runner (check.ts, evidence.ts), 3 occurrences: commits a1b2c3
|
|
64
|
+
and d4e5f6 edit both for one fix; ledger row 41 is a `check` red on a hidden
|
|
65
|
+
timeout. Sketch: `runCheck(spec)` returns evidence, the timeout behind it, so
|
|
66
|
+
timeouts test without a shell. Two-way door, 2 callers in one package."
|
|
67
|
+
|
|
68
|
+
## Check
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
workit knowledge lint # no new finding after each instruction-files commit
|
|
72
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Instruction-files mode (AGENTS.md, CLAUDE.md)
|
|
2
|
+
|
|
3
|
+
Instruction files are paid for in every session that reads them. Restructure
|
|
4
|
+
them in three escalating passes. Each pass is its own commit in one PR, in
|
|
5
|
+
this order, so the user can keep pass 1 and drop pass 3. Run
|
|
6
|
+
`workit knowledge lint` before pass 1 and after every commit: no commit adds
|
|
7
|
+
a finding, and the lint exits 0 after the last pass, or the report lists the
|
|
8
|
+
findings that remain and why.
|
|
9
|
+
|
|
10
|
+
After each commit, run `workit check test`. A sentence a test pins stays,
|
|
11
|
+
unless the user approves changing that test. Commit each pass with
|
|
12
|
+
`workit git commit -m "<type>: <pass>" -- <paths>`, then open the PR
|
|
13
|
+
(call the Skill tool with `workit:ship`).
|
|
14
|
+
|
|
15
|
+
Before pass 1, report the current byte counts and the plan for each pass, then
|
|
16
|
+
wait for approval. A pass with nothing to do is skipped and said so, not
|
|
17
|
+
padded.
|
|
18
|
+
|
|
19
|
+
## Pass 1: remove no-ops
|
|
20
|
+
|
|
21
|
+
Delete lines that would change no behavior if removed: "be thorough", "write
|
|
22
|
+
clean code", "follow best practices", restated defaults of the host, notes
|
|
23
|
+
about one past session, `path:line` references, and rules whose mistake a type,
|
|
24
|
+
lint or check now prevents. Nothing moves in this pass; it only deletes.
|
|
25
|
+
|
|
26
|
+
## Pass 2: progressive disclosure
|
|
27
|
+
|
|
28
|
+
Keep the root file to what every session needs: commands, workflow, and
|
|
29
|
+
"Read before <task>: <file>" pointers. Move topic detail (testing, release,
|
|
30
|
+
hosts, architecture) into topic files under an existing docs folder, one file
|
|
31
|
+
per topic, each opened by when to read it. Move text verbatim first; rewording
|
|
32
|
+
belongs in pass 1 or a later change. Every pointer from AGENTS.md or
|
|
33
|
+
CLAUDE.md must resolve (the lint's `broken-link` rule). The lint does not read
|
|
34
|
+
topic files: check their own links and content by hand.
|
|
35
|
+
|
|
36
|
+
## Pass 3: standards and checks
|
|
37
|
+
|
|
38
|
+
- A judgment rule a reviewer must weigh goes to `CODING_STANDARDS.md`; the
|
|
39
|
+
root file keeps one pointer to it.
|
|
40
|
+
- A mechanical rule (a forbidden import, a naming pattern, a file that must
|
|
41
|
+
exist) becomes a check instead of prose: a lint rule, a test, or a
|
|
42
|
+
configured `workit check <name>`. Show the check failing on a planted
|
|
43
|
+
violation, then delete the sentence.
|
|
44
|
+
- No rule lives in two files (`duplicate-rule`).
|
|
45
|
+
|
|
46
|
+
## Never
|
|
47
|
+
|
|
48
|
+
- Create a file without its first real entry in the same commit. The lint
|
|
49
|
+
flags a scaffolded `CODING_STANDARDS.md` or `GLOSSARY.md` (`scaffold-file`);
|
|
50
|
+
for a topic file, that check is yours.
|
|
51
|
+
- Squash the passes into one commit, or mix a behavior change into them.
|
|
52
|
+
- Grow the root file past the lint's byte budget (`agents-budget`).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Deepening vocabulary
|
|
2
|
+
|
|
3
|
+
Use these words exactly in every candidate. Do not drift into "component",
|
|
4
|
+
"service", "API" or "boundary".
|
|
5
|
+
|
|
6
|
+
| Term | Meaning |
|
|
7
|
+
| --- | --- |
|
|
8
|
+
| Module | Anything with an interface and an implementation: a function, a file, a package, a slice across tiers |
|
|
9
|
+
| Interface | Everything a caller must know: types, invariants, ordering, error modes, configuration, cost |
|
|
10
|
+
| Depth | Behavior a caller or test reaches per unit of interface learned. Deep: much behind little. Shallow: the interface is nearly as complex as the implementation |
|
|
11
|
+
| Seam | Where behavior can change without editing that place; where an interface lives |
|
|
12
|
+
| Adapter | A concrete thing that fills a seam (production, in-memory, fake) |
|
|
13
|
+
| Leverage | What callers gain from depth: one implementation pays back across many call sites and tests |
|
|
14
|
+
| Locality | What maintainers gain: change, bugs and verification concentrate in one place |
|
|
15
|
+
|
|
16
|
+
## Tests to run on a suspect
|
|
17
|
+
|
|
18
|
+
- **Deletion test.** Imagine deleting the module. Complexity vanishes: it was
|
|
19
|
+
a pass-through, so inline it. Complexity reappears across callers: it earns
|
|
20
|
+
its keep. A deepening concentrates complexity; it does not just move it.
|
|
21
|
+
- **Interface is the test surface.** Tests that must reach past the interface
|
|
22
|
+
mean the module has the wrong shape.
|
|
23
|
+
- **One adapter is a hypothetical seam; two are a real one.** Do not add a
|
|
24
|
+
port unless something varies across it (production and test count).
|
|
25
|
+
|
|
26
|
+
## What the explorer looks for
|
|
27
|
+
|
|
28
|
+
- One concept that needs a hop through many small modules to understand.
|
|
29
|
+
- Shallow modules: wide interface, thin implementation.
|
|
30
|
+
- Pure helpers extracted only for tests while the bugs live in how they are
|
|
31
|
+
called (no locality).
|
|
32
|
+
- Coupled modules leaking through their seams: one fix edits both (churn shows
|
|
33
|
+
them changing together).
|
|
34
|
+
- Code that is untested, or hard to test through its current interface.
|
|
35
|
+
|
|
36
|
+
The explorer is read-only (on Claude Code, the Explore agent). It reads code,
|
|
37
|
+
git history, `workit ledger list` and `workit test-audit` output only: never
|
|
38
|
+
session transcripts and never another workspace. It copies no secret, token
|
|
39
|
+
or personal data into its findings. It returns only cited findings (file,
|
|
40
|
+
commit, ledger row), never a refactor.
|
|
41
|
+
|
|
42
|
+
## Dependency categories (how the deeper module is tested)
|
|
43
|
+
|
|
44
|
+
1. In-process (pure, in-memory): merge and test through the new interface.
|
|
45
|
+
2. Local stand-in exists (temp dir, in-memory store): test with the stand-in;
|
|
46
|
+
the seam stays internal.
|
|
47
|
+
3. Owned but remote (your own service): a port at the seam, an in-memory
|
|
48
|
+
adapter in tests.
|
|
49
|
+
4. Third party: an injected port, a fake adapter in tests.
|
|
50
|
+
|
|
51
|
+
Replace, do not layer. An old test on a shallow module is deleted only after
|
|
52
|
+
naming the break it catches and showing that a test at the deeper interface
|
|
53
|
+
fails on that planted break (call the Skill tool with `workit:test-audit`). Until then it stays.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bdd
|
|
3
|
+
description: Turn requirements into Given/When/Then scenarios, agree the test seam, and work test-first in vertical RED/GREEN slices. Use for BDD, TDD, acceptance criteria, scenarios, Given/When/Then, write a test first.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Behavior first: Given/When/Then
|
|
7
|
+
|
|
8
|
+
1. **Write the scenarios.** One behavior each, in the caller's words:
|
|
9
|
+
`Given <state>, When <action>, Then <observable result>`. Include the
|
|
10
|
+
unhappy paths callers depend on (denied, empty, invalid, timeout).
|
|
11
|
+
2. **Agree the seam.** The highest stable interface the scenario can be
|
|
12
|
+
observed through: a CLI verb, a public function, an HTTP route; ideally one
|
|
13
|
+
per feature. Do not test at a seam nobody agreed to. Note what each seam
|
|
14
|
+
catches and misses (a unit seam misses wiring; a CLI seam misses nothing
|
|
15
|
+
the user sees but runs slower) and cover each miss once, elsewhere.
|
|
16
|
+
3. **Name tests after scenarios.** The name is the Given/When/Then sentence;
|
|
17
|
+
the body is arrange, act, assert. Expected values come from the scenario (a
|
|
18
|
+
literal from a worked example, the spec, an external contract), never from
|
|
19
|
+
the code under test. No tautological tests: a test must fail if the
|
|
20
|
+
behavior breaks, never restate the implementation.
|
|
21
|
+
4. **Build in vertical slices, never horizontal ones** (every test first,
|
|
22
|
+
then every implementation: tests written ahead of any code assert guessed
|
|
23
|
+
internals). Write one vertical RED slice that fails for
|
|
24
|
+
the missing behavior and run it through the CLI so the failure is observed:
|
|
25
|
+
`workit check test`. Make the smallest change, run the same check GREEN,
|
|
26
|
+
then take the next scenario. Any edit makes the observation stale; re-run
|
|
27
|
+
before you claim it. A recorded "tests pass" is a note, and an ad-hoc
|
|
28
|
+
`workit check -- <cmd>` never satisfies the gate: only the configured
|
|
29
|
+
`test` check does. No `test` detected? Create `.workit/checks.json`, copying
|
|
30
|
+
in every check the repo already runs: once it exists it replaces the
|
|
31
|
+
detected defaults.
|
|
32
|
+
5. **Mock only at system boundaries:** network, clock, randomness, other
|
|
33
|
+
processes, sometimes the filesystem. Never the unit or its own
|
|
34
|
+
collaborators; use the real thing or an in-memory adapter behind a port.
|
|
35
|
+
6. **Gherkin only where the repo already uses it** (`.feature` files with
|
|
36
|
+
playwright-bdd, cucumber, jest-cucumber). Otherwise test names carry it.
|
|
37
|
+
|
|
38
|
+
Reject noise: version-pin assertions, tests that mirror private structure,
|
|
39
|
+
assertions inside a possibly-empty loop, smoke-only renders, duplicates. If a
|
|
40
|
+
test still passes when every imported function returns `undefined`, rewrite it;
|
|
41
|
+
the audit finds these (call the Skill tool with `workit:test-audit`).
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
Bad: `test("calculateTotal works", () => expect(calculateTotal(items)).toBe(items.reduce((s, i) => s + i.price, 0)))`
|
|
46
|
+
|
|
47
|
+
Good: `test("Given two items of 5 and 10, When totalled, Then the total is 15", () => expect(calculateTotal([{ price: 5 }, { price: 10 }])).toBe(15))`
|
|
48
|
+
|
|
49
|
+
## Check
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
workit test-audit --diff && workit check test
|
|
53
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: continue
|
|
3
|
+
description: Keep work on track across interruptions and sessions - sort new input, checkpoint, hand off with a resume brief, and pick up by verifying inherited claims. Use for resume, pick up, handoff, new session, interruption, change of direction.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Continue without losing the thread
|
|
7
|
+
|
|
8
|
+
## New input mid-task
|
|
9
|
+
|
|
10
|
+
- **Quick question:** answer it; change nothing else.
|
|
11
|
+
- **Same-task adjustment:** update the affected constraint and next step, then
|
|
12
|
+
keep going.
|
|
13
|
+
- **Separate request:** do not silently resume an old objective, and do not
|
|
14
|
+
drop the current one. Checkpoint it (below) if it must continue later, then
|
|
15
|
+
start the new work. Held items stay parked with their resume condition until
|
|
16
|
+
the user resumes them.
|
|
17
|
+
|
|
18
|
+
## Checkpoint and hand off
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
workit git commit -m "wip: <state>" --all # nothing lives only in your context
|
|
22
|
+
workit handoff --note "<state in one line>" --next "<next command>" --record
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The brief carries the branch, HEAD, dirty state, check freshness, verdict,
|
|
26
|
+
rulings and the next command. Add only what it cannot know: choices still
|
|
27
|
+
open, approaches that failed and why. Work spanning repos gets one brief per
|
|
28
|
+
checkout, each with its branch and delivery endpoint. Notes too long for
|
|
29
|
+
`--note` go in a file under `workit dir handoffs`; name its path in the note.
|
|
30
|
+
|
|
31
|
+
## Pick up
|
|
32
|
+
|
|
33
|
+
1. In the checkout: `workit handoff`, then `workit ledger list` and
|
|
34
|
+
`git log --oneline -10`.
|
|
35
|
+
2. Trust the trail, verify the claims: re-run the checks the brief calls
|
|
36
|
+
stale, and confirm each "done" item against the goal on the real artifact
|
|
37
|
+
(a pushed SHA, a PR state, a running feature). Do not re-derive settled
|
|
38
|
+
decisions.
|
|
39
|
+
3. Continue to the recorded endpoint with the brief's next command.
|
|
40
|
+
|
|
41
|
+
## Example
|
|
42
|
+
|
|
43
|
+
Bad: a new session re-reads the whole codebase, re-asks the user which
|
|
44
|
+
approach to take, and redoes a finished slice.
|
|
45
|
+
|
|
46
|
+
Good: "`workit handoff`: feature/usage at 4be1, `test` stale, verdict none,
|
|
47
|
+
next `workit check test`. Re-ran it: exit 0. The brief says PR #42 is open:
|
|
48
|
+
`workit pr status` confirms, CI pending. Continuing to ship (call the Skill tool with `workit:ship`)."
|
|
49
|
+
|
|
50
|
+
## Check
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
workit handoff # read: "next command" is set and no check is listed as stale
|
|
54
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug
|
|
3
|
+
description: Find a root cause before patching - start from a red-capable deterministic repro, rank hypotheses, bisect regressions, fix at the root with a regression test. Use for bug, broken, failing, flaky, regression, error, why does.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debug from a red loop
|
|
7
|
+
|
|
8
|
+
## Steps
|
|
9
|
+
|
|
10
|
+
1. **Build the loop before any hypothesis.** One command that is red for the
|
|
11
|
+
user's exact symptom, deterministic, fast and runnable by you:
|
|
12
|
+
`workit check -- <repro>`. Shrink it until it fails in seconds. If the
|
|
13
|
+
symptom only shows on the running app, drive it with the project's
|
|
14
|
+
verify-<app> skill. No loop yet? Building it is the task; do not guess-patch.
|
|
15
|
+
2. **Read the failure, not the summary:** the full error, the failing value,
|
|
16
|
+
and every caller on its path.
|
|
17
|
+
3. **Rank three to five falsifiable hypotheses**, likeliest first. Test one at
|
|
18
|
+
a time with the loop or a tagged log line (`[DEBUG-<id>]`, removed at the
|
|
19
|
+
end with one grep). Keep a short hypothesis log so a dead idea stays dead.
|
|
20
|
+
4. **Regression? Bisect it:** `git bisect start <bad> <good>` then
|
|
21
|
+
`git bisect run <repro>`. The first bad commit names the cause.
|
|
22
|
+
5. **Fix at the root**, the one place every failing caller passes through.
|
|
23
|
+
Add a regression test at a seam that exercises the real bug pattern; if no
|
|
24
|
+
such seam exists, report that as a finding.
|
|
25
|
+
6. **Stop rule:** after three dead hypotheses, write down what is measured and
|
|
26
|
+
what is inferred, widen the loop, or ask for the one fact only the user has.
|
|
27
|
+
|
|
28
|
+
Every shipped line traces to evidence from the loop. A "might help" retry or
|
|
29
|
+
guard is a hypothesis, not a fix.
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
|
|
33
|
+
Bad: "Probably a race; added a retry." (no repro, nothing measured)
|
|
34
|
+
|
|
35
|
+
Good: "Repro: `workit check -- bun test lock.test.ts -t stale` red 10/10.
|
|
36
|
+
H1 dead pid not reclaimed - confirmed: `kill(pid, 0)` throws EPERM for another
|
|
37
|
+
user's pid and we treated it as dead. Fix: EPERM means alive. Loop green 10/10;
|
|
38
|
+
regression test pins the EPERM case."
|
|
39
|
+
|
|
40
|
+
## Check
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
workit check -- <repro> # red before the fix, green after
|
|
44
|
+
workit check test
|
|
45
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deslop
|
|
3
|
+
description: Remove AI slop before a PR - dead code, comments that restate the code, filler prose - with a minimal diff and identical behavior. Use for deslop, clean up, slop, tidy before PR, remove dead code, trim the PR body.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deslop code and prose
|
|
7
|
+
|
|
8
|
+
Deslop removes; it never changes behavior. Its depth follows the review lane.
|
|
9
|
+
|
|
10
|
+
1. **Scan first, no agent:** `workit deslop scan --diff [<base>] --json`. It
|
|
11
|
+
classes each added comment `narration`, `marker` (TODO, FIXME, HACK),
|
|
12
|
+
`suppression` (a lint or type disable with no reason), `debug` (stray logs,
|
|
13
|
+
`debugger`, `[DEBUG-` tags) or `allowed`, runs `test-audit` on changed
|
|
14
|
+
tests, and prints the lane and its passes. A marker or a lint/type
|
|
15
|
+
suppression raises `self` to `focused`.
|
|
16
|
+
2. **Run the lane's passes** (each lane adds to the one below):
|
|
17
|
+
- `none` (docs only): prose. Cut filler and hedging from the PR body and
|
|
18
|
+
docs; keep real symbol names and before-to-after numbers.
|
|
19
|
+
- `self`: delete every narration, marker and debug finding, plus dead code
|
|
20
|
+
from the repo's tools (`knip`, `ts-prune`, `vulture`, unused-lint rules).
|
|
21
|
+
- `focused`: a fresh-eyes no-comments pass and a test-quality lens. Hand
|
|
22
|
+
the diff, never your verdict, to a fresh reviewer: Claude Code and Codex,
|
|
23
|
+
the `reviewer` agent; OpenCode, a child session; Cursor, a Task subagent
|
|
24
|
+
marked `ROLE: reviewer`; Pi, a supervised worker. It deletes every added
|
|
25
|
+
comment off the keep list and triages `workit test-audit --diff`
|
|
26
|
+
(call the Skill tool with `workit:test-audit`).
|
|
27
|
+
- `full`: also `workit test-audit --mutate --diff` and one architect
|
|
28
|
+
sketch of the simpler shape, reported, not applied.
|
|
29
|
+
3. **The keep list** (everything else goes): a licence header, an external
|
|
30
|
+
quirk (a library, OS or spec behaving oddly), `prettier-ignore` and other
|
|
31
|
+
tool directives, a lint suppression with its reason (`-- <why>`), public
|
|
32
|
+
API docs, an issue or RFC link.
|
|
33
|
+
4. **No workaround comments for our own code.** Fix the root in a separate
|
|
34
|
+
`refactor:` commit, or open an issue that carries the explanation and
|
|
35
|
+
delete the comment. A "do not remove" note becomes a test, a type or a
|
|
36
|
+
lint rule.
|
|
37
|
+
5. **Record one line per PR** when checks pass again:
|
|
38
|
+
`workit deslop result --removed <n> --reshapes <n> --open <n>` writes
|
|
39
|
+
`deslop: lane focused, -42 lines, 3 reshapes, 1 open` to the ledger.
|
|
40
|
+
Nothing to clean is a valid result (`--removed 0`). When a tracked task
|
|
41
|
+
lists a `pre-pr-cleanup` requirement (≤6.x tasks), this is its evidence.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
Bad: keeping `// increment the counter` above `count += 1`, or deleting
|
|
46
|
+
`// eslint-disable-next-line no-await-in-loop -- the API rate-limits parallel calls`.
|
|
47
|
+
|
|
48
|
+
Good: the scan lists 6 narration, 1 marker and 1 bare `oxlint-disable`; the
|
|
49
|
+
lane rises to focused; narration and the marker go, the disable gains its
|
|
50
|
+
reason, a fresh reviewer drops two more comments, and a call-order assertion
|
|
51
|
+
on an internal mock becomes a result assertion:
|
|
52
|
+
`deslop: lane focused, -42 lines, 1 reshapes, 0 open`.
|
|
53
|
+
|
|
54
|
+
## Check
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
workit deslop scan --diff && workit check test && workit deslop result --removed <n>
|
|
58
|
+
```
|