template-comparison
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTemplate Comparison
模板对比
This skill helps an agent compare 2+ 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.
dotnet new该技能可帮助Agent将2个及以上模板进行并排对比,以便用户挑选合适的模板。它会检查每个模板的参数和功能支持,并生成对比表格。
dotnet newWhen to Use
适用场景
- User is deciding between similar templates (e.g., vs
webapi,webappvsblazor)blazorwasm - User asks "which template should I use for X?"
- User wants to understand how two or more templates differ before creating a project
- 用户需要在相似模板间做选择(例如:vs
webapi、webappvsblazor)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 or
template-authoringtemplate-validation - User just needs to find or inspect a single template — route to
template-discovery
- 用户想要创建项目 —— 转至
template-instantiation - 用户想要编写或验证自定义模板 —— 转至或
template-authoringtemplate-validation - 用户仅需查找或查看单个模板 —— 转至
template-discovery
Inputs
输入参数
| Input | Required | Description |
|---|---|---|
| Template short names | Yes | Two or more template short names to compare (e.g., |
| Comparison focus | No | Optional aspect to emphasize (auth, AOT, frameworks, interactivity) |
| 输入项 | 是否必填 | 描述 |
|---|---|---|
| 模板短名称 | 是 | 要对比的两个及以上模板短名称(例如: |
| 对比重点 | 否 | 可选的侧重对比方面(身份验证、AOT、框架、交互性) |
Workflow
工作流程
Step 1: Inspect each template
步骤1:检查每个模板
Run for each template being compared to collect its
parameters (names, types, defaults, choices) and supported frameworks:
dotnet new <template> --helpbash
dotnet new webapi --help
dotnet new webapp --helpIf a template is not installed, find and install it first (,
then ).
dotnet new search <keyword>dotnet new install <package>Runcalls sequentially. The template engine uses a global mutex, so running several--helpcommands 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
对每个要对比的模板执行命令,收集其参数(名称、类型、默认值、选项)和支持的框架:
dotnet new <template> --helpbash
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 | | |
|---|---|---|
Auth ( | None, Individual, SingleOrg, Windows | None, Individual, SingleOrg, ... |
AOT ( | present if | present if |
Controllers ( | Yes | n/a |
| Interactivity | n/a | n/a |
| Frameworks | net8.0 / net9.0 / net10.0 | net8.0 / net9.0 / net10.0 |
| Classifications | Web, WebAPI | Web, Razor Pages |
生成包含以下内容的并排对比表:
- 参数 —— 名称、类型、默认值、选项
- 功能支持 —— 身份验证、AOT、Docker、控制器、交互性
- 可用框架 —— 例如:net8.0、net9.0、net10.0
- 分类 —— 模板所属的类别(Web、API、Blazor等)
示例格式:
| 对比项 | | |
|---|---|---|
身份验证( | None、Individual、SingleOrg、Windows | None、Individual、SingleOrg、... |
AOT( | 若 | 若 |
控制器( | 是 | 不适用 |
| 交互性 | 不适用 | 不适用 |
| 框架 | net8.0 / net9.0 / net10.0 | net8.0 / net9.0 / net10.0 |
| 分类 | Web、WebAPI | Web、Razor Pages |
Step 3: Recommend
步骤3:给出推荐
End with a decisive Recommendation line — never leave the user with just a table. Format:
Recommendation:— one sentence tying the choice to the user's stated scenario. (Pick the other if<template>.)<condition>
Then link to 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-instantiation结尾需给出明确的推荐结论 —— 不能仅提供表格。格式如下:
推荐:—— 用一句话将选择与用户的场景关联起来。(若满足<template>,则选择另一个模板。)<条件>
然后链接至以创建项目。如果对比结束时未给出明确的推荐(或清晰的“取决于X”结论),则视为不完整 —— 这种不确定性正是该技能区别于普通回答的关键。
template-instantiationDecision shortcuts for common pairs
常见模板对的决策捷径
Use these as the opinionated default when the user hasn't given a countervailing constraint. Still inspect with to confirm parameters, but lead with the verdict:
--help| Pair | Default pick | Because |
|---|---|---|
| | webapi ships controllers/minimal APIs + OpenAPI, no UI |
| | Standalone WASM runs fully client-side, works offline |
| | Generic Host: DI, logging, config, graceful shutdown, |
| | Razor Pages is lighter for CRUD-style pages |
当用户未给出相反约束时,可使用以下默认结论。仍需通过检查参数,但可先给出结论:
--help| 模板对 | 默认选择 | 原因 |
|---|---|---|
| | webapi包含控制器/极简API + OpenAPI,无UI界面 |
| | 独立WASM完全在客户端运行,支持离线使用 |
| | 通用主机:依赖注入、日志、配置、优雅关闭、 |
| | 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
常见陷阱
| Pitfall | Solution |
|---|---|
| Comparing uninstalled templates from memory | Install and inspect each template so the comparison reflects the real parameters and choices. |
| Assuming feature parity | Parameter names and feature support vary by template — confirm each with |
| Comparing fundamentally different template types | Only compare templates that solve overlapping problems; note when they target different scenarios. |
| 陷阱 | 解决方案 |
|---|---|
| 凭记忆对比未安装的模板 | 安装并检查每个模板,确保对比结果反映真实的参数和选项。 |
| 假设功能完全一致 | 参数名称和功能支持因模板而异 —— 请通过 |
| 对比完全不同类型的模板 | 仅对比解决重叠问题的模板;若模板针对不同场景,请注明。 |
More Info
更多信息
- dotnet new templates — built-in template reference
- dotnet new — CLI reference
- dotnet new templates —— 内置模板参考文档
- dotnet new —— CLI参考文档