From product-playbook
Use when implementation work starts on a feature or bug fix: writing or modifying source code, adding tests, or closing out a branch. Covers TDD-first, scope integrity, secret and security hygiene, dual post-implementation review (code reviewer plus spec reviewer), and finish-branch closure. Triggers on "implement", "start coding", "build the feature", "write the code", "fix the bug", "finish the branch", "wrap up the branch", and the same intent in any language ("開始實作", "開發這個功能", "收尾", "実装して").
How this skill is triggered — by the user, by Claude, or both
Slash command
/product-playbook:dev-disciplineThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect the user's language and reply in it; the protocol below is authored in English.
Detect the user's language and reply in it; the protocol below is authored in English.
Provenance: this lens governs process, so code changes carry no framework tag. Skip the — Frameworks: line on code output; add dev-discipline to the provenance line only when the outcome is a document (a review report, a handoff note).
Decide the track before the first edit; ceremony scales with ambiguity, not with nervousness.
Write the plan to docs/plans/<slug>.md before implementing. The plan is a frozen contract on the OBSERVABLE OUTCOME the task asks for, never on how to build it — freezing file names or function signatures lets a reviewer refute correct work for diverging from them. Sections, in order:
# Plan: <one-sentence headline>
## Acceptance criteria 3-5 gating, outcome-based criteria; group related behaviors, never silently drop one
## Verification plan per criterion: the action + the observation that must hold; tag each step gating|evidence
## Non-goals required — park plausible-but-unrequested scope here so a reviewer sees it was deferred, not forgotten
## Assumed scope files / modules / deps this touches
## Task checklist 3-8 checkboxes, flipped as you work; guidance, never part of the judged contract
## Deviations single section, one terse bullet per deviation; never edit the criteria themselves
Keep the criteria set small and satisficing — inflating the contract is what makes a task unfinishable. The spec reviewer receives the git diff of the plan file alongside the code diff: a weakened or deleted acceptance criterion is itself a finding.
Apply these while implementation is active. Proportional like every lens: no ceremony, no per-step confirmation, no progress theater. Each gate is one judgment applied at the moment it matters.
Write the failing test before the production code. The cycle is red, green, refactor:
Every bug fix starts from a failing reproduction test, so the fix has proof and the regression stays covered.
No test theater. A passing test must prove the SHIPPED code works on the real path. Four named cheats, all forbidden: hard-code the expected value, start past the thing under test, re-implement the code under test inside the test, or report success without driving the real entry point. A test that passes while the program is broken is worse than none. The honest line: injecting a fake at an environment boundary — a clock, RNG, network, file, or output sink — to make the unit's real logic observable is honest and standard; faking the unit's OWN logic or its expected output is theater.
While developing, run the narrowest test touching the change first and widen only on green; the full suite has its mandatory run at branch close (gate 6).
Waivers are explicit, never silent. Valid waivers: the user waived TDD for this task, or the change has no testable runtime surface (docs, comments, pure renames, generated files). State the waiver in one line when you use it.
Build exactly what was agreed. When you discover an out-of-scope problem, flag it in one line and keep going; never silently fix it, never silently expand the task. When the agreed scope itself turns out to be wrong, say so and let the user decide before widening.
.env files.Implement inline by default; every subagent costs a full context of tokens. Reach for subagents only when the task genuinely benefits from parallel independent work, typically research or exploration across several areas whose results you synthesize afterwards. One subagent per implementation task is the anti-pattern to avoid. The threshold test: when the context-setup cost exceeds the parallelism benefit, do it inline.
Dispatch protocol — when a subagent IS justified, brief it like this:
After an implementation milestone is complete and tests are green, first save the evidence: write the actual test-run output (and screenshots for frontend work) to a scratch path. Then dispatch two independent reviewers with fresh context, in parallel:
/code-review both qualify.Fresh context matters: the author's context defends the code, a reviewer's context reads it. The two lenses catch different failures: code review finds bugs in what was built, spec review finds gaps between what was built and what was asked.
Reviewer dispatch contract. Every reviewer prompt carries these rules, and reviewers get read-only tools plus an instruction to read the repo's convention files (CLAUDE.md, project rules) before judging:
VERDICT: PASS or VERDICT: FAIL plus typed findings (kind, path:line, one-line detail). A missing verdict counts as FAIL.Convergence control. Findings from each round are saved; the next round's reviewers get them as prior gaps with the instruction: your primary job is to check each prior gap is genuinely fixed — the bar does not rise between rounds, and fresh nitpicks while the criteria hold are the failure mode that makes reviews never converge. If a round's finding locations are identical to the previous round's, stop iterating and escalate to the user. After two consecutive failed rounds that ARE making progress, dispatch a fresh-context strategist to diagnose the structural root cause (tangled untestable unit, test theater, or a design fighting the goal) and recommend one restructure — it changes the HOW, never the WHAT. Hard cap: three rounds, then report to the user with the open findings.
Address confirmed findings from both reviewers; report the findings you decided against acting on. Skip the reviews only when the user waives them, the change is trivial (typo, comment, config value), or the small-change valve above applies.
Closing checklist, in order:
main(), a missing import, or a bad entry script all pass unit tests and fail the user on first launch. Launch the real entry point and assert its PRIMARY observable is CORRECT — present and non-empty is insufficient:
Two plugin hooks enforce the highest-value gates outside the model's discretion:
pre-write-tdd-gate.py raises a one-line advisory when production code is written and no test referencing it exists anywhere in the repo. Silence it project-wide with a .product-tdd-waived marker file.pre-write-secret-guard.py pauses the write for user confirmation when file content matches a high-confidence credential pattern, or when the target is a .env file.Both follow the plugin's relative-guardrail style: one line, user overrides in one word, never a hard stop.
npx claudepluginhub kaminoikari/product-playbook --plugin product-playbookCoordinates specialist agents through a complete development cycle: requirements, planning, implementation, refactoring, QA, and documentation. Use for systematic feature development with quality checks.
Provides implementation patterns for writing code, building features, fixing bugs, and refactoring. Follows a verify-in-tight-loops approach to ship working code efficiently.
Enforces a 4-stage coding discipline: plan, isolate on a branch, test-first, then double-review output. Use for complex tasks or to prevent broken first drafts.