backprop
Bug → spec protocol. When a bug is found or a test fails, trace the cause, decide whether a new §V invariant would catch recurrence, append to §B. This is the one non-obvious thing SDD does that plan-then-execute doesn't. Triggers on test failure, bug report, post-mortem, or explicit user ask.
Security Assessment
About backprop
A bug-to-spec protocol for spec-driven development (SDD). Where plan-then-execute workflows fix the code and forget, this skill fixes the code and edits the spec so the same class of failure cannot recur. That spec edit is what the skill calls backprop, described as the one non-obvious thing SDD does that plan-then-execute does not.
It triggers on a test failure, a bug report, a post-mortem after a production incident, or when a `/check` flags a VIOLATE with a root cause found. The workflow follows six steps: TRACE the failure to the exact file and line and name the root cause in one sentence; ANALYZE whether a new invariant would catch the class of bug, whether the interface spec is wrong, or whether the wrong thing was built; PROPOSE a spec change, always appending a row to the bug ledger (§B) and usually adding an invariant (§V); GENERATE a failing test named after the invariant (for example `TestV7_RefundIdempotent`) before fixing; VERIFY by fixing the code, passing the new test, and running the full suite without regression; and LOG by committing the spec edit, test, and code fix together in a single commit.
Guidance is provided on what makes a good invariant: testable in code, scoped to a behavior rather than a file, stated positively when possible, and tied to the interface surface where it applies. The skill also notes when not to add an invariant, such as a purely mechanical typo with no class, a one-time migration, or a root cause in an external dependency. Even then a bug-ledger entry is still appended so that future bugs with the same smell surface the prior precedent. The output of every run is a §B entry, usually a §V entry, a test file when an invariant is added, a code fix, and one commit; the spec file plus git history is the full record, with no dashboards or log files.
FAQ
When does this skill trigger?
On a test failure at build verification, a user bug report, a post-mortem after a production incident, or when a `/check` flags VIOLATE with a root cause found.
What are the six steps of a backprop run?
TRACE the root cause to file and line, ANALYZE whether a new invariant is warranted, PROPOSE the spec change, GENERATE a failing test, VERIFY the fix against the full suite, and LOG everything in one commit.
Do I always need to add a new invariant when fixing a bug?
No. The bug-ledger (§B) entry is always appended, but adding an invariant (§V) is case-by-case. You skip the invariant for mechanical typos with no class, one-time migrations, or external dependency root causes.
What makes a good invariant according to the skill?
One that is testable in code (grep-able or assert-able), scoped to a behavior rather than a file, stated positively when possible, and that references the interface surface where it applies.
What artifacts does each run produce?
A §B ledger entry (always), a §V invariant entry (usually), a test file when an invariant is added, the code fix, and a single commit. The spec file plus git is the full history.
Install backprop
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
juliusbrussee/cavekit