Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/qwickapps/ai-sdlc-workflows/refactorgit clone --depth 1 https://github.com/qwickapps/ai-sdlc-workflowsWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00006 | $0.01077 |
| Opus 5 | $0.00003 | $0.00539 |
| Sonnet 5 | $0.00001 | $0.00215 |
| Haiku 4.5 | $0.00001 | $0.00108 |
Grade A, and why
refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactoring Workflow
You are now in Refactoring Mode. Follow this workflow strictly.
Input: $ARGUMENTS (code, component, or pattern to refactor)
CRITICAL RULES
- Plan before refactoring - understand scope and impact (see RESEARCH-DEPTH.md)
- NEVER auto-commit - always wait for explicit user approval
- NEVER add legacy support - clean breaks are OK
- Preserve behavior - refactoring should not change functionality
- No attributions in commit messages
- When blocked - STOP and discuss (see COMMUNICATION-PROTOCOL.md)
- Use worktree script - NEVER use git commands directly (see WORKTREE-ENFORCEMENT.md)
- Validate thoroughly - tests must pass before and after (see VALIDATION-GATES.md)
Interactive Setup
Check if $ARGUMENTS is provided.
If $ARGUMENTS is empty, ask:
"What would you like to refactor? Please describe:
- The code, component, or pattern to restructure
- Why refactoring is needed
- The desired end state
- Issue/ticket number (if this refactoring is tracked)"
Extract and store the issue/ticket number (if provided) for:
- Branch naming (refactor/ISSUE-123)
- Document attachment
- Commit messages
Wait for response before proceeding.
Workflow Phases
PHASE 1: Analysis (Architect)
-
Understand current state:
- What code is being refactored?
- Why is refactoring needed?
- What is the desired end state?
-
Impact analysis:
- What files/components are affected?
- What depends on this code?
- Are there breaking changes?
-
Create Refactoring Proposal:
- Save to:
.claude/engineering/refactors/REFACTOR-<id>-<short-name>.md - Include: current state, proposed state, migration steps, risks
- Save to:
-
Attach Refactoring Proposal to issue/ticket (if issue number provided):
- For GitHub issues: Use
gh issue comment <issue-number> --body-file <refactor-proposal-path> - For JIRA tickets: Use JIRA CLI or REST API to attach document
- If attachment fails or not applicable: Inform user to attach manually
- For GitHub issues: Use
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 147 lines · 6 tokens per session scan A 18db9bcb269c
refactor is a command published in the GitHub repository qwickapps/ai-sdlc-workflows (2 stars, last pushed 5mo ago), licensed MIT. It adds 6 tokens to every session and 1,077 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
git
Git operations with intelligent commit messages and workflow optimization.
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.