Agent skill

Refactoring Csharp

by CodeAlive-AI in CodeAlive-AI/ai-driven-development

Rename and refactor C symbols in a .NET solution or multi-solution monorepo with a one-shot Roslyn CLI.

MITAuto-check passedDevelopment

Install Refactoring Csharp

skills CLI
$ npx skills add CodeAlive-AI/ai-driven-development --skill refactoring-csharp -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install CodeAlive-AI/ai-driven-development refactoring-csharp --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/CodeAlive-AI/ai-driven-development.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/refactoring-csharp .claude/skills/refactoring-csharp && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactoring-csharp
GitHub stars
155
Token cost
~2.5k tokens
SKILL.md length
1,267 words
Files
26
Skills in repo
22
Repo updated
First seen
Licence
MIT

At a glance

Rename and refactor C symbols in a .NET solution or multi-solution monorepo with a one-shot Roslyn CLI.

  • Works in 5 steps: Use rg -n to locate the symbol and copy… → Call rename-symbol once without the… → Use dryRun=true only when the user… → …
  • The user asks to rename a symbol
  • SKILL.md covers Contents, Canonical CLI, Contract and How To Use It, plus 7 more sections
  • Runs C#, Shell and PowerShell scripts from its folder; calls dotnet and rg

What it does

Refactoring Csharp is an agent skill from CodeAlive-AI/ai-driven-development. Rename and refactor C symbols in a .NET solution or multi-solution monorepo with a one-shot Roslyn CLI. Use when the user asks to rename a symbol, preview impact, update references across a solution, or refactor shared projects across several solutions.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 31 other files (for example `README.md`, `install.sh` and `release.sh`).

It sits in Development, covering Refactoring and Monorepo tooling. It works with C# and .NET. The repository describes itself as: Practices, protocols, and skills for AI-driven software development. Skills and safety hooks for Claude Code, Codex, OpenCode, Cursor, Antigravity, and any agent supporting the… The licence is MIT.

When your agent uses it

  • The user asks to rename a symbol
  • Update references across a solution
  • Refactor shared projects across several solutions

Example prompts

  • “/refactoring-csharp”

Requirements

  • A Bash shell
  • PowerShell

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Use rg -n to locate the symbol and copy the 1-based line number directly.
  2. Call rename-symbol once without the dryRun argument for normal rename requests. This applies the rename.
  3. Use dryRun=true only when the user explicitly asks for preview, when the target is ambiguous, or when the rename is unusually broad/risky…
  4. Do not run a dry run just because the tool supports it. The tool loads the solution on every call, so preview+apply doubles the cost on…
  5. Summarize the result by reporting the original name, new name, changed document count, total text changes, changed files, and any file move.

What it can do on your machine

Read from SKILL.md and the folder at commit 25b7b1d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (C#, Shell and PowerShell, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • dotnet
    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactoring Csharp loads about 2.5k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 1,267 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from CodeAlive-AI/ai-driven-development at commit 25b7b1d, republished under its MIT licence (© CodeAlive-AI). 1,267 words, ~2,478 tokens.

Download SKILL.mdSave it as .claude/skills/refactoring-csharp/SKILL.md (or your agent's skills folder). This skill also uses 25 other files; get the full folder from GitHub.
name
refactoring-csharp
description
Rename and refactor C# symbols in a .NET solution or multi-solution monorepo with a one-shot Roslyn CLI. Use when the user asks to rename a symbol, preview impact, update references across a solution, or refactor shared projects across several solutions.

Refactoring C# Symbols

This skill ships a Roslyn-based C# rename CLI in src/. It is intentionally one-shot and stateless: one call resolves the target, validates the request, and returns either a preview or an applied rename. There is no public prepare step.

Contents

Canonical CLI

If the skill was installed by install.sh, prefer the prebuilt CLI:

bash
bin/csharp-refactor rename-symbol <sln|slnx|directory> <file> <line> <oldName> <newName> [dryRun=false|true]

Otherwise run the bundled source CLI from the skill directory:

bash
dotnet run --project src/CSharpRefactoring.Cli -- rename-symbol <sln|slnx|directory> <file> <line> <oldName> <newName> [dryRun=false|true]

When invoked from outside the skill directory, use an absolute project path:

bash
/<skill-dir>/bin/csharp-refactor rename-symbol <sln|slnx|directory> <file> <line> <oldName> <newName> [dryRun=false|true]
# or, if no prebuilt binary is installed:
dotnet run --project /path/to/refactoring-csharp/src/CSharpRefactoring.Cli -- rename-symbol <sln|slnx|directory> <file> <line> <oldName> <newName> [dryRun=false|true]

The tool project may create normal bin/ and obj/ directories under the skill. That is expected and useful: it lets repeated runs reuse the .NET build cache instead of rebuilding the CLI from scratch.

The target solution is not redirected to a temporary build output. The CLI opens the solution from the solution directory and lets Roslyn/MSBuild use the target project's normal build cache (obj/, bin/, or the repository's configured artifacts layout). This is intentional: it avoids creating a second cache tree for the project being refactored and lets repeated renames benefit from the project's existing MSBuild/Roslyn design-time build cache.

Contract

FieldRequiredDefaultNotes
solution_pathyes-Absolute path to the .sln/.slnx file, or a repository directory for monorepo-wide refactoring.
file_pathyes-Absolute path to a file inside the solution.
line_numberyes-1-based line number. Use the value reported by rg -n.
old_nameyes-Exact current identifier on that line. This is the anchor.
new_nameyes-Must be a valid C# identifier.
dry_runnofalseApply changes by default. Preview only when explicitly set to true.
rename_overloadsnofalseKeep overloads unchanged by default.
rename_in_stringsnofalseString literals stay untouched by default.
rename_in_commentsnotrueComments are renamed by default.
rename_filenotrueSafe file move for supported named types. Never recreate the file as delete+add.

How To Use It

  1. Use rg -n to locate the symbol and copy the 1-based line number directly.
  2. Call rename-symbol once without the dryRun argument for normal rename requests. This applies the rename.
  3. Use dryRun=true only when the user explicitly asks for preview, when the target is ambiguous, or when the rename is unusually broad/risky and applying immediately would be irresponsible. The CLI also accepts true, --dry-run, dryRun=false, false, and --no-dry-run; invalid values fail fast and must never silently apply.
  4. Do not run a dry run just because the tool supports it. The tool loads the solution on every call, so preview+apply doubles the cost on large projects.
  5. Summarize the result by reporting the original name, new name, changed document count, total text changes, changed files, and any file move.

Monorepo Directory Mode

Use directory mode only when a repository contains multiple .sln/.slnx files or shared projects that are not all present in one normal solution. For ordinary repositories, pass the specific solution file because it is faster and avoids scanning unrelated projects.

When solution_path is a directory:

  • Pass the repository or workspace root as solution_path.
  • Keep file_path as the absolute path to the target source file.
  • The tool recursively discovers .sln, .slnx, and supported project files under the directory.
  • It merges them into one temporary .slnx, opens that aggregate solution, performs the rename, and deletes the temporary solution directory before returning.
  • The temporary aggregate solution lives outside the target repository; source files and normal project build caches remain in their original locations.

Important Behavioral Rules

  • The tool is stateless. It loads the solution on every call.
  • If solution_path is a directory, the tool scans it recursively, merges discovered .sln, .slnx, and project files into one temporary .slnx, opens that solution, runs the rename, and deletes the temporary solution directory before returning.
  • A preview does not reserve state. If the workspace changes between preview and apply, rerun the preview.
  • Prefer one apply call over preview+apply when the user already asked to perform the rename.
  • For a .sln/.slnx input, the tool runs Roslyn from the target solution directory. For a directory input, it runs Roslyn from that directory while opening the temporary aggregate solution. In both modes, project files stay in place and use the target project's normal MSBuild outputs.
  • Do not invent a session or hidden prepare state.
  • Do not ask for a column number. The tool resolves from file_path, line_number, and old_name.
  • old_name is mandatory because it disambiguates the target when a line contains more than one renameable identifier.
  • The bundled source requires .NET 10 and restores NuGet packages on first run.
  • Let the tool keep its own normal bin/ and obj/ cache unless the user explicitly asks for a clean/no-cache run.
  • If the tool returns a preview, say preview. If it returns applied changes, say applied.
  • Keep responses concise and action-oriented. Tell the user what changed and whether a file move happened.
Show full SKILL.md (458 more words)Show less

Supported Targets

Treat these as supported rename targets when the Roslyn symbol is source-backed and CanBeReferencedByName:

  • NamedType
  • Method
  • Property
  • Field
  • Event
  • Parameter
  • Local
  • TypeParameter
  • Namespace

Do not rename constructors, destructors, static constructors, or indexers.

File Rename Nuance

rename_file=true is a convenience default, but it only produces a real safe move when the symbol is a single-declaration named type and the file stem matches the current type name.

If the tool does not return file_move_from_path and file_move_to_path, the symbol rename is still valid, but the file itself was not moved. Do not claim a file rename happened unless the tool reports it.

This is intentionally conservative so git sees a tracked rename instead of a delete+add pair.

Error Handling

Use the tool's error codes as actionable guidance:

Error codeMeaningWhat to do
invalid_solution_pathSolution path is missing, does not exist, or is neither .sln/.slnx nor a directory.Ask for a real solution path or repository directory.
invalid_file_pathFile path is missing or not present on disk.Ask for the correct file path.
file_not_in_solutionThe file is not part of the loaded solution.Ask for the correct file or solution.
invalid_line_numberLine number is outside file bounds or not 1-based.Ask for the correct line.
invalid_old_nameold_name was empty or whitespace.Ask for the exact current name.
old_name_not_found_on_lineNo renameable symbol with that name exists on the line.Ask for a better line or file.
ambiguous_old_name_on_lineMore than one renameable symbol matches that name on the line.Narrow the target or use a different line.
unsupported_symbol_kindRoslyn found a symbol, but this kind is not renameable here.Move to a supported symbol kind.
symbol_not_in_sourceThe symbol is not declared in source.Pick a source-backed target.
invalid_new_namenew_name is not a valid C# identifier.Propose a valid identifier.
same_nameNew name equals the current name.Ask for a different name.
no_changesRoslyn produced no text edits.Re-check the target or the new name.
apply_failedWorkspace apply failed.Treat as a runtime failure and retry only if the state is unchanged.
operation_timeoutThe rename timed out.Retry with a larger timeout or a narrower target.

Success Criteria

A rename workflow is complete when:

  • The target was resolved from line_number + old_name.
  • The user approved the rename, or explicitly requested a dry run only.
  • The tool returned changed documents, total text changes, and any file move details.
  • The final answer makes the applied scope clear enough for the user to trust the change.
  • For previews, say what would change and that nothing was applied.
  • For applied changes, say what changed and whether the file was moved.
  • If the file move fields are present, mention them explicitly.
  • If the tool returned an error code, echo the code and the human-readable reason.

© CodeAlive-AI, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 25 other files in skills/refactoring-csharp of CodeAlive-AI/ai-driven-development.

  • SKILL.md
  • .gitignore
  • README.md
  • install.ps1
  • install.sh
  • release.sh
  • src/CSharpRefactoring.Cli/CSharpRefactoring.Cli.csproj
  • src/CSharpRefactoring.Cli/Program.cs
  • src/CSharpRefactoring.Cli/sample/SampleTarget/Program.cs
  • src/CSharpRefactoring.Cli/sample/SampleTarget/SampleRenameDemo.sln
  • src/CSharpRefactoring.Cli/sample/SampleTarget/SampleRenameDemo.slnx
  • src/CSharpRefactoring.Cli/sample/SampleTarget/SampleTarget.csproj
  • src/CSharpRefactoring.Core.Tests/CSharpRefactoring.Core.Tests.csproj
  • src/CSharpRefactoring.Core.Tests/CSharpSymbolRenamerTests.cs
  • src/CSharpRefactoring.Core/CSharpRefactoring.Core.csproj
  • … and 11 more

Open the folder on GitHubat commit 25b7b1d

Compare with similar skills

Refactoring Csharp next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactoring Csharp compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactoring Csharp this skillCodeAlive-AI/ai-driven-development155—~2.5kAutomated safety check: PassMIT
Add Refactoringdotnet/roslynator3.5k—~946Automated safety check: PassCustom licence
Dynamo Dotnet ExpertDynamoDS/Dynamo2k—~909Automated safety check: PassApache-2.0
Deprecate Analyzer Or Refactoringdotnet/roslynator3.5k—~511Automated safety check: PassCustom licence
Okojo Test262akeit0/okojo160—~742Automated safety check: PassMIT
Dotnet10 Featuresrunceel/ReactiveProperty944—~2.7kAutomated safety check: PassMIT

Similar skills

  • Add Refactoring

    dotnet/roslynator

    Official

    A skill your agent uses when adding a new RR refactoring in roslynator, editing Refactorings.xml, registering in RefactoringContext, or when refactorings-testing.md shows XunitRefactoringVerifier —…

    3.5k GitHub stars~946 tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Dynamo Dotnet Expert

    DynamoDS/Dynamo

    Write and review C/.NET code in Dynamo following Dynamo coding standards, modern C patterns, and repo conventions.

    2k GitHub stars~909 tokensUpdated today
    DevelopmentAuto-check passed
  • Official

    A skill your agent uses when obsoleting or retiring RCS, RR, or RCF in roslynator, replacing an analyzer with another id, or when tempted to use IsObsolete on an Analyzer entry — analyzers use…

    3.5k GitHub stars~511 tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Okojo Test262

    akeit0/okojo

    Run and continue Okojo Test262 compliance work. An agent skill from akeit0/okojo.

    160 GitHub stars~742 tokensUpdated 16 days ago
    DevelopmentAuto-check passed
  • Dotnet10 Features

    runceel/ReactiveProperty

    Reference for the .NET 10 / C 14 features that are relevant to the ReactiveProperty repository.

    944 GitHub stars~2.7k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Refactor Analysis

    Samsung/TizenFX

    Automatically scans the TizenFX codebase on a rotating schedule to discover .NET 8 / C 12+ refactoring targets and register them as GitHub Issues.

    214 GitHub stars~2.6k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from CodeAlive-AI/ai-driven-development

All 22 skills in this repo
  • Investigating Repository History

    CodeAlive-AI/ai-driven-development

    Investigate GitHub repository history before risky code changes using git blame/log, GitHub PRs, review comments, squash/rebase/cherry-pick/rename heuristics, and cited evidence.

    155 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Plugins Management

    CodeAlive-AI/ai-driven-development

    Create, publish, delete, and submit plugins for coding agents (Claude Code, OpenCode, Devin CLI/Desktop).

    155 GitHub stars~3.1k tokensUpdated yesterday
    Auto-check: notes
  • Semantic Scholar Deep

    CodeAlive-AI/ai-driven-development

    Deep research over the Semantic Scholar Graph API. An agent skill from CodeAlive-AI/ai-driven-development.

    155 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed
  • Windows QA Engineer

    CodeAlive-AI/ai-driven-development

    A skill your agent uses when testing Windows 11 desktop apps (WinForms/WPF/UWP) via UFO UIA/Win32 automation MCP.

    155 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • Agentic Readiness

    CodeAlive-AI/ai-driven-development

    Audit and improve repositories for reliable agentic work across Codex and Codex App, Claude Code, and OpenCode.

    155 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Hooks Management

    CodeAlive-AI/ai-driven-development

    Manage hooks and automation for coding agents (Claude Code, Codex CLI, OpenCode, Devin CLI/Desktop).

    155 GitHub stars~4.8k tokensUpdated yesterday
    Auto-check: notes

Works with

Categories

Questions about Refactoring Csharp

What does Refactoring Csharp do?

Rename and refactor C symbols in a .NET solution or multi-solution monorepo with a one-shot Roslyn CLI. Refactoring Csharp is an agent skill from CodeAlive-AI/ai-driven-development.NET solution or multi-solution monorepo with a one-shot Roslyn CLI.

When should I use Refactoring Csharp?

Refactoring Csharp fits situations like: the user asks to rename a symbol; update references across a solution; refactor shared projects across several solutions.

How do I install Refactoring Csharp in Claude Code?

Run `npx skills add CodeAlive-AI/ai-driven-development --skill refactoring-csharp -a claude-code`. Or copy the skill folder (skills/refactoring-csharp in CodeAlive-AI/ai-driven-development) into .claude/skills/refactoring-csharp in your project. Claude Code loads it when a task matches its description.

How do I install Refactoring Csharp in Codex?

Run `npx skills add CodeAlive-AI/ai-driven-development --skill refactoring-csharp -a codex`. Or copy the skill folder (skills/refactoring-csharp in CodeAlive-AI/ai-driven-development) into .agents/skills/refactoring-csharp in your project. Codex loads it when a task matches its description.

Can I use Refactoring Csharp in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add CodeAlive-AI/ai-driven-development --skill refactoring-csharp -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactoring-csharp, .gemini/skills/refactoring-csharp, .github/skills/refactoring-csharp and .opencode/skills/refactoring-csharp in your project.

What does Refactoring Csharp need to run?

Going by SKILL.md and its folder, Refactoring Csharp needs C#, a shell and PowerShell for the scripts in its folder and the command-line tools its instructions call (dotnet and rg). Our summary lists: A Bash shell; PowerShell.

Does Refactoring Csharp access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Refactoring Csharp safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Refactoring Csharp use?

Refactoring Csharp is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactoring Csharp use?

About 2.5k tokens (SKILL.md is roughly 9.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Refactoring Csharp?

Skills that share tags, products or a category with Refactoring Csharp: Add Refactoring (dotnet/roslynator, 3.5k stars), Dynamo Dotnet Expert (DynamoDS/Dynamo, 2k stars), Deprecate Analyzer Or Refactoring (dotnet/roslynator, 3.5k stars) and Okojo Test262 (akeit0/okojo, 160 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactoring Csharp?

CodeAlive-AI (a GitHub organization) maintains it in CodeAlive-AI/ai-driven-development, which has 155 GitHub stars. The repository holds 22 skills in this directory. The repository was last updated on October 6, 2026.

Source: CodeAlive-AI/ai-driven-development on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.