/dotnet:codelensfrom dotnet
Use when reading, diagnosing, or refactoring a file in a .NET solution, covering the roslyn-codelens MCP server
Ships in dotnet. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Covers the roslyn-codelens MCP server over a loaded solution. Tools resolve every symbol through the compilation, and text search matches characters and misses aliases, partial types, generic instantiations, and metadata symbols.
Before a text search on a .cs, .razor, or .cshtml file, the target decides the tool:
search_symbols or find_referencesfind_attribute_usagesfind_reflection_usagergBefore reading a .cs file, the wanted view decides:
get_file_overview or get_type_overviewanalyze_methodget_method_source with every name in one call| [INDEX] | [TOOL] | [USE_WHEN] |
|---|---|---|
| [01] | find_implementations | "What implements this interface?" / "What extends this class?" |
| [02] | find_callers | "Who calls this method?" / "What depends on this?" |
| [03] | find_event_subscribers | "Who subscribes to this event?" |
| [04] | find_references | "Where is this symbol used?" / "Who writes to it?" (kinds filter) |
| [05] | find_tests_for_symbol | "What tests cover this method?" / "Which tests will break if I change X?" |
| [06] | get_test_summary | "What does this test suite cover?" |
| [07] | find_uncovered_symbols | "Which public members does no test reach?" |
| [08] | go_to_definition | "Where is this defined?" / "Jump to source" |
| [09] | search_symbols | "Find types or methods matching this name" |
| [10] | get_type_hierarchy | "What is the inheritance chain?" |
| [11] | get_symbol_context | "Give me everything about this type" |
| [12] | get_public_api_surface | "What is the public API of this library?" |
| [13] | find_breaking_changes | "Will this break consumers?" |
| [14] | get_di_registrations | "Where is this registered?" / "What is the DI lifetime?" |
| [15] | get_project_dependencies | "What does this project reference?" |
| [16] | get_nuget_dependencies | "What packages does this project use?" / "What is the assembly name?" |
| [17] | find_reflection_usage | "Is this used dynamically?" |
| [18] | find_attribute_usages | "Find all [Authorize] controllers" / "What holds this attribute?" |
| [19] | find_obsolete_usage | "What calls an [Obsolete] member?" / "Which deprecations are pending?" |
| [20] | get_diagnostics | "Are there compiler errors?" / "Show warnings" |
| [21] | get_code_fixes | "How do I fix this warning?" |
| [22] | trust_solution | "Authorize analyzers for another solution" |
| [23] | list_trusted_paths | "Is this solution trusted?" |
| [24] | revoke_trust | "Withdraw analyzer trust for this path" |
| [25] | get_code_actions | "What refactorings are available here?" |
| [26] | apply_code_action | "Apply this refactoring" / "Extract method" |
| [27] | rename_symbol | "Rename this symbol everywhere" / "Change this name across the solution" |
| [28] | change_signature | "Add, remove, or reorder a parameter and fix all the callers" |
| [29] | resolve_stack_trace | "Where did this exception come from?" / "Resolve this stack trace" |
| [30] | find_unused_symbols | "Is there dead code?" |
| [31] | get_complexity_metrics | "Which methods are too complex?" / "What do I refactor first?" |
| [32] | find_naming_violations | "Check naming conventions" |
| [33] | find_async_violations | "Are there async bugs?" / "Find sync-over-async" |
| [34] | find_disposable_misuse | "Are there resource leaks?" / "Find a missing using" |
| [35] | get_exception_flow | "What can escape this method?" / "Where does this exception get caught?" |
| [36] | find_throw_sites | "Where is this exception type thrown?" |
| [37] | find_catch_blocks | "Who catches this?" / "What is swallowing exceptions?" |
| [38] | find_large_classes | "Find classes that need splitting" |
| [39] | find_god_objects | "Which classes are doing too much?" |
| [40] | find_circular_dependencies | "Are there circular dependencies?" |
| [41] | check_architecture | "Is anything violating our layering?" / "Does Api reference Infrastructure?" |
| [42] | get_project_health | "How is this project doing?" / "Top hotspots across all dimensions" |
| [43] | get_source_generators | "What source generators are active?" |
| [44] | get_generated_code | "Show generated code" |
| [45] | inspect_external_assembly | "What does this NuGet package expose?" / "Show me the API of X assembly" |
| [46] | peek_il | "Show IL for this method" / "What does this external method do?" |
| [47] | list_solutions | "What solutions are loaded?" |
| [48] | rebuild_solution | "Reload the solution" / "Diagnostics are stale" |
| [49] | start_background_task | "Run a long rebuild without blocking" |
| [50] | get_task_status | "Check on a queued background task" |
| [51] | list_running_tasks | "Which background tasks are running?" |
| [52] | analyze_data_flow | "Which variables are read or written here?" |
| [53] | analyze_control_flow | "Is this code reachable?" |
| [54] | analyze_change_impact | "What breaks if I change this?" |
| [55] | get_type_overview | "Give me everything about this type in one call" |
| [56] | analyze_method | "Show signature, callers, and outgoing calls" |
| [57] | get_method_source | "Show me this method's body" / "Give me the source of these members" |
| [58] | get_overloads | "What overloads does this method have?" |
| [59] | get_extension_methods | "What can I call on this type?" / "Is there an extension for X?" |
| [60] | get_instantiation_options | "How do I construct this?" / "Why can I not new this up?" |
| [61] | get_operators | "What operators does this type define?" |
| [62] | get_call_graph | "Transitive callers or callees, depth-bounded" |
| [63] | get_file_overview | "What types are in this file?" |
| [64] | generate_test_skeleton | "Scaffold a test class for this type or method" |
go_to_definition — file and line where a symbol is declaredsearch_symbols — case-insensitive substring lookup over types, methods, properties, and fieldsfind_references — each occurrence in the solution as one item with a ReferenceKind, kinds filters on the serverresolve_stack_trace — maps a pasted .NET stack trace to file, line, and symbol, items keep trace order
in file:lineorigin="metadata", every other frame with origin="unresolved"kind="unknown"Reference kinds:
read, write (assignment target, out argument), readwrite (compound assignment, ++/--, ref argument)invocation, method_group (method used as a delegate)object_creation, cast ((T)x, x as T)type_check (x is T, is T v, case T v:), typeof, base_type, type_constraint, type_argumentdeclaration (variable, parameter, return, and field type positions), attribute, nameof, xml_doc (<see cref=...>)usage is a rare fallbackread, _map[k] = v and _map.Add(k, v) read field _map while its contents changeget_file_overview — types and diagnostics of a file, .razor and .cshtml resolve to their generated C# documentget_type_overview — context, hierarchy, and file diagnostics in one callget_symbol_context — namespace, base type, interfaces, injected dependencies, and public membersget_type_hierarchy — inheritance chains and extension pointsanalyze_method — signature, callers, and outgoing calls in one callget_call_graph — transitive caller and callee graph with cycle detection, for a depth greater than 1
direction defaults to callees, callers or both walks inboundmaxDepth defaults to 3, maxNodes to 500get_method_source — full declaration source for one or many members in one call, whole types are out of scope
Type.Type, nested types fully qualified), properties, fields, eventsType.this or Type.this[]ok, notFound, ambiguous, metadata, unsupportedKind), one miss leaves the batch intactmetadata items hold origin for peek_ilget_overloads — every overload of a method or constructor from source and metadata, with full parameter and modifier detailget_operators — every user-defined operator and conversion a type declares (operators do not inherit)
get_extension_methods — every extension member that applies to a type, from the solution and referenced assemblies
IEnumerablethis IEnumerable<T> applies to string, this IEnumerable<string> does notsignature is the reduced call-site form with the return type first (IEnumerable<int> Where<int>(Func<int, bool>))isStatic: false is an instance call (value.Doubled()) and covers every classic this extensionisStatic: true is a C# 14 static extension member called on the type (int.Zero)using scope, namespace is always reported, and the import can still be missingnameFilter narrows by substringget_instantiation_options — constructors, factories, diRegistrations, and requiredMembers of a type in one call
constructors hold parameters, accessibility, isImplicit for the compiler-supplied parameterless constructor, and isObsoletefactories are static members anywhere in the solution that return the type (WidgetFactory.Create() for a type with a private constructor)Task<T> and ValueTask<T> factories are unwrapped and flagged isAsync, instance builders are excludedfromProject computes accessible from that project and honors InternalsVisibleTo, accessible: null means not computedinstantiable: false with a note, find_implementations followsget_public_api_surface — every public and protected type and member declared in production projects
find_breaking_changes — diffs the current public API against a baseline
get_public_api_surface or a .dllsealed changes, and nullable annotation changes are undetected, an empty diff leaves compatibility unknownfind_implementations — every implementor of an interface and every type extending a classfind_callers — every call site for a methodfind_attribute_usages — types and members decorated with a given attributefind_event_subscribers — every += and -= site of an event, with the resolved handler and a subscribe or unsubscribe tagfind_reflection_usage — coupling no reference reports: Activator.CreateInstance, MethodInfo.Invoke, and assembly scanningget_di_registrations — IServiceCollection registrations and lifetimes of a type in generic, typeof pair, and factory formsget_project_dependencies — direct and transitive project references of the required projectget_nuget_dependencies — NuGet packages and versions per projectfind_obsolete_usage — every call site of an [Obsolete] symbol, grouped by deprecation message and severity, errors first
find_tests_for_symbol — xUnit, NUnit, and MSTest methods that exercise a production symbol
transitive walks through helper methods, bounded by maxDepth (default 3, maximum 5)get_test_summary — test methods per project, the reverse of find_tests_for_symbol
find_uncovered_symbols — public methods and properties no test reaches within 3 helper hops, sorted by cyclomatic complexity
get_diagnostics — compiler errors, warnings, and analyzer diagnostics
unreliable in its summary means the solution loaded degraded, items can then name errors no real build reportsrebuild_solution then a rerun clears unreliable, a block that persists leaves diagnostics to the buildCodeStyle assemblies alone drop no generated source, compiler items stay exactget_code_fixes — structured edits for one diagnostic at one locationget_code_actions — every refactoring and fix available at a position, with an optional rangeapply_code_action — runs a refactoring by title, preview by default, the in-memory snapshot updates at once on success
title in the result names the action that ranrebuild_solution then a rerun resolves a stale filerename_symbol — solution-wide rename of a type or member through the Roslyn Renamer, preview by default
apply_code_action offers no renamenameof, and crefsrenameInComments defaults to true, renameInStrings to false, renameOverloads to trueforce=true, and refuses on files changed since the snapshot in every caseData.Repository finds Repository<T>change_signature — adds, removes, and reorders a method's parameters and rewrites every call site
apply_code_action offers no signature changeoperations apply in order: remove takes a parameter name, reorder a full permutation of the surviving namesadd takes name, type, and a required callSiteValue, the expression every existing call site passesdefaultValue makes the parameter optional and leaves existing calls untouchedparams, and the extension this are handledthis off first position and leaving params anywhere but last are rejectedcascadedTo lists the rewritten overrides and interface implementations, read it in previewrename_symbolanalyze_data_flow — variable lifecycle over a statement range: declared, read, written, captured, and flowing in or outanalyze_control_flow — reachability, return statements, and exit points over a statement rangeCode generation runs through apply_code_action with the exact title get_code_actions returns, each task with its title:
Equals and GetHashCode → "Generate Equals and GetHashCode"get_diagnostics defaults to includeAnalyzers=false and returns compiler diagnostics only. Pass includeAnalyzers=true for analyzer findings and before get_code_fixes for an analyzer diagnostic. dotnet build <project> decides whether a project builds.
Solutions named on the server's command line are trusted for the session, every other solution needs trust_solution. get_code_fixes loads the fix providers as analyzer code and answers SolutionNotTrusted on an untrusted solution, compiler diagnostics included.
analyzerPolicy in the trust file (roslyn-codelens/trust.json under the user's application data directory, read at server start) selects the analyzer assemblies that load. nuget-and-solution-bin, the default, accepts ~/.nuget/packages, the SDK directory, and a bin or obj path under the solution, strict drops the solution paths, all accepts every path. nuget-and-solution-bin spells ~/.nuget/packages literally and reads no globalPackagesFolder from NuGet.config. Package analyzers restored to a relocated folder load under all alone, and get_diagnostics misses their diagnostics under the other policies.
Analyzers run under .editorconfig severities with no analyzer option values. Style analyzers that read an option (IDE0055 formatting) report against Roslyn defaults, their get_diagnostics items are no finding. dotnet format style <project> --verify-no-changes decides style findings and dotnet format whitespace <project> --verify-no-changes formatting findings, each without --verify-no-changes writes its fixes.
Analyzer assemblies built against a newer Roslyn than the server bundles do not load, and unreliable.loadDiagnostics in a get_diagnostics summary names each one as ReferencesNewerCompiler. Under a preview SDK, get_diagnostics omits CodeStyle (IDE*) diagnostics, the build reports them until a server release bundles the SDK's Roslyn.
When a call returns SolutionNotTrusted, confirm with the user that analyzer DLLs can run in-process, then call trust_solution and rerun the call. scope defaults to session, persistent writes the path to the trust store, and addRoot with a directory trusts every solution below it. list_trusted_paths reports the current state, revoke_trust removes an entry.
get_exception_flow — what can escape a method, with escapes, the path, and the catch site per exception
try/catchorigin is thrown for a source throw site, or documented for an exception XML tag on a metadata calleeincludeDocumented: false drops the documented itemswhen-filtered catches never count as catching, the filter can be false at run timehasFilter: true marks an exception that passed such a clause, escapes: false always pairs with hasFilter: falsemaxDepth defaults to 3, maxNodes to 500, either limit sets truncatedfind_throw_sites — every throw of an exception type across the solution, a throw inside a lambda or local function included
includeDerived matches subclasses, a rethrowing throw; resolves to the enclosing catch's typefind_catch_blocks — every catch for a type, each item with hasFilter, rethrows, and isEmpty
includeBaseClauses adds catch (Exception) and general catchisEmpty: true, rethrows: falseTools see explicit throw only, implicit run-time exceptions (null dereference, division by zero) and reflection-invoked throws stay unreported. get_exception_flow alone walks calls, and it resolves each call to its declared symbol in place of a run-time override. get_exception_flow models an async method as synchronous, a throw inside it propagates at the call site and an enclosing try counts as catching it. Synchronous modeling matches an awaited call and misses fire-and-forget (_ = M();), where nothing enclosing sees the throw.
get_project_health — composite audit per project with counts and the top hotspots per dimension
hotspotsPerDimension defaults to 5, 0 gives counts onlyfind_unused_symbols — dead code, found by reference, with the exclusion counts in summary.filteredOut
find_naming_violations — .NET naming conventionsfind_async_violations — async misuse across production projects, each violation with a severity
.Result, .Wait(), GetAwaiter().GetResult()) and async void outside an event handlerawait in an async method and fire-and-forget tasksfind_disposable_misuse — IDisposable and IAsyncDisposable locals at risk of leaking
using or await using, returned, or assigned to a field or out parameter are a warningfind_large_classes — types over a member count or line count thresholdfind_god_objects — types over all 3 size thresholds and at least one coupling threshold, a large isolated class is skipped
find_circular_dependencies — cycles in the project graph or the namespace graphcheck_architecture — layering rules supplied inline, scope selects namespace (default) or project
forbid (Api.* must not depend on Infrastructure.*) catches the expected violationallowOnly (Api.* can depend only on Application.*) catches the restallowOnly evaluates solution-internal, non-generated targets alone, edges to framework namespaces and generator output stay unchecked unless forbid names themreferenceCount and the first maxSitesPerViolation sitesget_complexity_metrics rows hold complexity per member (methods, constructors, properties, indexers, operators):
complexity — cyclomatic, the number of independent paths through the member, a straight-line method scores 1cognitive — how hard the member is to follow, 0 when nothing branches, ranks refactoring work
switch costs 1, else/else if cost 1 with no nesting penaltyif levels share one cyclomatic number and differ in cognitivemaxNesting — deepest control structure, lambda and local-function bodies includedmetric ("cyclomatic" by default, or "cognitive") selects the number threshold and the sort use. Both numbers always appear in the response.
get_source_generators — active generators per project and their outputsget_generated_code — generated source, filtered by generator or by file pathLocation-returning results hold an isGenerated flag, and the next compile rewrites generator output. Read the flag before editing a match.
Only assemblies the loaded solution references can be inspected. Unreferenced assemblies need a PackageReference or a Reference in a project, then rebuild_solution.
get_nuget_dependencies — first call, gives the exact assembly name the other tools takeinspect_external_assembly — what an assembly exposes, drill in before concluding that a package exposes nothing
mode defaults to summary and returns the namespace tree with type counts alonemode: "namespace" with namespaceFilter gives the public types and members of one namespacepeek_il — IL of a method by fully qualified method name with parameter typesExternal types resolve by name in go_to_definition, get_symbol_context, get_type_overview, and get_type_hierarchy, and find_references, find_callers, and find_implementations find the code that uses them.
Solutions named on the server's command line load with the first one active. With none named, the server loads the .sln or .slnx found walking up from the working directory. ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS (default 300) bounds each project's load, a project over it joins skippedProjects with kind: "Timeout" and the rest of the solution loads. Each loaded solution has one workspace the server serves to every client, a rebuild reaches every client. Writing, creating, deleting, or renaming a .cs, .csproj, .props, or .targets file recompiles on the next tool call: a .cs edit recompiles its project and dependents, any other change reopens the solution.
rebuild_solution — full reload: reopen the solution, recompile every project, rebuild every index
.slnx edit, and a restore that changed packages or analyzerslist_solutions — loaded solutions and the active one, read when an expected symbol is missing
skippedProjects per entry names each skipped project's kind and reasonstart_background_task — queues a long tool for get_task_status
rebuild_solution is the only allowed toolget_task_status — status, result, or error of one background tasklist_running_tasks — background tasks running or finished within the last 5 minutesEvery list-returning tool wraps its results in one envelope:
{
"items": [...],
"totalCount": 142,
"truncated": false,
"limit": 500,
"summary": { ... }
}
When truncated is true, items holds the top N in the tool's own sort order: severity-first, worst-first, or by-project. Raise limit when the missing items change the answer. Each tool sets its own limit default: get_diagnostics 1000, find_references 500, get_complexity_metrics 100, list_solutions 50.
Single-object tools (get_type_overview, apply_code_action) return their own shape.
Tools that add a summary aggregate:
get_diagnostics — { error, warning, info, hidden } counts, with an unreliable block when the solution loaded degradedfind_references — { byProject: { name: count }, byKind: { kind: count } }find_callers, find_attribute_usages — { byProject: { name: count } }search_symbols, find_reflection_usage — { byKind: {...} }find_throw_sites, find_catch_blocks — { byType: {...}, byProject: {...} }find_unused_symbols — { byKind, filteredOut: { testMethod, testContainer, mcpTool, generated, composition, interop } }find_naming_violations — { byRule: {...} }find_uncovered_symbols — counts with riskHotspotCount, the uncovered members with complexity 5 or morecheck_architecture — { byRule, totalReferences, rulesEvaluated }resolve_stack_trace — { byOrigin: { source, metadata, unresolved }, exceptions, skippedFrameLike }
skippedFrameLike counts frame-like lines that did not parseget_complexity_metrics — { max, avg, overThreshold, maxCognitive }
max, avg, and overThreshold describe the selected metric, maxCognitive is always the cognitive numberWhen a tool cannot proceed, the response has isError: true and a JSON body of { code, message, details? }. Switch on code:
| [INDEX] | [CODE] | [MEANING] |
|---|---|---|
| [01] | SymbolNotFound | Type, method, or property did not resolve |
| [02] | SolutionNotTrusted | Analyzers requested before trust_solution ran |
| [03] | AmbiguousMatch | Many matches, listed in details.matches |
| [04] | FileNotFound | File path or baseline does not exist |
| [05] | ProjectNotFound | Solution name did not match |
| [06] | InvalidArgument | Malformed or unsupported caller input |
| [07] | Internal | Unexpected, message has the exception text |
Fix the cause code names before the next call.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin dotnet8 skills in this plugin
/codingUse when writing or reviewing C#, covering functional design with result and effect types/debuggingUse when C# or another CoreCLR program misbehaves at runtime and its cause is unproven (wrong value, failing test, exception, hang, crash, breakpoint that never stops), covering DNCDbg launches and attaches, held starts, test runners, PDB documents, exception stops, expressions, live process reads, and dumps/languageextUse when calling a LanguageExt member/mapperlyUse when writing or reviewing a Mapperly mapper, covering mapping at the host boundaryOther plugins' skills for the same job