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/kewton/commandmate/refactoringgit clone --depth 1 https://github.com/Kewton/CommandMateWhat 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.00020 | $0.00825 |
| Opus 5 | $0.00010 | $0.00413 |
| Sonnet 5 | $0.00004 | $0.00165 |
| Haiku 4.5 | $0.00002 | $0.00082 |
Grade B, and why
refactoring 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 yesterday.
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.
cat .claude/prompts/refactoring-core.md What it actually says
リファクタリングスキル
概要
コード品質を改善し、SOLID原則に基づく設計パターンを適用して、技術的負債を解消するスキルです。
このスキルはスラッシュコマンドモードで動作します(ユーザーが直接実行)。
使用方法
/refactoring [対象ファイル/クラス]- 「[ファイル名]をリファクタリングしてください」
- 「コンポーネントを分割してください」
実行内容
共通プロンプトを読み込んで実行します:
cat .claude/prompts/refactoring-core.md
↑ このプロンプトの内容に従って、リファクタリングを実行してください。
動作モード
スラッシュコマンドモード:
- ユーザーから対話的に情報を取得
- リファクタリング対象、改善目標、適用パターンなどを確認
- コード品質分析を実行
- リファクタリングを段階的に適用
- 結果をターミナルに表示
リファクタリング原則
- SOLID: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
- KISS: Keep It Simple, Stupid
- DRY: Don't Repeat Yourself
- YAGNI: You Aren't Gonna Need It
リファクタリングパターン
メソッド抽出
長いメソッドを小さなメソッドに分割
クラス抽出
大きなクラスを責任ごとに分割
重複コード削除
共通処理を関数/クラスに抽出
命名改善
意図を明確に表す命名に変更
設計パターン適用
- Repository Pattern
- Factory Pattern
- Strategy Pattern
- Dependency Injection
完了条件
以下をすべて満たすこと:
- すべてのテストが引き続き成功
- 品質メトリクスが改善(カバレッジ、複雑度)
- 静的解析エラーがゼロ
- コミットが完了
出力例
リファクタリング完了
## リファクタリング内容
- 長いメソッドの分割
- 重複コードの削除
- 命名の改善
## 品質メトリクス改善
| 指標 | Before | After | 改善 |
|------|--------|-------|------|
| Coverage | 75.0% | 85.0% | +10.0% |
| ESLint errors | 5 | 0 | -5 |
| TypeScript errors | 2 | 0 | -2 |
## ファイル変更
- src/lib/xxx.ts (リファクタリング)
- src/utils/helper.ts (新規)
## Commits
- abc1234: refactor(xxx): improve code quality
サブエージェントモード
サブエージェントとして呼び出す場合は、PM Auto-Devが以下のように実行します:
Use refactoring-agent to improve code quality for Issue #166.
この場合、.claude/agents/refactoring-agent.md が使用されます。
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.
- yesterday First seen · 120 lines · 20 tokens per session scan B 5144a0a8319c
refactoring is a command published in the GitHub repository Kewton/CommandMate (39 stars, last pushed yesterday), licensed MIT. It adds 20 tokens to every session and 825 once invoked, about $0.0001 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-30.
Other commands, from other repositories
crow-image
Show an image in Crow's Images panel — pass the file path as the argument.
release-notes
Draft release notes, recommend and apply a version bump, and update CHANGELOG.md for the next dormouse release by analyzing all merge commits and squash-merged PRs since the last release tag. Used as step 2 of the release checklist in docs/specs/deploy.md.
refresh-compare-pages
Freshly research, add, and refresh marketing compare pages, then open a descriptive PR.
build-docs
Build and serve the docs site locally with Jekyll.
release
Cut a domux release — tag HEAD, push, watch the GH Action.
review-session-log
Use when the user asks what a session did, wants to review session history, or needs to find errors in a session log.