agentleFS
SpencerGossSpencerGoss/agent-engineering/pre-mortem/SKILL.md

pre-mortem

Skill0 starsChanged 5 months agoMITView on GitHub

Use when reviewing code for fragility before deployment, after completing a feature, before a release, or when the user says "what could break", "find fragile code", "pre-mortem", "what will go wrong", "future bugs". NOT for current bugs (use debug-session) or code style (use refactor-session).

30 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use brainstorm-experiments-existing, prioritize-assumptions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • skytiger6724Skill

    brainstorm-experiments-existing

    Design experiments to test assumptions for an existing product — prototypes, A/B tests, spikes, and other low-effort validation methods. Use when validating assumptions, testing feature ideas cheaply, or planning product experiments.

    Also in 7 projects that use this

  • skytiger6724Skill

    prioritize-assumptions

    Prioritize assumptions using an Impact × Risk matrix and suggest experiments for each. Use when triaging a list of assumptions, deciding what to test first, or applying the assumption prioritization canvas.

    Also in 7 projects that use this

  • 45ckSkill

    pestle-analysis

    Also in 7 projects that use this

  • About-IntelligenceSkill

    positioning-ideas

    Brainstorm product positioning ideas differentiated from competitors.

    Also in 7 projects that use this

  • About-IntelligenceSkill

    product-name

    Brainstorm 5 unique, memorable product names with rationale aligned to brand values and target audience.

    Also in 6 projects that use this

  • nandanosqlSkill

    swot-analysis

    Conduct a structured SWOT analysis — Strengths, Weaknesses, Opportunities, Threats — that connects internal capabilities to external forces for strategic decision-making.

    Also in 9 projects that use this

  • +5 more from skytiger6724
  • +1 more from About-Intelligence

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 23 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Coverage downgrades severity: If a fragility is already protected by tests, it is not a P0.

    line 16
  2. Distinctive:

    Write incident reports for bugs that haven't happened yet.

    line 20
  3. Distinctive:

    Ask: "Which area should I pre-mortem?" or infer from context.

    line 28
  4. Distinctive:

    Read the target code. Max 5 files for File/Feature scope.

    line 35
  5. Very specific:

    Write all incidents to PRE-MORTEM.md (or .planning/PRE-MORTEM.md if that directory exists) with:

    line 89

“Common” is measured: kept by at least 6 in 10 of the 23 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Hard Rules

  • Future fragility, not current bugs. Pre-mortem analyzes code that WORKS NOW but will plausibly break from a reasonable future edit. If something is already broken, stop and run a systematic diagnosis (debug-session) instead.
  • Every finding needs a complete causal chain. "This could be a problem" is not a finding. Write the full incident in past tense with cause → effect → detection, or don't report it.
  • Hard cap of 7 incidents per analysis. Pick the most plausible and highest-severity. Over-reporting buries the signal.
  • Coverage downgrades severity. If a fragility is already protected by tests, it is not a P0. Lower its severity accordingly.

Pre-Mortem Analysis

Write incident reports for bugs that haven't happened yet. Read working code and identify where future edits will plausibly introduce failures.

Philosophy

This is NOT a linter. NOT a code review. This is a predictive failure analysis — imagining realistic future scenarios where reasonable edits break working code. The output is written in past tense ("What happened", "Why it broke") to force complete causal chains instead of vague warnings.

Step 1: Scope Selection

Ask: "Which area should I pre-mortem?" or infer from context.

Scope options:

  • File: Single file deep-dive (best for complex modules)
  • Feature: Cross-file analysis of a feature path (best for integration risks)
  • System: Broad scan for top fragility hotspots (broadest; parallelize across modules if the host supports it)

Read the target code. Max 5 files for File/Feature scope. For System scope, work module by module.

Step 2: Fragility Pattern Scan

For each code area, check these 12 fragility patterns:

PatternWhat to Look For
Implicit orderingCode that works only because steps happen in a specific order, with no enforcement
Shared mutable stateGlobals, module-level dicts, class variables mutated by multiple callers
Stringly-typed contractsString comparisons for control flow (if status == "active")
Baked-in data assumptionsHardcoded column names, assumed data shapes, magic indices
Coincidental correctnessCode that produces right answers for current data but wrong for edge cases
Non-atomic operationsMulti-step mutations that can leave state inconsistent if interrupted
Invisible invariantsRules that must hold but aren't enforced (e.g., "X must be called before Y")
Load-bearing defaultsDefault values that silently mask failures instead of surfacing them
Implicit resource lifecyclesFiles, connections, locks that depend on call order for cleanup
Version-coupled assumptionsCode that breaks when a dependency updates (API version, schema change)
Silent None propagationFunctions that return None on failure where callers expect values
Train/inference skewML paths where training and prediction use different preprocessing

Step 3: Write Incident Reports

For each fragility found (max 7 per analysis), write a realistic incident report:

### Incident: [Short title]

**Severity:** P0 / P1 / P2 / P3
**Fragility Pattern:** [from table above]
**File(s):** [paths]

**What happened:** [Past tense — describe the plausible future scenario]
A developer added multi-field validation to the form processor. Each invalid field
now generates a separate error record. The success_rate metric divided total_records
by error_count, assuming one error per row. With multiple errors per row, the
denominator inflated, dropping the reported success rate from 94% to 61%.

**Why it broke:** [Root cause chain]
The success_rate calculation in metrics.py:47 assumed a 1:1 relationship between
rows and errors. This assumption was never documented or enforced. The validation
change was reasonable and passed all existing tests.

**How it was caught:** [Realistic detection path]
An A/B test showed a 30% drop in the success metric. The on-call engineer traced it
to the validation change merged 3 days prior.

**Hardening suggestion:** [Specific, minimal fix]
Add assertion: `assert error_count <= total_records` in metrics calculation.
Or: normalize by unique row IDs, not raw error count.

Step 4: Output PRE-MORTEM.md

Write all incidents to PRE-MORTEM.md (or .planning/PRE-MORTEM.md if that directory exists) with:

  • Header: date, scope, files analyzed
  • Incidents ranked by severity (P0 first)
  • Summary: total fragilities found, top 3 actionable items

Step 5: Route to Action

FindingRoute To
P0 fragility in production codeFlag to the user immediately — potential current risk
P1-P2 fragilitiesAdd to a tracked "hardening backlog" (e.g., a TODO/backlog doc)
Pattern appears across 3+ filesCapture it as a systemic insight in your durable notes — it's bigger than one file
ML train/inference skew detectedPair with a domain expert review before deploying the model path

Trigger Conditions

  • Reviewing code for fragility before a deployment or release
  • Just completed a feature and want to know where it will bite later
  • The user says "what could break", "find fragile code", "pre-mortem", "what will go wrong", or "future bugs"
  • A working module is about to take on new callers or new edits

Out of Scope

  • Current bugs or test failures → run a systematic diagnosis (debug-session)
  • Code style or naming → refactor-session
  • Security vulnerabilities → security-audit
  • Performance bottlenecks → performance-tuning
  • Quality review of code as written (not future fragility) → code-review-session

Common Traps

  • Finding current bugs, not future fragilities — pre-mortem is about code that WORKS NOW but will break from reasonable future edits. If it's already broken, use debug-session.
  • Vague warnings without causal chains — "This could be a problem" is useless. Write the full incident with past-tense causality.
  • Over-reporting — Max 7 incidents. Pick the most plausible and highest-severity. Don't report style issues.
  • Ignoring test coverage — If a fragility is already covered by tests, it's not a P0. Downgrade severity.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.