implement-slice
Skill52 starsChanged 20 days agoMITView on GitHub
Implement the next smallest slice from the current plan using TDD — tests first, then code, then verification, then an atomic commit. Reads the plan from the scratchpad.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- kpblcaoo/agent-skillstheir own version, first seen Jun 21, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- kpblcaoo/agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- src/claude.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- bootstrap-featureSkill
- context-refreshSkill
- design-foundationSkill
- develop-featureSkill
- merge-readySkill
- sdlc-fastSkill
- sdlc-quickSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
28 rules. About 0 are common, 13 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Parallel subagent mode: when running as a subagent within a parallel wave (wave context provided in spawn prompt), the following rules …
- Very specific: line 23
Do NOT write to .claude/scratchpad.md — the orchestrator handles scratchpad updates
- Very specific: line 24
Do NOT write to .claude/instincts.md — it is PROTECTED identically to the scratchpad (Section 8 FR-7.2).
- Distinctive: line 25
Do NOT auto-continue to the next slice — return to the orchestrator after committing
- Very specific: line 35
Tracer gate: read the plan file and check whether any slice is marked Tracer: yes.
- Distinctive: line 53
Read the current slice from the implementation plan.
- Very specific: line 56
Use the Files: list directly — these are the exact files to create/modify
- Very specific: line 57
Use the Changes: descriptions as implementation guidance
- Very specific: line 58
Use the Verify: commands in step 4
- Very specific: line 59
Use the Done when: condition to confirm completion
- Distinctive: line 66
Read existing files that will be modified
- Very specific: line 70
Quick-tier carve-out (FR-4.4, AC-26): when .claude/scratchpad.md reads ## Tier: quick, state the following verbatim in the delegation …
- Distinctive: line 82
Write tests for this slice's behavior using the project's test framework
- Distinctive: line 96
Before editing each file: re-read it from disk (do NOT rely on earlier in-context reads — context compaction may have made them stale)
- Distinctive: line 98
Follow the project structure as defined in CLAUDE.md
- Distinctive: line 99
Keep route handlers thin, business logic in services/data layer
- Distinctive: line 100
If this slice edits 4+ files: run the project's typecheck command after every 3 file edits before continuing (per error-recovery rules)
- Very specific: line 101
When a slice touches UI files: read .claude/rules/design.md and extend its declared tokens — introduce no color, font, or duration value …
- Very specific: line 105
If the slice has a
Verify:field: run the exact command(s) from that field first. - Very specific: line 107
If the slice has a
Done when:field: after verification passes, confirm the done-condition is satisfied (e.g., run the grep, check the … - Very specific: line 153
Every time a deviation rule (src/rules/error-recovery.md, Rules 1–4) fires during this feature's implementation — across every slice, not …
- Very specific: line 155
When a given rule's count reaches 2 or more, capture (or update) one instinct with Trigger: Repeated Deviation Rule, describing the …
- Very specific: line 183
Wave-subagent carve-out: When running as a parallel-wave subagent (wave context provided in spawn prompt), .claude/instincts.md and …
- Very specific: line 199
If either condition holds, do NOTHING here — merge-ready writes the single consolidated entry.
- Distinctive: line 205
Idempotency guard: if an existing entry with the same name already exists under today's date, UPDATE that entry in place — do NOT duplicate …
- Distinctive: line 213
Use cases covered by this slice
- Distinctive: line 220
No refactors unless required for this slice
- Distinctive: line 221
NEVER add "Co-Authored-By" or AI attribution to commits
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Command: Implement Slice
Implement only the next smallest slice from the plan using TDD.
Arguments
$slice (also available as $ARGUMENTS) optionally names the slice to implement. When empty, take the next pending slice from .claude/scratchpad.md.
Literal-token flag rule: a documented flag is active ONLY if its literal token appears in $ARGUMENTS. In particular, the no-changelog suppression flag is in effect ONLY when the literal token no-changelog was passed. Never infer it from context, and never assume it because the documentation describes it.
Pre-flight Checks
- Confirm you are NOT on
main— must be on a feature branch (feat/*orfix/*) - Confirm
git statusis clean (or explain why not) - Parallel subagent mode: when running as a subagent within a parallel wave (wave context provided in spawn prompt), the following rules apply for the entire execution:
- Do NOT write to
.claude/scratchpad.md— the orchestrator handles scratchpad updates - Do NOT write to
.claude/instincts.md— it isPROTECTEDidentically to the scratchpad (Section 8 FR-7.2). Track deviation-rule tallies and the build-runner attempts counter in-context instead, and report them to the orchestrator for it to persist (see Step 6, Capture Instincts) - Do NOT auto-continue to the next slice — return to the orchestrator after committing
- Chain git commands:
git add <files> && git commit -m '...'as a single Bash command to prevent staging conflicts with sibling subagents
- Do NOT write to
- Tier-aware documentation check: confirm these documentation files exist — skipped entirely
when
.claude/scratchpad.mdreads## Tier: quick, since neither file is ever required for aquick-tier change, by design (FR-4.4). This check runs unmodified — exactly as written below — when## Tier:readsfullor the field is absent: absence meansfullis the backward-compatibility default for every scratchpad written before this tier field existed, so an absent field is never read as license to skip this check.docs/qa/<feature>_test_cases.md— if not, delegate toqa-plannerfirstdocs/use-cases/<feature>_use_cases.md— if not, delegate toba-analystfirst
- Tracer gate: read the plan file and check whether any slice is marked
**Tracer:** yes.- If a
**Tracer:** yesslice exists and this invocation targets a different (non-tracer) slice, AND the tracer slice'sVerify:condition has not yet been run and passed: REFUSE. Do not proceed to Step 1 (Identify the Slice) or any TDD work. State plainly that the tracer slice must be implemented and itsVerify:condition passed first, name the tracer slice, and instruct the caller to run/implement-sliceagainst the tracer slice before retrying this one. This check exists because standalone invocation of this skill bypasses/develop-feature's wave sequencing entirely — wave ordering alone cannot gate a direct, out-of-band/implement-slicecall. Source of truth for "the tracer passed": the tracer slice's DONE record with a commit hash in.claude/scratchpad.md, or a fresh run of the tracer's ownVerify:command. If neither is available, or the record is ambiguous, REFUSE — an unverifiable tracer is an unpassed tracer. - If this invocation targets the tracer slice itself: proceed normally — the tracer is exempt from its own gate.
- Exemption (backward compatibility), tier-aware wording (FR-4.5, AC-27): if the plan carries no
**Tracer:** yesmarker anywhere, this check does not apply. Print the tier-appropriate line verbatim, then continue with the remaining pre-flight checks and TDD flow as normal — the exemption is never silent:When
.claude/scratchpad.mdreads## Tier: quick: a marker-free plan here isquicktier's own single-slice plan, exempt from the tracer requirement by design — never a legacy plan. Print exactly:tracer gate inactive — tier: quick, single-slice plan is exempt from the tracer requirement by design.When
## Tier:readsfull, or the field is absent (the pre-F4 legacy case): print the existing legacy wording, unchanged:tracer gate inactive — no **Tracer:** yes marker found; treating as pre-F3 plan.
- If a
TDD Implementation Flow
1. Identify the Slice
Read the current slice from the implementation plan. Two formats are supported:
Executable format (preferred — when the slice has Files:, Changes:, Verify:, Done when: fields):
- Use the
Files:list directly — these are the exact files to create/modify - Use the
Changes:descriptions as implementation guidance - Use the
Verify:commands in step 4 - Use the
Done when:condition to confirm completion - List the use-case scenarios this slice covers (from
Use cases:field) - Re-read each file from the
Files:list before modifying
Legacy format (fallback — when the slice is prose without structured fields):
- Restate the next slice in 1 sentence
- List the use-case scenarios this slice covers (UC-X.Y, UC-X-A, etc.)
- Read existing files that will be modified
2. Write Tests First
Quick-tier carve-out (FR-4.4, AC-26): when .claude/scratchpad.md reads ## Tier: quick, state
the following verbatim in the delegation prompt, before the request itself: "no
docs/qa/<feature>_test_cases.md file exists for this change by design and MUST NOT be treated as a missing input."
test-writer derives its tests from the slice's own Verify:/Done when: fields
instead. This carve-out lives in the delegation prompt only — agents/test-writer.md itself is never
modified by this instruction.
Delegate to test-writer agent:
- Reference documented test cases from
docs/qa/(for aquick-tier run, this reference is replaced by the carve-out above, since no such file exists by design) - Reference use-case scenarios from
docs/use-cases/for this slice (for aquick-tier run, use the slice's ownUse cases:field if present, since no use-cases file exists by design) - Write tests for this slice's behavior using the project's test framework
- Run them and capture the RED result before writing any implementation.
test-writerreports the command, the exit status and which assertions failed, per its Output Format. This run is the point of TDD here: a test never observed to fail is not evidence that the change did anything (measured:docs/findings/harness-optimization-research.md§3). - If the tests pass on that first run, that is a legitimate outcome — but it must be declared, never silent. Two honest cases: the behaviour already exists and the slice characterizes it, or the test does not reach the new path and is therefore wrong. Say which. The forbidden state is a green suite whose greenness nobody can account for.
3. Implement Code
- Do not start until Step 2's red-phase result is in hand (a failing run, or a declared reason the tests passed). Implementing first and testing after produces a green suite that cannot distinguish "fixed it" from "never tested it".
- Before editing each file: re-read it from disk (do NOT rely on earlier in-context reads — context compaction may have made them stale)
- Make minimal changes to pass the tests
- Follow the project structure as defined in CLAUDE.md
- Keep route handlers thin, business logic in services/data layer
- If this slice edits 4+ files: run the project's typecheck command after every 3 file edits before continuing (per error-recovery rules)
- When a slice touches UI files: read
.claude/rules/design.mdand extend its declared tokens — introduce no color, font, or duration value not declared there
4. Verify
If the slice has a Verify: field: run the exact command(s) from that field first. Then delegate to build-runner for full verification (typecheck, tests, build).
If the slice has a Done when: field: after verification passes, confirm the done-condition is satisfied (e.g., run the grep, check the endpoint, verify the file exists). If the done-condition is not met, the slice is not complete — investigate and fix.
If the slice has a Verify: field with "Manual verification:": report the check instructions in the output so the developer can verify manually.
Fallback (no structured fields): delegate to build-runner agent to run the project's typecheck, test, and build commands (from CLAUDE.md).
Persisted red-phase record. Alongside the attempts counter below, write one line per slice into
.claude/scratchpad.md via Edit, never a whole-file Write:
Slice <N> red-phase: <command> → FAILED (<n> assertions) | NONE — <declared reason>Same discipline as the attempts counter: it is the durable half of a fact that otherwise lives only
in a subagent's reply and dies with its context. On the wave-subagent path .claude/scratchpad.md
is PROTECTED, so the subagent reports the red-phase line and the orchestrator writes it when
folding the wave, exactly as it already does for (category, count) deviation pairs.
Persisted build-runner attempts counter and debugger auto-invocation (FR-8.5, C8/FR-8.10). The 3-retry budget src/rules/error-recovery.md already governs is not tracked in conversation memory alone here either — mirroring /merge-ready's Gate 6 attempts: N/3 precedent exactly:
- Standalone path (no wave context): after every
build-runnerinvocation for this slice (the initial run and each retry), writeSlice <N> build-runner attempts: N/3under the feature's current status in.claude/scratchpad.mdviaEdit, never a whole-fileWrite. Before deciding whether to retry, read this line back from the file — never rely on what you recall having written earlier in the conversation. When the counter reaches2/3withbuild-runnerstill FAILing, self-invoke thedebuggeragent — feeding it the prior failure output(s) and the feature slug — BEFORE the 3rd (final) retry attempt. Applydebugger's recommended fix under whichever deviation rule it names; ifdebuggerreturnsUNDIAGNOSED, the final attempt proceeds exactly as it would have without this feature. - Wave-subagent path (wave context provided):
.claude/scratchpad.mdisPROTECTED— do NOT write it. TrackSlice <N> build-runner attempts: N/3in-context for the duration of this slice instead, self-invokedebuggerat2/3identically to the standalone path, and report the final attempts count to the orchestrator (Step 6, Capture Instincts) for it to persist. - C8/FR-8.10 inline fallback: both paths above assume
debuggercan be reached via theAgenttool. If nested agent spawn is unavailable in the running context, do NOT skip the diagnostic pass — rundebugger's bounded scientific-method protocol (agents/debugger.mdProcess: up to 5 falsifiable hypothesis cycles) inline, in this same context, instead of spawning it. TheUNDIAGNOSEDverdict and the final-attempt escalation path are unchanged either way. A diagnosis that cannot run degrades to a slower, inline diagnosis — never to silence.
5. Commit
git addspecific changed files (notgit add -A)git commit -m "<type>(<scope>): <slice summary>"- Types:
feat,fix,test,chore - Scopes:
api | ui | db | auth | core | infra
6. Capture Instincts
This step runs after the commit step (5), occupying the same post-commit position pattern the changelog step (7, below) occupies. Unlike the changelog step, it is never suppressed by the no-changelog flag — that flag governs only CHANGELOG.md; the instinct store has its own, separate gating (the wave-subagent carve-out below).
Trigger 1 — User Correction (FR-2.1). Scan the conversation since this slice began for exactly these three heuristics:
(a) explicit rejection language ("that's wrong," "no, you should," "revert that," "undo that," or equivalent);
(b) the developer supplies replacement code or a replacement approach directly;
(c) the developer references a prior state or explicitly asks to go back.
A match against any of the three captures (or updates, per the dedup scan below) one instinct entry with Trigger: User Correction. A non-match writes nothing — never force a capture when none of the three heuristics fired.
Trigger 2 — Repeated Deviation Rule (FR-2.2). Maintain a single per-feature tally line in .claude/scratchpad.md:
Deviation rule fires this feature: rule1=<n> rule2=<n> rule3=<n> rule4=<n>- Every time a deviation rule (
src/rules/error-recovery.md, Rules 1–4) fires during this feature's implementation — across every slice, not only this one — increment that rule's count viaEdit, never a whole-fileWrite. - Before deciding whether the threshold is met, read the line back from the file — never rely on an in-context recollection of what was written earlier in the conversation; this is what survives a context compaction.
- When a given rule's count reaches 2 or more, capture (or update) one instinct with
Trigger: Repeated Deviation Rule, describing the recurring error pattern. - Rule 1 and Rule 2 fires count identically to Rule 3 and Rule 4 fires. Rule 1/2 fixes are "free" — they consume no retry budget and are therefore invisible in any retry count — which is exactly why this tally must track them explicitly rather than deriving the signal from retries.
- Standalone path: update the tally directly via
Editas each rule fires, on this slice's own turn. - Wave-subagent path: see the carve-out below — the tally is tracked in-context here, never written to the file.
Entry schema — the full 8 fields (FR-1.4), minted within D1's allowlist. Every captured or updated entry is a ### <slug> heading (kebab-case, ≤60 characters — the mechanical dedup key) followed by:
Confidence:—min(0.9, 0.3 + 0.2 × (occurrences − 1)), recomputed ONLY at a new-occurrence event (a fresh feature slug added to(features: ...)), overwriting any prior decay.Category:— see the FR-1.7 rules below.Pattern:— the file path or glob the instinct concerns.Rule:— a single-line ALWAYS/NEVER/WHEN prevention heuristic, generalized beyond the specific instance that produced it, minted within D1's allowlist:/^[\p{L}\p{N} ._/():+#&',—-]{1,200}$/u, 1–200 characters, a single physical line. A candidateRule:that fails D1 is never written raw or truncated into shape — regenerate it within the allowlist before capturing; D1 is the one shared definition this step and the session-start injection hook both validate against.Trigger:—User CorrectionorRepeated Deviation Rule(the two triggers this step owns;Gate Auto-Fix/Gate Retry Exhaustedbelong to/merge-ready's own capture step).Occurrences:— an integer, followed by(features: <slug1>, <slug2>, ...).Last confirmed at:— the## MetaFeature countervalue, stamped per the dedup rule below.Retires at:—Last confirmed at+ 10.
Category assignment — FR-1.7 in full:
Category: securitywhen the capturing gate is Gate 3 (Security Audit) ORPattern:hitsauth,payment,billing, orsecretas a path segment (case-insensitive), ORPattern:is.github/workflows/,install.sh, or.claude/settings.json.Category: data-integritywhenPattern:containsmigrationas a path segment, OR the capturing context is a data-mutation or financial code path.Category: generalotherwise — the conservative default;generalentries require one more occurrence to elevate thansecurity/data-integrityentries.
C3/FR-1.5a pre-capture dedup scan — MANDATORY. Before minting any new ### <slug> heading, scan both ## Prevention Rules and ## Instincts Log for an existing entry whose Pattern: and Category: both match the pattern about to be captured (case-insensitive). A match is a recapture of that existing heading — never a new one: update the matched entry in place instead of minting a new slug.
- A recapture within the same feature (the feature slug already present in that entry's
(features: ...)list) does NOT incrementOccurrences:a second time. - On any capture (new or recapture), stamp
Last confirmed atwith the counter's pre-increment value — the## MetaFeature counteras it reads right now, before/merge-readyFinalization's own+1(FR-3.2) next runs. - This scan is not optional. Skipping it lets a model-minted slug fragment the same pattern across near-duplicate headings (
missing-api-validationvs.api-input-validation-missing) — occurrence counts never converge, nothing reaches the elevation threshold, nothing ever retires, and the store silently degrades into exactly the flat, append-only log this feature exists to replace, while every mechanism above still appears to be working.
FR-1.2 lazy creation. If a trigger above fires and .claude/instincts.md does not exist yet: Write it from the identical scaffold templates/instincts.md provides (three sections — ## Meta with Feature counter: 0, ## Prevention Rules, ## Instincts Log, no pre-populated entries). This targets a nonexistent file, so it is outside pre:write:shrink-guard's scope (that guard fires on Write to an existing, curated file — Section 8 FR-3). Then append the new entry via Edit. Only instructions that read the store need an existence guard (it may legitimately not exist yet); an instruction that only writes it never does.
Wave-subagent carve-out. When running as a parallel-wave subagent (wave context provided in spawn prompt), .claude/instincts.md and .claude/scratchpad.md are both PROTECTED (Section 8 FR-7.2) — do NOT write either file in this step.
- Track the Trigger 2 deviation-rule tally and the
Slice <N> build-runner attempts: N/3counter (Step 4) in-context for the duration of this slice. - Self-invoke
debuggerat2/3exactly as the standalone path does (Step 4) — this requires writing neither the store nor the scratchpad. - In the result returned to the orchestrator, report: the detected Trigger 1 corrections (if any), the deviation-rule fires as
(category, count)pairs, and the finalSlice <N> build-runner attempts: N/3count. The orchestrator folds these into the feature-level tally and captures/persists any resulting instinct after collecting the whole wave's results (FR-2.4, FR-7.0) — mirroring the changelog step's own orchestrator-owns-the-write discipline. - Accepted residual, stated plainly: a context compaction mid-subagent can lose the in-context tally or attempts count before either is ever reported. This is bounded by the subagent's own single-slice lifetime — worst case, one slice's signal is undercounted, never the whole feature's — and is an accepted residual, not a defect this slice closes.
Standalone path (no wave context). Apply Trigger 1 and Trigger 2 directly: Edit the tally line in .claude/scratchpad.md, read it back, and capture/update instinct entries in .claude/instincts.md per the schema, category rules, and dedup scan above.
7. Write Changelog Entry
This step runs only after a successful commit (step 5). It is the standalone-fix path: when a slice is committed outside the full pipeline, the changelog still needs an entry.
Skip this step entirely when EITHER skip condition is true:
- (a) Parallel-wave subagent — wave context was provided in the spawn prompt. The orchestrator /
merge-readyowns the changelog entry for the wave. - (b)
no-changelogsuppression flag — ano-changelogflag was passed (i.e. this run is driven by/develop-feature).merge-readyowns the entry for the whole feature.
If either condition holds, do NOTHING here — merge-ready writes the single consolidated entry.
When BOTH skip conditions are false (true standalone fix), write ONE entry to the project-root CHANGELOG.md following the changelog rule (changelog.md):
- Retrieve the real timestamp by running
date -u +'%Y-%m-%d %H:%M'— NEVER invent or guess the timestamp. - Fields: name, UTC time, a non-technical Summary, and Details (≤500 characters).
- Entries are day-grouped, newest-first.
- Idempotency guard: if an existing entry with the same name already exists under today's date, UPDATE that entry in place — do NOT duplicate it.
8. Update Scratchpad
Skip this step when running as a parallel subagent (wave context provided in spawn prompt). The orchestrator handles scratchpad updates after collecting all wave results.
When running standalone (no wave context), update .claude/scratchpad.md with:
- What changed
- Commit hash + message
- Use cases covered by this slice
- What's next (next slice)
Rules
- Minimal diff — change only what's necessary for this slice
- 1 slice = 1 commit (atomic)
- No refactors unless required for this slice
- NEVER add "Co-Authored-By" or AI attribution to commits
Output Format
## Slice: [description]
### Wave: [N — slice X of Y in this wave] (or "standalone — no wave context")
### Use Cases Covered
- UC-X.Y: [scenario name]
- UC-X-A: [alternative flow name]
### Tests Written
- [test file]: [number] test cases
### Implementation
- [files changed with brief description]
### Verification
- Red phase: [command] → FAILED ([n] assertions) / NONE — [declared reason]
- Typecheck: PASS/FAIL
- Tests: PASS/FAIL (X passed)
- Build: PASS/FAIL
- Slice <N> build-runner attempts: [n]/3 — debugger invoked: Yes (at 2/3) / No
### Git
- Branch: [branch name]
- Commit: [hash] — [message]
### Instincts
- Trigger 1 (User Correction) detected: Yes/No — [1-line description if Yes]
- Deviation-rule fires this slice, as (category, count) pairs: [list, or "none"]
- Store write: Yes (standalone) / Skipped (parallel-wave subagent — reported to orchestrator) / None (no trigger matched)
### Changelog
- Entry written: Yes / Skipped (parallel-wave subagent) / Skipped (no-changelog flag — develop-feature owns it)
### Next
- `Continuing to Slice N` — or `All slices done — running /merge-ready`Auto-Continue (run-to-completion)
When running as a parallel subagent (wave context provided): do NOT auto-continue. Return your result (PASS with commit hash, or FAIL with error details) to the orchestrator. Wave progression is managed by develop-feature.
When running standalone (no wave context), after committing this slice, in the SAME turn:
- Slices remain → read
.claude/scratchpad.mdand start the next slice's TDD flow. Never end the turn with a question like "continue?" — the report above is a log line, not a hand-off. - None remain → run
/merge-ready. - The only legitimate stop is a real blocker: write it under
## Blockers, set## Status: blocked(pausedif the user asked to pause).stop:gate-evidencerefuses any other mid-plan stop.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

