/dotnet-template-authoring:dotnet-template-authoringfrom dotnet-template-authoring
Authors, validates and packages custom `dotnet new` templates, covering template.json from an existing project, symbols and conditional content, post-actions, constraints and template packs. Use for "turn this project into a template", a template missing from `dotnet new list` after install, or reviewing a template.json before publishing.
Ships in dotnet-template-authoring. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A template is a working project plus .template.config/template.json. Its value is that generated projects keep the source repo's conventions and build cleanly for every parameter combination. Prove both by instantiating and building, not by reading the JSON.
Not for: finding, comparing or using existing templates (dotnet new list, dotnet new search, dotnet new <name> --help cover it); MSBuild problems unrelated to the template (msbuild); package versions, CPM policy and publishing to nuget.org (nuget); project scaffolding inside an existing app (aspnet-core, csharp).
Copy the source project into a dedicated template-source folder (for example templates/<Name>/). Leave the original untouched unless the user asks to template it in place.
Create .template.config/template.json in that folder:
{
"$schema": "http://json.schemastore.org/template",
"author": "Contoso",
"classifications": ["Library"],
"identity": "Contoso.Templates.Library",
"name": "Contoso Library",
"shortName": "contoso-lib",
"sourceName": "Contoso.Library",
"defaultName": "MyLibrary",
"preferNameDirectory": true,
"tags": { "language": "C#", "type": "project" }
}
sourceName is the text replaced by --name in file names and contents, so set it to the source project's name. identity is reverse-DNS with no spaces. shortName must not equal a dotnet new subcommand (step 5).
Carry over the source project's conventions and report each one in a table:
| Source setting | Carried over? | How |
|---|---|---|
SDK (Microsoft.NET.Sdk, .Web, .Worker) | yes | template .csproj keeps the same SDK |
TargetFramework, Nullable, LangVersion, TreatWarningsAsErrors, OutputType | yes | kept verbatim or turned into a parameter |
PrivateAssets / IncludeAssets / ExcludeAssets on references | yes | metadata kept |
| Central Package Management | yes | PackageReferences stay versionless; ship Directory.Packages.props if self-contained |
Directory.Build.props/targets, global.json, .editorconfig, folder layout | yes or no | shipped, or noted as expected from the host repo |
Mark anything deliberately dropped with the reason. Don't leave omissions implicit.
Read references/template-json.md before writing symbols, conditions, post-actions or constraints. It has the exact structures. The rules that most often go wrong:
<!--#if (database == "Postgres") --> ... <!--#endif -->. Bare #if lines break the .csproj."condition": "(includeTests)".actionId 210D431B-A78B-4D2F-B762-4ED3E3EA9025 with primaryOutputs, or args.files with source-template paths. It takes no executable field."args": [{ "hostname": "dotnetcli" }]. Use an sdk-version constraint to restrict the SDK version.description, datatype and a defaultValue (a choice parameter's default must be one of its choices).dotnet new install ./templates/Contoso.Library # folder that contains .template.config
dotnet new contoso-lib --help # parameters appear here, not in `dotnet new --help`
dotnet new contoso-lib -n Smoke -o /tmp/tpl-smoke --dry-run
dotnet new contoso-lib -n Smoke -o /tmp/tpl-smoke
dotnet build /tmp/tpl-smoke
dotnet new uninstall ./templates/Contoso.Library
Repeat the instantiate and build for each meaningful parameter combination (each choice value, each bool flipped). Report every observed result. For regression tests across versions, use snapshot testing with Microsoft.TemplateEngine.Authoring.TemplateVerifier (see packaging reference).
Read references/packaging.md when the user wants a NuGet template pack: the pack project, content/ layout, CPM inside templates, localization and snapshot tests.
Parse first. If the JSON doesn't parse, report the parser's line and column and the smallest fix, then stop; semantic findings from a broken file are guesses.
Then check every category in references/validation-rules.md: required fields, identity format, shortName conflicts, symbols, source conditions, post-actions, constraints, tags. Report with a one-line verdict and one table:
Not ready: N errors, M warnings / Publishable with N warnings / Ready to publish: 0 errors, 0 warningsdotnet new subcommands (install, uninstall, update, list, search, details, create on current SDKs). Read the live set from the Commands: section of dotnet new --help. Top-level verbs (build, test, run, publish) do not conflict.dotnet new list usually has invalid JSON, a missing identity/name/shortName, or a .template.config folder not at the root that was installed. dotnet new install prints warnings for templates it skipped; read them.args.files on a restore action matches paths in the source template, before sourceName renames.Auth, AuthMode) makes expression parsing ambiguous; rename one.identity, uninstall the old one or both appear.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub adminhead/claude-plugins --plugin dotnet-template-authoring