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/sefaertunc/worclaude/refactor-cleangit clone --depth 1 https://github.com/sefaertunc/WorclaudeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/sefaertunc/worclaude/refactor-clean)<a href="https://agentmods.dev/commands/sefaertunc/worclaude/refactor-clean"><img src="https://agentmods.dev/badge/commands/sefaertunc/worclaude/refactor-clean.svg" alt="Measured on agentmods" height="20"></a>What 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.00007 | $0.00969 |
| Opus 5 | $0.00003 | $0.00485 |
| Sonnet 5 | $0.00001 | $0.00194 |
| Haiku 4.5 | $0.00001 | $0.00097 |
Grade B, and why
refactor-clean scanned grade B with 1 finding 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 4d 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
test -f .claude/scratch/last-review.md && head -10 .claude/scratch/last-review.md How it starts
The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Run a focused cleanup pass on recently changed code. This command runs INLINE in your current session — it reads uncommitted changes, improves them in place, and leaves everything uncommitted for /commit-push-pr.
When invoked with arguments, use them to scope the cleanup. Example: /refactor-clean src/core/merger.js
Arguments: $ARGUMENTS
Do NOT spawn a subagent or worktree for this. Work directly on the files in the current working directory.
What to Clean
-
Dead code — unused imports, commented-out blocks, unreachable branches, uncalled functions. Delete them — git has history.
-
Duplication — identical or near-identical code blocks → extract shared function. Repeated validation → centralize. Copy-pasted error handling → extract helper.
-
Complexity — functions over 30 lines → split by responsibility. Nesting deeper than 3 levels → early returns, guard clauses. Long parameter lists → group into option objects.
-
Consistency — naming that doesn't match project conventions. Mixed patterns in the same module. Inconsistent error handling.
Process
0. Check for fresh /review-changes output
Before doing your own analysis, look for .claude/scratch/last-review.md:
test -f .claude/scratch/last-review.md && head -10 .claude/scratch/last-review.md
If the file exists AND its sha: frontmatter matches git rev-parse HEAD,
use the review as your work plan. Skip steps 1-3 below; jump straight
to step 4 with the review's findings as your candidate list.
If the SHA doesn't match, the review is stale — ignore it and proceed with your own analysis.
1-6. Self-analysis path (only if no fresh review)
- Identify changed files:
git diff --name-only(unstaged) andgit diff --cached --name-only(staged). If no changes, checkgit diff --name-only HEAD~5for recent commits. - Read each changed file fully — understand context before changing
- Check CLAUDE.md for project-specific conventions
- Make one improvement at a time, smallest meaningful change first
- Scoped tests after each change. Run only the tests related to
the files you changed (don't run the whole suite each time):
- Vitest:
npx vitest run --related <changed-files> - Jest:
npx jest --findRelatedTests <changed-files> - Other runners: scope to the relevant test directory or file pattern
- Vitest:
- If scoped tests fail, revert immediately — your change broke behavior
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.
- 4d ago First seen · 109 lines · 7 tokens per session scan B ff33296725eb
refactor-clean is a command published in the GitHub repository sefaertunc/Worclaude (4 stars, last pushed 25d ago), licensed MIT. It adds 7 tokens to every session and 969 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
statusbar-style
Switch the status-bar style (classic / capsule / hairline).
fest-show
Show festival progression (in-progress tasks, roadmap, and dependency view).
superpowers-execute
Execute the current GSD phase plan with Superpowers instead of gsd-execute-phase.
config
Command "config" from sdebruyn/fabric-dw-mcp-cli, covering configuration & defaults, http retry budget, sql retry budget, mcp workspace allowlist {#mcp-workspace-allowlist} and mcp server log level.
deps-age
Analyze dependency freshness and maintenance activity.
session-active
Set the persistent, per-session credo mode to active.