Agent skill

Roslyn Query

by NikiforovAll in NikiforovAll/claude-code-rules

Query .NET/C codebases using Roslyn AST analysis via dotnet run file.

Apache-2.0Auto-check passed

Install Roslyn Query

skills CLI
$ npx skills add NikiforovAll/claude-code-rules --skill roslyn-query -a claude-code

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

GitHub CLI
$ gh skill install NikiforovAll/claude-code-rules roslyn-query --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/NikiforovAll/claude-code-rules.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/handbook-dotnet/skills/roslyn-query .claude/skills/roslyn-query && 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
roslyn-query
GitHub stars
141
Token cost
~957 tokens
SKILL.md length
372 words
Files
3 (incl. references)
Skills in repo
26
Repo updated
First seen
Licence
Apache-2.0

At a glance

Query .NET/C codebases using Roslyn AST analysis via dotnet run file.

  • Works in 5 steps: Determine analysis type → Generate the script → Script conventions → …
  • Tracing data flow
  • SKILL.md covers When to Use, Analysis Tiers, Instructions and Key Roslyn APIs Quick Reference, plus 1 more section
  • Calls dotnet

What it does

Roslyn Query is an agent skill from NikiforovAll/claude-code-rules. Query .NET/C codebases using Roslyn AST analysis via dotnet run file. Use for tracing data flow, auditing API usage, finding pattern violations, or ad-hoc codebase queries.

Its SKILL.md is about 960 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/roslyn-api.md` and `references/templates.md`).

It works with .NET and C#. The repository describes itself as: Learn practical techniques to enhance your AI-assisted development workflow with Claude Code. The licence is Apache-2.0.

When your agent uses it

  • Tracing data flow
  • Auditing API usage
  • Finding pattern violations
  • Ad-hoc codebase queries

Example prompts

  • “/roslyn-query”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Determine analysis type
  2. Generate the script
  3. Script conventions
  4. Execute
  5. Interpret results

What it can do on your machine

Read from SKILL.md and the folder at commit 281c063. 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

    Shell commands in SKILL.md call:

    • dotnet

    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

Roslyn Query loads about 957 tokens when it runs, and up to ~6.1k if it reads all its reference files. Until then it costs about 47 tokens; SKILL.md has 372 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~957
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.1k

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 NikiforovAll/claude-code-rules at commit 281c063, republished under its Apache-2.0 licence (© NikiforovAll). 372 words, ~957 tokens.

Download SKILL.mdSave it as .claude/skills/roslyn-query/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
roslyn-query
description
Query .NET/C# codebases using Roslyn AST analysis via dotnet run file. Use for tracing data flow, auditing API usage, finding pattern violations, or ad-hoc codebase queries.
argument-hint
[analysis description or query type]

Roslyn Query

Query .NET/C# codebases using Roslyn AST analysis scripts executed via dotnet run file.cs.

Before generating scripts, load the handbook-dotnet:dotnet-run-file skill for execution conventions and directive syntax.

When to Use

  • Trace data flow from sources to sinks (taint analysis)
  • Audit all assignments to specific properties
  • Find all callers of a method
  • Find all implementations of an interface
  • Detect pattern violations (empty catches, missing sanitizers, etc.)
  • Architecture validation (layer violations)
  • Ad-hoc codebase structural queries

Analysis Tiers

Tier 1: Syntax-Only (fast, no compilation)

Uses CSharpSyntaxTree.ParseText() — parses files individually, no solution loading.

Best for:

  • Property assignment audits (x.Content = ...)
  • Empty catch block detection
  • Naming convention checks
  • Cyclomatic complexity
  • Magic number/string detection
  • Method size metrics
  • Pattern matching on code structure
Tier 2: Semantic (needs project/solution)

Uses MSBuildWorkspace — loads project, resolves types, enables cross-file analysis.

Best for:

  • Find all callers of a method (SymbolFinder.FindCallersAsync)
  • Find interface implementations (SymbolFinder.FindImplementationsAsync)
  • Find method overrides (SymbolFinder.FindOverridesAsync)
  • Type dependency graphs
  • Full data flow analysis (SemanticModel.AnalyzeDataFlow)

Instructions

Step 1: Determine analysis type

Based on the user's request, choose the appropriate template from references/templates.md. If no template fits, compose a custom script using the patterns documented there.

Show full SKILL.md (187 more words)Show less
Step 2: Generate the script

Create a .cs file in a scripts/ directory (or temp location) using dotnet run file.cs format with #:package directives.

For syntax-only analysis:

csharp
#:package Microsoft.CodeAnalysis.CSharp@4.*

For semantic analysis, additionally:

csharp
#:package Microsoft.CodeAnalysis.CSharp.Workspaces@4.*
#:package Microsoft.CodeAnalysis.Workspaces.MSBuild@4.*
#:package Microsoft.Build.Locator@1.*
#:property DisableMSBuildAssemblyCopyCheck=true

Note: DisableMSBuildAssemblyCopyCheck=true suppresses the MSBL001 build error that requires ExcludeAssets="runtime" on MSBuild packages — an attribute #:package directives can't express. Safe for throwaway analysis scripts.

.slnx not supported: Roslyn 4.x MSBuildWorkspace only supports .sln, not .slnx. Use OpenProjectAsync with a .csproj instead — transitive project references are loaded automatically.

Step 3: Script conventions
  • Accept target directory/path via args[0], default to Directory.GetCurrentDirectory()
  • Use Path.GetRelativePath() for output paths
  • Print structured output: file:line, description, context
  • Use color: green for safe, yellow for warnings, red for violations
  • Exit code 0 = clean, 1 = findings
Step 4: Execute
bash
dotnet run scripts/my-analysis.cs -- <target-path>
Step 5: Interpret results

Analyze the output. For taint analysis, categorize findings:

  • Safe — trusted source (code-generated, AI output, literal null)
  • Already sanitized — sanitizer call deeper in call chain (syntax-only false positive)
  • Needs investigation — external input, user-authored content
  • Violation — clear miss that should be fixed

Key Roslyn APIs Quick Reference

Load references/roslyn-api.md for detailed API reference with code examples.

Templates

Load references/templates.md for ready-to-use analysis script templates.

© NikiforovAll, Apache-2.0. 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 2 other files (references) in plugins/handbook-dotnet/skills/roslyn-query of NikiforovAll/claude-code-rules.

  • SKILL.md
  • references/roslyn-api.md
  • references/templates.md

Open the folder on GitHubat commit 281c063

Compare with similar skills

Roslyn Query 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.

Roslyn Query compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Roslyn Query this skillNikiforovAll/claude-code-rules141—~957Automated safety check: PassApache-2.0
Minimax DOCXpoco-ai/poco-claw1.4k7 repos~3.9kAutomated safety check: PassMIT
Speckit ConstitutionWeihanLi/WeihanLi.Common24211 repos~2.1kAutomated safety check: PassApache-2.0
Analyzing .NET Performancedotnet/skills5.6k3 repos~3.1kAutomated safety check: PassMIT
Find Untested Sourcesmicrosoft/testfx1k2 repos~3.3kAutomated safety check: PassMIT
Add Analyzerdotnet/roslynator3.5k—~1.3kAutomated safety check: PassCustom licence

Similar skills

  • Minimax DOCX

    poco-ai/poco-claw

    Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET).

    1.4k GitHub starsUsed in 7 repos~3.9k tokens
    Documents & OfficeAuto-check passed
  • Speckit Constitution

    WeihanLi/WeihanLi.Common

    Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.

    242 GitHub starsUsed in 11 repos~2.1k tokens
    DevelopmentAuto-check passed
  • Official

    Scans C# and .NET code for about 50 performance anti-patterns and reports prioritized findings with concrete fixes, at a scan depth you choose.

    5.6k GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Find Untested Sources

    microsoft/testfx

    Official

    MANDATORY for static source-to-test pairing: find or list source files/modules without corresponding tests, or suggest test locations from repository structure.

    1k GitHub starsUsed in 2 repos~3.3k tokens
    MobileAuto-check passed
  • Add Analyzer

    dotnet/roslynator

    Official

    A skill your agent uses when adding a new RCS diagnostic in roslynator (RCS0 formatting, RCS1 general, RCS9 code-analysis), wiring roslynator EditorConfig options, or when docs say CHANGELOG.md…

    3.5k GitHub stars~1.3k tokensUpdated 5 days ago
    DevelopmentAuto-check passed
  • GitVersion .NET Development

    GitTools/GitVersion

    Gives repository-specific .NET guidance for GitVersion: build and test commands, central package management, project layout and coding conventions.

    3.1k GitHub stars~1.7k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from NikiforovAll/claude-code-rules

All 26 skills in this repo
  • Reflect Solution

    NikiforovAll/claude-code-rules

    Summarize WHAT WAS SHIPPED in a Claude Code session as a self-contained HTML slide deck — the elevator pitch (problem, solution, decisions, artifacts, verification, gaps), not a play-by-play of tool…

    141 GitHub stars~3.8k tokensUpdated 8 days ago
    Auto-check passed
  • Dotnet Analyzers

    NikiforovAll/claude-code-rules

    Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA, SA).

    141 GitHub stars~1.9k tokensUpdated 8 days ago
    Auto-check passed
  • Ilspy Decompile

    NikiforovAll/claude-code-rules

    Understand implementation details of .NET code by decompiling assemblies.

    141 GitHub starsUsed in 2 repos~760 tokens
    Auto-check passed
  • Reflect Tree

    NikiforovAll/claude-code-rules

    Visualize a Claude Code session as a quest/skill tree — a navigable SVG graph where nodes are turns and edges show flow, with distinct visual encoding for normal flow, dead-ends, corrections…

    141 GitHub stars~2.8k tokensUpdated 8 days ago
    Auto-check passed
  • Structured Plan Mode

    NikiforovAll/claude-code-rules

    This skill should be used when planning and tracking complex feature implementations that require systematic task decomposition.

    141 GitHub stars~4.2k tokensUpdated 8 days ago
    Auto-check passed
  • Glab

    NikiforovAll/claude-code-rules

    Expert guidance for using the GitLab CLI (glab) to manage GitLab issues, merge requests, CI/CD pipelines, repositories, and other GitLab operations from the command line.

    141 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed

Works with

Questions about Roslyn Query

What does Roslyn Query do?

Query .NET/C codebases using Roslyn AST analysis via dotnet run file. Roslyn Query is an agent skill from NikiforovAll/claude-code-rules.NET/C codebases using Roslyn AST analysis via dotnet run file.

When should I use Roslyn Query?

Roslyn Query fits situations like: tracing data flow; auditing API usage; finding pattern violations; ad-hoc codebase queries.

How do I install Roslyn Query in Claude Code?

Run `npx skills add NikiforovAll/claude-code-rules --skill roslyn-query -a claude-code`. Or copy the skill folder (plugins/handbook-dotnet/skills/roslyn-query in NikiforovAll/claude-code-rules) into .claude/skills/roslyn-query in your project. Claude Code loads it when a task matches its description.

How do I install Roslyn Query in Codex?

Run `npx skills add NikiforovAll/claude-code-rules --skill roslyn-query -a codex`. Or copy the skill folder (plugins/handbook-dotnet/skills/roslyn-query in NikiforovAll/claude-code-rules) into .agents/skills/roslyn-query in your project. Codex loads it when a task matches its description.

Can I use Roslyn Query 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 NikiforovAll/claude-code-rules --skill roslyn-query -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/roslyn-query, .gemini/skills/roslyn-query, .github/skills/roslyn-query and .opencode/skills/roslyn-query in your project.

What does Roslyn Query need to run?

Going by SKILL.md and its folder, Roslyn Query needs the command-line tools its instructions call (dotnet).

Does Roslyn Query 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 Roslyn Query 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 Roslyn Query use?

Roslyn Query is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Roslyn Query use?

About 957 tokens (SKILL.md is roughly 3.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.2k tokens, read only when the agent opens those files.

What are the alternatives to Roslyn Query?

Skills that share tags, products or a category with Roslyn Query: Minimax DOCX (poco-ai/poco-claw, 1.4k stars), Speckit Constitution (WeihanLi/WeihanLi.Common, 242 stars), Analyzing .NET Performance (dotnet/skills, 5.6k stars) and Find Untested Sources (microsoft/testfx, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Roslyn Query?

NikiforovAll (a GitHub user) maintains it in NikiforovAll/claude-code-rules, which has 141 GitHub stars. The repository holds 26 skills in this directory. The repository was last updated on October 2, 2026.

Source: NikiforovAll/claude-code-rules on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.