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.00041 | $0.03208 |
| Opus 5.5 | $0.00016 | $0.01283 |
| Sonnet 5.5 | $0.00008 | $0.00642 |
| Haiku 4.5 | $0.00004 | $0.00321 |
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 23d 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.
How it starts
The opening of the file, as written. The whole thing — 404 lines — stays where its author put it; the contents beside it link to each section on GitHub.
REFACTOR-ENGINEER v2.0 — Behavior-Preserving Transformation (Premium)
Mathematical Compliance: This skill implements the DEPTH-MATHEMATICS specification. It computes and outputs ADS phase activation, CEI components, SI components, cognitive traces (refactor safety calculus, refactor ), and verifies Gates V1, V3, V5. It formalizes refactoring as a measurable calculus.
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.
New in v2.0: Mathematical depth metrics, refactor safety calculus, refactor , recursive self-audit, verification gates.
The Protocol
0 — PARAMETERIZE: Read Thinking Parameters
Read thinking_parameters:
require_safety_calculus(default true) — compute refactor safety calculusrequire_refactor_(default true) — issue refactorrecursion_depth(default 1) — recursive self-audit rounds
1 — REFACTOR SAFETY CALCULUS (if require_safety_calculus = true)
NEW IN v2.0 — Formal calculus for refactor safety.
REFACTOR SAFETY CALCULUS
────────────────────────────────────────
Characterization Coverage:
Functions/Methods Characterized: [N/N]
Inputs Documented: [YES/NO]
Outputs Documented: [YES/NO]
Side Effects Documented: [YES/NO]
Edge Cases Covered: [YES/NO]
Characterization Score: [0.0-1.0]
Test Suite Health:
Tests Exist: [YES/NO]
Tests Pass: [YES/NO]
Coverage: [XX%]
Edge Case Coverage: [XX%]
Mutation Score: [XX% — if available]
Test Health Score: [0.0-1.0]
Structural Goal Clarity:
Problem Defined: [YES/NO — duplication/coupling/complexity/naming]
"Better" Defined: [YES/NO — specific, not "cleaner"]
Minimum Change: [YES/NO]
Goal Clarity Score: [0.0-1.0]
Step Granularity:
Max Step Size: [small / medium / large]
Each Step Keeps Tests Green: [YES/NO]
Commit Per Step: [YES/NO]
Structural/Behavioral Separation: [YES/NO]
Granularity Score: [0.0-1.0]
Refactor Safety = (Characterization × 0.3) + (Test_Health × 0.3) + (Goal_Clarity × 0.2) + (Granularity × 0.2) = [0.0-1.0]
Thresholds:
≥ 0.8: SAFE TO REFACTOR
0.5-0.8: CAUTION — address gaps first
< 0.5: UNSAFE — do not refactor until gaps addressed
────────────────────────────────────────
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.
- 23d ago Changed · +345 lines · +18 tokens per session 415d758b84c7
- 1mo 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 (5 stars, last pushed 12d ago), licensed MIT. It adds 41 tokens to every session and 3,208 once invoked, about $0.0002 per session on Opus 5.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
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…
verification-quality
Truth scoring, code-quality verification, and automatic rollback with a high accuracy threshold. Use when validating agent output before it ships, gating changes on quality, or adding a verify-and-rollback safety loop.
refactoring-workflow
Improve the structure of existing code without changing its behaviour, in small verified steps under a green test suite. Use when the user asks to refactor, clean up, restructure or simplify code, wants to reduce duplication or coupling, is preparing a codebase for a feature it cannot currently accommodate, or when…
Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持
A code review check that separates refactoring—changing code structure without changing its behavior—from feature changes that intentionally alter what the software does. It also checks whether tests, type checks, or other evidence support the claim that behavior stayed the same.
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…
qa-advisor
You are a senior software quality engineer conducting a systematic audit of a codebase. Your mandate is to surface real risks — not lint warnings, not style preferences. You evaluate five dimensions: test quality, maintainability, security, reliability/scalability, and delivery health. You are direct, specific, and…