AgentSkillsCN

dotnet-inspect

检查 .NET 程序集与 NuGet 包。当您需要深入了解包内容、查看公开 API 表面、对比不同版本之间的 API,或对程序集进行 SourceLink/确定性相关审计时,此功能尤为实用。对于涉及包探索或 API 发现的 .NET 开发任务而言,这一工具不可或缺。

SKILL.md
--- frontmatter
name: dotnet-inspect
description: Inspect .NET assemblies and NuGet packages. Use when you need to understand package contents, view public API surfaces, compare APIs between versions, or audit assemblies for SourceLink/determinism. Essential for .NET development tasks involving package exploration or API discovery.

dotnet-inspect

A CLI tool for inspecting .NET assemblies and NuGet packages.

Requirements

  • .NET 10+ SDK

Installation

Use dnx to run without global installation (like npx for Node):

bash
dnx dotnet-inspect -y -- <command>

Important:

  • Always use -y to skip the interactive confirmation prompt (which breaks LLM tool use). New package versions also trigger this prompt.
  • Always use -- to separate dnx options from tool arguments. Without it, --help shows dnx help, not dotnet-inspect help.

Quick Patterns

Start with these common workflows:

bash
# Understand a type's API shape (start here - most useful for learning APIs)
dnx dotnet-inspect -y -- api JsonSerializer --package System.Text.Json --tree

# Compare API changes between versions (essential for migrations)
dnx dotnet-inspect -y -- diff --package System.CommandLine@2.0.0-beta4.22272.1..2.0.2
dnx dotnet-inspect -y -- diff Command --package System.CommandLine@2.0.0-beta4.22272.1..2.0.2
dnx dotnet-inspect -y -- diff "*Json*" --package System.Text.Json@9.0.0..10.0.0

# Search for types by pattern (single or batch with comma-separated patterns)
dnx dotnet-inspect -y -- find "*Handler*" --package System.CommandLine
dnx dotnet-inspect -y -- find "Option*,Argument*,Command*" --package System.CommandLine --terse

# Find extension methods for a type
dnx dotnet-inspect -y -- extensions HttpClient --framework runtime
dnx dotnet-inspect -y -- extensions HttpClient --framework runtime --reachable

# Find types implementing an interface or extending a class
dnx dotnet-inspect -y -- implements IDisposable --framework runtime
dnx dotnet-inspect -y -- implements Stream --framework runtime

# Package metadata and versions
dnx dotnet-inspect -y -- package System.Text.Json
dnx dotnet-inspect -y -- package System.Text.Json --versions

# Get XML documentation for a type
dnx dotnet-inspect -y -- api Option --package System.CommandLine --docs

Key Flags

FlagPurposeCommands
-v:dDetailed output (full signatures, more info)all commands
--docsInclude XML documentation from sourceapi
-m NameFilter to specific member(s)api
-t NameFilter to specific type(s), supports globsdiff
-n 10Limit resultsfind, extensions, package --versions
--terseCompact output (alias for --oneline --grouped)find
--onelineSpace-separated type names on one linefind
--name-onlyShow only names, one per linefind, diff
--statShow only statistics (no member details)diff
--breakingShow only breaking changesdiff
--additiveShow only additive changesdiff
--groupedGroup results by pattern (with --oneline)find
--reachableInclude extensions on reachable typesextensions
--prereleaseInclude prerelease versionspackage --versions

Signatures include params and default values — you can determine calling conventions directly from output: void .ctor(string name, params string[] aliases), Parse(args, configuration = null)

Generic types: Use quotes around generic types: 'Option<T>', 'IEnumerable<T>'

Diff supports globs and whole-package comparison: Omit the type name to see all changes across a package version range. Use glob patterns like "*Writer*" to filter.

Command Reference

CommandPurpose
api <type>Start here. Public API surface (table format, or --tree for hierarchy)
diffCompare API surfaces between package versions (whole-package or filtered)
find <pattern>Search for types across packages, assemblies, or frameworks
extensions <type>Find extension methods for a type
implements <type>Find types implementing an interface or extending a class
package <name>Package metadata, files, versions, dependencies
assembly <path>Assembly info, SourceLink/determinism audit
llmstxtComplete usage examples for all commands

Full Documentation

For comprehensive examples and edge cases:

bash
dnx dotnet-inspect -y -- llmstxt

When to Use This Skill

  • Exploring what types/APIs a NuGet package provides
  • Searching for types by pattern across packages or frameworks
  • Finding types that implement an interface or extend a base class
  • Understanding method signatures and overloads
  • Comparing API changes between package versions
  • Auditing assemblies for SourceLink and determinism
  • Finding types matching a pattern (--filter "Progress*")
  • Getting documentation from source (--docs)