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/versoxbt/claude-initial-setup/refactorgit clone --depth 1 https://github.com/VersoXBT/claude-initial-setupWhat 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.00010 | $0.00429 |
| Opus 5 | $0.00005 | $0.00215 |
| Sonnet 5 | $0.00002 | $0.00086 |
| Haiku 4.5 | $0.00001 | $0.00043 |
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.
What it actually says
Refactor
Identify and remove dead code, then refactor for improved maintainability and readability.
Steps
-
Identify dead code:
- Search for unused exports — functions, classes, constants, and types that are never imported.
- Search for unused imports in each file.
- Search for unreachable code after return, throw, or break statements.
- Search for commented-out code blocks.
- Search for unused variables and parameters.
-
Verify before removing:
- For each candidate, search the entire codebase for references.
- Check for dynamic usage patterns (string-based imports, reflection, config-driven loading).
- Check if the code is used in tests — remove test code only if the production code is also removed.
- Do not remove public API surface without confirming it is safe.
-
Remove dead code safely:
- Remove one item at a time.
- Run the build after each removal to catch breakage.
- Run the test suite after each removal.
- If removal breaks something, revert and investigate the dependency.
-
Refactor for clarity:
- Extract functions longer than 50 lines into smaller, well-named functions.
- Reduce nesting depth to 4 levels or fewer.
- Replace magic numbers and strings with named constants.
- Apply immutable patterns — replace mutations with spread operators or functional updates.
-
Refactor for structure:
- Split files larger than 800 lines into focused modules.
- Group related functions into cohesive modules.
- Move shared utilities to a common location.
-
Final verification:
- Run the full build.
- Run all tests and confirm they pass.
- Verify no new lint warnings were introduced.
If Removal Breaks the Build
- Revert the removal immediately.
- Investigate the reference that was missed.
- Add the item back and mark it for later review if the dependency is complex.
Output
A cleaner codebase with dead code removed, files properly sized, and all tests passing.
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 · 55 lines · 10 tokens per session scan A 6c137ea47d89
refactor is a command published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 3mo ago), licensed MIT. It adds 10 tokens to every session and 429 once invoked, about $0.0001 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.
constitution
Create or update the project constitution from interactive or provided principle inputs.