refactoring-csharp

Performs C# symbol renaming and refactoring in .NET solutions or multi-solution monorepos using one-off Roslyn CLI commands; suitable for renaming symbols, previewing impact, updating references across solutions, or refactoring shared projects.

Last repository push
GitHub Stars
194
Forks
17
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "refactoring-csharp" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-99ee23947369b4e2be9aecf9d92d73bea478399740597a819a84c6658c4eb2df. Verify the upstream source and version against https://github.com/CodeAlive-AI/ai-driven-development before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Performs C# symbol renaming and refactoring in .NET solutions or multi-solution monorepos using one-off Roslyn CLI commands; suitable for renaming symbols, previewing impact, updating references across solutions, or refactoring shared projects.

0 Downloads

Introduction source: third_party · CodeAlive-AI · 0.0.1 Reference

SkillPi interpretation

Tasks
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.
Inputs and outputs
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.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
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:

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:

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:

/<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

Field Required Default Notes
solution_path yes - Absolute path to the .sln/.slnx file, or a repository directory for monorepo-wide refactoring.
file_path yes - Absolute path to a file inside the solution.
line_number yes - 1-based line number. Use the value reported by rg -n.
old_name yes - Exact current identifier on that line. This is the anchor.
new_name yes - Must be a valid C# identifier.
dry_run no false Apply changes by default. Preview only when explicitly set to true.
rename_overloads no false Keep overloads unchanged by default.
rename_in_strings no false String literals stay untouched by default.
rename_in_comments no true Comments are renamed by default.
rename_file no true Safe 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.

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 code Meaning What to do
invalid_solution_path Solution 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_path File path is missing or not present on disk. Ask for the correct file path.
file_not_in_solution The file is not part of the loaded solution. Ask for the correct file or solution.
invalid_line_number Line number is outside file bounds or not 1-based. Ask for the correct line.
invalid_old_name old_name was empty or whitespace. Ask for the exact current name.
old_name_not_found_on_line No renameable symbol with that name exists on the line. Ask for a better line or file.
ambiguous_old_name_on_line More than one renameable symbol matches that name on the line. Narrow the target or use a different line.
unsupported_symbol_kind Roslyn found a symbol, but this kind is not renameable here. Move to a supported symbol kind.
symbol_not_in_source The symbol is not declared in source. Pick a source-backed target.
invalid_new_name new_name is not a valid C# identifier. Propose a valid identifier.
same_name New name equals the current name. Ask for a different name.
no_changes Roslyn produced no text edits. Re-check the target or the new name.
apply_failed Workspace apply failed. Treat as a runtime failure and retry only if the state is unchanged.
operation_timeout The 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.

Recommended Output Style

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

Version history

  1. v10.11.0 GitHub ↗
    Original release notes

    ## pragmatic-architecture (new) A design method for simple solutions that are not fragile, from the choice of model, state ownership and boundaries down to the order of implementation steps. It unfolds Kent Beck's rule: "For each desired change, make the change easy (warning: this may be hard), then make the easy change." - **Two tests, in order.** A design that breaks a must under a realistic sequence of events is out. Among the admissible ones, prefer the design in which this change and the next plausible ones cost least. - **A route of eight steps,** each ending in an output, from naming the change to rehearsing it. How deep to go is decided by what the change touches, not by the size of the diff. - **The context that decides a design** is part of the method: eight groups of facts, a filter question, criteria, cost over the horizon and a stopping condition (`references/context.md`). - **A property card for each promise at risk:** mechanism, assumptions, a counterexample of 3-4 events, the nearest failure the mechanism does not stop, evidence, recovery. - References on models and boundaries, failure and recovery, the change path, and 22 moves indexed by symptom. The `architecture-consilium` skill in [pragmatic-orchestration](https://github.com/CodeAlive-AI/pragmatic-orchestration) applies the method with several independent architect models. Not measured yet: the effect of the skill on real design work. One probe on a single task showed no difference with and without the core; the task was too easy to tell. ## pragmatic-verification - Case design: a mode, setting or permission the user can turn on needs a case that turns it off again and one that shows which state is current. ## maintaining-macos-health - `mac-heavy` rewritten: a holder blocks other heavy jobs only while it is busy (its first 45 s, or while its process tree uses at least 50 % CPU or 1024 MB RSS), so something light wrapped by mistake no longer holds the queue. ## fetch-url-as-markdown - The script runs through `uv` with an inline PEP 723 header and a lock file, instead of a system-wide `pip` install.

  2. v10.10.0 GitHub ↗
    Original release notes

    ## pragmatic-verification Three gaps found by an experiment in which two models planned the verification of a real issue with and without the skill: - **Time bounds are boundaries.** Delays, timeouts, expiry and upper caps are checked just before and just after the bound with a controlled clock, including the cap that ends waiting and a wait that outlives the process. - **Platform rules a substitute does not enforce.** The fidelity questions for a significant fake now ask which rules of the real platform (required user-visible effects, permissions, background limits, quotas, sizes, signing) the substitute skips. - **The purpose after release.** When a change exists to move an outcome only real use shows, closeout names the signal, its baseline and when it is read, and reports the purpose as not verified until then. ## maintaining-macos-health - Memory guard: recalibrated alert and kill thresholds, swap gated on VM free space, limited freezes, a 60-second projection; the 120-second frozen-unit hold and the repeat-offender exception restored; ALERT on slow swap growth with less than 10 GiB free. ## skills-management - `install_skill.py --link` no longer refuses to link a canonical source that the duplicate audit finds at the same real path. - A project-scope install from inside a skill directory is refused, and the CLI prints the same command with `--scope global`. ## fpf-problem-solving - Library synced with upstream; new Core patterns routed. ## Docs - README: the `openrouter-provider-ranking` skill now points to rodion-m/model-that-fits-my-task; the skill tree is rebuilt.

  3. v10.9.0 GitHub ↗
    Original release notes

    - **Renamed:** `verification-playbook` is now `pragmatic-verification`. Install it under the new name; the old name no longer exists. - **New: audit of an existing project.** The skill now audits the tests, gates and QA practice of a project with no particular change at hand (`references/suite-audit.md`). The auditor sizes the project, asks once (scope, worker models, parallelism, whether anything may be run), splits the tests into shards, lets cheaper worker models scan them, verifies their claims itself and reports three to seven ranked, concrete fixes. Read-only and static by default. No score and no coverage target. - **Worker contract** (`references/suite-audit-worker.md`): lettered signals for self-confirming and vacuous tests, doubles, level, duplicates, brittle and flaky sources, checks that may be off, heavy setup and UI hygiene. Every finding carries a file, a line and one line quoted exactly, so locations are checked mechanically. - **Calibrated on a real repository** with three worker models (21 runs). What the run changed: - The auditor reads each critical shard itself and also gives it to one worker. One model found between a third and two thirds of what three found together. - Shards stay at about 2,000 lines for any model: a larger shard gave every model fewer findings per line. - Findings of several workers are joined by location, recall is counted by signal family, and search hits are classified by reading before they serve as the answer key. - Delivery rules for harnesses confined to the repository, and a read-only check that compares the audited files with the recorded revision. - The worker's own confidence is not used to pick what to verify.

  4. v10.8.0 GitHub ↗
    Original release notes

    - New `verification-playbook` skill: a language-agnostic playbook for thoughtful tests and checks. For each risk, pick the cheapest check that still contains the mechanism of the defect and lets the correct result be observed. - Decides what goes to unit, integration, contract or e2e, when to mock and what must stay real, and how to avoid self-confirming, redundant, brittle and flaky tests. - Plans and runs QA passes through browser, computer or phone use, and closes out with per-claim evidence statuses (verified / partially verified / not verified / blocked). - Compact `SKILL.md` (~2k tokens) with a read-when table, eight topical references and per-stack tooling files (Python, TypeScript/JavaScript, JVM, .NET, Go, mobile).

  5. v10.7.0 GitHub ↗
    Original release notes

    - New `mac-heavy` wrapper (maintaining-macos-health): one Mac-wide slot for heavy local work (lint, type checks, tests, installs, land gates); admits only while the memory guard reports CALM; nested calls run inline; default wait 30 min, exit 75 on timeout; `mac-heavy status` shows holder, waiters and guard level; best-effort ledger without argv. - The memory guard now writes a live status file every sample (`~/.local/state/mac-health/memory-guard.status`), atomically, at mode 0600. - If the guard status is unavailable, admission warns visibly and uses the slot alone.

Only the five most recent versions are shown. View full version history at the source ↗

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 面向 .NET 开发者的专业重构工具,解决跨解决方案符号重命名核心痛点
  • 支持单体仓库多解决方案场景,提供完整 CLI 工具链和错误处理指南
Trigger Precision92/100

Highlights

  • 触发条件精准:明确区分单解决方案与多解决方案目录模式
  • 参数定义完整:solution_path、file_path、line_number 等关键参数边界清晰
Structure and Standards95/100

Highlights

  • 文档结构完整:涵盖 CLI 用法、契约、行为规则、错误处理等必要章节
  • 提供端到端示例和详细操作流程,frontmatter 齐全
Execution Reliability90/100

Highlights

  • 工具来源明确:基于 Roslyn 的 CLI,提供预编译和源码两种运行方式
  • 错误处理完善:17 种错误码覆盖主要异常,dry_run 模式支持安全预览
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.