OpenParable
Skip to content
← Back to skills

Template Smart Defaults

Development
template-smart-defaults

Template Smart Defaults is an Agent Skill for development published in the dotnet/skills repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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 sensible defaults for related parameters during project creation, resolving cross-parameter interactions (AOT implies a compatible framework, auth implies HTTPS, controllers excludes minimal-API flags), explaining why a default was applied. 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).

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/dotnet/skills/blob/HEAD/plugins/dotnet-template-engine/skills/template-smart-defaults/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/template-smart-defaults, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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

InputRequiredDescription
Template short nameYesThe template the project will be created from (e.g., webapi)
Parameters already chosenYesThe parameter values the user has explicitly set
Available choicesRecommendedParameter 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 an explicit user value.
  3. Log every applied default with a short rationale so the user can see and override it.
  4. Confirm the chosen parameter names and choices against dotnet new <template> --help before creating.

AOT at create time vs publish time. --aot is a dotnet new flag only on the templates that expose it (e.g. console, worker, grpc); it is not on webapi/webapp. 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

RuleDefault appliedRationale
--aot is set (on templates that support it, e.g. console/worker/grpc) and --framework is unsetSet --framework to the latest AOT-compatible framework the template offersNative AOT requires a recent, AOT-capable target framework; using the latest avoids build failures.
--auth is anything other than NoneDo NOT pass --no-httpsAuthentication flows (cookies, tokens, redirects) require HTTPS; disabling it breaks auth.
--use-controllers is setDo NOT also pass a minimal-API flagControllers and minimal APIs are mutually exclusive program models; passing both is contradictory.
User set a value explicitlyLeave it unchangedSmart defaults only fill gaps; explicit user intent always wins.

Validation

  • Each applied default was logged and explained to the user
  • No parameter the user set explicitly was overridden
  • Only unset parameters were filled
  • The resulting parameter names/choices were confirmed against dotnet new <template> --help

Common Pitfalls

PitfallSolution
Treating heuristics as enforcementThese are guidance rules, not validation. Always confirm against dotnet new <template> --help choices, since parameter names vary by template.
Overriding an explicit user valueApply a rule only when the target parameter is unset.
Assuming a flag nameThe exact flag differs per template (--aot exists on console/worker/grpc but not webapi; controllers use --use-controllers) — verify with --help.
Picking a framework the template doesn't supportUse the latest framework that appears in the template's --framework choices, not an arbitrary newest version.

More Info