| name | nazgul:patch |
| description | Lightweight task mode for bug fixes, config changes, and small features. Supports --no-review and --discuss flags. |
| context | fork |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep, Agent |
| metadata | {"author":"Jose Mejia","version":"2.7.1"} |
Nazgul Patch
Examples
/nazgul:patch "fix CORS headers on API" — Quick patch with single reviewer
/nazgul:patch --no-review "update README badges" — Skip review, just implement
/nazgul:patch --discuss "add rate limiting" — Discuss gray areas first, then patch
/nazgul:patch — Interactive mode, prompts for description
Arguments
$ARGUMENTS
Current State
- Config: !
cat nazgul/config.json 2>/dev/null | head -3 || echo "NOT_INITIALIZED"
- Existing patches: !
ls nazgul/tasks/patches/PATCH-*.md 2>/dev/null | wc -l || echo "0"
- Active reviewers: !
jq -r '.agents.reviewers // [] | join(", ")' nazgul/config.json 2>/dev/null || echo "none"
Instructions
Pre-flight
- Check if
nazgul/config.json exists. If not: "Nazgul not initialized. Run /nazgul:init first." and STOP.
- Parse
$ARGUMENTS for flags:
- Backstop: if the
## Arguments block above is exactly the literal token $ARGUMENTS (the placeholder was not substituted at all — not merely a patch description that happens to mention $ARGUMENTS), argument substitution is broken — STOP and report: "Skill argument substitution failed — this is a plugin bug, do not proceed." Otherwise continue.
--no-review → skip review step
--discuss → run gray area discussion before planning
- Remaining text → patch description
- These flags are persisted to the manifest's
## Flags line in Step 1 and are the authoritative on-disk record; Step 2 and Step 5 read the decision back from that line (do not rely on remembered variables, which are lost on compaction).
- If no description after parsing, ask interactively: "What do you want to patch?"
Display Banner
Output per references/ui-brand.md:
─── ◈ NAZGUL ▸ PATCHING ────────────────────────────────
Step 1: Create Patch Task
- Scan
nazgul/tasks/patches/ for next available PATCH-NNN number (create directory if needed)
- Create
nazgul/tasks/patches/PATCH-NNN.md:
# PATCH-NNN: [description]
## Metadata
- **Status**: IN_PROGRESS
- **Created**: [ISO 8601 timestamp]
- **Source**: /nazgul:patch
- **Flags**: [--no-review, --discuss, or none]
## Description
[full description from user]
## Subtasks
[Generated by planner in Step 3]
## Implementation Log
[Filled during execution]
Step 2: Discuss (if --discuss flag)
Read the patch manifest's ## Flags line (the authoritative on-disk record written in Step 1). Only if it contains --discuss:
- Analyze the patch description for gray areas based on domain:
- Code changes → scope, backwards compatibility, edge cases
- Config changes → environments affected, rollback plan
- Bug fixes → root cause, regression test needed
- Ask the user about each gray area (one at a time)
- Lock decisions into the patch task manifest under
## Decisions
Step 3: Plan
Use the planner agent to generate 1-3 subtasks for the patch:
- Dispatch planner with a simplified prompt: "Generate 1-3 small subtasks for this patch. No research, no docs. Just implementation steps."
- Planner reads the patch description (and decisions if --discuss was used)
- Subtasks are written into the patch manifest under
## Subtasks
Step 4: Implement
Use the implementer agent to execute each subtask:
- Dispatch implementer with the patch manifest
- Implementer follows existing patterns (reads CLAUDE.md, follows conventions)
- Each subtask gets an atomic git commit with prefix:
patch(PATCH-NNN):
- Update patch manifest with implementation log
Step 5: Review (unless --no-review)
Read the patch manifest's ## Flags line (the authoritative on-disk record written in Step 1) to decide. If it does NOT contain --no-review:
- Auto-select a single reviewer based on file types changed:
.ts/.tsx/.js/.jsx → frontend-reviewer (if available) or code-reviewer
.py → code-reviewer
.md/.json/.yaml → skip review (docs/config only)
- Mixed → code-reviewer
- Run the selected reviewer on the changed files
- If APPROVED: mark patch DONE
- If CHANGES_REQUESTED: show feedback, implementer fixes, re-review (max 2 retries)
If the ## Flags line contains --no-review:
- Mark patch DONE immediately after implementation
Step 6: Complete
- Update patch manifest status to DONE
- Append to
nazgul/plan.md under ## Patches section (create section if it doesn't exist):
- [x] PATCH-NNN: [description] (sha: [commit])
- Display completion with Next Up block per ui-brand.md:
─── ◈ NAZGUL ▸ COMPLETE ✦ ──────────────────────────────
✦ PATCH-NNN: [description]
Commits: [N] | Files changed: [N] | Review: [approved/skipped]
─── ◈ NEXT ─────────────────────────────────────────────
/nazgul:start to continue main objective
/nazgul:patch for another quick fix
────────────────────────────────────────────────────────
Error Handling
- If planner fails to generate subtasks: "Could not plan this patch. Try providing more detail or use
/nazgul:start for a full task."
- If implementer fails: Mark patch BLOCKED with error details
- If reviewer rejects after max retries: Mark patch BLOCKED, show consolidated feedback