Agent Skillsdotnet/skills › template-smart-defaults

template-smart-defaults

GitHub

为.NET项目创建提供跨参数智能默认值填充,确保参数一致性且不覆盖用户显式设置。用于在生成命令前推断缺失参数,解释默认值依据,并输出带来源标记的决策日志及最终dotnet new命令。

plugins/dotnet-template-engine/skills/template-smart-defaults/SKILL.md dotnet/skills

Trigger Scenarios

用户请求创建.NET项目但未指定所有参数 需根据已选参数推断相关参数的合理默认值

Install

npx skills add dotnet/skills --skill template-smart-defaults -g -y
More Options

Non-standard path

npx skills add https://github.com/dotnet/skills/tree/main/plugins/dotnet-template-engine/skills/template-smart-defaults -g -y

Use without installing

npx skills use dotnet/skills@template-smart-defaults

指定 Agent (Claude Code)

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

安装 repo 全部 skill

npx skills add dotnet/skills --all -g -y

预览 repo 内 skill

npx skills add dotnet/skills --list

SKILL.md

Frontmatter
{
    "name": "template-smart-defaults",
    "license": "MIT",
    "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).\n"
}

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 at creation time. For an advice-only request (the user isn't creating yet — e.g. "tell me the parameters/command"), answer from the rules below and note you'd confirm the exact names at creation; don't spend a --help call just to advise on well-known parameters.
  4. Emit the two required outputs (see below) — this is what makes the skill decisive rather than inert.

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

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.

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.

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
  • Parameter names/choices were confirmed against dotnet new <template> --help at creation (for advice-only requests, flagged as to-confirm rather than run eagerly)

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.

More Info

Version History

  • 5354047 Current 2026-07-23 12:09

    强化输出要求:必须生成包含来源和理由的“Defaults applied”日志表格,并输出仅包含实际传递标志位的精确 dotnet new 命令行;修正关于 --aot 支持的描述,避免对特定模板的不准确断言。

  • ce75c35 2026-07-06 00:32

Same Skill Collection

.agents/skills/create-custom-agent/SKILL.md
.agents/skills/create-skill-test/SKILL.md
.agents/skills/create-skill/SKILL.md
.agents/skills/improve-skill-quality/SKILL.md
.github/skills/agentic-workflows/SKILL.md
eng/skill-validator/tests/fixtures/sample-skill/SKILL.md
plugins/dotnet-advanced/skills/csharp-scripts/SKILL.md
plugins/dotnet-advanced/skills/nuget-trusted-publishing/SKILL.md
plugins/dotnet-aspnetcore/skills/configuring-opentelemetry-dotnet/SKILL.md
plugins/dotnet-aspnetcore/skills/dotnet-webapi/SKILL.md
plugins/dotnet-aspnetcore/skills/minimal-api-file-upload/SKILL.md
plugins/dotnet-blazor/skills/create-blazor-project/SKILL.md
plugins/dotnet-blazor/skills/fetch-and-send-data/SKILL.md
plugins/dotnet-blazor/skills/support-prerendering/SKILL.md
plugins/dotnet-blazor/skills/use-js-interop/SKILL.md
plugins/dotnet-data/skills/optimizing-ef-core-queries/SKILL.md
plugins/dotnet-diag/skills/analyzing-dotnet-performance/SKILL.md
plugins/dotnet-diag/skills/clr-activation-debugging/SKILL.md
plugins/dotnet-diag/skills/dotnet-trace-collect/SKILL.md
plugins/dotnet-diag/skills/dump-collect/SKILL.md
plugins/dotnet-experimental/skills/exp-mock-usage-analysis/SKILL.md
plugins/dotnet-experimental/skills/exp-simd-vectorization/SKILL.md
plugins/dotnet-msbuild/skills/binlog-failure-analysis/SKILL.md
plugins/dotnet-msbuild/skills/copy-to-output-directory/SKILL.md
plugins/dotnet-msbuild/skills/msbuild-server/SKILL.md
plugins/dotnet-msbuild/skills/resolve-project-references/SKILL.md
plugins/dotnet-test-migration/skills/migrate-xunit-to-mstest/SKILL.md
plugins/dotnet-test-migration/skills/migrate-xunit-to-xunit-v3/SKILL.md
plugins/dotnet-test/skills/code-testing-extensions/SKILL.md
plugins/dotnet-test/skills/filter-syntax/SKILL.md
plugins/dotnet-test/skills/find-untested-sources/SKILL.md
plugins/dotnet-test/skills/platform-detection/SKILL.md
plugins/dotnet-upgrade/skills/dotnet-aot-compat/SKILL.md
.agents/skills/authoring-github-workflows/SKILL.md
plugins/dotnet-advanced/skills/dotnet-pinvoke/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-create/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-debug/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.md
plugins/dotnet-ai/skills/technology-selection/SKILL.md
plugins/dotnet-aspnetcore/skills/convert-blazor-server-to-webapp/SKILL.md
plugins/dotnet-blazor/skills/author-component/SKILL.md
plugins/dotnet-blazor/skills/collect-user-input/SKILL.md
plugins/dotnet-blazor/skills/configure-auth/SKILL.md
plugins/dotnet-blazor/skills/coordinate-components/SKILL.md
plugins/dotnet-blazor/skills/plan-ui-change/SKILL.md
plugins/dotnet-data/skills/create-datadriven-aspnetcore/SKILL.md
plugins/dotnet-diag/skills/android-tombstone-symbolication/SKILL.md
plugins/dotnet-diag/skills/apple-crash-symbolication/SKILL.md
plugins/dotnet-diag/skills/microbenchmarking/SKILL.md
plugins/dotnet-experimental/skills/exp-test-maintainability/SKILL.md

Metadata

Files
0
Version
2124a6e
Hash
12f59b49
Indexed
2026-07-06 00:32

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-05 19:45
浙ICP备14020137号-1 $Map of visitor$