Skip to content

Instantly share code, notes, and snippets.

@hexawulf
Created October 9, 2025 00:08
Show Gist options
  • Save hexawulf/53cb8bbb4c80f3ec2f3fdf599a0514ce to your computer and use it in GitHub Desktop.
Save hexawulf/53cb8bbb4c80f3ec2f3fdf599a0514ce to your computer and use it in GitHub Desktop.
Claude Code custom slash command — /dev:triage
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:*)

Dev Triage (explain | fix | tests | refactor)

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.

1) Gather context (run in order)

  • 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 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).

2) Decide action by mode

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.

3) Quality gates (apply to all modes)

  • 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.

4) Output format

  1. Summary (bullets)
  2. Risk & Impact
  3. Proposed Changes / Tests (with unified diffs or code blocks)
  4. Next Steps (one-liners I can copy/paste)

5) Inputs from user

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment