Official agent skill

Template Authoring

by dotnet in dotnet/skills

Guides creation and validation of custom dotnet new templates from existing projects.

OfficialMITAuto-check passed

Install Template Authoring

skills CLI
$ npx skills add dotnet/skills --skill template-authoring -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dotnet/skills template-authoring --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dotnet/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dotnet-template-engine/skills/template-authoring .claude/skills/template-authoring && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
template-authoring
GitHub stars
5.6k
Used in
1 other repo
Token cost
~3.3k tokens
SKILL.md length
1,290 words
Files
1
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Guides creation and validation of custom dotnet new templates from existing projects.

  • Works in 4 steps: Bootstrap from existing project → Validate template.json → Refine the template → …
  • : creating a reusable dotnet new template from an existing project
  • SKILL.md covers When to Use, When Not to Use, Inputs and Workflow, plus 3 more sections
  • Calls dotnet; reaches json.schemastore.org

What it does

Template Authoring is an agent skill from dotnet/skills, published by the product's own GitHub organization. Guides creation and validation of custom dotnet new templates from existing projects. Generates a .template.config/template.json that preserves the source project's conventions. USE FOR: creating a reusable dotnet new template from an existing project, bootstrapping .template.config/template.json with correct identity, shortName, parameters, and post-actions, adding parameters or conditional content to a template you are authoring, validating the template.json you are authoring before publishing, packaging…

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with .NET. The repository describes itself as: Repository for skills to assist AI coding agents with .NET and C. The licence is MIT.

When your agent uses it

  • : creating a reusable dotnet new template from an existing project
  • Bootstrapping .template.config/template.json with correct identity
  • Adding parameters
  • Conditional content to a template you are authoring

Example prompts

  • “Use the template-authoring skill to guide creation and validation of custom dotnet new templates from existing projects”
  • “/template-authoring”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Bootstrap from existing project
  2. Validate template.json
  3. Refine the template
  4. Test the template locally

What it can do on your machine

Read from SKILL.md and the folder at commit a660de8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • json.schemastore.org

    Also links to:

    • github.com
    • learn.microsoft.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Template Authoring loads about 3.3k tokens when it runs. Until then it costs about 222 tokens; SKILL.md has 1,290 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~222
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dotnet/skills at commit a660de8, republished under its MIT licence (© dotnet). 1,290 words, ~3,266 tokens.

Download SKILL.mdSave it as .claude/skills/template-authoring/SKILL.md (or your agent's skills folder).
name
template-authoring
description
Guides creation and validation of custom dotnet new templates from existing projects. Generates a .template.config/template.json that preserves the source project's conventions. USE FOR: creating a reusable dotnet new template from an existing project, bootstrapping .template.config/template.json with correct identity, shortName, parameters, and post-actions, adding parameters or conditional content to a template you are authoring, validating the template.json you are authoring before publishing, packaging templates as NuGet packages for distribution. DO NOT USE FOR: validating an existing template.json as a standalone task (use template-validation), finding or using existing templates (use template-discovery and template-instantiation), MSBuild project file issues unrelated to template authoring, NuGet package publishing (only template packaging structure).
license
MIT

Template Authoring

This skill helps an agent create and validate custom dotnet new templates. It guides bootstrapping templates from existing projects and validates template.json files for authoring issues before publishing.

When to Use

  • User wants to create a reusable template from an existing .csproj
  • User wants to validate a template.json they are authoring before publishing
  • User is setting up .template.config/template.json from scratch
  • User wants to package a template for NuGet distribution

When Not to Use

  • User wants to find or use existing templates — route to template-discovery or template-instantiation
  • User has MSBuild issues unrelated to template authoring — route to dotnet-msbuild plugin

Inputs

InputRequiredDescription
Source project pathFor creationPath to the .csproj to use as template source
template.json pathFor validationPath to an existing template.json to validate
Template nameFor creationHuman-readable name for the template
Short nameRecommendedShort name for dotnet new <shortname> usage

Workflow

Rules that change the answer

Use these structures exactly; do not invent fields from other template features.

Deliver the requested artifact. When the user says "show", "write", or "give me the content", put the complete JSON/XML in the final response even if you also wrote it to disk. Never edit this skill's SKILL.md or plugin documentation as a substitute for authoring the user's template. Only create or modify template files when the user requested file changes and the target template/project is present.

NeedCorrect structureNever use
Conditional XML in a .csprojXML comments such as <!--#if (database == "SqlServer") --> and <!--#endif --> around the complete elementbare #if lines, which make the XML invalid
Restore generated projectsrestore action 210D431B-A78B-4D2F-B762-4ED3E3EA9025; use primaryOutputs, or args.files containing source-template paths/globsrun-script fields such as executable on the restore action
Restrict to the SDK hosta host constraint whose args is an array containing { "hostname": "dotnetcli" }; its optional version restricts the host/CLI versionusing host version when the requirement is specifically the active SDK version, the invalid host ID dotnet-cli, or unrelated pattern / value fields
Restrict the active SDK versionan sdk-version constraint with a NuGet version/range string in argsa machine-specific exact patch unless the template truly requires it
Preserve CPMkeep generated PackageReference items versionless and package the owning Directory.Packages.props when the template is self-containedadding inline Version attributes
Package templatesa pack project with <PackageType>Template</PackageType> and template content packed below content/describing a layout without showing the requested project file
Step 1: Bootstrap from existing project

Analyze the source .csproj and create a .template.config/template.json:

  1. Copy the source project into a dedicated template-source directory by default, preserving the original project untouched. Modify the original in place only when the user explicitly asks for that layout.
  2. Create .template.config inside the template-source directory.
  3. Generate template.json with identity (reverse-DNS), name, shortName, sourceName (project name for replacement), classifications, and tags
  4. Preserve from source — generic dotnet new templates frequently get these wrong, so verify each is carried over from the original .csproj:
    1. SDK type — Microsoft.NET.Sdk, Microsoft.NET.Sdk.Web, Microsoft.NET.Sdk.Worker, etc.
    2. Analyzer/package reference metadata — PrivateAssets, IncludeAssets, ExcludeAssets
    3. OutputType and other key properties — TreatWarningsAsErrors, Nullable, LangVersion
    4. CPM participation — no inline Version attributes when a Directory.Packages.props is present
    5. Custom build props/targets and Directory.Build.props conventions
    6. Repo conventions — folder layout, naming, global.json SDK pin

Minimal example:

json
{
  "$schema": "http://json.schemastore.org/template",
  "author": "MyOrg",
  "classifications": ["Library"],
  "identity": "MyOrg.Templates.MyLib",
  "name": "My Library Template",
  "shortName": "mylib",
  "sourceName": "MyLib",
  "tags": { "language": "C#", "type": "project" }
}

Required output — do not stop at a minimal stub. Write the complete .template.config/template.json for the actual source project, then emit a short conventions-preserved confirmation so the user can see nothing was silently dropped. This carry-over is the whole value of the skill; a generic dotnet new template that loses these is why authoring ties with a hand-written stub.

Source .csproj settingCarried over?How
SDK (Microsoft.NET.Sdk.*)✅template content .csproj uses same SDK
TreatWarningsAsErrors / Nullable / LangVersion✅preserved verbatim in template .csproj
PackageReference PrivateAssets / IncludeAssets / ExcludeAssets✅metadata kept on each reference
CPM (Directory.Packages.props present)✅ManagePackageVersionsCentrally remains enabled and no inline Version attributes are emitted

Mark any row you intentionally omitted as ⚠️ with a reason — never leave it implicit.

Step 2: Validate template.json

Validate the generated template.json using the template-validation skill (it owns the full rule set — required fields, identity format, reserved shortName conflicts, parameter datatypes, post-actions, constraints, and tags).

Quick summary of what gets checked:

  • Required fields — identity, name, and shortName must be present.
  • ShortName conflicts — avoid names that collide with dotnet new subcommands. Read the authoritative set from the Commands: section of dotnet new --help for the installed SDK and do not hardcode it (it can change between versions); illustrative examples from current SDKs are install, uninstall, update, list, search, details, create. A conflict happens because dotnet new <name> would be parsed as the subcommand of the same name. Top-level dotnet verbs like build, run, test, and publish do NOT conflict. Run dotnet new list to confirm the name is not already taken.
  • Parameters, post-actions, tags — see template-validation for the complete rules, including the valid datatype list.
Show full SKILL.md (501 more words)Show less
Step 3: Refine the template

Based on validation results and user requirements:

  1. Add parameters with appropriate types (string, bool, choice), defaults, and descriptions

  2. Add conditional content using the file type's valid syntax. In XML use template directives inside XML comments, not bare preprocessor lines:

    xml
    <!--#if (database == "SqlServer") -->
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
    <!--#endif -->
    <!--#if (database == "Postgres") -->
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
    <!--#endif -->
  3. Configure post-actions for solution add, restore, or custom scripts

  4. Set constraints to restrict which SDKs or workloads the template supports

  5. Add classifications and tags for discoverability

For a restore post-action, prefer primaryOutputs when the project path is known:

json
"primaryOutputs": [{ "path": "MyProject.csproj" }],
"postActions": [{
  "description": "Restore NuGet packages.",
  "manualInstructions": [{ "text": "Run 'dotnet restore'." }],
  "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
  "continueOnError": true
}]

If args.files is needed, its paths are matched against the source template before renames, for example "files": ["**/*.csproj"]. Explain that distinction.

Step 4: Test the template locally

For a create-from-existing-project request, this step is required rather than optional: install the authored template, run a dry-run, instantiate it into a temporary output folder, and build the generated project. Report each observed result; inspecting template.json alone does not prove the reusable template works.

bash
dotnet new install ./path/to/template/root
dotnet new mylib --name TestProject --dry-run
dotnet new mylib --name TestProject --output ./test-output
dotnet build ./test-output/TestProject

When packaging is requested, include the complete pack project, not only a directory tree:

xml
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <PackageId>Contoso.ProjectTemplates</PackageId>
    <PackageType>Template</PackageType>
    <TargetFramework>net8.0</TargetFramework>
    <IncludeBuildOutput>false</IncludeBuildOutput>
    <NoWarn>$(NoWarn);NU5128</NoWarn>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="**\*" />
    <Content Include="templates\**\*" Pack="true" PackagePath="content\" />
  </ItemGroup>
</Project>

The pack project's target framework applies only to the content-only packaging project; it does not retarget projects inside templates/. Prefer a broadly available supported framework unless the packaging project itself uses newer build features.

For a self-contained CPM template, the packaged Directory.Packages.props must include <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and every versionless PackageReference must have a matching PackageVersion. Keep the props file at the intended generated repository root; do not place a duplicate nearer the project where it changes lookup.

Validation

  • template.json passes manual validation with zero errors
  • Template identity and shortName are unique and meaningful
  • All parameters have descriptions and appropriate defaults
  • Template can be installed, dry-run, and instantiated successfully
  • Created projects build cleanly with dotnet build
  • Conditional content produces correct output for all parameter combinations
  • XML template directives are wrapped in XML comments and the generated project parses
  • Host constraints use args[].hostname; restore actions use primaryOutputs or args.files

Common Pitfalls

PitfallSolution
Identity format issuesUse reverse-DNS format (e.g., MyOrg.Templates.WebApi). Avoid spaces or special characters.
ShortName conflicts with CLI commandsAvoid names that match a dotnet new subcommand; read the live set from dotnet new --help and don't hardcode it (illustrative examples: install, uninstall, update, list, search, details, create). Top-level verbs like build/run/test/publish are fine. Run dotnet new list to see if the name is already taken.
Missing parameter descriptionsEvery parameter should have a description and displayName for discoverability.
Not testing all parameter combinationsUse dotnet new <template> --dry-run with different parameter values to verify conditional content works correctly.
Hardcoded versions in templateUse sourceName replacement for project names and consider parameterizing framework versions.
Not setting classificationsAdd appropriate classifications (e.g., ["Web", "API"]) for template discovery.
Reusing fields from a different constraint or post-actionFollow the exact schema: host.args[].hostname, and restore args.files rather than run-script fields.

More Info

© dotnet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dotnet-template-engine/skills/template-authoring of dotnet/skills.

Open the folder on GitHubat commit a660de8

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in dotnet/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Template Authoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Template Authoring compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Template Authoring this skilldotnet/skills5.6k1 repos~3.3kAutomated safety check: PassMIT
Minimax DOCXpoco-ai/poco-claw1.4k7 repos~3.9kAutomated safety check: PassMIT
Microsoft Skill CreatorMicrosoftDocs/mcp1.9k3 repos~2.1kAutomated safety check: PassCC-BY-4.0
Speckit ConstitutionWeihanLi/WeihanLi.Common24211 repos~2.1kAutomated safety check: PassApache-2.0
Copilot Session Failure Analysisdotnet/maui23k—~3.4kAutomated safety check: PassMIT
Microsoft Code ReferenceMicrosoftDocs/mcp1.9k4 repos~1.1kAutomated safety check: PassCC-BY-4.0

Similar skills

  • Minimax DOCX

    poco-ai/poco-claw

    Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET).

    1.4k GitHub starsUsed in 7 repos~3.9k tokens
    Documents & OfficeAuto-check passed
  • Microsoft Skill Creator

    MicrosoftDocs/mcp

    Official

    Create agent skills for Microsoft technologies using official documentation.

    1.9k GitHub starsUsed in 3 repos~2.1k tokens
    Agent WorkflowsAuto-check passed
  • Speckit Constitution

    WeihanLi/WeihanLi.Common

    Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.

    242 GitHub starsUsed in 11 repos~2.1k tokens
    DevelopmentAuto-check passed
  • Mines local Copilot CLI session logs for dotnet/maui to rank costly or failing runs, tag recurring failure modes, propose repo edits and emit guard evals.

    23k GitHub stars~3.4k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Microsoft Code Reference

    MicrosoftDocs/mcp

    Official

    Find working code samples, verify API signatures, and fix Microsoft SDK errors using official docs.

    1.9k GitHub starsUsed in 4 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Official

    Audits and updates os-packages.json files listing the Linux packages each .NET release needs per distro, then regenerates the Markdown from the JSON.

    22k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed

More from dotnet/skills

All 91 skills in this repo
  • Official

    Resolves .NET runtime frames in Apple .ips crash logs to function names, source files and line numbers using dSYM symbols, atos and the Microsoft symbol server.

    5.6k GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed
  • Official

    Resolves native crash frames from .NET Android tombstones to function names, source files and line numbers using BuildIds, Microsoft's symbol server and llvm-symbolizer.

    5.6k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Official

    Scans C# and .NET code for about 50 performance anti-patterns and reports prioritized findings with concrete fixes, at a scan depth you choose.

    5.6k GitHub starsUsed in 3 repos~3.1k tokens
    Auto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Auto-check passed
  • Microbenchmarking

    dotnet/skills

    Official

    Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks.

    5.6k GitHub starsUsed in 3 repos~3.3k tokens
    Auto-check passed
  • Official

    Makes .NET projects compatible with Native AOT and trimming by resolving IL trim and AOT analyzer warnings through annotations rather than suppressions.

    5.6k GitHub starsUsed in 2 repos~4.2k tokens
    Auto-check passed

Works with

Questions about Template Authoring

What does Template Authoring do?

Guides creation and validation of custom dotnet new templates from existing projects. Template Authoring is an agent skill from dotnet/skills, published by the product's own GitHub organization. Guides creation and validation of custom dotnet new templates from existing projects.

When should I use Template Authoring?

Template Authoring fits situations like: : creating a reusable dotnet new template from an existing project; bootstrapping .template.config/template.json with correct identity; adding parameters; conditional content to a template you are authoring.

How do I install Template Authoring in Claude Code?

Run `npx skills add dotnet/skills --skill template-authoring -a claude-code`. Or copy the skill folder (plugins/dotnet-template-engine/skills/template-authoring in dotnet/skills) into .claude/skills/template-authoring in your project. Claude Code loads it when a task matches its description.

How do I install Template Authoring in Codex?

Run `npx skills add dotnet/skills --skill template-authoring -a codex`. Or copy the skill folder (plugins/dotnet-template-engine/skills/template-authoring in dotnet/skills) into .agents/skills/template-authoring in your project. Codex loads it when a task matches its description.

Can I use Template Authoring in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dotnet/skills --skill template-authoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/template-authoring, .gemini/skills/template-authoring, .github/skills/template-authoring and .opencode/skills/template-authoring in your project.

What does Template Authoring need to run?

Going by SKILL.md and its folder, Template Authoring needs the command-line tools its instructions call (dotnet).

Does Template Authoring access the network?

SKILL.md names 3 domains. In commands or code: json.schemastore.org; the agent is likely to contact it when it follows the instructions. As links in the text: github.com and learn.microsoft.com. This is read from the text; nothing was executed.

Is Template Authoring safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Template Authoring use?

Template Authoring is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Template Authoring use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Template Authoring?

Skills that share tags, products or a category with Template Authoring: Minimax DOCX (poco-ai/poco-claw, 1.4k stars), Microsoft Skill Creator (MicrosoftDocs/mcp, 1.9k stars), Speckit Constitution (WeihanLi/WeihanLi.Common, 242 stars) and Copilot Session Failure Analysis (dotnet/maui, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Template Authoring?

dotnet (a GitHub organization, an official publisher) maintains it in dotnet/skills, which has 5,576 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 8, 2026.

Source: dotnet/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.