agentleFS
danielvm-gitdanielvm-git/bigpowers/.cursor/rules/fix-bug.mdc

bigpowers / rules

Cursor rule252 starsChanged 3 months agoMITView on GitHub

Bug fix orchestrator — active_flow fix_bug; reads specs/bugs/BUG-*.md; chains investigate-bug, develop-tdd, validate-fix. Use when user reports a defect.

The file

We split this fix-bug.mdc into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Create specs/bugs/BUG-*.md via investigate-bug (or inline in fix-bug step 1) describing the gate failure, then run the standard fix_bug …

    line 22
  2. Very specific:

    Step 1 — investigate-bug: If no specs/bugs/BUG-*.md, run investigate-bug first — it handles history check, RCA (via diagnose-root), fix …

    line 44
  3. Distinctive:

    Step 2 — diagnose-root: Run 4-phase RCA (reproduce → isolate → hypothesize → verify).

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
fix-bug.mdc
---
description: "Bug fix orchestrator — active_flow fix_bug; reads specs/bugs/BUG-*.md; chains investigate-bug, develop-tdd, validate-fix. Use when user reports a defect."
alwaysApply: false
---

# Fix Bug

**Boundary**: Orchestrator flow — chains `investigate-bug` (entry point + RCA via `diagnose-root`) → `develop-tdd` → `validate-fix`. Does not implement RCA or write bug files directly.

Orchestrates **fix_bug** flow without mixing epic build state.

> **HARD GATE** — Set `specs/state.yaml` `active_flow: fix_bug` and `bug_cycle.current_step: 1` before starting.

## Discovered gate failures (e51s04)

Valid entry **without a user-reported bug** when:

- **Preflight** or **CI** is red at kickoff or verify-work
- **Golden suite** or project baseline is red (`bash scripts/run-verification-gates.sh` or equivalent)
- A reproducible gate failure during unrelated epic work exceeds quick-fix guardrails

Create `specs/bugs/BUG-*.md` via `investigate-bug` (or inline in fix-bug step 1) describing the gate failure, then run the standard fix_bug chain.

## Five steps (`bug_cycle` in state.yaml)

| Step | Skill / action |
|------|----------------|
| 1 | `investigate-bug` — create BUG-*.md with RCA |
| 2 | `diagnose-root` — 4-phase root cause analysis |
| 3 | `develop-tdd` — red-green against bug file verify steps |
| 4 | `validate-fix` — re-run failing test, full suite, lint |
| 5 | `release-branch` — PR or solo land the fix |

### Checkpoint / resume

Track progress via `specs/state.yaml` `bug_cycle`:
- `bug_cycle.current_step`: current step (1–5)
- `bug_cycle.completed_steps`: completed step numbers
- `handoff.next_skill`: skill for the current step
- On resume, read `bug_cycle.current_step` and continue from there

## Process

1. **Step 1 — investigate-bug:** If no `specs/bugs/BUG-*.md`, run `investigate-bug` first — it handles history check, RCA (via `diagnose-root`), fix approach, and writes the bug file. Increment `bug_cycle.current_step` to 2 on completion.
2. **Step 2 — diagnose-root:** Run 4-phase RCA (reproduce → isolate → hypothesize → verify). Record findings in the bug file. Increment to step 3.
3. **Step 3 — develop-tdd:** `develop-tdd` against the bug file's verify steps. Increment to step 4 on all-green.
4. **Step 4 — validate-fix:** `validate-fix` — re-run failing test, full suite, typecheck, lint. Increment to step 5.
5. **Step 5 — release-branch:** Land the fix via `release-branch`. Clear `bug_cycle` and `active_flow` when done.

## Bug file SoT

One markdown file per bug with frontmatter:

```yaml
---
bug_id: BUG-001
status: open
severity: high
scope: api
title: Short title
---
```

## Verify

→ verify: `test -d specs/bugs && test -f scripts/run-skill-verify.sh`

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.