agentleFS
dkpapadopoulosdkpapadopoulos/auto-claude-skills/skills/incident-trend-analyzer/SKILL.md

incident-trend-analyzer

Skill6 starsChanged 53 days agoMITView on GitHub

On-demand postmortem trend analysis — recurrence grouping, trigger categorization, MTTR/MTTD from canonical docs/postmortems/ corpus

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If docs/postmortems/ does not exist, report: "No postmortem corpus found.

    line 12
  2. Very specific:

    Read docs/postmortems/*.md — NON-RECURSIVE.

    line 14
  3. Distinctive:

    No partial metrics are reported below this threshold.

    line 25
  4. Distinctive:

    Dominant trigger category: if > 40% of incidents → systemic observation

    line 193
  5. Very specific:

    Create docs/postmortems/trends/ if it does not exist

    line 203
  6. Very specific:

    If a same-day report already exists, append -2, -3, etc.

    line 205

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Incident Trend Analyzer

On-demand analysis of historical postmortems from docs/postmortems/. Reads canonical postmortems produced by the incident-analysis skill, extracts normalized incident records, surfaces recurrence patterns, trigger distributions, and timing metrics. Terminal-first output with optional persistence on request.

Step 1: Scan Corpus

If docs/postmortems/ does not exist, report: "No postmortem corpus found. Expected directory: docs/postmortems/. Run incident-analysis to generate postmortems first." and stop.

Read docs/postmortems/*.md — NON-RECURSIVE. Do NOT descend into subdirectories (e.g., docs/postmortems/trends/). Filter to filenames matching YYYY-MM-DD-*.md. Report total files found.

Minimum corpus: 3 recurrence-eligible postmortems. If fewer than 3 qualify after Step 2, stop the entire analysis and report:

Not enough data for trend analysis.
Found N file(s) in docs/postmortems/:
  - <filename> (eligible: yes/no — reason)
Minimum required: 3 recurrence-eligible postmortems.

No partial metrics are reported below this threshold.

Step 2: Parse and Classify Eligibility

For each file matching YYYY-MM-DD-*.md, extract the date from the filename and extract raw section text by heading boundaries. Match sections by heading text, not ordinal position — e.g., any ## N. Summary or ## Summary heading matches "Summary" regardless of its number.

This supports both the canonical 8-section schema (Summary, Impact, Action Items, Root Cause & Trigger, Timeline, Contributing Factors, Lessons Learned, Investigation Notes) and legacy 7-section postmortems (where Timeline was section 3 and Action Items was section 7).

Classify into eligibility tiers:

TierRequiredEnables
Recurrence-eligibleValid filename + a Summary heading + a Root Cause heading (matches "Root Cause & Trigger" or "Root Cause")Recurrence grouping, trigger categorization
Timeline-eligibleRecurrence-eligible + a Timeline heading with parseable timestamps (at any position)Timing metric candidates
MTTR-eligibleTimeline-eligible + identifiable detection and recovery eventsMTTR computation
MTTD-eligibleTimeline-eligible + identifiable trigger and detection eventsMTTD computation

Parseable timestamps: Absolute only. Accepted formats:

  • ISO 8601: 2026-03-15T10:32:00Z
  • HH:MM or HH:MM:SS with date inferred from the filename
  • YYYY-MM-DD HH:MM

Relative timestamps ("5 minutes later", "+10m") are NOT parseable. They produce low timing confidence and are excluded from MTTR/MTTD computation.

Unparseable files: Listed in coverage report, excluded from analysis. No fuzzy parsing.

Step 3: Build Normalized Incident Records

For each recurrence-eligible postmortem, build one normalized record with these fields. Failure mode and trigger category are extracted independently from the same section text. They answer different questions: failure mode = "what broke" (the symptom), trigger category = "what caused it" (the change type). The same signal words may match in both vocabularies; this is expected and correct. Signal pattern matching is case-insensitive.

Service Extraction (from Summary)

ConfidenceRule
highExplicit service name in summary text (e.g., "auth-service experienced...", "checkout-service returned 500s")
mediumFilename slug — first segment of the kebab-case portion before a failure-mode word (e.g., 2026-01-12-auth-timeout.md → auth)
lowNo identifiable service → unknown-service

Failure Mode (from Root Cause & Trigger)

Match signal patterns in the Root Cause & Trigger section text against this vocabulary:

KeySignal patterns
timeouttimeout, deadline exceeded, context cancelled
oomOOM, out of memory, memory limit, killed
config-changeconfig, misconfiguration, feature flag, env var
dependency-failureupstream, downstream, third-party, provider outage
deploy-regressiondeploy, release, regression, rollback, bad merge
traffic-overloadspike, load, burst, capacity, scaling, rate limit
infra-failurenode, disk, network, DNS, certificate, zone
unknownNo confident match (0 signals or tie between keys)

Confidence: high (2+ signal words match one key), medium (1 signal word), low → unknown.

Group on vocabulary key only. Show raw Root Cause text as evidence, never as grouping key. Wording differences must not fragment groups.

Trigger Category (from Root Cause & Trigger)

Match signal patterns in the Root Cause & Trigger section text against this vocabulary:

CategorySignal patterns
deploymentdeploy, release, rollout, version, merge
config-changeconfig, feature flag, env var, parameter
dependencyupstream, downstream, third-party, provider, API
trafficspike, load, burst, capacity, scaling
infrastructurenode, disk, network, DNS, certificate
unknownNo clear match, or tie between categories

Pick the category with the most signal words. If tied, use unknown.

Timing Extraction (from Timeline)

For timeline-eligible postmortems only. Extract these timestamps from the Timeline section rows (matched by heading text, not position):

FieldSignal patterns in timeline row
incident_start"deployed", "pushed", "config changed", "traffic spike", or first row if it describes a causal event
detected_at"alert", "page", "noticed", "reported", "detected"
recovered_at"resolved", "recovered", "mitigated", "restored"

timing_confidence: high (3/3 timestamps found), medium (2/3), low (0–1). If a timestamp cannot be identified deterministically, the incident is excluded from the relevant metric and noted in coverage.

Full Record Schema

FieldSourceConfidence levels
dateFilename YYYY-MM-DDAlways high
serviceSummary sectionhigh / medium / low → unknown-service
failure_modeRoot Cause & Trigger, vocabulary matchhigh / medium / low → unknown
trigger_categoryRoot Cause & Trigger, category matchSame rules as failure_mode
incident_startTimeline: first causal eventPer timing_confidence
detected_atTimeline: alert/page/noticed rowPer timing_confidence
recovered_atTimeline: resolved/mitigated rowPer timing_confidence
timing_confidenceCount of parsed timestampshigh (3/3) / medium (2/3) / low (0–1)
eligible_forDerived from above[recurrence, mttr, mttd] flags
raw_evidenceOriginal section textFor audit trail

Step 4: Compute Metrics

Recurrence Grouping

  • Group by (service, failure_mode) — both from vocabulary keys, not free text
  • Minimum group size for recurrence: 2
  • Per cluster, show dominant trigger_category as annotation (NOT part of grouping key)
  • Sort by count descending
  • unknown-service / unknown failure_mode clusters are excluded from headline recurrence output. They appear in a separate Uncategorized section to avoid surfacing false patterns.

Trigger Distribution

  • Count each trigger_category across all recurrence-eligible incidents
  • Show count and percentage
  • Sort descending by count

MTTR (Mean Time to Recovery)

  • Formula: recovered_at - detected_at
  • Both timestamps require timing_confidence >= medium
  • Report: median (headline), mean, range
  • Show eligible count vs total recurrence-eligible

MTTD (Mean Time to Detection)

  • Formula: detected_at - incident_start
  • Both timestamps require timing_confidence >= medium
  • Report: median (headline), mean, range
  • Show eligible count vs total recurrence-eligible

Step 5: Generate Output

Terminal Summary (default)

Print this exact structure:

## Incident Trend Analysis

Corpus: N files scanned, X recurrence-eligible, Y MTTR-eligible, Z MTTD-eligible
Period: YYYY-MM-DD to YYYY-MM-DD (N days)

### Recurrence Patterns
  service / failure_mode  — N incidents (dates) | trigger: category
  ...
  N incidents showed no recurrence

### Trigger Distribution
  category  — N (PP%)
  ...

### MTTR (Y of X eligible)
  Median: Xm | Mean: Xm | Range: Xm – Xm

### MTTD (Z of X eligible)
  Median: Xm | Mean: Xm | Range: Xm – Xm

### Coverage Gaps
  (Report any metric with < 60% eligibility)

### Insights
- (2–4 cited observations)

Insights Rules

Generate 2–4 insight bullets by applying these rules:

  1. Top recurrence cluster + its dominant trigger → observation
  2. Dominant trigger category if > 40% of incidents → systemic observation
  3. MTTD outliers > 2x median → detection gap observation
  4. Coverage gaps < 60% eligible for any metric → data quality observation

Every insight bullet MUST cite the supporting count or rate (e.g., "3x in 63 days", "4/9 incidents, 44%"). Insights are observations with citations, NOT prescriptions. The skill does NOT prescribe fixes — it surfaces patterns and lets the user decide.

Step 6: Persist (on request only)

Persistence is triggered ONLY when the user explicitly requests it ("save this", "save report", "persist"). Do NOT auto-persist.

  1. Create docs/postmortems/trends/ if it does not exist
  2. Write to docs/postmortems/trends/YYYY-MM-DD-trend-report.md
  3. If a same-day report already exists, append -2, -3, etc. (e.g., 2026-03-21-trend-report-2.md)
  4. Content: full terminal summary + per-incident record table for auditability
  5. No auto-commit — the user decides when to commit

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.