dotnet-refactor

dotnet-refactor is a command for Claude Code from Metalnib/dotnet-episteme-skills. It costs 73 tokens per session (2,585 once invoked), scanned A, original, MIT.

A guided refactoring process that maps existing code, tests uncertain behavior, designs a change, waits for approval, and checks the finished branch against that design. Refactoring changes code structure without changing its intended behavior.

In plain words
What is it for?
Use it to redesign or improve a specified area of a .NET codebase while controlling when code changes are allowed.
Why use it?
It separates investigation and design from implementation, preserving the work in project files so the process can continue across sessions.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions CLAUDE.md; mentions subagents.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the dotnet-episteme-skills plugin — 14 skills, 3 commands, 2 hooks, 1 MCP server shipped together

Good fit Use it to redesign or improve a specified area of a .NET codebase while controlling when code changes are allowed.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add Metalnib/dotnet-episteme-skills
Claude Code
/plugin install dotnet-episteme-skills

Made for: Claude Code.

Or install dotnet-episteme-skills, the plugin that ships this one along with the rest of its 14 skills, 3 commands, 2 hooks, 1 MCP server.

Wrote 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.

agentmods badge for dotnet-refactor

README.md
[![agentmods](https://agentmods.dev/badge/commands/metalnib/dotnet-episteme-skills/dotnet-refactor/github.svg)](https://agentmods.dev/commands/metalnib/dotnet-episteme-skills/dotnet-refactor)
Your own site
<a href="https://agentmods.dev/commands/metalnib/dotnet-episteme-skills/dotnet-refactor"><img src="https://agentmods.dev/badge/commands/metalnib/dotnet-episteme-skills/dotnet-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.

agentmods 80×15 button for dotnet-refactor

Your own site · 80×15
<a href="https://agentmods.dev/commands/metalnib/dotnet-episteme-skills/dotnet-refactor"><img src="https://agentmods.dev/badge/commands/metalnib/dotnet-episteme-skills/dotnet-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,585 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.02585
Opus 5 $0.00036 $0.01293
Sonnet 5 $0.00015 $0.00517
Haiku 4.5 $0.00007 $0.00259

Measured 3d ago against content hash 085e6c8c317d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

dotnet-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 3d 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.

commands/dotnet-refactor.md · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/dotnet-refactor - orchestrated design loop

You are the orchestrator. Do not enumerate or trace code yourself - dispatch session-blind workers, persist their artifacts, and hold the gates. No code is written or edited until the design is approved at the Phase D gate.

Arguments given: $ARGUMENTS

Step 0 - Resolve target and state

  • Target: a ticket id or an area description. Slug it (e.g. yb-1234 or orderservice-errors).

  • State file: --design-file if given, else .episteme/DESIGN-<slug>.md at the repository root (create .episteme/ if missing; whether the host repo gitignores it is the user's call).

  • If the file exists, route on its frontmatter - the file is the source of truth, never conversation memory. This is the context-compaction contract: after /clear, compaction, or a fresh session, the loop continues losslessly from the file (a plugin hook re-injects it).

    frontmatter resume at
    status: done nothing to resume - say so and stop
    status: blocked restate the recorded blocker, ask the user
    status: awaiting-approval re-present the design, hold the Phase D gate
    status: active the phase in phase:
  • If not, create it:

    ---
    target: <ticket id or area, one line>
    sources: <where the request came from - ticket, MR/PR review thread, QA doc, incident, probe>
    phase: R
    status: active
    design_revision: 0
    ---
    ## Why
    ## References
    ## Map
    ## Traces
    ## Probes
    ## Design (approved)
    ## Decision log
    ## Deferred
    ## Todo
    ## Review findings
    

    Fill Why and References before Phase R, while the request is still fresh. They are the only sections a later reader cannot reconstruct from the code, and a target line is not a problem statement. Why is prose, not a list: the defect or goal in the reader's terms, what triggered the loop, why it is worth doing now rather than later, and what breaks if nothing changes. A loop that cannot state its problem in a paragraph should not be spending a worker fan-out on a map. References is a provenance table: ticket and sibling ticket ids, the review or PR threads, prior QA or design files, the contract/spec source, vendor docs or live schema fetched, probe artifacts, and the host-repo rule sections applied. Cite them as ids and paths, not as bare claims - "the reviewer asked" is unusable six weeks later.

Read the full file on GitHub · 195 lines

Changes

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.

  1. 3d ago Changed · +18 lines 085e6c8c317d
  2. 12d ago First seen · 177 lines · 73 tokens per session scan A 1228a8274bd7

Subscribe to this mod's changes

dotnet-refactor is a command published in the GitHub repository Metalnib/dotnet-episteme-skills (12 stars, last pushed 3d ago), licensed MIT. It adds 73 tokens to every session and 2,585 once invoked, about $0.0004 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-30.