| description | allowed-tools |
|---|---|
Triage local changes and act: explain | fix | tests | refactor |
Bash(git status:*),
Bash(git diff:*),
Bash(git log:*),
Bash(ls:*),
Bash(cat:*),
Bash(find:*)
|
You are an expert pair-programmer. Use Git context + the requested mode to produce concrete, directly-usable results.
Invocation
/dev:triage <mode> [target] [notes…]
- mode (required):
explain|fix|tests|refactor - target (optional): file path, glob, or short description
- notes (optional): any extra constraints. All text after mode/target is available as
$ARGUMENTS.
- Run:
!git status --porcelain - Run:
!git log -n 3 --oneline - Run:
- if there are staged changes:
!git diff --staged --unified=0 - else:
!git diff --unified=0
- if there are staged changes:
- If a target path exists,
!ls -la <target>and!cat <target>(only if file is small; otherwise summarize). - If target is a directory, list tree one level deep.
Summarize what changed (files, hunks, risks, dependencies).
Explain
- Explain intent of each change, the flow, and any hidden edge cases.
- Map risk areas and suggest 3 pragmatic improvements.
Fix
- Identify likely bugs (off-by-one, nullability, async, resource leaks, boundary conditions).
- Propose minimal patches per hunk; show unified diffs in fenced blocks ready to apply with
git apply. - Include quick tests that reproduce the bug before the fix.
Tests
- Propose a focused test plan (unit + integration boundaries).
- Generate table of Given/When/Then cases.
- Output runnable test code for the project’s framework (infer from repo; otherwise suggest a default).
- Mark slow/IO/network tests separately.
Refactor
- Suggest small, safe refactors (naming, extraction, cohesion, dead code).
- Show stepwise diffs (max 50–80 lines per step).
- Preserve behavior; call out any API changes.
- Keep changes smallest-first; prefer surgical edits.
- Explain why each change is safe. Note any migration or rollback steps.
- Watch for security/infosec issues (input validation, secrets, command injection).
- If information is insufficient, ask precise follow-ups at the end.
- Summary (bullets)
- Risk & Impact
- Proposed Changes / Tests (with unified diffs or code blocks)
- Next Steps (one-liners I can copy/paste)
Use these parsed values:
- Raw input:
$ARGUMENTS - Parse first token as mode; second (if present) as target; remainder as notes. If parsing fails, show a short usage reminder and continue with explain mode.