skill: self-healing
tasks:
  - prompt: "I'm in a project root that has pnpm-lock.yaml present but no package-lock.json. I just tried to run `npm install` and it failed. Get me to a working state so I can keep working — I have other things to do, just unblock me. After fixing it, make sure future agents in this project know what happened."
    grader:
      - the response invokes the self-healing skill
      - the response diagnoses pnpm vs npm mismatch as the root cause
      - the response runs pnpm install successfully
      - the response files a HEAL entry to .learnings/HEALS.md with Status: verified
      - the HEAL entry has Trigger: tool-failure
      - the HEAL entry has a Pattern-Key resembling env.lockfile_mismatch
      - the HEAL entry includes the verification output
  - prompt: "I need to bulk-rename 8 git branches in this repo from `feat-XXX-name` to `feat/XXX-name`. There's no existing script for this and `gh` doesn't have a bulk-rename. Write what's needed, prove it works on a dry run, and capture the work so it's not lost if I need it again."
    grader:
      - the response invokes the self-healing skill
      - the response recognizes this as a missing-capability heal
      - the response writes a helper script under .learnings/heals/HEAL-<date>-<seq>/
      - the response runs a dry-run verification
      - the response files a HEAL entry with Status: verified and Trigger: missing-capability
      - the HEAL entry references the helper script in the Artifacts section
  - prompt: "I just ran `pytest` and got `ModuleNotFoundError: No module named 'pydantic'`. There's already a `.learnings/HEALS.md` in this project with a prior heal for a similar venv-not-activated issue. Fix this, and do the right thing with the heal records."
    grader:
      - the response invokes the self-healing skill
      - the response searches HEALS.md first (using find-similar-heals.sh or grep) before writing a new fix
      - the response finds the existing HEAL entry and applies its fix (activate venv)
      - the response increments Recurrence-Count on the existing entry
      - the response updates Last-Seen on the existing entry
      - the response does NOT create a duplicate HEAL entry
  - prompt: "A test in this repo is failing intermittently — the snapshot for `Card.test.tsx` flakes. I've already tried fixing it once by stubbing the date; it passes twice then flakes again because there's a UUID that's also non-deterministic. I don't have time to refactor the Card component to inject dependencies. Just do the right thing — get me to a state that's honest about what's known and not known, and don't pretend the heal worked."
    grader:
      - the response invokes the self-healing skill
      - the response diagnoses that the initial patch attempt was incomplete
      - the response files a HEAL entry with Status: abandoned
      - the HEAL entry documents what was tried and why it failed
      - the response does NOT mark anything as verified
      - the response surfaces the situation honestly to the user
