Repair damage

From pjt222/agent-almanac · View interactive version

Repair damage is an AI agent skill from the GitHub repository pjt222/agent-almanac. Implement regenerative recovery using triage, scaffolding, and progressive rebuild. Covers damage assessment, wound classification, emergency stabilization, scar tissue management, and resilience strengthening for systems that have sustained structural damage. Use when a system has suffered an incid

How to use this skill

Skill file

Repair Damage

Implement regenerative recovery for systems that have sustained structural damage — whether from incidents, failed migrations, accumulated neglect, or external disruption. Uses biological wound-healing as a framework: triage, stabilization, scaffolding, progressive rebuild, and scar tissue management.

When to Use

Inputs

Procedure

Step 1: Triage — Assess and Classify Wounds

Rapidly assess all damage and classify by severity and urgency.

  1. Catalog every known point of damage:
  1. Classify each wound:
Wound Classification:
┌──────────┬──────────────────────┬────────────────────────────────────┐
│ Class    │ Severity             │ Response                           │
├──────────┼──────────────────────┼────────────────────────────────────┤
│ Critical │ Core function lost,  │ Immediate: stop bleeding, activate │
│          │ data at risk,        │ backup, redirect traffic, page     │
│          │ actively spreading   │ on-call team                       │
├──────────┼──────────────────────┼────────────────────────────────────┤
│ Serious  │ Important function   │ Urgent: fix within hours/days,     │
│          │ degraded, no spread  │ workarounds acceptable short-term  │
├──────────┼──────────────────────┼────────────────────────────────────┤
│ Moderate │ Non-critical function│ Scheduled: fix within sprint,      │
│          │ affected, contained  │ prioritize against other work      │
├──────────┼──────────────────────┼────────────────────────────────────┤
│ Minor    │ Cosmetic or edge     │ Backlog: fix when convenient,      │
│          │ case, no user impact │ may self-resolve                   │
└──────────┴──────────────────────┴────────────────────────────────────┘
  1. Prioritize repair order:
  1. Check for wound interaction:

Got: A complete wound inventory classified by severity, with a prioritized repair order that accounts for wound interactions.

If fail: If triage takes too long (the system is actively degrading), skip detailed classification and focus on: "What is the single most critical thing to stabilize?" Fix that first, then return to full triage.

Step 2: Emergency Stabilization

Stop the damage from spreading before beginning repair.

  1. Contain the wound:
  1. Apply emergency patches:
  1. Verify stabilization:

Got: The system is stable (not actively degrading) even if degraded. Damage is contained and not spreading. Evidence is preserved for root cause analysis.

If fail: If stabilization fails (damage continues spreading despite containment), escalate to full system fallback: activate disaster recovery, switch to backup system, or gracefully degrade to minimal viable operation. Stabilization that takes too long becomes the disaster.

Step 3: Build Repair Scaffolding

Construct the temporary structures that support the repair process.

  1. Set up a repair environment:
  1. Build diagnostic infrastructure:
  1. Design the repair sequence:

a. Root cause identification (why did this break?)

b. Repair approach (fix the cause, not just the symptom)

c. Verification method (how to confirm the repair worked)

d. Regression check (did the repair break anything else?)

  1. Identify scar tissue risk:

Got: A repair environment with diagnostic capability, a sequenced repair plan, and awareness of scar tissue risk.

If fail: If setting up a proper repair environment is too slow (system urgency demands immediate production changes), apply changes directly but with extreme discipline: one change at a time, tested by the available means, rolled back if it doesn't help.

Step 4: Execute Progressive Rebuild

Repair damage systematically, verifying each fix before proceeding.

  1. For each wound (in triage priority order):

a. Identify root cause:

b. Implement the repair:

c. Verify the repair:

d. Check for regression:

  1. After all critical and serious wounds are repaired:
  1. Schedule moderate and minor wound repairs:

Got: Critical and serious wounds are repaired with verified fixes. Emergency patches are removed. The system is restored to functional operation.

If fail: If a repair attempt fails or causes regression, roll back to the previous state and reassess. If multiple repair attempts fail for the same wound, the damage may be too deep for local repair — consider whether the affected component needs full replacement rather than repair (see dissolve-form).

Step 5: Manage Scar Tissue and Strengthen

Address the workarounds and shortcuts introduced during emergency repair, and strengthen against recurrence.

  1. Inventory scar tissue:
  1. For each piece of scar tissue, decide:
  1. Strengthen against recurrence:
  1. Update immune memory:

Got: Scar tissue is managed (removed, replaced, or accepted with documentation). The system is not only repaired but more resilient than before the damage. Learnings are captured for future incidents.

If fail: If scar tissue management is deprioritized ("it works, don't touch it"), schedule it explicitly. Unmanaged scar tissue accumulates and eventually contributes to the next incident. If the root cause can't be identified, strengthen detection and recovery speed as compensating controls.

Validation

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.