Analyze why a bug escaped the workflow and strengthen the process so the entire class of bug cannot recur.
/ctdd cycleRuns outside the normal pipeline, triggered by a production bug or post-merge discovery. Does not touch code. Analyzes the gap in the process (spec, review, TDD, QA, audit) and produces class-level corrective actions that prevent the entire category of bug from recurring. Feeds learnings back into CLAUDE.md so every future agent session benefits.
Requires high intensity or above.
.correctless/meta/workflow-effectiveness.json## Correctless Learnings section of CLAUDE.md so all future agents know what escaped testingUsers report that logging in from two devices simultaneously causes one session to silently lose write permissions. The bug is in merged code.
You run /cpostmortem.
The agent reads the spec for the auth feature and finds INV-009: “each user may have at most 3 active sessions.” The invariant exists but says nothing about what happens to an existing session’s permissions when a new session is created. The test suite verifies session count limits but never tests concurrent session creation.
Trace: The spec phase (/cspec) missed the concurrent-session edge case. The review phase (/creview-spec) had an Assumptions Auditor that flagged “assumes sequential session creation” but the finding was marked low-severity and deferred.
Corrective actions:
The PMB entry is written, phase effectiveness counters are updated (review-spec gets a “should have caught” increment), and a learning is appended to CLAUDE.md.
| Reads | Writes |
|---|---|
.correctless/meta/workflow-effectiveness.json |
.correctless/meta/workflow-effectiveness.json (PMB entry) |
.correctless/antipatterns.md |
.correctless/antipatterns.md (new AP-xxx entry) |
Spec artifact (.correctless/specs/{slug}.md) |
.correctless/templates/invariants/ (template updates) |
Verification report (docs/verification/) |
CLAUDE.md (Correctless Learnings section) |
Debug investigations (.correctless/artifacts/debug-investigation-*.md) |
Token log (.correctless/artifacts/token-log-{slug}.json) |
| Action | What It Does | When to Use |
|---|---|---|
| New antipattern (AP-xxx) | Adds a class-level bug pattern to .correctless/antipatterns.md |
The bug class is not yet tracked |
| Structural test | Automated test that catches all current and future instances | Highest-value action — turns a process gap into a CI check |
| Invariant template update | Adds a rule to spec templates so future specs include it | The spec domain template should have required this invariant |
| Drift debt (DRIFT-xxx) | Tracks unresolved architectural drift | The bug reveals a gap between docs and reality |
This skill requires high intensity or above. At standard intensity, post-merge bug analysis is done manually. The structured tracing across workflow phases and automatic learning propagation require the extended agent pipeline.
/ctdd cycle.