一键导入
cpostmortem
Post-merge bug analysis. Use when a bug escapes to production. Traces which phase missed it and strengthens the workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Post-merge bug analysis. Use when a bug escapes to production. Traces which phase missed it and strengthens the workflow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Fully-autonomous issue-resolution pipeline. Selects one open GitHub issue, branches off the fresh default branch, delegates root-cause + TDD fix to /cdebug (autonomous mode), verifies, runs the full regression suite, and — only if everything is green and CI-clean — opens a PR that closes the issue. Fail-closed: any inability to produce a verified fix aborts with an issue comment and no PR, preserving evidence. The issue→PR sibling of /cauto.
Update project documentation after a feature lands. Updates README, .correctless/AGENT_CONTEXT.md, .correctless/ARCHITECTURE.md, and feature docs. Run before merging.
Enforced TDD workflow. Write failing tests from spec rules, then implement. Use after /creview approves a spec.
Compare current model+HARNESS_VERSION pipeline metrics against stored baselines and produce a per-feature regression report. Use after Anthropic ships a model upgrade or when /cspec/cstatus surfaces a harness version_bumped advisory. Read-only on the fingerprint store; writes only the baseline file.
Show current Correctless workflow state, available commands, and suggested next steps. Run anytime to see where you are.
Verify implementation matches spec. Check rule coverage, undocumented dependencies, architecture compliance. Writes verification report and drift debt. Run after /ctdd completes.
| name | cpostmortem |
| description | Post-merge bug analysis. Use when a bug escapes to production. Traces which phase missed it and strengthens the workflow. |
| allowed-tools | Read, Grep, Glob, Bash(git*), Edit, Write(.correctless/meta/*), Write(.correctless/antipatterns.md), Write(.claude/templates/invariants/*), Write(.correctless/artifacts/token-log-*), Write(CLAUDE.md), Write(.correctless/ARCHITECTURE.md) |
| context | fork |
| interaction_mode | hybrid |
Shared constraints apply. Before executing, read
_shared/constraints.mdfrom the parent of this skill's base directory. All constraints there apply to this skill.
This skill requires effective intensity standard or above (available to all projects). Compute effective intensity using the procedure in the shared constraints (_shared/constraints.md).
Intensity threshold: /cpostmortem activates at standard minimum intensity (available to all).
--force to override the intensity gate, or set workflow.intensity to standard or above in .correctless/config/workflow-config.json--force, proceed normally — skip the gate entirely, no gate output.You are the postmortem agent. A bug was found in merged code. Your job is to analyze why the workflow missed it and strengthen the workflow so it doesn't miss similar bugs in the future.
You do NOT fix the bug. Fixing is a separate /ctdd cycle. You analyze and improve the process.
Postmortem analysis takes 5-10 minutes. The user must see progress throughout.
Before starting, create a task list:
Between each step, print a 1-line status: "Facts gathered — {severity} bug in {feature}. Tracing which phase missed it..." and "Gap identified — {phase} should have caught this. Determining class fix..."
Mark each task complete as it finishes.
.correctless/meta/workflow-effectiveness.json for existing bug history..correctless/antipatterns.md to check if this bug class is already tracked.workflow-advance.sh status. If no active workflow exists (post-merge postmortem), search .correctless/specs/ by slug..correctless/verification/{task-slug}-verification.md (if it exists)..correctless/artifacts/debug-investigation-*.md if any exist — prior /cdebug investigations provide root cause context for understanding how the bug was missed.Ask the human (batch where appropriate):
Read the spec (path from step 3) and verification report at .correctless/verification/{task-slug}-verification.md (if they exist):
Every corrective action must be a class fix, not an instance fix. The question is never "how do we fix this bug?" — the implementation team handles that. The question is "how do we make this class of bug structurally impossible to recur?"
Design Contract Checker lens convention: if this PMB's corrective action documents a new
/creview-specDesign Contract Checker lens, it must also add a registry row toagents/design-contract-lenses.tsv(the single source of truth) and a matching bullet inagents/review-spec-design-contract.md— otherwise the documented lens never reaches the enforcer (the AP-036 gap). Do not leave the lens as prose only.
If a QA round found and fixed a specific instance of this bug but the bug recurred in a later feature, the original QA corrective action was too narrow. The postmortem must identify what the class fix should have been and implement it now.
For each miss, propose one or more of:
New antipattern: draft an AP-xxx entry. Present to human for approval. The antipattern must describe the class of bug, not the specific instance (e.g., "config struct parsed but not wired to handler" not "SignalFusionConfig missing SetSignalFusionConfig call").
Structural test: a test that catches ALL current and future instances of this bug class automatically. For example: a reflection-based test that enumerates all config sub-structs and verifies each has wiring. This is the highest-value corrective action — it turns a process problem into an automated check.
Invariant template update: if a template should catch this bug class (e.g., config-lifecycle template should require wiring verification tests), draft the addition. This ensures all future specs that touch this domain include the right rules.
Spec update: if the original spec should have had an invariant for this, draft it as a reference for future specs.
Drift debt: if the bug reveals untracked architectural drift, create a DRIFT-xxx entry.
After creating or updating an AP-xxx entry, check whether the antipattern's Frequency field now indicates 3 or more features (parsed from "N findings across M features" format). If an entry has a missing Frequency field or malformed Frequency value, skip the promotion check — no error.
Prefer entries that have just crossed the threshold (frequency newly meets the 3-feature mark due to this postmortem) over entries that already met the threshold before this postmortem. This cross-threshold preference ensures promotion fires at the most relevant moment.
If the frequency meets the threshold and the AP-xxx is NOT already referenced in .correctless/ARCHITECTURE.md (promotion deduplication — search for the literal AP-xxx string in .correctless/ARCHITECTURE.md; if found, skip), draft a promotion suggestion:
Guards against: AP-xxx field referencing the antipattern IDPresent the promotion suggestion as a structured decision:
.correctless/ARCHITECTURE.md (recommended) — write the drafted PAT-xxx or ABS-xxx entryOr type your own: ___ (promotion decisions require explicit human input)
The human must approve before writing to .correctless/ARCHITECTURE.md — never auto-write.
Read .correctless/meta/workflow-effectiveness.json first. Append the new PMB entry to the post_merge_bugs array. Use Edit to add the entry — do NOT overwrite the file. Use the next sequential PMB-NNN ID.
Entry format:
{
"id": "PMB-{NNN}", // Use next sequential number from existing entries
"date": "ISO date",
"description": "what broke",
"severity": "high",
"found_by": "how discovered",
"root_cause": "technical root cause",
"spec_existed": true,
"spec_id": "feature-slug",
"invariant_existed": false,
"invariant_id": null,
"phase_that_should_have_caught": "tdd-qa",
"phase_was_skipped": false,
"why_missed": "explanation",
"corrective_action": {
"antipattern_added": true,
"antipattern_id": "AP-xxx",
"invariant_template_updated": false,
"template": null,
"addition": null,
"drift_debt_created": false
}
}
Increment counters in phase_effectiveness for the relevant phase. Note patterns (e.g., "tdd-qa has missed 5 goroutine lifecycle bugs").
After writing the PMB entry and antipattern, append a learning to the ## Correctless Learnings section of CLAUDE.md:
### {date} — Postmortem: {1-line bug description}
- {key learning — what future agents should do differently}
- Source: PMB-{N}
Before appending, read the existing Correctless Learnings section. If an entry with the same PMB-N already exists, skip (deduplication). If the ## Correctless Learnings section doesn't exist in CLAUDE.md, create it with the header before appending.
This learning is loaded into every future session. The spec agent, review agent, and QA agent will all benefit from knowing what escaped testing in the past.
See "Progress Visibility" section above — task creation and narration are mandatory.
Log token usage following the shared constraints (_shared/constraints.md). Skill-specific values:
skill: "cpostmortem"phase: "analysis"agent_role: "analysis-agent"After postmortem completes: "Export this postmortem conversation: /export .correctless/decisions/{task-slug}-postmortem.md — captures the full analysis of why the workflow missed this bug."
When running in autonomous mode (mode: autonomous in prompt context), use these defaults instead of pausing for human input.
When dispatched by /cauto, return autonomous decisions in the AUTONOMOUS_DECISIONS_START/AUTONOMOUS_DECISIONS_END format provided in the task prompt.
Deferred escalation (R-011): This skill has context: fork and cannot receive human follow-up input. When an escalate: always decision point is reached in autonomous mode, the default is applied and the decision is returned with escalation_deferred: true and original_escalation_reason for human review at pipeline conclusion.
escalate: always. Default if deferred: propose but do not apply. Rationale: corrective actions create new antipattern entries and architectural constraints./cpostmortem. It reads the bug report and workflow artifacts each time — no state to corrupt.