roslyn-query

roslyn-query is a skill for Claude Code, Codex from NikiforovAll/claude-code-rules. It costs 44 tokens per session (858 once invoked), scanned A, original, Apache-2.0.

A tool for examining .NET and C# code by its structure and meaning. Roslyn is Microsoft's platform for reading and analyzing C# source code.

In plain words
What is it for?
Use it to trace data flow, find method callers and interface implementations, check API usage, detect code-pattern violations, and validate architecture.
Why use it?
It helps answer codebase-wide questions that are difficult to solve with simple text search, such as how data moves or which methods call another method.

Skill for Claude CodeCodex

Part of the handbook-dotnet plugin — 9 skills, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nikiforovall/claude-code-rules/roslyn-query
Any agent
npx skills add NikiforovAll/claude-code-rules --skill roslyn-query
Clone the repo
git clone --depth 1 https://github.com/NikiforovAll/claude-code-rules

Made for: Claude Code, Codex.

Or install handbook-dotnet, the plugin that ships this one along with the rest of its 9 skills, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for roslyn-query

README.md
[![agentmods](https://agentmods.dev/badge/skills/nikiforovall/claude-code-rules/roslyn-query.svg)](https://agentmods.dev/skills/nikiforovall/claude-code-rules/roslyn-query)
Your own site
<a href="https://agentmods.dev/skills/nikiforovall/claude-code-rules/roslyn-query"><img src="https://agentmods.dev/badge/skills/nikiforovall/claude-code-rules/roslyn-query.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 858 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.00858
Opus 5 $0.00022 $0.00429
Sonnet 5 $0.00009 $0.00172
Haiku 4.5 $0.00004 $0.00086

Measured 5d ago against content hash 45a332a7e7f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

roslyn-query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/handbook-dotnet/skills/roslyn-query/SKILL.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

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:

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

For semantic analysis, additionally:

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

Read the full file on GitHub · 105 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 105 lines · 44 tokens per session scan A 45a332a7e7f6

Subscribe to this mod's changes

roslyn-query is a skill published in the GitHub repository NikiforovAll/claude-code-rules (141 stars, last pushed 7d ago), licensed Apache-2.0. It adds 44 tokens to every session and 858 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

review-pr

Review a Pull Request in one of two postures: an expository "tour guide" that walks through changes in logical order, or an adversarial audit that assumes the change is wrong until proven safe and hunts for the failure mode. Triggers: "review PR #123", "adversarial review", "walk me through this PR", "PR tour guide"…

jontsai/claude-plugins · 139 tokens

researcher

Use when asked to create research documents, generate PDFs, make one-pagers, or create cheatsheets. Triggers: "research document", "generate PDF", "one-pager", "cheatsheet", "distinctive design". Provides HTML/Markdown/PDF with Terminal, Editorial, Corporate, Industrial, Fresh aesthetic presets.

jontsai/claude-plugins · 68 tokens

start-thread

Use when opening OR RESUMING a unit of work — a feature, bug, research spike, refactor, an experiment — that should survive context loss in its own scratch workspace with a handoff doc. Idempotent create-or-resume: a fresh topic gets a scaffolded STATE doc; an existing thread gets a resume briefing (STATE + live…

shck-dev/ccx-context-system · 130 tokens

save-state

Use when you need the whole picture of active work in this project — at session start, after a context clear or /compact, when finishing a work item, or when asked "what's in flight", "what am I building", "show the overall picture", or "save state".

shck-dev/ccx-context-system · 61 tokens

svg-mastery

Expert knowledge for working with SVG (Scalable Vector Graphics) — optimization, embedding, animation, accessibility, responsive scaling, React integration, filters, and programmatic creation. Use when the user asks to "optimize SVG", "clean up SVG", "reduce SVG file size", "embed SVG in HTML", "inline SVG vs img…

lukaskellerstein/claude-my-marketplace · 276 tokens

visual-planning

ALWAYS use this skill FIRST, before producing or fetching ANY media asset — an image, video/GIF, chart, graph, diagram, infographic, SVG/icon, music, or speech/voiceover — and before any stock-photo search. It is the mandatory pre-generation gate. For a SINGLE asset it runs a short brief — clarify the ask → confirm…

lukaskellerstein/claude-my-marketplace · 271 tokens