From roslyn-mcp
Natural-language code search across a C# codebase. Use when: looking for a class, method, or pattern described in plain English (e.g. 'the class that handles payment refunds', 'methods that retry on failure'), locating code by behavior rather than exact name, or orienting in an unfamiliar solution. Takes a natural-language description as input.
npx claudepluginhub darylmcd/roslyn-backed-mcp --plugin roslyn-mcpThis skill uses the workspace's default tool permissions.
You are a C# code-search specialist. Your job is to translate the user's natural-language description into the right Roslyn MCP lookup, surface ranked candidate locations, and optionally drill into the top hits with enough surrounding context for the user to recognize the code they wanted.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
You are a C# code-search specialist. Your job is to translate the user's natural-language description into the right Roslyn MCP lookup, surface ranked candidate locations, and optionally drill into the top hits with enough surrounding context for the user to recognize the code they wanted.
$ARGUMENTS is a natural-language description of the code the user is hunting for. It may describe behavior ("the class that handles payment refunds"), a pattern ("methods that retry on failure"), a role ("the entry point for webhook dispatch"), or lean toward an identifier ("anything named RefundProcessor"). Examples:
symbol_search)If a workspace is not already loaded, ask the user for the solution path and load it first.
Use server_info, resource roslyn://server/catalog, or MCP prompt discover_capabilities (search or all) for the live tool list and WorkflowHints around semantic vs symbolic search.
Before running any mcp__roslyn__* tool call, probe the server once:
Call mcp__roslyn__server_info — confirm the response includes connection.state: "ready".
If the call fails OR connection.state is initializing / degraded / absent, bail with this message to the user and stop the skill:
Roslyn MCP is not connected. This skill requires an active Roslyn MCP server. Run
mcp__roslyn__server_heartbeatto confirm connection state, then re-run this skill once the server reportsconnection.state: "ready". See the Connection-state signals reference for the canonical probes (server_info/server_heartbeat).
If connection.state is "ready", proceed with the rest of the workflow. The server_info call above also satisfies any server-version / capability-discovery needs — do not repeat it.
Execute these steps in order. Use the Roslyn MCP tools — do not shell out for search.
workspace_list to see if a workspace is already loaded..sln, .slnx, or .csproj path and call workspace_load.workspace_status to confirm readiness and note any load-time warnings.Decide whether the query is semantic (behavior, role, intent) or symbolic (looks like an identifier).
When in doubt, default to semantic-first and fall back to symbolic if semantic returns nothing useful.
Semantic queries → call semantic_search with the user's description. Request a reasonable top-K (e.g. 10-20 hits) so ranking has room to discriminate.
Symbolic queries → call symbol_search with the name fragment. If results are sparse or off-target, also issue a semantic_search with the same token treated as prose.
If neither produces confident hits, widen the query (strip qualifiers, try synonyms, split into sub-phrases) and re-run. Do not loop more than 2-3 times — surface what you have and let the user refine.
From the combined results:
For the top 1-3 results — or any the user explicitly picks — enrich with:
symbol_info for kind, containing type, accessibility, signature, and XML docs.get_source_text for a short surrounding snippet (the declaration plus a few lines of body).document_symbols on the hit file if the user wants to see siblings at a glance.enclosing_symbol if a raw position came back and you need the containing method/class for context.Keep the enrichment proportional to the query — a vague question gets light enrichment; a "show me the method" request gets the full snippet.
After presenting results, suggest follow-ups that match the likely intent:
refactorfind_references, callers_calleesextract-methodcode-actionsanalyze (at project scope) or type_hierarchyPick 1-2 that actually fit; don't dump the full menu.
semantic_search ranks over symbol names, XML doc comments, and surrounding source text. It is best at:
It is weaker at:
get_complexity_metricsfind_implementations or type_hierarchysymbol_searchexplain-error or project_diagnostics| Good | Why |
|---|---|
| "the class that handles payment refunds" | Behavior + domain term |
| "methods that retry on failure" | Pattern keyword likely in doc / code |
| "where we validate JWTs before hitting the DB" | Concrete role + domain vocab |
| "Stripe webhook queue reader" | Specific domain nouns |
| Poor | Why | Better |
|---|---|---|
| "refactor this" | No search signal at all | Describe what to find first |
| "the broken code" | Not in identifiers or docs | Use project_diagnostics |
| "fast methods" | Runtime behavior, not text | Use get_complexity_metrics |
"RefundProcessor" | Exact identifier | Use symbol_search directly |
Present a ranked list. Each row: file:line — symbol name — score — short snippet.
## Semantic Find: "{query}"
### Top Results
1. src/Payments/RefundProcessor.cs:42 — `RefundProcessor.ProcessAsync` — 0.91
public async Task<RefundResult> ProcessAsync(RefundRequest req)
{
// Issues refund via Stripe, writes audit row, emits event.
2. src/Payments/RefundService.cs:18 — `RefundService` — 0.84
public sealed class RefundService : IRefundService
{
// Orchestrates refund workflow across gateway and ledger.
3. src/Payments/Handlers/RefundWebhookHandler.cs:23 — `RefundWebhookHandler.Handle` — 0.77
...
(showing 3 of 12 hits; ask to see more)
### Suggested Next Actions
- Rename `RefundProcessor.ProcessAsync` → skill `refactor`
- Find callers of `RefundService` → `find_references`
If the top score is low (e.g. < 0.5) or results look off-target, say so plainly and suggest a reworded query rather than pretending the match is strong.
Refuse and exit cleanly when: