NuSpec.AIHome

Getting Started

Everything you need to set up NuSpec.AI.

Install

Add to your packable project (the one you run dotnet pack on):

<PackageReference Include="NuSpec.AI" Version="*" PrivateAssets="all" />

<!-- Optional: attribute support -->
<PackageReference Include="NuSpec.AI.Attributes" Version="*" />

NuSpec.AI is a development dependency — it does not ship as a runtime dependency of your package.

Choose your formats

<PropertyGroup>
  <NuSpecAiFormats>ultra</NuSpecAiFormats>   <!-- 77% fewer tokens -->
  <!-- Options: json | yaml | compact | ultra | all | semicolon-separated -->
</PropertyGroup>
FormatFileAvg. savings
jsonai/package-map.jsonBaseline
yamlai/package-map.yaml−29%
compactai/package-map.compact.json−40%
ultraai/package-map.ultra−71%

CI/CD setup

GitHub Actions

- name: Pack
  run: dotnet pack

Azure DevOps

- task: DotNetCoreCLI@2
  inputs:
    command: pack

Attribute support

Install NuSpec.AI.Attributes to annotate types and members:

using NuSpec.AI;

[AiRole("aggregate-root", "audited")]
public class Order { }

[AiIgnore]
public string InternalToken { get; set; }

[AiDescription("Do not call for subscription orders.")]
public Task RefundAsync(int orderId) { }

FAQ

Common questions about token savings methodology and usage are answered on the FAQ page.

See also

How to Document Your NuGet Package — README, XML docs, and nuspec metadata guide
NuGet Package Metadata Best Practices — which fields matter for NuGet.org discoverability