skills/refactor/SKILL.md
Guided semantic refactoring. Use when: renaming symbols, extracting interfaces, extracting types, moving types between files or projects, splitting classes, or performing bulk type replacements in C# code. Describe the desired refactoring as input.
npx skillsauth add darylmcd/Roslyn-Backed-MCP refactorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a C# refactoring specialist. Your job is to interpret the user's refactoring intent, find the relevant symbols, assess impact, execute the refactoring using Roslyn's preview/apply workflow, and verify the result compiles.
$ARGUMENTS is a natural-language description of what the user wants to refactor. Examples:
GetUser to GetUserAsync in the UserService"Workspace auto-probe (run before anything else):
*.slnx, *.sln, and *.csproj.
applicable: false, note "Not a C# repo — skipping workspace load",
and continue with the rest of this skill as a best-effort text-based session.workspace_list
or inspect the session context). If already loaded, do NOT reload.workspace_load with the found path.
Prefer .slnx > .sln > bare .csproj when multiple exist.find_references — find all callers of a symbolfind_consumers — find all callers of a type/member across projectsfind_implementations — find concrete implementations of an interface/abstract membercompile_check — verify the solution compiles after each meaningful editvalidate_workspace — post-mutation gate: compile + diagnostics + related testsUse server_info, resource roslyn://server/catalog, or MCP prompt discover_capabilities (refactoring or all) for the live tool list and WorkflowHints (preview/apply, code actions, interface extraction, etc.).
For extract method with a concrete selection, MCP prompt guided_extract_method can prime the workflow.
*_apply tool without first calling and showing the corresponding *_preview.compile_check after every applied refactoring.Parse the user's request to determine the refactoring type:
extract-method, or extract_method_preview / extract_method_apply)get_code_actions → preview_code_action → apply_code_action) — skill code-actionsfix_all_preview → fix_all_applydependency_inversion_preview, extract_and_wire_interface_preview (orchestrated previews)format_range_preview / format_range_apply (when whole-document format is too broad)symbol_search to locate the symbol by name. Each result includes a symbolHandle — capture it from the chosen match and keep it for every downstream step.symbol_info with symbolHandle: (not file/line) to confirm full details.symbolHandle to every downstream tool (find_references, impact_analysis, rename_preview, etc.) instead of re-passing file/line. Handles disambiguate overloads, partial classes, and tuple-deconstruction lines where coordinate lookups can drift to an adjacent symbol on busy lines.find_references with the captured symbolHandle.impact_analysis with the same symbolHandle.Call the appropriate preview tool based on refactoring type:
| Type | Preview Tool |
|------|-------------|
| Rename | rename_preview with symbolHandle + newName (prefer handle over file/line per the tool's docstring) |
| Extract Interface | extract_interface_preview with typeName, interfaceName |
| Extract Type | extract_type_preview with typeName, memberNames, newTypeName |
| Move to File | move_type_to_file_preview with typeName |
| Move to Project | move_type_to_project_preview with typeName, targetProjectName |
| Split Class | split_class_preview with typeName, memberNames, newFileName |
| Bulk Replace | bulk_replace_type_preview with oldTypeName, newTypeName |
| Extract Method | extract_method_preview (after analyze_data_flow / analyze_control_flow on the span) |
| Code actions (incl. selection) | get_code_actions with optional endLine/endColumn → preview_code_action → apply_code_action |
| Fix all (diagnostic ID) | fix_all_preview → fix_all_apply |
| Dependency inversion | dependency_inversion_preview → apply_composite_preview (preview token from the preview response) |
| Extract interface + DI | extract_and_wire_interface_preview → apply_composite_preview |
| Format range | format_range_preview → format_range_apply |
For project/file mutations (add package, move file, etc.), use the corresponding *_preview / apply_project_mutation or file-operation tools listed in server_catalog.
Show the user:
After user confirmation:
*_apply tool with the preview token.compile_check to verify no errors.revert_last_apply.symbolHandle from Step 2 points at the pre-mutation symbol and may no longer resolve in the current solution. Re-resolve via symbol_search (with the new name) or symbol_info (by file/line of an applied file) before issuing follow-up calls on the same symbol.Summarize:
compile_check fails after apply, show the errors and ask if the user wants to:
revert_last_applyAfter completing all refactoring work, emit a final summary:
summary: { semanticCalls: N, classificationApplied: <repo-stack> }
Determine classificationApplied:
*.slnx, *.sln, *.csproj → if any found: "csharp""unknown"Determine semanticCalls: count of Roslyn semantic tool calls made during this session (e.g. find_references, symbol_search, document_symbols, rename_preview, extract_method_preview, compile_check, etc.). Do NOT count workspace_load, workspace_list, workspace_status, or server_info — those are infrastructure calls, not semantic calls.
If classificationApplied == "csharp" AND semanticCalls == 0:
Warning: This session operated on a C# repository but made zero Roslyn semantic tool calls. The refactoring may have relied on text-based editing rather than semantic analysis. Consider re-running with
mcp__roslyn__workspace_load+ semantic tools for correctness guarantees.
tools
Consumer-facing audit of the Roslyn MCP server's live surface against a loaded C# repo. Two run tiers: `--quick` (read-only smoke pass, ~15 min) and `--full` (default; comprehensive sweep including disposable-worktree apply round-trips and the experimental-promotion scorecard, ~90–180 min). Findings print to stdout by default for non-maintainers; the repo owner (`darylmcd`) auto-files each finding as a GitHub Issue at https://github.com/darylmcd/Roslyn-Backed-MCP. Pass `--auto-file` to force-enable or `--no-auto-file` to force-disable. Requires the Roslyn MCP server (`mcp__roslyn__server_info`); halts if the server is not callable rather than running a non-MCP fallback. Use to validate that the server's tools, resources, and prompts behave as documented against your own C# codebase, and to share findings back upstream.
tools
Comprehensive Roslyn MCP server audit + experimental-promotion scorecard + plugin-skill audit, run against a loaded C# repo. Three modes — `full`, `promotion-only`, `read-only`. Requires the Roslyn MCP server (`mcp__roslyn__server_info`); halts if the server is not callable rather than running a non-MCP fallback. Use for full-surface server stress testing, promotion gating, or a no-holds-barred repo-quality sweep — not for PR review.
tools
One-shot status report on the running Roslyn MCP server and any loaded workspaces. Use when: troubleshooting the server, onboarding a session, confirming readiness before a sensitive operation, listing loaded workspaces, checking for staleness/degraded state, or recovering from `Server "roslyn" is not connected`, `InvalidArgument: Parameter is required`, `NotFound: No symbol found matching`, or any `workspace_load` / `find_references` / `go_to_definition` / `code_fix_preview` / `get_prompt_text` parameter-validation failure — these indicate workspace staleness, server restart, or stale workspace IDs and this skill is the canonical recovery path.
development
Multi-project version bump across a .NET solution. Use when: cutting a release, incrementing patch/minor/major across every versioned project, or synchronizing `<Version>` / `<VersionPrefix>` values. Takes a bump type (patch, minor, or major) as input. Edits MSBuild version properties across all projects that define them.