azure-pipelines-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAzure Pipelines Generator
Azure Pipelines 生成器
Generate production-ready Azure DevOps pipeline YAML with deterministic steps, explicit fallbacks, and clear completion criteria.
生成可用于生产环境的Azure DevOps流水线YAML,具备确定性步骤、明确的降级方案和清晰的完成标准。
Trigger Guidance
触发指南
Use this skill when the user asks to generate or redesign Azure Pipelines YAML, for example:
- "Create for my Node service."
azure-pipelines.yml - "Build a multi-stage Azure DevOps pipeline with staging and production."
- "Generate Azure pipeline templates for reuse across repos."
- "Convert this CI flow to Azure Pipelines."
Do not use this skill for validation-only requests. For validation-only work, use .
azure-pipelines-validator当用户要求生成或重新设计Azure Pipelines YAML时使用这个技能,例如:
- "为我的Node服务创建。"
azure-pipelines.yml - "搭建包含预发和生产环境的多阶段Azure DevOps流水线。"
- "生成可跨代码仓库复用的Azure流水线模板。"
- "将这个CI流程转换为Azure Pipelines配置。"
不要将这个技能用于仅验证的请求。仅验证类工作请使用。
azure-pipelines-validatorExecution Model
执行模型
Normative keywords:
- : required
MUST - : default unless user asks otherwise
SHOULD - : optional
MAY
Deterministic sequence:
- Classify request mode.
- Capture minimum required inputs.
- Load minimum references (progressive disclosure).
- Generate YAML using the quality checklist.
- Validate (validator skill, script fallback, or manual fallback).
- Return output in the required report format.
If a step cannot run due to environment limits, use the fallback in that step and continue.
规范性关键词说明:
- :必须遵守
MUST - :默认遵守,除非用户另有要求
SHOULD - :可选
MAY
确定性执行流程:
- 对请求模式进行分类。
- 收集最低要求的输入信息。
- 加载最低参考资料(渐进式披露)。
- 按照质量检查清单生成YAML。
- 进行验证(调用验证技能、脚本降级或人工校验降级)。
- 按照要求的报告格式返回输出。
如果某个步骤因环境限制无法运行,使用该步骤对应的降级方案后继续执行。
1) Classify Request Mode
1) 对请求模式分类
Choose exactly one primary mode:
- Basic CI: build/test/lint for one stack.
- Multi-stage CI/CD: build -> test -> deploy with environment tracking.
- Docker: image build/push and optional deploy.
- Kubernetes: image build/push plus Kubernetes deployment.
- Language-specific: .NET, Node.js, Python, Go, Java focused.
- Template-based: reusable templates plus thin root pipeline.
- Snippet-only: partial YAML requested, not full pipeline.
Mode-to-example mapping:
- Basic CI ->
examples/basic-ci.yml - Multi-stage CI/CD ->
examples/multi-stage-cicd.yml - .NET ->
examples/dotnet-cicd.yml - Python ->
examples/python-cicd.yml - Go ->
examples/go-cicd.yml - Kubernetes ->
examples/kubernetes-deploy.yml - Template-based -> +
examples/template-usage.ymlexamples/templates/*.yml
仅选择一个主模式:
- 基础CI: 单一技术栈的构建/测试/语法检查流程。
- 多阶段CI/CD: 包含构建 -> 测试 -> 部署全流程,带环境追踪。
- Docker: 镜像构建/推送,可选择包含部署。
- Kubernetes: 镜像构建/推送 + Kubernetes部署。
- 特定语言: 聚焦于.NET、Node.js、Python、Go、Java的流水线。
- 模板化: 可复用模板 + 精简的根流水线。
- 仅代码片段: 用户请求部分YAML,而非完整流水线。
模式与示例映射:
- 基础CI ->
examples/basic-ci.yml - 多阶段CI/CD ->
examples/multi-stage-cicd.yml - .NET ->
examples/dotnet-cicd.yml - Python ->
examples/python-cicd.yml - Go ->
examples/go-cicd.yml - Kubernetes ->
examples/kubernetes-deploy.yml - 模板化 -> +
examples/template-usage.ymlexamples/templates/*.yml
2) Capture Required Inputs
2) 收集必填输入信息
Collect these before generation:
- App stack and package manager
- Build/test commands and report expectations
- Deployment target (none, Azure service, Docker registry, Kubernetes)
- Environment flow (dev/staging/prod) and branch gates
- Service connections, variable groups, secret handling
- Template requirement (yes/no)
Safe defaults when missing:
- CI branches: ,
maindevelop - Production deploy branch: only
main - Agent image: pinned image (for example )
ubuntu-22.04 - Deploy image tag: immutable (), never deploy
$(Build.BuildId)latest
If key details are missing, state assumptions explicitly in final output.
生成前收集以下信息:
- 应用技术栈和包管理器
- 构建/测试命令和报告要求
- 部署目标(无、Azure服务、Docker镜像仓库、Kubernetes)
- 环境流转流程(开发/预发/生产)和分支准入规则
- 服务连接、变量组、密钥处理方式
- 模板需求(是/否)
信息缺失时的安全默认值:
- CI触发分支:、
maindevelop - 生产环境部署分支:仅允许
main - Agent镜像:固定版本镜像(例如)
ubuntu-22.04 - 部署镜像标签:不可变标签(),绝对不部署
$(Build.BuildId)标签latest
如果关键信息缺失,在最终输出中明确说明假设条件。
3) Load References (Progressive Disclosure)
3) 加载参考资料(渐进式披露)
Read local references first.
Always read:
docs/yaml-schema.mddocs/best-practices.md
Read conditionally:
- when selecting tasks/inputs
docs/tasks-reference.md - only for template-based mode
docs/templates-guide.md
Then read only the closest example(s) from the mode mapping above.
Fallback behavior for missing references:
- Missing example: use nearest mode example and note substitution.
- Missing doc section: continue with known conventions and mark uncertainty.
- Snippet-only request: read only the minimum needed for safe output.
The final response MUST include:
References usedReferences skipped or missingImpact
优先读取本地参考资料。
必须读取:
docs/yaml-schema.mddocs/best-practices.md
条件读取:
- 选择任务/输入参数时读取
docs/tasks-reference.md - 仅模板模式下读取
docs/templates-guide.md
然后仅读取上述模式映射中最匹配的示例。
参考资料缺失时的降级行为:
- 缺失示例:使用最接近的模式示例,并说明替换情况。
- 缺失文档章节:按照已知规范继续,并标注不确定性。
- 仅代码片段请求:仅读取生成安全输出所需的最少内容。
最终响应必须包含:
已使用的参考资料跳过或缺失的参考资料影响
4) External Docs Escalation (Only When Needed)
4) 外部文档查询(仅必要时)
Escalate beyond local docs only when:
- required task info is not in local docs
- task version compatibility is unclear
- troubleshooting a task-specific failure
Use this order:
- Context7 (->
mcp__context7__resolve-library-id)mcp__context7__query-docs - Official docs search (Microsoft Learn first)
If network/tools are unavailable, proceed with best-known local guidance and add a residual-risk note.
仅在以下情况时才查询本地文档之外的资源:
- 本地文档中没有所需的任务信息
- 任务版本兼容性不明确
- 排查特定任务的失败问题
按以下顺序查询:
- Context7(->
mcp__context7__resolve-library-id)mcp__context7__query-docs - 官方文档搜索(优先Microsoft Learn)
如果网络/工具不可用,按照本地已知的最优指引继续,并添加残留风险说明。
5) Pipeline Generation Checklist
5) 流水线生成检查清单
Apply all items below unless user asks for a narrow snippet.
Security:
- Never hardcode secrets.
- Use service connections and variable groups/secrets.
- Use immutable deploy image tags.
Versioning:
- Pin to explicit version, not
vmImage.*-latest - Pin task major versions ().
Task@N - is allowed only when that task uses major
@0.0
Reliability:
- Use explicit .
dependsOn - Add for long-running jobs.
timeoutInMinutes - Use branch-gated deployment rules.
condition - Use deployment jobs with for deploy stages.
environment
Performance:
- Use where it improves dependency install time.
Cache@2 - Use shallow checkout when full history is not required.
- Publish only required artifacts.
Testing/observability:
- Run lint/tests in CI.
- Publish test results with .
condition: succeededOrFailed() - Publish coverage when available.
Maintainability:
- Add for stages/jobs/key steps.
displayName - Use templates when logic repeats.
- Add short comments only for non-obvious logic.
除非用户要求生成窄范围的代码片段,否则应用以下所有规则:
安全相关:
- 绝对不硬编码密钥。
- 使用服务连接、变量组/密钥管理敏感信息。
- 使用不可变的部署镜像标签。
版本控制相关:
- 将固定到明确版本,不要使用
vmImage。*-latest - 固定任务的主版本号()。
Task@N - 仅当任务的主版本就是时才允许使用
0。@0
可靠性相关:
- 使用明确的配置。
dependsOn - 为长时间运行的作业添加配置。
timeoutInMinutes - 使用分支准入的部署规则。
condition - 部署阶段使用带配置的部署作业。
environment
性能相关:
- 可缩短依赖安装时间时使用。
Cache@2 - 不需要完整历史记录时使用浅克隆。
- 仅发布必要的构件。
测试/可观测性相关:
- 在CI中运行语法检查/测试。
- 使用配置发布测试结果。
condition: succeededOrFailed() - 可用时发布覆盖率报告。
可维护性相关:
- 为阶段/作业/关键步骤添加。
displayName - 逻辑重复时使用模板。
- 仅为非显而易见的逻辑添加简短注释。
6) Validation Workflow
6) 验证工作流
Default path (MUST for full pipeline generation):
- Generate or update YAML.
- Validate with .
azure-pipelines-validator - Fix findings.
- Re-run validation until no blocking issues remain.
Script fallback if validator skill is unavailable but local validator scripts exist:
bash
bash devops-skills-plugin/skills/azure-pipelines-validator/scripts/validate_azure_pipelines.sh <pipeline-file>Manual fallback when neither skill nor script can run:
- YAML structure/indentation sanity
- Hierarchy sanity ()
stages -> jobs -> steps - Task format sanity ()
Task@Major - Secret exposure scan (no plaintext credentials/tokens)
- Deployment safety scan (environment usage, immutable deploy tags)
When fallback is used, final response MUST include:
Validation status: Manual fallbackChecks performedResidual risk
Validation MAY be skipped only for:
- snippet-only YAML
- documentation-only examples
- explicit user request to skip validation
默认路径(完整流水线生成时必须遵守):
- 生成或更新YAML。
- 使用验证。
azure-pipelines-validator - 修复发现的问题。
- 重新运行验证直到没有阻塞问题。
如果验证技能不可用但存在本地验证脚本,使用脚本降级方案:
bash
bash devops-skills-plugin/skills/azure-pipelines-validator/scripts/validate_azure_pipelines.sh <pipeline-file>如果技能和脚本都无法运行,使用人工校验降级方案:
- YAML结构/缩进合理性检查
- 层级合理性检查()
stages -> jobs -> steps - 任务格式合理性检查()
Task@Major - 密钥泄露扫描(无明文凭证/令牌)
- 部署安全扫描(环境使用、不可变部署标签)
使用降级方案时,最终响应必须包含:
验证状态:人工降级校验已执行的检查残留风险
仅在以下情况可跳过验证:
- 仅YAML代码片段请求
- 仅文档类示例
- 用户明确要求跳过验证
7) Output Contract
7) 输出约定
Final response MUST include:
- Pipeline YAML (or template set)
- Required setup:
- service connections
- variable groups/secrets
- environments and approvals/checks
- Validation result:
- validator status, script status, or manual fallback status
- Assumptions
- References used/skipped and impact
- Optional next improvements
最终响应必须包含:
- 流水线YAML(或模板集合)
- 所需的前置配置:
- 服务连接
- 变量组/密钥
- 环境和审批/检查规则
- 验证结果:
- 验证器状态、脚本状态或人工降级校验状态
- 假设条件
- 已使用/跳过的参考资料及影响
- 可选的后续优化建议
8) Canonical Example Flows
8) 标准示例流程
Example A: Full multi-stage generation
示例A:完整多阶段生成
- Select mode: Multi-stage CI/CD.
- Capture stack/deploy/service-connection inputs.
- Read ,
docs/yaml-schema.md, anddocs/best-practices.md.examples/multi-stage-cicd.yml - Add requested customizations (stages, branch gates, environments, tasks).
- Validate with ; fix and re-run.
azure-pipelines-validator - Return YAML + setup + validation + assumptions + references.
- 选择模式:多阶段CI/CD。
- 收集技术栈/部署/服务连接相关输入。
- 读取、
docs/yaml-schema.md和docs/best-practices.md。examples/multi-stage-cicd.yml - 添加用户要求的自定义配置(阶段、分支准入、环境、任务)。
- 使用验证;修复问题后重新运行。
azure-pipelines-validator - 返回YAML + 前置配置 + 验证结果 + 假设条件 + 参考资料说明。
Example B: Quick snippet generation
示例B:快速代码片段生成
- Select mode: Snippet-only.
- Read only the minimum required reference section.
- Generate focused YAML snippet with safe defaults.
- Skip full validation and state .
Validation status: Skipped (snippet-only) - Return snippet + assumptions + references.
- 选择模式:仅代码片段。
- 仅读取所需的最少参考章节。
- 生成聚焦的YAML代码片段,使用安全默认值。
- 跳过完整验证,标注。
验证状态:已跳过(仅代码片段) - 返回代码片段 + 假设条件 + 参考资料说明。
9) Definition of Done
9) 完成定义
The execution is complete only when all applicable checks pass:
- Request mode is explicitly chosen.
- Assumptions are explicit for missing inputs.
- YAML follows checklist requirements (security, versioning, reliability, performance, maintainability).
- Validation path is documented (validator, script fallback, or manual fallback).
- Final response follows the output contract, including references and impact.
仅当所有适用检查都通过时,执行才算完成:
- 已明确选择请求模式。
- 缺失输入的假设条件已明确说明。
- YAML符合检查清单要求(安全、版本控制、可靠性、性能、可维护性)。
- 验证路径已记录(验证器、脚本降级或人工降级校验)。
- 最终响应符合输出约定,包含参考资料和影响说明。