Borrowing it
Nothing to install: this file belongs to jayminwest/kotadb. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/jayminwest/kotadb/develop/.claude/commands/issues/refactor.mdgit clone --depth 1 https://github.com/jayminwest/kotadbWrote 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/jayminwest/kotadb/refactor)<a href="https://agentmods.dev/commands/jayminwest/kotadb/refactor"><img src="https://agentmods.dev/badge/commands/jayminwest/kotadb/refactor/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/jayminwest/kotadb/refactor"><img src="https://agentmods.dev/badge/commands/jayminwest/kotadb/refactor.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00000 | $0.01444 |
| Opus 5.5 | $0.00000 | $0.00578 |
| Sonnet 5.5 | $0.00000 | $0.00289 |
| Haiku 4.5 | $0.00000 | $0.00144 |
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 1mo 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.
This is a copy
86% identical to bug — 104 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/refactor
Template Category: Action
Author a refactoring plan for the code improvement described in $ARGUMENTS (issue metadata JSON). The plan must guide the implementor through structural changes while preserving existing behavior.
CRITICAL - Worktree Path Handling:
- You are executing in an isolated git worktree directory
- Your CWD is the worktree root (e.g.,
/project/trees/refactor-123-abc12345) - ALL file paths in Write, Edit, Read tools MUST be relative to CWD
- ✅ Correct:
.claude/.cache/specs/refactor-123-plan.md - ❌ Wrong:
/project/trees/refactor-123-abc12345/.claude/.cache/specs/refactor-123-plan.md - Using absolute paths will cause git staging failures and commit errors
Instructions
- Verify issue labels first: Run
gh issue view <issue-number> --json labelsto ensure the issue has labels from all four categories (component, priority, effort, status). If labels are missing, apply them before proceeding. - Create a new markdown plan under
.claude/.cache/specs/namedrefactor-<issue-number>-<slug>.md(e.g.,.claude/.cache/specs/refactor-2350-extract-auth-logic.md). - Build
<slug>from the issue title using 3–6 lowercase, hyphenated words (alphanumeric only). - Follow the format exactly so orchestrators can parse sections reliably.
- MANDATORY: Use KotaDB MCP tools for impact analysis: Use
mcp__kotadb-staging__search_dependencies(minimum depth=2) andmcp__kotadb-staging__analyze_change_impactbefore refactoring (see.claude/commands/docs/kotadb-agent-usage.mdfor patterns) - Analyze existing code structure to understand current dependencies, interfaces, and behavior before proposing changes.
- Investigate impacted modules in
src/**,tests/**, and any infrastructure that depends on the code being refactored. - Capture all impacted files (and any new assets) in the dedicated section so implementors have clear scope boundaries.
- Reference the repo git flow: work from
refactor/<issue-number>-<slug>offdevelop, withdeveloppromoted tomainon release. - Integrate
/anti-mockexpectations: update test coverage to validate behavior preservation, use real database connections, and document any temporary test skips. - Ensure the plan's closing tasks rerun validation and push the branch so a PR can be raised (PR titles must end with the issue number, e.g.
refactor: extract auth logic (#210)). - Consult
.claude/commands/docs/conditional_docs/app.mdor.claude/commands/docs/conditional_docs/automation.mdand read only the documentation whose conditions align with the refactoring scope. - When the refactoring introduces new patterns or documentation, add or update the relevant conditional entry so future agents can discover it quickly.
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.
- 1mo ago First seen · 137 lines · 0 tokens per session scan A e74fc16b1dea
refactor is a command published in the GitHub repository jayminwest/kotadb (100 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,444 tokens. A static security scan graded it A with 0 findings. It is 86% identical to bug, differing in 104 lines, and is treated as a copy.
Other commands, from other repositories
fest-show
Show festival progression (in-progress tasks, roadmap, and dependency view).
verify-math
Verify a self-authored mathematical result end to end by routing claims across adversarial review, numerical falsification, symbolic or CAS checks, and Lean, then aggregating one report. Use when a theorem, proposition, conjecture, or paper-wide mathematical argument needs the appropriate combination of verification…
synthesise-reviews
Deduplicate and reconcile multiple completed review reports into one prioritised revision plan with conflicts and dependencies made explicit. Use when parallel reviewers have returned findings that need a single action sequence. Not for running the reviews; use $review-cluster.
firebase-publish
Create or reuse a Firebase project, configure Hosting, and deploy the current static site. Never deletes.
tdd-feature
Implement a new feature using full TDD loop.
auditoria-legal
Grupo: Trabajo con el framework En una frase: Auditoría de cumplimiento legal del producto — territorio, evidencia y lo que el código no cubre. Cuándo: Antes de publicar una app o web: registro, cookies, analítica, emails, suscripciones, contenido de usuarios. Quién: Cualquier operador del repo.