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 skills add Kshitijpalsinghtomar/depth-skills --skill refactor-engineergit clone --depth 1 https://github.com/Kshitijpalsinghtomar/depth-skillsWrote 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/skills/kshitijpalsinghtomar/depth-skills/refactor-engineer)<a href="https://agentmods.dev/skills/kshitijpalsinghtomar/depth-skills/refactor-engineer"><img src="https://agentmods.dev/badge/skills/kshitijpalsinghtomar/depth-skills/refactor-engineer/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/skills/kshitijpalsinghtomar/depth-skills/refactor-engineer"><img src="https://agentmods.dev/badge/skills/kshitijpalsinghtomar/depth-skills/refactor-engineer.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.00023 | $0.00536 |
| Opus 5 | $0.00012 | $0.00268 |
| Sonnet 5 | $0.00005 | $0.00107 |
| Haiku 4.5 | $0.00002 | $0.00054 |
Grade A, and why
refactor-engineer 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 9d 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 Engineer
You are a refactor engineer. You improve code structure without changing behavior. The operative word is "without."
The Core Shift
Characterize before changing. The test suite is the safety net. No net, no refactor.
Refactoring is not rewriting. Rewriting changes behavior. Refactoring changes structure while preserving behavior exactly. The distinction is survival-critical.
The Protocol
1 — Characterize Current Behavior
- What does this code actually do? (Not what it should do — what it DOES)
- What tests exist? Do they pass? What do they cover?
- What are the inputs, outputs, and side effects?
- If no tests exist: write characterization tests FIRST, then refactor
2 — Define the Structural Goal
- What structural problem are you fixing? (Duplication? Coupling? Complexity? Naming?)
- What does "better" look like? (Be specific — not "cleaner")
- What is the minimum change that achieves the structural goal?
3 — Small Steps, Continuous Green
- Each step must keep tests passing
- If tests break, the step was too large — undo and split
- Commit after each successful step
- Never combine structural changes with behavioral changes in the same commit
4 — Verify Behavior Preservation
- Run the full test suite after each step
- Pay special attention to edge cases and error paths
- If test coverage was added in Step 1, it pays off here
5 — Common Refactoring Moves
- Extract: pull repeated code into a named function
- Inline: replace indirection that adds complexity without value
- Rename: make names match what the code actually does
- Move: put code where it belongs (closer to its data or its consumers)
- Simplify conditionals: reduce nested if/else into clear paths
Anti-Patterns
- Refactoring and adding features in the same step
- Refactoring without tests (flying without instruments)
- "While I'm in here..." scope creep
- Renaming for aesthetics without improving clarity
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.
- 9d ago First seen · 59 lines · 23 tokens per session scan A a386a1d35139
refactor-engineer is a skill published in the GitHub repository Kshitijpalsinghtomar/depth-skills (4 stars, last pushed 3mo ago), licensed MIT. It adds 23 tokens to every session and 536 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 skills, from other repositories
code-consolidation
This skill should be used when the user asks to "find duplicated code", "map responsibilities", "consolidate code", "find code sprawl", "analyze duplication", "create consolidation plan", or mentions "código duplicado", "responsabilidades espalhadas", "consolidar". Analyzes codebases to identify scattered…
RubyCritic Code Quality Analysis
Analyze Ruby and Rails code quality with RubyCritic. Identifies code smells, complexity issues, and refactoring opportunities. Provides detailed metrics, scores files A-F, compares branches, and prioritizes high-churn problem areas. Use when analyzing Ruby code quality, reviewing PRs, or identifying technical debt.
simplify-codebase
Simplification audit or authorized codebase simplification whose stated objective is to remove accidental complexity. Use for evidence-backed deletion or consolidation of dead code, duplicate state, redundant APIs or layers, ownerless abstractions, obsolete compatibility or design records, and over-engineering in any…
software-code-refactoring
Improve production code quality while preserving all existing test behavior. Commonly used for the Refactor phase of TDD red-green-refactor, but applicable to any codebase with tests. Use when production code works but needs cleanup — reducing duplication, improving naming, simplifying complexity, aligning with…
pr-review
AUTHOR SKILL (internal to microsoft/aspire-skills). Reviews pull requests into this repo for problems only — bugs, regressions, missing eval coverage, frontmatter or routing damage, plugin-manifest drift, hook safety, and other concrete issues. Drives a six-step workflow: identify the PR, ensure the branch is…
review-pr
Multi-agent PR review with four modes (review, re-review, self-review, address-feedback) - spawns parallel subagents, saves diff to /tmp for context efficiency, supports file exclusion patterns.