Template Validation

Validates custom dotnet new templates for correctness before publishing. Catches missing fields, parameter bugs, shortName conflicts, constraint issues, and common authoring mistakes that cause templates to fail silently. USE FOR: checking template.json files for errors before publishing or testing, diagnosing why a template doesn't appear after installation, reviewing template parameter definitions for type mismatches and missing defaults, finding shortName conflicts with dotnet CLI commands, validating post-action and constraint configuration. DO NOT USE FOR: finding or using existing templates (use template-discovery), creating projects from templates (use template-instantiation), creating templates from existing projects (use template-authoring).

Workflow

Step 1: Locate the template.json

The file can be at:

  • Direct path: path/to/template.json
  • In a template directory: path/to/.template.config/template.json
  • In a .template.config directory: path/.template.config/template.json

Step 2: Parse and validate

Read the JSON. If it's malformed, report the JSON parse error with line number.

Run all 8 validation categories above. Collect errors, warnings, and suggestions separately.

Step 3: Report results

Lead with a one-line verdict, then a single findings table. This decisive shape is required — do not scatter findings across prose paragraphs.

Verdict header (pick one):

  • ❌ Not ready — N error(s), M warning(s) — has errors
  • ⚠️ Publishable but N warning(s) — no errors, has warnings
  • ✅ Ready to publish — 0 errors, 0 warnings — no errors or warnings (optional suggestions may still apply)

Then one table, ordered errors → warnings → suggestions:

| Severity | Location (JSON path or line:col) | Issue | Fix | |----------|------------------------------------|-------|-----| | ERROR | shortName | "list" conflicts with a dotnet new subcommand | Rename to a distinctive value, e.g. "my-list" | | ERROR | symbols.maxRetries.defaultValue | "abc" is not a valid int | Set a numeric default, e.g. "3" | | ERROR | 12:5 | JSON parse error: unexpected , | Remove the trailing comma |

Every ERROR and WARNING MUST include a concrete fix — the corrected value, JSON snippet, or a specific edit instruction (e.g. "remove the trailing comma"), not just a restatement of the problem. A finding without an actionable fix is incomplete. This is the single biggest thing that separates a useful validation from a generic lint.

Close with the total: "N error(s), M warning(s), K suggestion(s)."

Related skills

Compares two or more dotnet new templates side by side to help users choose between them based on parameters, feature support, frameworks, and classifications.