From lattice
Reproduce-first bug repair workflow with regression protection. Gathers context, diagnoses root cause, and applies code quality and testing guardrails. Activated by commands like 'fix this bug' or 'debug this'.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lattice:bug-fixThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Load these skills based on bug scope (see Steps 2 and 5 for when):
Load these skills based on bug scope (see Steps 2 and 5 for when):
framework:knowledge-priming -- (always)framework:context-anchoring -- (always)framework:learning-harvest -- (always)framework:collaborative-judgment -- (always)framework:clean-code -- (always)framework:test-quality -- (always)framework:architecture -- (conditional)framework:domain-driven-design -- (conditional)framework:secure-coding -- (conditional)Start from failure, not proposed fix.
framework:learning-harvest Load behavior. Focus hint: "bug investigation — focus: reliability, quality signals".framework:context-anchoring Document Discovery to check for existing context doc for affected feature/module.
End this step, summarize bug one sentence:
"Observed X, expected Y, reproducible via Z."
STOP: If can't state bug clearly yet, gather more evidence before proposing code changes.
Primary discipline: don't present fix for bug you haven't reproduced.
Reproduce failure using strongest evidence available, this order:
Localize issue before editing:
framework:architecture to identify which architectural layer defect originates inframework:secure-codingframework:domain-driven-designframework:architectureIf multiple plausible root causes remain, use framework:collaborative-judgment to present leading hypotheses + what evidence would distinguish.
Before writing regression test, state root cause hypothesis explicitly, use framework:collaborative-judgment to surface:
"Bug caused by [X]. When [C holds], correct outcome should be [P]. Confirm this by writing test that red before fix, green after."
If user identifies flaw in hypothesis, revise before writing tests.
End step with explicit bug contract:
C (bug condition): [exact input/state triggering bug] P (fix postcondition): [what correct behavior looks like when C holds] Preserved: [what must remain identical for all inputs outside C]
STOP: If can't state all three, keep localizing before writing tests.
Optional persistence check: Now that bug reproduced + localized, decide whether persist investigation:
framework:context-anchoring, use as source of truthPhase A — Bug-Condition Tests (must start RED)
framework:test-quality inlineStopping rule:
framework:clean-code inline, keep seam minimal.Phase B — Preservation Baseline (must stay GREEN)
Separate repair strategy from code change itself.
Before editing, decide:
Default to smallest safe fix restoring correct behavior without architectural backsliding.
Guardrails:
framework:architecture layering rules when choosing repair location — don't patch in outer layer when rule belongs inwardIf multiple valid repair strategies with meaningful trade-offs, present using framework:collaborative-judgment before proceeding.
Always apply:
framework:clean-code -- keep delta focused, readable, easy to reason aboutframework:test-quality -- maintain regression test + any nearby supporting testsConditionally apply based on localized root cause:
framework:architectureframework:domain-driven-designframework:secure-codingAfter implementing fix, before presenting:
Verify repair three levels:
When reporting completion, explicit about verification scope:
If fix narrow + confidence high, say so briefly. If verification partial, say so clearly.
Use framework:context-anchoring Enrich behavior to preserve important parts of repair:
If no context doc exists + fix exposed non-trivial design/domain lesson, suggest creating one.
Use framework:learning-harvest Harvest behavior. Session context: "bug investigation — root cause diagnosis and repair". Synthesize and propose cross-cutting patterns from this session — root cause categories, failure modes likely to recur elsewhere, boundary condition gaps. User confirms what enters the document.
After fix complete, recommend /review when change:
npx claudepluginhub techygarg/lattice --plugin latticeGuides bug fixes through reproduction, root-cause analysis, minimal changes, and validation. Use when tasked with finding and fixing a code defect.
Root cause based one-shot bug fix. Runs a full investigation pipeline: debugger diagnosis, gap analysis, requirements generation, execution, and verification. Includes QA suggestions after successful fix.