template-comparison

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Template Comparison

模板对比

This skill helps an agent compare 2+
dotnet new
templates side by side so the user can pick the right one. It inspects each template's parameters and feature support and renders a comparison table.
该技能可帮助Agent将2个及以上
dotnet new
模板进行并排对比,以便用户挑选合适的模板。它会检查每个模板的参数和功能支持,并生成对比表格。

When to Use

适用场景

  • User is deciding between similar templates (e.g.,
    webapi
    vs
    webapp
    ,
    blazor
    vs
    blazorwasm
    )
  • User asks "which template should I use for X?"
  • User wants to understand how two or more templates differ before creating a project
  • 用户需要在相似模板间做选择(例如:
    webapi
    vs
    webapp
    blazor
    vs
    blazorwasm
  • 用户询问“我做X应该用哪个模板?”
  • 用户希望在创建项目前了解两个或多个模板的差异

When Not to Use

不适用场景

  • User wants to create a project — route to
    template-instantiation
  • User wants to author or validate a custom template — route to
    template-authoring
    or
    template-validation
  • User just needs to find or inspect a single template — route to
    template-discovery
  • 用户想要创建项目 —— 转至
    template-instantiation
  • 用户想要编写或验证自定义模板 —— 转至
    template-authoring
    template-validation
  • 用户仅需查找或查看单个模板 —— 转至
    template-discovery

Inputs

输入参数

InputRequiredDescription
Template short namesYesTwo or more template short names to compare (e.g.,
webapi
,
webapp
)
Comparison focusNoOptional aspect to emphasize (auth, AOT, frameworks, interactivity)
输入项是否必填描述
模板短名称要对比的两个及以上模板短名称(例如:
webapi
webapp
对比重点可选的侧重对比方面(身份验证、AOT、框架、交互性)

Workflow

工作流程

Step 1: Inspect each template

步骤1:检查每个模板

Run
dotnet new <template> --help
for each template being compared to collect its parameters (names, types, defaults, choices) and supported frameworks:
bash
dotnet new webapi --help
dotnet new webapp --help
If a template is not installed, find and install it first (
dotnet new search <keyword>
, then
dotnet new install <package>
).
Run
--help
calls sequentially.
The template engine uses a global mutex, so running several
dotnet new <template> --help
commands concurrently can fail with a transient "mutex"/"persistence" error and empty output. Inspect templates one at a time; if a call fails, retry it once before moving on, and still produce the comparison from whatever parameter knowledge you have rather than ending with no answer.
对每个要对比的模板执行
dotnet new <template> --help
命令,收集其参数(名称、类型、默认值、选项)和支持的框架:
bash
dotnet new webapi --help
dotnet new webapp --help
如果模板未安装,请先查找并安装(执行
dotnet new search <keyword>
,然后
dotnet new install <package>
)。
请按顺序执行
--help
命令。
模板引擎使用全局互斥锁,因此同时运行多个
dotnet new <template> --help
命令可能会因短暂的“互斥锁”/“持久化”错误而失败,导致输出为空。请逐个检查模板;如果某一次调用失败,重试一次后再继续,即使部分参数信息缺失,也要基于已有信息生成对比结果,而非直接返回无结果。

Step 2: Build the comparison table

步骤2:生成对比表格

Produce a side-by-side table covering:
  • Parameters — name, type, default, choices
  • Feature support — auth, AOT, Docker, controllers, interactivity
  • Available frameworks — e.g., net8.0, net9.0, net10.0
  • Classifications — categories the template advertises (Web, API, Blazor, etc.)
Example shape:
Aspect
webapi
webapp
Auth (
--auth
)
None, Individual, SingleOrg, WindowsNone, Individual, SingleOrg, ...
AOT (
--aot
flag)
present if
dotnet new webapi --help
lists
--aot
present if
dotnet new webapp --help
lists
--aot
Controllers (
--use-controllers
)
Yesn/a
Interactivityn/an/a
Frameworksnet8.0 / net9.0 / net10.0net8.0 / net9.0 / net10.0
ClassificationsWeb, WebAPIWeb, Razor Pages
生成包含以下内容的并排对比表:
  • 参数 —— 名称、类型、默认值、选项
  • 功能支持 —— 身份验证、AOT、Docker、控制器、交互性
  • 可用框架 —— 例如:net8.0、net9.0、net10.0
  • 分类 —— 模板所属的类别(Web、API、Blazor等)
示例格式:
对比项
webapi
webapp
身份验证(
--auth
None、Individual、SingleOrg、WindowsNone、Individual、SingleOrg、...
AOT(
--aot
标志)
dotnet new webapi --help
中列出
--aot
则支持
dotnet new webapp --help
中列出
--aot
则支持
控制器(
--use-controllers
不适用
交互性不适用不适用
框架net8.0 / net9.0 / net10.0net8.0 / net9.0 / net10.0
分类Web、WebAPIWeb、Razor Pages

Step 3: Recommend

步骤3:给出推荐

End with a decisive Recommendation line — never leave the user with just a table. Format:
Recommendation:
<template>
— one sentence tying the choice to the user's stated scenario. (Pick the other if
<condition>
.)
Then link to
template-instantiation
to create it. A comparison that ends without naming a winner (or a clear "it depends on X") is incomplete — that indecision is what makes this skill tie with a plain answer.
结尾需给出明确的推荐结论 —— 不能仅提供表格。格式如下:
推荐:
<template>
—— 用一句话将选择与用户的场景关联起来。(若满足
<条件>
,则选择另一个模板。)
然后链接至
template-instantiation
以创建项目。如果对比结束时未给出明确的推荐(或清晰的“取决于X”结论),则视为不完整 —— 这种不确定性正是该技能区别于普通回答的关键。

Decision shortcuts for common pairs

常见模板对的决策捷径

Use these as the opinionated default when the user hasn't given a countervailing constraint. Still inspect with
--help
to confirm parameters, but lead with the verdict:
PairDefault pickBecause
webapi
vs
webapp
webapi
for a JSON/REST backend;
webapp
for server-rendered HTML/Razor Pages
webapi ships controllers/minimal APIs + OpenAPI, no UI
blazor
vs
blazorwasm
blazorwasm
when offline / no server is required;
blazor
(Web App) for flexible server + client interactivity
Standalone WASM runs fully client-side, works offline
worker
vs
console
worker
for long-lived/queue/background processing
Generic Host: DI, logging, config, graceful shutdown,
IHostedService
lifecycle
mvc
vs
webapp
webapp
(Razor Pages) for page-focused apps;
mvc
for controller/view separation at scale
Razor Pages is lighter for CRUD-style pages
当用户未给出相反约束时,可使用以下默认结论。仍需通过
--help
检查参数,但可先给出结论:
模板对默认选择原因
webapi
vs
webapp
webapi
适用于JSON/REST后端;
webapp
适用于服务器渲染HTML/Razor Pages
webapi包含控制器/极简API + OpenAPI,无UI界面
blazor
vs
blazorwasm
blazorwasm
适用于离线/无需服务器的场景;
blazor
(Web App)适用于灵活的服务器+客户端交互场景
独立WASM完全在客户端运行,支持离线使用
worker
vs
console
worker
适用于长期运行/队列/后台处理
通用主机:依赖注入、日志、配置、优雅关闭、
IHostedService
生命周期
mvc
vs
webapp
webapp
(Razor Pages)适用于页面聚焦的应用;
mvc
适用于大规模场景下的控制器/视图分离
Razor Pages对于CRUD类页面更轻量化

Validation

验证清单

  • Every template requested was inspected via
    dotnet new <template> --help
  • The comparison covers parameters, feature support, frameworks, and classifications
  • Differences relevant to the user's scenario are called out explicitly
  • A recommendation (or clear trade-off) is provided
  • 所有请求的模板均已通过
    dotnet new <template> --help
    检查
  • 对比内容涵盖参数、功能支持、框架和分类
  • 已明确指出与用户场景相关的差异
  • 已提供推荐(或清晰的权衡结论)

Common Pitfalls

常见陷阱

PitfallSolution
Comparing uninstalled templates from memoryInstall and inspect each template so the comparison reflects the real parameters and choices.
Assuming feature parityParameter names and feature support vary by template — confirm each with
--help
.
Comparing fundamentally different template typesOnly compare templates that solve overlapping problems; note when they target different scenarios.
陷阱解决方案
凭记忆对比未安装的模板安装并检查每个模板,确保对比结果反映真实的参数和选项。
假设功能完全一致参数名称和功能支持因模板而异 —— 请通过
--help
逐一确认。
对比完全不同类型的模板仅对比解决重叠问题的模板;若模板针对不同场景,请注明。

More Info

更多信息