Skip to main content
skill CX Codex

template-smart-defaults — Claude Code skill: what it does

A skill that fills related dotnet new parameters when you leave them unset, and leaves your explicit choices alone.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dotnet/skills --skill template-smart-defaults -a claude-code
Open on GitHub

What template-smart-defaults does

The skill kicks in when you ask for a project from a dotnet new template but skip some flags. It fills the gaps by rule. --aot with no --framework gets the newest AOT-capable target the template offers. An --auth value other than None keeps HTTPS on, so --no-https never gets added, and --use-controllers rules out any minimal-API flag. Anything you set yourself stays untouched.

You get two things back, in order. A "Defaults applied" table, one row per parameter, tagged Source = user or Source = rule with the reason. Then a single dotnet new command listing only the flags you are actually passing. For advice-only requests --dry-run goes on the end, so the command cannot write files.

The rules are heuristics, not validation. Names and choices get checked against dotnet new <template> --help, which matters: on a template that does not expose --aot the framework rule never fires, so there is nothing to lean on. Creating the project is a separate job — template-instantiation — while finding or comparing templates routes to template-discovery and template-comparison.

What it helps with

  • scaffold a project with native AOT without guessing a target framework
  • keep HTTPS on when authentication is enabled
  • avoid passing controllers and a minimal-API flag together
  • get one clean dotnet new command with no extra flags
  • see why a default was applied before you accept it

Example prompts for the agent

  • Create a webapi with --aot and --auth Individual, I'm not picking a framework — show me what you fill in.
  • Give me the dotnet new command for a controllers-based API, don't create files.
  • Why is --no-https missing from the command?

How to install template-smart-defaults

1Skills CLI (Vercel)

npx skills add dotnet/skills --skill template-smart-defaults -a claude-code

2Manually: put the files in place

~/.claude/skills/template-smart-defaults/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/template-smart-defaults/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about template-smart-defaults

How do I install template-smart-defaults in Claude Code?

Run npx skills add dotnet/skills --skill template-smart-defaults -a claude-code. The skill ends up at ~/.claude/skills/template-smart-defaults/SKILL.md.

What does template-smart-defaults do?

It fills related parameters during dotnet new project creation and shows which values came from rules and why. Values you set yourself are never overwritten.

How is it different from template-instantiation?

This one only decides which flags to pass and hands back the command. Project creation belongs to template-instantiation; finding and comparing templates goes to template-discovery and template-comparison.

Source text

SKILL.md · MIT
---
name: template-smart-defaults
description: >
  Applies cross-parameter default rules when creating .NET projects with dotnet new,
  filling gaps consistently without overriding values the user set explicitly.
  USE FOR: choosing which target framework to pair with native AOT, deciding whether to
  keep HTTPS when authentication is enabled, recognizing that controllers and minimal-API
  flags are mutually exclusive, filling unset related parameters during project creation,
  explaining why a default was applied and ensuring an explicit user value is never
  overridden.
  DO NOT USE FOR: creating the project itself (use template-instantiation), finding or
  comparing templates (use template-discovery and template-comparison), authoring or
  validating custom templates (use template-authoring and template-validation).
license: MIT
---

# Template Smart Defaults

This skill helps an agent fill in cross-parameter defaults when creating a `dotnet new`
project. The rules below are guidance heuristics that keep related parameters consistent —
they only fill gaps and never override a value the user set explicitly.

## When to Use

- The user asks to create a project but leaves related parameters unspecified
- A parameter the user chose implies a sensible value for another parameter
- You need to explain why a particular default was selected

## When Not to Use

- User wants to actually create the project — route to `template-instantiation`
- User wants to find or compare templates — route to `template-discovery` or `template-comparison`
- User wants to author or validate a custom template — route to `template-authoring` or `template-validation`

## Inputs

| Input | Required | Description |
|-------|----------|-------------|
| Template short name | Yes | The template the project will be created from (e.g., `webapi`) |
| Parameters already chosen | Yes | The parameter values the user has explicitly set |
| Available choices | Recommended | Parameter names/choices from `dotnet new <template> --help` |

## Workflow

1. Gather the parameters the user has explicitly set.
2. Apply each rule below **only where the corresponding parameter is unset** — never override a value the user set explicitly.
3. Confirm the chosen parameter names and choices against `dotnet new <template> --help`
   whenever the user asks for an exact command. This inspection does not create files and is
   worthwhile even for advice-only requests. Skip it only for a conceptual explanation that
   does not claim exact option names.
4. **Emit the two required outputs** (see below) — this is what makes the skill decisive rather than inert.

For advice-only prompts that say "don't create files", make the displayed command safe to run
by appending `--dry-run`. If a scenario needs a named example and the user omitted the name,
choose a short descriptive sample name and mark it `Source = rule`. Do not add a name when the
user asked for a command containing only explicitly requested choices or when the template can
demonstrate those choices safely without one.

### Required output

Always produce **both**, in this order:

**A. A "Defaults applied" log** — one row per parameter, covering **both** the explicit values you preserved (`Source = user`) and the gaps you filled by rule (`Source = rule`), so the user can see and override every choice:

| Parameter | Value | Source | Why |
|-----------|-------|--------|-----|
| `--framework` | `net10.0` | rule | Native AOT (from `--aot`) needs the latest AOT-capable TFM |
| `--auth` | `Individual` | user | Explicitly requested — left unchanged |
| `--name` | `AotWorker` | rule | Added a descriptive sample name for this named example |

Use `Source = user` for explicit values (never overridden) and `Source = rule` for gap-fills.

**B. The exact single `dotnet new` command line** you would run — include **only** the flags you are actually passing. Do not list flags you decided *not* to pass (e.g. don't mention `--no-https` when you are keeping HTTPS; don't mention a minimal-API flag when using controllers). Silence on an omitted flag is the correct, decisive signal.

Always emit a flag the user explicitly requested when the observed template help exposes it,
even when its value matches the template default; this keeps intent visible and reproducible
(for example, `--auth None`). Omit only **inferred** defaults that you are not actually
passing. Boolean switches such as `--no-https` are passed without `true`.

> **AOT at create time vs publish time.** `--aot` is a `dotnet new` flag only on the templates that expose it — always confirm with `dotnet new <template> --help` rather than assuming a given template does or doesn't offer it. There is no `--publish-aot` template flag — publish-time native AOT is enabled with the MSBuild property `PublishAot=true` (via `dotnet publish` or in the `.csproj`), not through `dotnet new`. Apply the framework rule only when the template actually offers `--aot`.

### Rules

| Rule | Default applied | Rationale |
|------|-----------------|-----------|
| `--aot` is set (on any template whose `--help` exposes it) and `--framework` is unset | Set `--framework` to the latest AOT-compatible framework the template offers | Native AOT requires a recent, AOT-capable target framework; using the latest avoids build failures. (A framework already pinned by the workspace or `global.json` counts as set — keep it unless it's incompatible with AOT.) |
| `--auth` is anything other than `None` | Do NOT pass `--no-https` | Authentication flows (cookies, tokens, redirects) require HTTPS; disabling it breaks auth. |
| `--use-controllers` is set | Do NOT also pass a minimal-API flag | Controllers and minimal APIs are mutually exclusive program models; passing both is contradictory. |
| User set a value explicitly | Leave it unchanged | Smart defaults only fill gaps; explicit user intent always wins. |
| Advice-only command must not create files | Add `--dry-run` | The command itself must honor the no-write constraint, not only the agent's behavior. |

When controllers are explicitly requested, the command must contain the controller option
shown by `--help`; explaining controllers without passing the option is incomplete.

## Validation

- [ ] A "Defaults applied" log was produced with a Source (user/rule) and rationale per row
- [ ] The exact single `dotnet new` command line was emitted, listing only flags actually passed
- [ ] No parameter the user set explicitly was overridden
- [ ] Only unset parameters were filled
- [ ] Exact parameter names/choices were confirmed against `dotnet new <template> --help`, including for advice-only exact commands
- [ ] A no-file advice command includes `--dry-run`
- [ ] Boolean switches are emitted without a trailing `true`

## Common Pitfalls

| Pitfall | Solution |
|---------|----------|
| Treating heuristics as enforcement | These are guidance rules, not validation. Always confirm against `dotnet new <template> --help` choices, since parameter names vary by template. |
| Overriding an explicit user value | Apply a rule only when the target parameter is unset. |
| Assuming a flag name | The exact flag differs per template — always verify with `--help` (e.g. `--aot` is present only where `--help` lists it; controllers use `--use-controllers`). |
| Picking a framework the template doesn't support | Use the latest framework that appears in the template's `--framework` choices, not an arbitrary newest version. |
| Showing a plain creation command after "don't create files" | Append `--dry-run` so the displayed command is safe to execute. |

## More Info

- [dotnet new](https://learn.microsoft.com/dotnet/core/tools/dotnet-new) — CLI reference
- [Native AOT deployment](https://learn.microsoft.com/dotnet/core/deploying/native-aot/) — AOT framework requirements

© dotnet · MIT · dotnet/skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set101

setup-local-sdk Installs a .NET SDK into a project-local .dotnet/ folder and wires it up through global.json, leaving the system-wide install alone. CX Codex +1 2,900installs support-prerendering Configures interactive Blazor components to handle prerendering cleanly. It prevents duplicate data fetches, UI flicker during handoff, and null reference crashes. CX Codex +1 3,000installs target-authoring A skill for writing custom MSBuild targets: canonical patterns plus fixes for anti-patterns like overwriting DependsOn chains. CX Codex +1 3,000installs template-comparison This skill puts two or more dotnet new templates side by side in a table and picks a winner for your scenario. Handy when you are stuck between webapi and webapp or blazor and blazorwasm. CX Codex +1 2,800installs migrate-xunit-to-mstest Converts .NET test suites from xUnit.net v2 or v3 to MSTest v4 while preserving VSTest or MTP runners. Helpful when unifying test frameworks across .NET repositories. CX Codex +1 2,900installs copy-to-output-directory A skill that picks the right CopyToOutputDirectory mode in MSBuild: Never, PreserveNewest, Always or IfDifferent. Useful when files in bin/ go stale or builds slow down. CX Codex +1 2,700installs create-datadriven-aspnetcore Generates ASP.NET Core CRUD code — Razor Pages, Blazor components, controllers, and Minimal APIs — aligned with project styles and EF Core without CLI generators. CX Codex +1 2,800installs scaffold-dotnet-test-project Creates or repairs a .NET test project: finds why CI discovers zero tests and wires the project into the solution file CI actually uses. CX Codex +1 2,600installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor