Loading...
Loading...
Guides creation and validation of custom dotnet new templates. Generates templates from existing projects and validates template.json for authoring issues. USE FOR: creating a reusable dotnet new template from an existing project, validating template.json files for schema compliance and parameter issues, bootstrapping .template.config/template.json with correct identity, shortName, parameters, and post-actions, packaging templates as NuGet packages for distribution. DO NOT USE FOR: 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).
npx skill4agent add dotnet/skills template-authoringdotnet newtemplate.json.template.config/template.jsontemplate-discoverytemplate-instantiationdotnet-msbuild| Input | Required | Description |
|---|---|---|
| Source project path | For creation | Path to the .csproj to use as template source |
| template.json path | For validation | Path to an existing template.json to validate |
| Template name | For creation | Human-readable name for the template |
| Short name | Recommended | Short name for |
.csproj.template.config/template.json.template.configtemplate.jsonidentitynameshortNamesourceNameclassificationstags{
"$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" }
}template.jsonidentitynameshortNameMyOrg.Templates.WebApistringboolchoiceintfloatbuildruntestpublishdotnet new list#ifdotnet 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/TestProjecttemplate.jsondotnet build| Pitfall | Solution |
|---|---|
| Identity format issues | Use reverse-DNS format (e.g., |
| ShortName conflicts with CLI commands | Avoid names like |
| Missing parameter descriptions | Every parameter should have a |
| Not testing all parameter combinations | Use |
| Hardcoded versions in template | Use |
| Not setting classifications | Add appropriate |