dotnet-api-surface-validation
Detecting API changes in CI. PublicApiAnalyzers, Verify snapshots, breaking change enforcement.
What this skill does
# dotnet-api-surface-validation Tools and workflows for validating and tracking the public API surface of .NET libraries. Covers three complementary approaches: **PublicApiAnalyzers** for text-file tracking of shipped/unshipped APIs with Roslyn diagnostics, the **Verify snapshot pattern** for reflection-based API surface snapshot testing, and **ApiCompat CI enforcement** for gating pull requests on API surface changes. **Version assumptions:** .NET 8.0+ baseline. PublicApiAnalyzers 3.3+ (ships with `Microsoft.CodeAnalysis.Analyzers` or standalone `Microsoft.CodeAnalysis.PublicApiAnalyzers`). ApiCompat tooling included in .NET 8+ SDK. **Out of scope:** Binary vs source compatibility rules, type forwarders, SemVer impact -- see [skill:dotnet-library-api-compat]. NuGet packaging, `EnablePackageValidation` basics, and suppression file mechanics -- see [skill:dotnet-nuget-authoring] and [skill:dotnet-multi-targeting]. Verify library fundamentals (setup, scrubbing, converters) -- see [skill:dotnet-snapshot-testing]. General Roslyn analyzer configuration (EditorConfig, severity levels) -- see [skill:dotnet-roslyn-analyzers]. HTTP API versioning -- see [skill:dotnet-api-versioning]. Cross-references: [skill:dotnet-library-api-compat] for binary/source compatibility rules, [skill:dotnet-nuget-authoring] for `EnablePackageValidation` and NuGet SemVer, [skill:dotnet-multi-targeting] for multi-TFM ApiCompat tool mechanics, [skill:dotnet-snapshot-testing] for Verify fundamentals, [skill:dotnet-roslyn-analyzers] for general analyzer configuration, [skill:dotnet-api-versioning] for HTTP API versioning. --- ## PublicApiAnalyzers PublicApiAnalyzers tracks every public API member in text files committed to source control. The analyzer enforces that new APIs go through an explicit "unshipped" phase before being marked "shipped," preventing accidental public API exposure and undocumented surface area changes. ### Setup Install the analyzer package: ```xml <ItemGroup> <PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.*" PrivateAssets="all" /> </ItemGroup> ``` Create the two tracking files at the project root (adjacent to the `.csproj`): ``` MyLib/ MyLib.csproj PublicAPI.Shipped.txt # APIs shipped in released versions PublicAPI.Unshipped.txt # APIs added since last release ``` Both files must exist, even if empty. Each must contain a header comment: ``` #nullable enable ``` The `#nullable enable` header tells the analyzer to track nullable annotations in API signatures. Without it, nullable context differences are ignored. ### Diagnostic Rules | Rule | Severity | Meaning | |------|----------|---------| | RS0016 | Warning | Public API member not declared in API tracking files | | RS0017 | Warning | Public API member removed but still in tracking files | | RS0024 | Warning | Public API member has wrong nullable annotation | | RS0025 | Warning | Public API symbol marked shipped but has changed signature | | RS0026 | Warning | New public API added without `PublicAPI.Unshipped.txt` entry | | RS0036 | Warning | API file missing `#nullable enable` header | | RS0037 | Warning | Public API declared but does not exist in source | **RS0016** is the most common diagnostic. When you add a new `public` or `protected` member, RS0016 fires until you add the member's signature to `PublicAPI.Unshipped.txt`. Use the code fix (lightbulb) in the IDE to automatically add the entry. **RS0017** fires when you remove or rename a `public` member but the old signature still exists in the tracking files. Remove the stale line from the appropriate file. ### File Format Each line in the tracking files represents one public API symbol using its documentation comment ID format: ``` #nullable enable MyLib.Widget MyLib.Widget.Widget() -> void MyLib.Widget.Name.get -> string! MyLib.Widget.Name.set -> void MyLib.Widget.Calculate(int count) -> decimal MyLib.Widget.CalculateAsync(int count, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<decimal>! MyLib.IWidgetFactory MyLib.IWidgetFactory.Create(string! name) -> MyLib.Widget! MyLib.WidgetOptions MyLib.WidgetOptions.WidgetOptions() -> void MyLib.WidgetOptions.MaxRetries.get -> int MyLib.WidgetOptions.MaxRetries.set -> void ``` Key formatting rules: - The `!` suffix denotes a non-nullable reference type in nullable-enabled context - The `?` suffix denotes a nullable reference type or nullable value type - Constructors use the type name (e.g., `Widget.Widget() -> void`) - Properties expand to `.get` and `.set` entries - Default parameter values are included in the signature ### Shipped/Unshipped Lifecycle The workflow across release cycles: **During development (between releases):** 1. Add new public API member to source code 2. RS0016 fires -- member not tracked 3. Use code fix or manually add to `PublicAPI.Unshipped.txt` 4. RS0016 clears **At release time:** 1. Move all entries from `PublicAPI.Unshipped.txt` to `PublicAPI.Shipped.txt` 2. Clear `PublicAPI.Unshipped.txt` back to just the `#nullable enable` header 3. Commit both files as part of the release PR 4. Tag the release **When removing a previously shipped API (major version):** 1. Remove the member from source code 2. Remove the entry from `PublicAPI.Shipped.txt` 3. RS0017 clears (if it fired) 4. Document the removal in release notes **When removing an unshipped API (before release):** 1. Remove the member from source code 2. Remove the entry from `PublicAPI.Unshipped.txt` 3. No SemVer impact -- the API was never released ### Multi-TFM Projects For multi-targeted projects, PublicApiAnalyzers supports per-TFM tracking files when the API surface differs across targets: ``` MyLib/ MyLib.csproj PublicAPI.Shipped.txt # Shared across all TFMs PublicAPI.Unshipped.txt # Shared across all TFMs PublicAPI.Shipped.net8.0.txt # net8.0-specific APIs PublicAPI.Unshipped.net8.0.txt # net8.0-specific APIs PublicAPI.Shipped.net10.0.txt # net10.0-specific APIs PublicAPI.Unshipped.net10.0.txt # net10.0-specific APIs ``` The shared files contain APIs common to all TFMs. The TFM-specific files contain APIs that only exist on that target. The analyzer merges them at build time. To enable per-TFM files, add to the `.csproj`: ```xml <PropertyGroup> <RoslynPublicApiPerTfm>true</RoslynPublicApiPerTfm> </PropertyGroup> ``` See [skill:dotnet-multi-targeting] for multi-TFM packaging mechanics. ### Integrating with CI PublicApiAnalyzers runs as part of the standard build. To enforce it in CI, ensure warnings are treated as errors for the RS-series rules: ```xml <!-- In Directory.Build.props or the library .csproj --> <PropertyGroup> <WarningsAsErrors>$(WarningsAsErrors);RS0016;RS0017;RS0036;RS0037</WarningsAsErrors> </PropertyGroup> ``` This gates CI builds on any undeclared public API changes. Developers must explicitly update the tracking files before the build passes. --- ## Verify API Surface Snapshot Pattern Use the Verify library to snapshot-test the entire public API surface of an assembly. This approach uses reflection to enumerate all public types and members, producing a human-readable snapshot that is committed to source control and compared on every test run. Any change to the public API surface causes a test failure until the snapshot is explicitly approved. This pattern complements PublicApiAnalyzers -- the analyzer catches changes at build time within the project, while the Verify snapshot catches changes from the perspective of a compiled assembly consumer. For Verify fundamentals (setup, scrubbing, converters, diff tool integration, CI configuration), see [skill:dotnet-snapshot-testing]. ### Extracting the Public API Surface Create a helper method that reflects over an assembly to produce a stable, sorted representation of all public types and their members: ```csharp using System.Reflection; usi
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.