🇺🇸 English Original
Anthropic Applied AI · Engineering Playbook

The AI-Native SDLC Playbook

How to transform your software development lifecycle with AI—stage by stage.
AuthorLouis Claxton (Anthropic)
PublishedAugust 2026
CategoryEnterprise AI · Claude Code
Reading Time~20 min · Original English
🇨🇳 中文精译
Anthropic Applied AI · 工程实践指南

AI 原生 SDLC 实践指南:阶段性重塑软件研发生命周期

当编写代码不再是瓶颈,软件工程真正的约束转移到了前后的意图捕获、架构设计、测试验证与运维自愈。Anthropic 官方团队全面拆解六大阶段的落地范式与实操模板。
原作者Louis Claxton (Anthropic)
发布时间2026 年 8 月
分类标签Enterprise AI · Claude Code
阅读估时约 25 分钟 · 全文精译
🇺🇸 English Original
🇨🇳 中文精译
🇺🇸 English Original

Code is no longer the bottleneck

Organizations have started using AI to write code at a speed unthinkable one year ago, yet the processes around the code haven't changed at the same pace.

Many engineering teams still have the same approval gates, reviews, handoffs, and policies, stalling productivity gains made by using agentic coding solutions like Claude Code.

The Software Development Lifecycle (SDLC) is the process that takes software from idea to production. Most organizations run some version of the same six stages, covering planning, design, building, testing, deploying, and maintaining software. Traditionally, each stage is a discrete phase owned by a different role. Product managers write requirements, technical architects turn them into designs, engineers build the designs, QA teams at regulated enterprises verify it, release teams ship it, and operations monitors what is running. Work moves between the phases through documents, tickets, and sign-offs.

The traditional software development lifecycle (SDLC) is process-heavy to ensure accountability and control at each step. However, the traditional SDLC was designed to maximize efficiency in an era where the most time-consuming and expensive stage was writing and implementing code, which is no longer the case. PRDs, estimation rituals, and product security reviews all existed to force alignment during what could be weeks, months, or quarters of development work.

The traditional SDLC also features controls that assume every step is performed by humans. The organizations generating the most value have rebuilt their process around what agentic AI can now do, while ensuring that humans stay in the loop. In this guide, we walk through several of our Applied AI team's best practices for integrating Claude internally across each stage of the SDLC to accelerate development and make processes run faster, inspired by working with our customers.

When code is no longer the bottleneck and the build phase runs faster than the traditional SDLC allows for, three things become true:

  • The bottleneck moves to the steps to the left and right of the build phase. This is mainly plan, review/test, and deploy, which still run at human speed.
  • The controls stop matching reality and become intractable. Reviewing each line by hand made sense when a person had written it, but it can't keep up once agents write most of the diff.
  • Governance costs increase because exceptions still route through meetings and committees that meet weekly or monthly.
🇨🇳 中文精译

代码编写不再是瓶颈

过去一年中,各组织开始利用 AI 以一年前无法想象的速度编写代码。然而,围绕代码构建的组织流程与协作机制,却未曾以同等节奏进化。

许多工程团队依然维持着原有的审批卡点、漫长评审、多重交接与过时规范,导致使用 Claude Code 等智能体编码方案所带来的生产力跃升被严重阻滞。

软件研发生命周期(Software Development Life Cycle,简称 SDLC)是将一个想法转化为生产环境运行软件的核心流程。绝大多数组织都遵循着大同小异的六个阶段:规划(Plan)、设计(Design)、构建(Build)、测试(Test)、部署(Deploy)以及运维(Maintain)。在传统模式下,每个阶段都是由不同角色主导的离散步骤:产品经理撰写需求 PRD,技术架构师将其转化为架构设计,工程师动手编写代码,监管企业的 QA 团队进行质量验证,发布团队负责上线,而运维团队监控生产运行。工作成果通过文档、工单和签字确认在各阶段之间流转。

传统软件研发生命周期(SDLC)流程之所以如此繁重,核心是为了在每一步确保问责机制与有效控制。然而,传统 SDLC 设计的初衷,是为了在一个“编写和实现代码是最耗时且最昂贵阶段”的时代实现效率最大化——而今天,这一前提已经彻底不复存在。详尽的 PRD、估时仪式和繁复的产品安全评审,其存在都是为了在长达数周、数月甚至数个季度的漫长开发周期中强行对齐各方预期。

传统 SDLC 的各项管控机制还隐含了一个底层假设:每一个环节都由人类亲自执行。而收益最大化的领先组织,已经围绕智能体 AI(Agentic AI)的能力重塑了整个研发流程,同时确保人类在关键决策环路中(Human-in-the-loop)保持掌控。在这份指南中,我们将深入解析 Anthropic Applied AI 团队内部深度整合 Claude 的多项最佳实践,涵盖 SDLC 各阶段的加速方案与提效指南。

当编写代码不再是瓶颈,构建阶段的速度远超传统 SDLC 流程所能容纳的极限时,会出现三个必然事实:

  • 瓶颈向构建阶段的左右两侧转移:主要集中在规划、评审/测试和部署环节,因为这些环节依然以人类的原有速度运行。
  • 原有的管控机制脱离现实并难以为继:当一行行代码由人工敲出时,逐行人工代码审查(Code Review)是合理的;但当智能体生成了大部分代码差集(diff)时,人工逐行审查根本无法跟上节奏。
  • 治理成本急剧飙升:因为任何异常与例外仍需通过每周或每月召开的例会与委员会进行裁决。
🇺🇸 English Original
Build is no longer the constraint
Figure 1: Build is no longer the constraint — the human-speed steps around it are. Human-speed stages keep their length while build collapses to hours.
🇨🇳 中文精译
构建不再是约束瓶颈
图 1:构建不再是核心瓶颈,围绕其展开的人类速度环节才是。构建耗时已塌缩至数小时,而人类速度环节仍维持原有长度。
💡 图 1 核心名词解析 · Terminology Breakdown
Build phase
构建/实现阶段:指根据设计图和需求具体编写代码、完成程序功能的阶段。在智能体支持下,原本需要数周的工作被压缩到数小时。
Human-speed steps
人类速度环节:指需求审批、跨部门会签、人工逐行 Code Review 和手动发布等依然依赖人类排期与脑力操作的环节,耗时通常以天或周计算。
Bottleneck shift
瓶颈转移:当代码生成变得极快后,整体交付速度不再由“写代码有多快”决定,而是被“前后审批与测试有多慢”卡死。
🇺🇸 English Original

Let's use a security bottleneck as an example. Security teams are sized for human output, so when agents multiply code output, either the review queue builds or code ships under-reviewed. A regulated organization can't accept either outcome, so its security and policy checks have to keep pace with the agents.

To better realize the productivity gains of and secure agentic AI, the traditional SDLC lifecycle requires the same level of transformation as the implementation phase has undergone.

🇨🇳 中文精译

以安全评审瓶颈为例:安全团队的编制通常根据人类的代码产出规模匹配。当智能体让代码产出成倍暴增时,要么安全评审队列严重积压,要么代码在未经充分审查的情况下冒险上线。对于强监管组织而言,这两种结果都不可接受,因此其安全与合规校验必须提升到与智能体相同的吞吐速率。

为了充分释放智能体 AI 的生产力红利并确保工程安全,传统 SDLC 流程必须经历与实现阶段同等深度的根本性重塑。

🇺🇸 English Original

What is an AI-native SDLC?

The AI-native SDLC is a reimagined process that combines the old control objectives with new enforcement. Instead of a linear flow, the process becomes a loop, and AI is embedded at each point. The AI-native SDLC promotes automated handover and triggering of subsequent plays, helping to address the manual and clunky nature of handoff between the phases of the traditional SDLC.

🇨🇳 中文精译

什么是 AI 原生 SDLC?

AI 原生 SDLC 是一个重新构想的软件工程体系,它将传统的核心控制目标与全新的执行手段相结合。研发流程不再是单向线性的流水线,而是一个紧密协同的闭环,AI 深度嵌入到每一个节点中。AI 原生 SDLC 强调自动化的成果交接与后续动作的自动触发,从而彻底解决传统 SDLC 阶段之间人工交接的低效与割裂。

🇺🇸 English Original
AI-native SDLC loop
Figure 2: The AI-native SDLC loop: Plan → Design → Build → Test → Deploy → Maintain.
🇨🇳 中文精译
AI 原生 SDLC 闭环示意图
图 2:AI 原生 SDLC 闭环:规划(Plan)→ 设计(Design)→ 构建(Build)→ 测试(Test)→ 部署(Deploy)→ 运维(Maintain)。
💡 图 2 核心名词解析 · Terminology Breakdown
Plan (规划)
捕获业务意图,生成结构化的 intent.md 需求原型文件。
Design (设计)
对照代码库与组织规范 Skills,由 AI 和架构师共同生成 spec.md 技术方案。
Build (构建)
CLAUDE.md 和 Plan Mode 指引下生成落地计划 plan.md 并自动编写代码。
Test (测试)
智能体运行即时验证命令,CI 流水线执行自动化 Agent Evals 评测。
Deploy (部署)
智能体多轮预审 PR,通过代码化 Hooks 严格拦截未授权的发布动作。
Maintain (运维)
监控指标偏离基线时,智能体自动诊断排障并将结论写回闭环形成新意图。
🇺🇸 English Original

The shifts

The table below highlights the ends of the spectrum between traditional SDLC and AI-native SDLC, supported by Claude. Most organizations sit somewhere between the two columns.

Stage Traditional SDLC AI-native SDLC
Plan Requirements gathered by committee, distilled through workshops and sign-offs, written up by hand Claude synthesizes pain points straight from the sources and captures them within intent.md which is human readable and machine actionable
Design Spec written by analysts, parsed by designers Requirements and design compressed into one working session with an agent, guided by standards encoded as skills, versioned in git
Build Tests and code are handwritten and documentation is written after the main development happens Tests and code are generated by AI and institutional knowledge is maintained as versioned machine-readable CLAUDE.md files and skills
Test QA gates at stage boundaries Continuous evals woven through implementation
Deploy Humans review every line of code and governance occurs in review cycles, often inconsistently Layers of agentic review with human review reserved for regulated and critical code. Governance is enforced as the AI acts, with hooks as approval gates
Maintain Humans watch production for bugs Agents monitor live deployments. Any breached control band is diagnosed and written back into the loop as a new intent.md
🇨🇳 中文精译

核心范式转变

下表对比了传统 SDLC 与在 Claude 支持下的 AI 原生 SDLC 之间的核心差异。大多数现代化组织目前正处于由左向右迁移的光谱之中。

阶段 传统 SDLC 模式 AI 原生 SDLC 模式
规划 (Plan) 委员会收集需求,通过多次研讨会与签字确认层层提炼,人工手写 PRD 文档 Claude 直接从原始业务源头归纳痛点,并沉淀为既适合人类阅读又可供机器直接执行的 intent.md
设计 (Design) 分析师撰写技术规范,设计师逐行拆解解读 需求与架构设计压缩为与智能体的一次协作会话,由沉淀为 Skills(技能)的标准规范指引,全量纳入 Git 版本控制
构建 (Build) 手工编写测试与代码,开发主体完成后才补写技术文档 AI 生成测试与代码,组织知识库作为机器可读且受版本控制的 CLAUDE.md 文件和 Skills 进行维护
测试 (Test) 在各阶段边界设立人工质量把关(QA gates) 持续性评测(Continuous evals)贯穿于整个实现过程之中
部署 (Deploy) 人工逐行审查所有代码,合规治理分散在评审周期中且执行标准常不一致 分层的智能体自动审查,人类精力聚焦于受监管与关键核心代码。在 AI 操作时通过 Hooks 实时执行治理与审批门禁
运维 (Maintain) 运维人员人工值守生产环境监控与故障排查 智能体持续监控线上部署。一旦指标突破控制带,自动完成故障诊断并生成新的 intent.md 重新进入闭环
🇺🇸 English Original

The thread running through the right-hand column is the committed artifact. Each stage ends by writing one to version control (including intent.md, spec.md, plan.md, the diff and its tests, the PR with its review findings, and the incident record) and the next stage begins by reading it. For the early stages, .md files are the predominant artifact because a product owner and an agent can both read and act on the same file. From Build onward, the artifact is code and its records. The chain of commits is also the audit trail: who asked for what, what the agent produced, and who approved it.

Humans remain accountable for every decision that requires judgment. In the agentic SDLC world, the human attention shifts along with the artifacts that must be reviewed.

Every stage commits an artifact the next stage can read. Together, the intent, the spec, the plan, the diff and the review findings are the audit trail.
🇨🇳 中文精译

贯穿右侧 AI 原生模式的核心脉络是版本受控的工件(Committed Artifact)。每个阶段都以向版本控制系统提交一个标准化文件作为结束(包括 intent.mdspec.mdplan.md、代码 diff 与配套测试、带评审结论的 PR、事故排障记录),而下一阶段则通过读取该文件自动启动。在早期阶段,Markdown(.md)是主导工件,因为业务负责人与 AI 智能体都能无障碍地理解并操作同一份文件;从构建阶段开始,工件则延伸至代码本体及其衍生记录。这一连串的 Git Commit 链条同时构成了不可篡改的审计追踪线索:谁提出了诉求、智能体生成了什么、最终由谁审核批准。

在所有需要人类专业判断的决策节点上,人类始终承担最终责任。在智能体 SDLC 体系中,人类的关注点随同审查工件的形态发生了跃迁。

每个阶段提交下一阶段可读取的工件。业务意图(intent)、技术规范(spec)、实施计划(plan)、代码差集(diff)以及评审结论共同构成完整的合规审计链。
🇺🇸 English Original

Plays

The plays are the core of the playbook and are grouped into six non-linear stages (Plan, Design, Build, Test, Deploy, Maintain), which together cover the complete lifecycle.

Each play covers:

  • What changes;
  • Getting started;
  • Concrete steps for implementation;
  • Governance considerations; and
  • How you measure whether it worked.

These steps are modular and organizations may choose to prioritize transforming different stages at different times based on their unique needs. Each play names its dependencies under "Prerequisites," which the dependency graph further illustrates.

A stage ends by committing an artifact with the commit initiating the next stage. An accepted intent.md triggers the requirements and design pass, an approved spec.md triggers plan mode, a merged PR triggers the pipeline, and a breached control band in production writes the next intent.md and so the loop continues.

First, you prompt each step by hand with the end state being a loop in which each accepted artifact fires the next gate. Human attention concentrates at the gates, reviewing what the agent flagged rather than starting each stage from scratch.

🇨🇳 中文精译

实践矩阵(Plays Overview)

实践矩阵是本指南的核心,按六个非线性阶段划分(规划、设计、构建、测试、部署、运维),完整覆盖软件研发生命周期。

每个实践方案均包含:

  • 发生的变化(What changes);
  • 准备起步(Getting started);
  • 具体落地步骤(Concrete steps for implementation);
  • 治理与合规考量(Governance considerations);
  • 度量成效的指标体系(How you measure whether it worked)。

这些步骤是高度模块化的,团队可根据自身痛点自主决定推进的优先级。每个实践均在“先决条件(Prerequisites)”中明确了依赖项,如下图依赖拓扑所示。

阶段以提交工件结束,该提交随即触发下一阶段。通过验收的 intent.md 触发需求与设计会话,审批通过的 spec.md 触发规划模式(Plan Mode),合并的 PR 触发自动化流水线,而生产环境告警则自动撰写下一份 intent.md,从而让闭环持续流转。

起步时,可以通过手工 Prompt 驱动各个环节;终局状态则是一个由工件自动触发卡点的自治循环。人类精力聚焦于各个卡点的质量把关,审查智能体提炼的关键问题,而非每次从空白草稿从头开始。

🇺🇸 English Original
The plays dependency graph
Figure 3: The plays are listed with stage; the arrows give the order to adopt them in. The two are not the same. Start with any clay play — nothing points into it, so it needs nothing first. For any other play, the arrows pointing into it are the plays to adopt before it.
🇨🇳 中文精译
实践依赖拓扑图
图 3:各项实践按阶段列出,箭头指示落地实施的先后依赖顺序。可从任何无前置箭头的初始实践着手;对于后续实践,指向它的箭头即为必须先行落地的先决条件。
💡 图 3 完整节点名词解析 · Figure 3 Plays & Concepts Glossary
Clay plays
基石实践/起始实践:拓扑图中无任何前置输入箭头的根节点实践(如创建 CLAUDE.md、Plan Mode)。没有任何前置依赖,团队可立即着手推进。
Dependency arrows
依赖拓扑箭头:指示各项工程实践落地的先后次序。指向某项实践的箭头即为其必须先行实施的先决条件。
Capture as intent.md
以 intent.md 捕获业务意图(阶段一):业务发起人与 Claude 头脑风暴,用通俗语言直接沉淀为版本受控的结构化需求原型 intent.md
Requirements & design
需求与架构设计方案(阶段二):智能体在组织 Skills 约束下,将 intent.md 转化为可供工程实施的技术规范 spec.md
Plan mode
以 Plan Mode 作为默认起点(阶段三):在编写代码前,智能体先输出只读落地计划 plan.md 并由工程师审批。
Auto mode
Auto Mode 自动执行模式(阶段三):工程师审批计划后,智能体在护栏保护下自主连续应用代码修改。
The CLAUDE.md
CLAUDE.md 规范底座(阶段三):存放在仓库根目录供智能体每次会话必读的工程上下文与防错守则。
Skills
Skills 制度化工程知识(阶段三):将安全基线、API 规范封装为可按需激活的 .claude/skills/ 模块。
Hooks (Build-time)
Hooks 构建期确定性护栏(阶段三):在代码变更时通过确定性脚本阻断高危操作与格式偏离。
Parallel & subagents
并行会话与子智能体(阶段三):通过 Git Worktrees 并行推进多任务,并派发专属子智能体(如 Verifier 验证器)。
Feedback loop
建立即时反馈循环(阶段四):让智能体在汇报完成前自行运行构建与测试,自检并修复缺陷。
Continuous evals
CI 持续自动化评测(阶段四):在 CI 中持续运行智能体评测套件,确保 Prompt 与配置变更不引发工程能力倒退。
AI in PR review
PR 审查流中的 AI 辅助(阶段五):智能体多轮预审逻辑与合规问题,并在 @claude 提及时代为修复提交。
Approval gates
Hooks 审批发布门禁(阶段五):通过 Hook 强制要求人工审批 Token,拦截未经授权的生产发布命令。
CI/CD integration
CI/CD 深度集成与部署(阶段五):在沙箱中非交互运行 Claude,并通过 MCP 暴露受控的部署与回滚工具。
Maintenance & loop
运维与闭环流转(阶段六):线上异常自动触发 Claude,诊断结果作为新 intent.md 重新进入研发闭环。
Closing the loop
统计控制带闭环自愈(阶段六):通过 bands.yaml 监控指标偏离,自动触发分级响应与修复提案。
Claude Tag
Claude Tag 智能体线上值班(阶段六):智能体常驻协作频道,接收故障报警并协助工程师完成诊断与自愈。
🇺🇸 English Original
01

Plan

Ideas stop waiting for someone to write them up. Intent is captured once, in the originator's own words, as a version-controlled artifact the next stage can act on.
🇨🇳 中文精译
01

规划阶段 · Plan

新想法不再苦等人员排期整理。意图在最初由发起人原汁原味地捕获,并沉淀为版本受控的结构化工件,供下一阶段直接执行。
🇺🇸 English Original

Capture as intent.md

The intent.md, which kicks off the software development process can enter through different routes. A person has an idea, a ticket is filed, or an incident is surfaced via an alert (see Stage 6: Maintenance).

When a person has an idea, they brainstorm with Claude and produce a markdown proto-spec. In the traditional SDLC, the same person must then convince a member of the product team to write the idea up with them or on their behalf.

The proto-spec generated by Claude is human readable, version-controlled, and immediately consumable by the next stage. The proto-spec is saved as an intent.md.

Regardless of whether the intent originates from an event trigger or an agent, the same steps apply: the product owner reviews and corrects the agent-written intent.md before it is committed.

🇨🇳 中文精译

以 intent.md 捕获业务意图

作为启动软件开发源头的 intent.md,可以来自不同途径:员工产生的一个新创意、客服工单系统汇总的痛点,或是线上监控警报发现的异常事故(参见阶段六:运维)。

当业务人员产生一个想法时,他们直接与 Claude 进行头脑风暴,共同生成一份 Markdown 格式的原始规格草案(proto-spec)。在传统 SDLC 中,这个人必须先说服产品团队的一位 PM 协助撰写详尽需求。

由 Claude 协助生成的原始草案既易于人类阅读,又受到版本控制,并能立即被下一阶段消费。这份草案被保存为 intent.md

无论意图源自事件触发器还是智能体,执行逻辑完全相同:产品负责人在 intent.md 被 Commit 提交入库之前,对智能体草拟的内容进行复核与修正。

🇺🇸 English Original
Traditional An idea passes through backlog entries, user stories, story points, and refinement meetings before anyone can act on it. Ownership transfers at each handoff, so what reaches engineering is several steps removed from what the originator meant.
AI-native The originator brainstorms with Claude and writes the result down as intent.md, a proto-spec in the originator's own terms. The artifact contains what is wanted, why, and under which constraints. Repeat processes are encoded via skills.
🇨🇳 中文精译
传统 SDLC 一个想法必须在待办列表、用户故事、故事点估算和需求梳理会议中层层流转。所有权在每次交接中转移,最终到达工程团队手中的内容往往与发起人的初衷大相径庭。
AI 原生 SDLC 业务发起人与 Claude 进行头脑风暴,直接以发起人自己的语言写下 intent.md。工件明确包含想要什么、为什么想要以及受何种约束。高频重复流程沉淀为 Skills(技能)。
🇺🇸 English Original
Getting started
Prerequisites
None.
Infrastructure
Claude access for people who are not engineers (claude.ai or Cowork); an agreed intent.md template; a shared, version-controlled home for intent that the product owner watches. For a single product the simplest home is an intent/ folder in the product repo. This setup keeps the artifact chain next to the code derived from it. A dedicated intent repo is only worth the overhead when intent spans many repositories, and in a monorepo it is a directory. The Stage 3: Build sidebar covers how this home relates to a Jira or requirements tool that already holds the record.

Setting this up is a one-time task for the platform or engineering team. A technical team member needs to stand up the intent home and decide who can write to it, since many contributors will come from across the organization.

Once the repository exists, contributors without git experience don't need to use git directly. Instead a connector to the version-control system (e.g. GitHub) lets Claude commit markdown files on their behalf from claude.ai or Cowork.

🇨🇳 中文精译
准备起步 · Getting started
先决条件
无。
基础设施
为非技术人员开通 Claude 访问权限(claude.ai 或 Cowork);一套统一商定的 intent.md 模板;一个由产品负责人监控的、共享且受版本控制的意图存放仓库。对于单产品,最简方案是在产品代码库中建立 intent/ 文件夹,确保工件链紧挨着衍生出的代码。专用的意图仓库只在需求跨越多个代码库时才值得维护;在单体大仓(Monorepo)中它只是一个子目录。阶段三(构建)的侧栏将介绍该主目录如何与现有的 Jira 等需求工具协同。

设置该基础设施是平台或工程团队的一次性工作。技术团队成员负责搭建存放目录并配置写入权限,因为未来许多贡献者将来自组织各部门。

仓库建立后,非技术背景的业务贡献者无需学习 Git 命令行,通过版本控制连接器(如 GitHub Connector)即可让 Claude 在网页端代为提交 Markdown 文件。

🇺🇸 English Original

How to execute it

  1. The originator describes the problem to Claude in their own words. The originator may describe what they cannot do today, who is affected by the idea, what better looks like, or what is out of scope. No formal language is required.
  2. Brainstorm until the idea is concrete. Claude asks the questions an analyst would ask: scope, users, constraints, and what success looks like.
  3. Ask Claude to write the result as intent.md using the organization's template, which can be encoded as a skill set up by a technical team member and signed off by a lead. This can cover the problem, proposed outcome, affected users and systems, constraints, and open questions.
  4. The originator corrects anything Claude misunderstood.
  5. Commit intent.md to the shared home. Author and timestamp join the record, and the product owner picks the idea up from there.
🇨🇳 中文精译

具体落地步骤

  1. 业务发起人以通俗语言向 Claude 描述问题:描述当前无法做到的事情、受影响的用户、期望达成的理想效果以及明确不属于本次范围的内容,无需使用专业技术术语。
  2. 持续头脑风暴直至意图清晰具体:Claude 会像资深业务分析师一样提出关键问题:范围边界、目标用户、客观约束条件以及成功衡量标准。
  3. 让 Claude 依据团队模板生成 intent.md:该模板可配置为团队专属 Skill(由技术成员配置并由组长审核),涵盖:问题定义、期望产出、受影响用户与系统、硬性约束条件以及待澄清问题。
  4. 发起人校正 Claude 理解有偏差的地方
  5. intent.md 提交至指定目录:作者与时间戳随之固化,产品负责人据此接手推进。
🇺🇸 English Original

What it looks like (intent.md)

# Intent: claims status self-service
Author: J. Ortiz (claims operations). Status: draft.

## Problem
Customers phone the contact center to ask where their claim is.
Handlers spend roughly a third of call time on status-only queries.

## Proposed outcome
Customers see claim status, next step and expected date in the portal.

## Affected users and systems
Claims handlers, portal team, claims-core API.

## Constraints
No new PII in the portal session. Existing authentication only.

## Open questions
Do third-party loss adjusters need access too?
🇨🇳 中文精译

实操代码示例 (intent.md)

# Intent: claims status self-service
Author: J. Ortiz (claims operations). Status: draft.

## Problem
Customers phone the contact center to ask where their claim is.
Handlers spend roughly a third of call time on status-only queries.

## Proposed outcome
Customers see claim status, next step and expected date in the portal.

## Affected users and systems
Claims handlers, portal team, claims-core API.

## Constraints
No new PII in the portal session. Existing authentication only.

## Open questions
Do third-party loss adjusters need access too?
🇺🇸 English Original

Governance considerations

The evidence is the committed intent.md, which lists the author, the timestamp and the full revision history. It's logged in the git history of the intent home. The product owner approves, and the accept or reject decision that sends the intent into Stage 2: Design is recorded as the merge or the closing review.

🇨🇳 中文精译

治理考量

合规审计证据即为提交入库的 intent.md,记录了作者、时间戳及完整版本历史。产品负责人的审核决定(是将该意图推进到阶段二还是予以关闭)通过 Pull Request 的合并或关闭记录完整归档。

🇺🇸 English Original
How to measure it
Leading indicator
Time from first conversation to a committed intent.md, read from git history on the intent home, which records author and time stamp. The expectation is to fall from a multi-week elicitation and refinement cycle to hours.
Lagging indicator
The survival rate, or the share of intent.md files that the product owner accepts into Stage 2: Design rather than closes. The accept or reject decision is recorded as the merge of the artifact or the closed review. Additionally, the number of changes made to the intent.md that are made after the first spec.md commit for the same change.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
从发起首次对话到 intent.md 正式 Commit 的耗时。预期从传统的数周需求调研梳理周期骤降至数小时内。
滞后指标
存活率(Survival Rate):产品负责人采纳进入阶段二而非直接关闭的 intent.md 比例;以及在同一需求的首份 spec.md 提交后,intent.md 发生后续修改的频次。
🇺🇸 English Original
02

Design

Requirements and design collapse into one session. Policy is applied while the spec is written, not discovered in a review weeks later.
🇨🇳 中文精译
02

设计阶段 · Design

需求分析与架构设计压缩为一次会话。在撰写规范的同时实时应用合规策略,而不是几周后在评审会上才被动发现。
🇺🇸 English Original

Requirements and design

Once approved by the product owner, Claude takes the accepted intent.md and produces a requirements and design spec. This is guided by the organization's skills for brand, security, compliance, and UX.

The product owner reviews that spec, but doesn't write it. The goal of this process is to create a spec the engineering team can plan against, with flagged areas of concern.

Front-end work is the clearest example. Once the intent.md is accepted, the product owner mocks the design up in Claude Design (beta) from the intent.md, iterates on the mock, and then exports it to Claude Code to build.

🇨🇳 中文精译

需求与技术方案设计

一旦获得产品负责人批准,Claude 便读取通过验收的 intent.md,并输出一份需求与设计技术规范。这一过程由组织沉淀在品牌、安全、合规与 UX 领域的 Skills(技能) 作为硬性指引。

产品负责人负责审核该规范,但无需亲自撰写。该流程的目标是产出一份工程团队可以直接据此规划实施的 spec.md,并显式标出值得关注的风险点。

前端开发是最直观的范例:一旦 intent.md 被接受,产品负责人可直接在 Claude Design(Beta)中基于 intent.md 快速生成界面原型并迭代打磨,随后将其导出至 Claude Code 进行构建。

🇺🇸 English Original
Traditional Requirements and design are separate phases run by separate teams. Analysts formalize the idea into requirements and designers then parse those back into a design. The separation exists for accountability, but it is slow and lossy.
AI-native Both phases happen in a single prompted session. Claude takes intent.md and produces a requirements and design spec, constrained by the organization's skills, with areas of concern flagged.
🇨🇳 中文精译
传统 SDLC 需求和设计是由不同团队负责的独立阶段。分析师将想法转化为需求文档,设计师再将其拆解转化为设计。这种割裂虽然为了问责,但过程缓慢且信息损耗极大。
AI 原生 SDLC 两个阶段合并在与智能体的一次 Prompt 会话中完成。Claude 读取 intent.md 并输出受组织 Skills 约束的需求与设计规范,显式高亮疑难问题。
🇺🇸 English Original
Getting started
Prerequisites
Write an intent.md file, with brand, security, compliance, and UX policies written as skills.
Infrastructure
A product owner with Claude access. No engineering skill is required.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
撰写一份 intent.md 文件,并将品牌、安全、合规与 UX 策略编写为 Skills。
基础设施
拥有 Claude 访问权限的产品负责人。无需掌握专业工程编程技能。
🇺🇸 English Original

How to execute it

  1. The product owner opens a session with the organization's skills available and attaches the intent.md.
  2. The product owners prompt points at the intent.md, names the constraints, and demands flagged concerns. Run it by hand at first, then codify it as an organization-level slash command. From there make the acceptance of intent.md in the intent home the trigger, with a non-interactive job that fires on the merge, run the pass with the organization's skills loaded, and commit spec.md as a pull request (the CI/CD play in Stage 5: Deploy covers the plumbing). From that point the product owner's first involvement is the review.
  3. The same product owner reviews the spec against the idea. Does the spec solve the stated problem, and are the open questions from intent.md answered or carried forward?
  4. Work through the flagged concerns first as they are the points an analyst would have escalated. The product owner resolves each one with its policy owner before engineering sees the spec.
  5. Commit spec.md alongside intent.md. The file pair records what was asked for and what was decided.
  6. The product owner decides whether the spec and intent progress to build, consulting a technical lead for anything the organization classes as higher risk. A human team mate always makes this call, and accepting the spec is what starts the plan mode play in Stage 3: Build.
🇨🇳 中文精译

具体落地步骤

  1. 产品负责人开启一个挂载了组织 Skills 的会话,并附上 intent.md
  2. 产品负责人的 Prompt 指向 intent.md,明确约束条件并要求主动高亮风险点。起步时可手工执行,后续可固化为组织级斜杠命令(Slash Command)。最终状态是将 intent.md 的合并设为自动触发器,通过非交互式任务自动生成 spec.md 并发起 PR(阶段五的 CI/CD 将介绍该链路)。届时产品负责人的首要工作即为评审。
  3. 产品负责人对照原始想法审核该规范:规范是否解决了所阐述的问题?intent.md 中的未决问题是否得到解答或妥善传递?
  4. 首先解决被标记出的风险隐患,这些往往是分析师需要上报的关键问题。在工程团队接触规范前,产品负责人与各策略负责人对齐解决。
  5. spec.mdintent.md 一并提交入库。这对文件共同记录了“提出了什么诉求”与“作出了何种设计决策”。
  6. 产品负责人决定是否将规范和意图推进至构建阶段,对高风险项目可咨询技术主管。人类团队成员始终保留最终决定权,接受该规范即可启动阶段三(构建)的规划模式。
🇺🇸 English Original

What it looks like (the prompt)

Read the attached intent.md and produce a requirements and design spec for integrating it into our existing codebase. Apply the skills available to you so the plan conforms to our brand guidelines, security policies and UX standards. Document the spec fully as spec.md, ready to hand to the engineering team. Describe clearly any areas of concern, especially where you cannot satisfy contradicting policies.
🇨🇳 中文精译

实操提示词模版 (Prompt)

Read the attached intent.md and produce a requirements and design spec for integrating it into our existing codebase. Apply the skills available to you so the plan conforms to our brand guidelines, security policies and UX standards. Document the spec fully as spec.md, ready to hand to the engineering team. Describe clearly any areas of concern, especially where you cannot satisfy contradicting policies.
🇺🇸 English Original

Governance considerations

Instead of being discovered in a review weeks later, the live policy is read and applied while the spec is written. The organization's skills are applied as constraints on the spec. The spec, the prompt that produced it, and the skill versions in force are all logged in version control. The product owner signs off the spec, and routes flagged concerns to the named policy owners.

🇨🇳 中文精译

治理考量

合规策略不再是在几周后的评审会上被偶然发现,而是在撰写规范的当下即被实时读取和应用。组织的 Skills 作为硬性约束作用于规范。规范本身、生成它的 Prompt 以及生效的 Skill 版本均完整记录在版本控制中。产品负责人签字确认,并将高亮隐患分发至对应责任人。

🇺🇸 English Original
How to measure it
Leading indicator
Elapsed time between the intent.md commit and the spec.md commit for the same change (two git timestamps), compared with the old requirements-plus-design cycle.
Lagging indicator
Requirements rework after build starts. Count spec.md commits dated after the first plan.md commit for the same change. Git log will give this directly.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
intent.md 提交到对应 spec.md 提交的耗时(对照两个 Git 时间戳),与以往的需求加设计周期进行对比。
滞后指标
构建开始后的需求返工量。统计在同一改动的首个 plan.md 提交之后发生的 spec.md 修改提交次数。
🇺🇸 English Original
03

Build

Nothing is implemented without an accepted plan. Institutional knowledge becomes files the agent reads, and the guardrails run as code rather than as habits.
🇨🇳 中文精译
03

构建阶段 · Build

没有任何代码在未经批准的计划下被盲目实现。团队沉淀的制度化知识转化为智能体随时读取的文件,而工程护栏直接作为代码自动运行。
🇺🇸 English Original

Claude Code plan mode as the default starting point

Engineers start Claude Code sessions in plan mode, give Claude the approved spec.md from Stage 2: Design, and let it interview them, iterating on the plan until the engineer is happy with it.

🇨🇳 中文精译

以 Claude Code 规划模式作为默认起点

工程师在开启 Claude Code 会话时,默认从规划模式(Plan Mode)启动。工程师将阶段二生成的 spec.md 交付给 Claude,让智能体主动提问澄清,迭代生成可落地的实施计划 plan.md,直到工程师完全满意为止。

🇺🇸 English Original
Traditional An engineer reads the design and starts writing code. How the change will be made, down to which files and which tests, stays in the engineer's head or at best a ticket comment. Nobody else can review it. The first thing a reviewer sees is the finished diff, and by then rework is slow.
AI-native Work starts with a written plan that Claude produces in plan mode, where it can read the codebase without changing anything. The engineer corrects the plan before code is written, and the approved version is committed as plan.md for later stages to check against.
🇨🇳 中文精译
传统 SDLC 工程师看完需求便直接动手编码。具体要改动哪些文件、加哪些测试全凭个人脑内构思。审阅者直到看到成百上千行 diff 时才能介入,此时任何重构都极其痛苦。
AI 原生 SDLC 所有编码工作始于 Claude 在 Plan Mode 下生成的结构化计划。在该模式下智能体只能读取代码库而无法修改。工程师批准后计划被提交为 plan.md
🇺🇸 English Original
Getting started
Prerequisites
The intent artifact (intent.md or spec.md) if one exists, and the CLAUDE.md file helps.
Infrastructure
Claude Code with access to the repository.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
阶段一或阶段二产出的工件(intent.mdspec.md),配合 CLAUDE.md 文件效果更佳。
基础设施
拥有代码库访问权限的 Claude Code 环境。
🇺🇸 English Original

How to execute it

  1. The engineer starts the session in plan mode with Claude.
  2. The engineer gives Claude the intent.md and the spec.md and asks for an implementation plan that names the files that change, the order of the work, and the tests that prove it.
  3. Interrogate the plan by asking what the change could break, which step is most risky, and what other options Claude chose not to do.
  4. Iterate until an engineer who has never seen the conversation could implement the change from the plan alone.
  5. Commit the approved plan as plan.md. The plan joins the audit trail, and the PR review play (Stage 5: Deploy) checks the eventual diff against it.
  6. Accept the plan and let Claude implement. With a solid plan, the implementation is often a single pass.
  7. When implementation departs from the plan, update plan.md in the same commit. Consider using a hook to enforce synchronization between the two.
🇨🇳 中文精译

具体落地步骤

  1. 工程师在 Claude Code 中进入 Plan Mode(规划模式)。
  2. 交付 intent.mdspec.md,要求 Claude 产出包含:改动文件清单、实施先后次序及验证测试方案的落地计划。
  3. 向智能体发起质询:“本次改动可能破坏什么现有功能?最危险的步骤是什么?为什么不采用备选方案?”
  4. 持续打磨计划,直到一位从未参与会话的第三方工程师仅凭该 plan.md 也能独立实施。
  5. 将批准后的计划提交为 plan.md 纳入版本控制,后续的 PR 审查将严格对照该文件检验代码。
  6. 切换为执行模式,让 Claude 依据计划编写代码。通常在详尽计划指引下,代码实现可一次性高质量通过。
  7. 若实现过程中偏离计划,必须在同一个 Commit 中同步修正 plan.md。建议使用 Hook 强制确保两者同步。
🇺🇸 English Original

What it looks like (plan.md)

# Plan: claims status self-service (from intent.md 2026-06-02)

## Files that change
portal/src/claims/StatusPanel.tsx (new), claims-api/routes/status.py,
claims-api/tests/test_status.py

## Order of work
1. Add the status endpoint behind existing auth.
2. Panel against the endpoint.
3. Wire into the portal nav.

## Risks
The claims-core API rate-limits at 50 rps; the panel must cache.

## Proof
test_status.py covers the four claim states; screenshot matches the
approved mock.
🇨🇳 中文精译

落地示例 (plan.md)

# Plan: claims status self-service (from intent.md 2026-06-02)

## Files that change
portal/src/claims/StatusPanel.tsx (new), claims-api/routes/status.py,
claims-api/tests/test_status.py

## Order of work
1. Add the status endpoint behind existing auth.
2. Panel against the endpoint.
3. Wire into the portal nav.

## Risks
The claims-core API rate-limits at 50 rps; the panel must cache.

## Proof
test_status.py covers the four claim states; screenshot matches the
approved mock.
🇺🇸 English Original

Governance considerations

Design review happens before any code is generated, when changing course is still a matter of editing a document. Plan mode enforces this itself, since Claude cannot edit files until the engineer accepts the plan. The plan and its revisions are logged along with who accepted it. Routine changes are approved by the engineer, and anything the organization classes as higher risk goes to a tech lead or architect.

🇨🇳 中文精译

治理考量

设计评审在生成任何代码之前完成,此时调整方向仅需修改文档。Plan Mode 本身强制执行了这一约束,因为在工程师批准计划之前,Claude 无法编辑任何文件。计划及其修订记录连同批准人一同归档。常规改动由工程师审批,高风险改动流转至技术主管或架构师。

🇺🇸 English Original
How to measure it
Leading indicator
Share of changes that merge from the first implementation pass, and time from plan approval to merged PR with the required data within the PR metadata.
Lagging indicator
Rework cycles per change, again from the PR metadata, and how often the merged diff still matches the committed plan.md.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
首轮实现即顺利合并的变更比例,以及从计划批准到 PR 合并的周期时长。
滞后指标
单次变更的返工循环次数,以及合并后的代码 diff 与最初提交的 plan.md 保持一致的概率。
🇺🇸 English Original

Claude Code on auto mode

Claude Code can also run in auto mode, where the engineer approves the plan and, once happy and iterated upon, Claude applies each change without a per-edit prompt. As the guardrails from the later plays mature (a tuned CLAUDE.md, skills that encode policy, hooks that block unsafe actions, and a test suite Claude can run), auto-accept becomes the default for routine work: a tight spec.md, a small blast radius, and code the tests already cover.

The shift is now away from the user watching the agent make the edits and reviewing actions, towards the review of artifacts after longer autonomous sessions. Auto-accept mode further enables parallelism across individuals and the team when used with worktrees and is fundamental to running the SDLC autonomously and closing the loop as described in Stage 6: Maintenance.

🇨🇳 中文精译

Claude Code 自动执行模式

Claude Code 还支持在 Auto Mode(自动执行模式)下运行。工程师对计划感到满意并批准后,Claude 可以在无需每一步人工确认的情况下连续执行修改。随着后续实践中的护栏逐渐成熟(调优完备的 CLAUDE.md、封装了策略的 Skills、阻断高危操作的 Hooks 以及 Claude 可自行运行的测试套件),对于边界清晰、影响范围小且已有测试覆盖的常规工作,自动接受模式将成为默认选择。

工程师的重心由此从“盯视智能体每一次修改”转变为“在较长的自主会话后集中审阅工件”。结合 Worktrees 使用时,自动模式进一步支持个人及团队的并行工作,这是实现自治 SDLC 与阶段六运维闭环的基础。

🇺🇸 English Original
Sidebar

Legacy systems and the source of truth

Applies to every artifact the process produces.

Existing SDLC processes likely already track artifacts, just not in markdown files. Work items may be in Jira, requirements in a tool with regulatory traceability built in, designs in Figma, and change approvals with a change board. Those systems are hard to displace because auditors and regulators already accept them and other teams depend on them, so the AI-native SDLC has to fit around what exists.

When transitioning to the AI-native SDLC, for every artifact the process produces, name one system as the source of truth, with everything else holding a copy or a link to the original. The configurations below can be set up to have one source of truth, with the choice differing per artifact:

  • The repo as the source of truth. The markdown artifacts are the authoritative record and the legacy system references files within commits. This can be one of the cleanest configurations for engineering-led organizations, as all records live in one tool with one timestamp authority.
  • The legacy system as the source of truth. Jira, ServiceNow, or the requirements tool holds the authoritative record and the markdown artifacts are working copies. Claude reads the record at the start of the session and writes the outcome back through an MCP connector in the same session that produced the spec or the plan.
  • Linkage as the minimum bar. All artifacts note the record ID and all legacy records contain the commit SHA of the markdown file. Linkage is a good place to start when transitioning to the AI-native SDLC, accepting that there are two sources of truth.

Both the legacy system and the markdown-first system can coexist, so long as there is a link between the two or one is declared the source of truth.

🇨🇳 中文精译
侧栏深度解析

传统遗留系统与唯一事实源 (Source of Truth)

本原则适用于研发流程中产出的所有工件。

现有的 SDLC 流程通常已经在追踪各类工件,只是它们并不以 Markdown 文件的形式存在:任务项在 Jira 中,需求在具有合规追溯性的系统里,设计在 Figma 中,而变更审批通过变更委员会流转。这些系统很难被轻易取代,因为审计员和监管机构已经认可它们,其他团队也依赖它们,因此 AI 原生 SDLC 必须与现有系统相兼容。

在向 AI 原生 SDLC 转型的过程中,对于流程产出的每一项工件,必须明确指定一个系统作为“唯一事实源(Source of Truth)”,其他系统仅保留副本或指向原件的链接。针对不同工件,可采取以下配置策略:

  • 以代码仓库为唯一事实源:Markdown 工件是权威记录,传统系统仅引用 Git Commit 中的文件。这是工程主导型组织中最干净的架构,所有记录都在统一的时间戳权威下集中管理。
  • 以传统系统为唯一事实源:Jira、ServiceNow 或专用需求工具保存权威记录,Markdown 工件作为工作副本。Claude 在会话开始时读取记录,并通过 MCP 连接器在同一次会话中将产出的 spec 或 plan 写回传统系统。
  • 以相互链接作为最低基线:所有工件记录对应系统的 ID,所有传统系统记录保存 Markdown 文件的 Commit SHA。这是过渡初期的实用选择。

传统系统与 Markdown 优先系统完全可以和平共存,关键在于建立两者之间的双向链接或明确哪一方为唯一权威。

🇺🇸 English Original

The CLAUDE.md

CLAUDE.md gives Claude the context a new joiner would need, covering conventions, commands, architecture, and the mistakes the team sees most often. Knowledge that used to sit in people's heads and on wikis becomes a file the agent reads at the start of every session, maintained by the whole team and iterated on whenever a mistake is made.

🇨🇳 中文精译

CLAUDE.md:团队知识的统一底座

CLAUDE.md 为 Claude 提供了一位新入职员工所需的所有核心上下文,涵盖编码约定、常用命令、架构分层以及团队最常遇到的错误清单。以往零散在脑海或 Wiki 中的隐性知识,沉淀为智能体在每次会话开始时必读的文件,由全团队共同维护,每犯一次错误便迭代更新一次。

🇺🇸 English Original
Getting started
Prerequisites
None.
Infrastructure
A repo, Claude Code installed, and one engineer who knows the codebase well.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
无。
基础设施
一个代码仓库、安装好的 Claude Code,以及一位熟悉该代码库的工程师。
🇺🇸 English Original

How to execute it

  1. Run /init in the repo. Claude generates a starting CLAUDE.md from what it finds.
  2. Cut the generated file down to what a new joiner would need on day one. Keep the build, test and lint commands, the conventions that matter, and the things Claude keeps getting wrong.
  3. Check CLAUDE.md into git at the repo root so the whole team shares one version and changes are reviewed like code.
  4. A working rule helps here. When Claude makes a mistake twice, the correction goes into CLAUDE.md.
  5. Keep it under a page, because Claude reads all of it at the start of a session and anything stale is taking up context for no benefit.
🇨🇳 中文精译

具体落地步骤

  1. 在仓库中运行 /init。Claude 会根据扫描到的项目结构生成一份初始 CLAUDE.md
  2. 将生成的文件精简至新员工第一天真正所需的内容。保留构建、测试和代码检查命令、关键约定以及 Claude 反复犯错的事项。
  3. CLAUDE.md 提交至仓库根目录,使全团队共享统一版本,其变更像代码一样经过评审。
  4. 建立工作守则:当 Claude 犯了两次同样的错误时,纠正指令必须写入 CLAUDE.md
  5. 将文件体积控制在一页以内。因为 Claude 会在每次会话开始时全量读取它,任何过时的内容都会白白消耗上下文窗口。
🇺🇸 English Original

What it looks like (CLAUDE.md)

# Payments service

## Commands
- Build: make build
- Test: make test (unit), make itest (integration, needs docker)
- Lint: make lint (runs in CI; fix before pushing)

## Conventions
- Java 21, Spring Boot 3. No new Lombok.
- Money is always BigDecimal, never double.
- Every endpoint needs an integration test in src/itest.

## Architecture
- api/ holds REST controllers, core/ holds domain logic,
  adapters/ talks to external systems.
- Kafka events are defined in schemas/; never edit generated classes.

## Things Claude gets wrong
- Do not bump dependency versions; the platform team owns them.
- The legacy v1/ package is frozen; changes go in v2/.
🇨🇳 中文精译

CLAUDE.md 实操模版

# Payments service

## Commands
- Build: make build
- Test: make test (unit), make itest (integration, needs docker)
- Lint: make lint (runs in CI; fix before pushing)

## Conventions
- Java 21, Spring Boot 3. No new Lombok.
- Money is always BigDecimal, never double.
- Every endpoint needs an integration test in src/itest.

## Architecture
- api/ holds REST controllers, core/ holds domain logic,
  adapters/ talks to external systems.
- Kafka events are defined in schemas/; never edit generated classes.

## Things Claude gets wrong
- Do not bump dependency versions; the platform team owns them.
- The legacy v1/ package is frozen; changes go in v2/.
🇺🇸 English Original

Governance considerations

CLAUDE.md is version controlled, so the instructions the agent works to are reviewable and auditable. Team conventions are applied through the file, changes to it are logged in git history, and code owners approve those changes in PR review.

🇨🇳 中文精译

治理考量

CLAUDE.md 纳入版本控制,因此智能体遵循的指令是完全可审查和可审计的。团队约定通过该文件生效,变更记录在 Git 历史中,并由 Code Owner 在 PR 评审中签字确认。

🇺🇸 English Original
How to measure it
Leading indicator
How often Claude repeats a mistake CLAUDE.md should have caught. The corrections or changes to the CLAUDE.md should be tracked within the git history.
Lagging indicator
Time to first merged PR for a new member of the team from PR history.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
Claude 重复出现本应被 CLAUDE.md 拦截的错误的频次。通过 Git 追踪对 CLAUDE.md 的修订记录。
滞后指标
新团队成员完成首个 PR 合并所需的时间周期。
🇺🇸 English Original

Skills as institutional knowledge

Skills are how an organization makes its institutional knowledge operational. The instructions are explicit, version-controlled, applied broadly, and updated centrally when policy changes. The rule of thumb: write a skill for institutional knowledge that must be applied consistently; don't write a skill for components that belong in CLAUDE.md or a prompt.

🇨🇳 中文精译

Skills:制度化组织工程知识

Skills 是组织将其制度化知识转化为可操作能力的方式。其指令清晰明确、纳入版本控制、广泛应用并在策略变更时集中更新。核心准则:针对必须一致执行的制度化知识编写 Skill;不要为属于 CLAUDE.md 或单次 Prompt 的零散组件编写 Skill。

🇺🇸 English Original
Getting started
Prerequisites
None required. Having a CLAUDE.md helps, because it keeps the agent's working knowledge in the repo, but a skill does not depend on it.
Infrastructure
One policy with a named owner and a written source of truth.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
非必需。配置有 CLAUDE.md 效果更佳,但 Skill 本身不依赖它。
基础设施
拥有明确责任人和书面事实源的策略规则。
🇺🇸 English Original

How to execute it

  1. Pick one piece of knowledge that is enforced inconsistently today. This could be a security standard, an API design convention, or a brand rule.
  2. Write it as a skill, a folder containing a SKILL.md whose frontmatter says when it triggers and whose body says what to do. An engineer writes it from the policy owner's source of truth, using Claude to help.
  3. Put the skill in the repo at .claude/skills/<name>/ so it ships with the code, or distribute it organization-wide through a plugin.
  4. Test that the skill triggers. Ask Claude to do the relevant task in different ways and confirm the skill loads each time.
  5. When the policy changes, change the skill and have the policy owner sign off the change.
  6. Engineers pick up the new version automatically in their next session.
🇨🇳 中文精译

具体落地步骤

  1. 挑选一项当前执行标准不一致的制度知识(如 API 安全标准、接口设计约定或品牌规则)。
  2. 将其编写为 Skill:一个包含 SKILL.md 的文件夹,其 Frontmatter 定义触发条件,正文定义具体操作。由工程师协助策略负责人编写。
  3. 将 Skill 放置在仓库的 .claude/skills/<name>/ 目录下随代码交付,或通过 Plugin 在全组织范围内分发。
  4. 测试 Skill 是否正确触发:以不同方式向 Claude 派发相关任务,确认每次均正确加载该 Skill。
  5. 当策略发生变更时,修改 Skill 并由策略负责人签字确认。
  6. 工程师将在下一次会话中自动获取最新版本。
🇺🇸 English Original

What it looks like (.claude/skills/secure-api-review/SKILL.md)

---
name: secure-api-review
description: Apply the API security standard. Use whenever creating or
  modifying an external-facing endpoint, reviewing API code, or
  generating an OpenAPI spec.
---
# Secure API review

When you create or change an API endpoint:
1. Authentication: every endpoint requires the gateway JWT;
   no anonymous routes outside /health.
2. Input validation: validate request bodies against the OpenAPI
   schema and reject unknown fields.
3. Audit: every state-changing endpoint emits an audit event with
   actor, action, entity and timestamp.
4. Data classification: fields tagged pii in the schema must never
   appear in logs or error messages.

Run scripts/check-endpoints.sh and include its output in your summary.
🇨🇳 中文精译

Skills 定义示例 (.claude/skills/secure-api-review/SKILL.md)

---
name: secure-api-review
description: Apply the API security standard. Use whenever creating or
  modifying an external-facing endpoint, reviewing API code, or
  generating an OpenAPI spec.
---
# Secure API review

When you create or change an API endpoint:
1. Authentication: every endpoint requires the gateway JWT;
   no anonymous routes outside /health.
2. Input validation: validate request bodies against the OpenAPI
   schema and reject unknown fields.
3. Audit: every state-changing endpoint emits an audit event with
   actor, action, entity and timestamp.
4. Data classification: fields tagged pii in the schema must never
   appear in logs or error messages.

Run scripts/check-endpoints.sh and include its output in your summary.
🇺🇸 English Original

Governance considerations

A skill is a control, though an advisory one. It makes Claude likely to apply the policy while the code is written, and nothing forces a session to comply with it. A policy that must always hold needs something deterministic behind the skill, such as a hook that blocks the action or a review pass that re-checks the policy at the PR. The skill makes violations rare and the hook makes them close to impossible. Skill invocations are logged in session traces, and the policy owner reviews skill changes like code.

🇨🇳 中文精译

治理考量

Skill 是一种建议性控制(Advisory Control)。它促使 Claude 在编写代码时遵循策略,但无法硬性阻断违规操作。对于必须毫无例外遵守的策略,需要配合确定性控制机制(如阻断操作的 Hook 或在 PR 中二次校验的评审流程)。Skill 让违规变得罕见,Hook 让违规几乎不可能发生。Skill 的调用记录在会话日志中,策略所有者像审查代码一样审查 Skill 的修改。

🇺🇸 English Original
How to measure it
Leading indicator
Time from the policy owner approving a policy change to the updated skill merging, taken from the PR on the skill folder.
Lagging indicator
PR reviews findings that cite the policy, which should fall towards zero once the skill is applying the policy while the code is written. Where the findings don't fall towards zero, either the skill isn't triggering or its text has drifted from the official policy.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
从策略负责人批准变更到更新后的 Skill 完成合并的耗时。
滞后指标
PR 评审中引用该策略的问题数量。在 Skill 正常发挥作用后该数值应趋近于零。若未下降,说明 Skill 未被正确触发或文本与官方策略脱节。
🇺🇸 English Original

Hooks as build-time guardrails

A skill is an advisory control while a hook is the deterministic layer behind it. Most of Claude's actions are file edits and shell commands during implementation, so the build phase is where hooks can end up firing most often.

Build-phase hooks can:

  • Block edits to protected paths such as generated classes or a frozen package;
  • Run the formatter and linter after file edits so drift never accumulates;
  • Keep credentials out of the diff.

Back any skill whose policy has to hold without exception. A hook runs on each action that matches it, so build-phase hooks should be fast and scoped to the file that changed. Heavier checks such as the full test suite belong at the commit or the PR.

A hook that asks a human for approval belongs with the gates in Stage 5: Deploy, because an approval prompt during the build puts a person back on the critical path of all the sessions running in parallel.

🇨🇳 中文精译

Hooks 作为构建阶段的确定性护栏

Skill 是建议性控制,而 Hook(钩子) 则是其背后的确定性防线。在实现阶段,Claude 的绝大部分操作是文件编辑和 Shell 命令,因此构建阶段也是 Hook 触发最频繁的地方。

构建阶段的 Hook 可以做到:

  • 阻断对受保护路径的修改(如自动生成的类或已被冻结的旧包);
  • 在文件编辑后自动运行格式化与 Lint 工具,避免代码风格漂移;
  • 阻止将密钥凭据写入代码差集。

为所有必须绝对保持的策略配备 Hook。Hook 在每次匹配的动作发生时执行,因此构建阶段的 Hook 应保持极高的执行速度,并仅作用于发生变动的文件。全量测试套件等重量级检查应放在 Commit 或 PR 阶段。

需要人工审批的 Hook 属于阶段五(部署)的门禁范畴,因为在构建过程中弹出审批提示会让所有并行会话重新回到等待人类的单线瓶颈中。

🇺🇸 English Original

Parallel sessions and subagents

One engineer can drive several streams of work at once.

A parallel session is another full Claude Code instance, working a separate task in its own git worktree. Each independent session knows nothing about the others, and the engineer steering them is the only thing they share.

A subagent runs inside a single session as a scoped helper with its own context window and tool limits and suits jobs that recur in multiple tasks such as verifying the app runs as expected.

Parallel sessions raise the number of tasks an engineer can have in flight, while subagents keep each session focused on its own task. The engineer's job is steering and reviewing all of them.

🇨🇳 中文精译

并行会话与子智能体(Subagents)

一名工程师可以同时推进多条工作流。

并行会话(Parallel Session)是指另一个完整的 Claude Code 实例,在专属的 Git Worktree 中执行独立的开发任务。各个独立会话之间互不知晓,负责调度把关的工程师是它们唯一的交集。

子智能体(Subagent)则运行在单个会话内部,作为拥有受限上下文窗口和工具权限的专属助手,适用于在多项任务中反复出现的工作(如验证应用程序是否按预期运行)。

并行会话提升了一名工程师可以并发处理的任务数量,而子智能体则让各个会话专注于自身任务。工程师的核心职责转变为统筹调度与成果审查。

🇺🇸 English Original
Traditional One engineer works one task at a time and spends a significant portion of their day or week on builds, tests and reviewers. Switching between tasks while waiting is possible, but the context switch is tiring enough that few people choose to.
AI-native One engineer runs several Claude sessions at once, each in its own worktree on its own task. Repeated jobs become subagents with their own context and tool limits. The engineer's job shifts to orchestrating, and eventually, to building and monitoring loops.
🇨🇳 中文精译
传统 SDLC 一名工程师一次只处理一个任务,并在构建、测试和等待评审中消耗大量时间。在等待时切换任务虽然可行,但上下文切换带来的疲惫感让很少有人愿意这么做。
AI 原生 SDLC 一名工程师同时运行多个 Claude 会话,各自在专属 Worktree 中处理独立任务。重复性工作封装为具有受限上下文的子智能体。工程师的角色转变为编排与监控。
🇺🇸 English Original
Getting started
Prerequisites
The CLAUDE.md, since all sessions read the file. The feedback loop (Stage 4: Test) also helps here, because less supervision from the engineer is needed when a session can verify its own work.
Infrastructure
A git repository, since isolation comes from worktrees and permission settings tuned so sessions are not waiting on approval prompts for commands the organization considers safe.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
CLAUDE.md 文件(所有会话都会读取)。阶段四的即时反馈循环也大有帮助,因为会话能够自我验证时对工程师的监督依赖更低。
基础设施
Git 仓库(隔离依赖 Worktrees 实现)以及调优后的权限配置,避免会话在执行安全命令时频繁阻塞等待人工确认。
🇺🇸 English Original

How to execute it

  1. The engineer splits the work into tasks that touch different files, using the plan from the plan mode play (Stage 3: Build) to see where the work is independent. Tasks that share files run in a single session, one after another.
  2. Each parallel task gets its own worktree, for example claude --worktree feature-auth in one terminal and claude --worktree fix-rate-limit in another. A worktree is a separate checkout on its own branch, which stops sessions colliding on files.
  3. Two or three sessions is a sensible starting point. The practical ceiling is how many streams one person can review properly, so add sessions only while review is keeping up.
  4. Turn repeated jobs into subagents, as defined in markdown files in .claude/agents/, each with a name, a description of when to use it, and the tools it may touch. Examples include a code simplifier that strips needless complexity after the main agent finishes, a verifier that runs the app and checks behavior, a researcher that explores the codebase and reports back without flooding the main context. Check the definitions into git so the whole team shares them.
🇨🇳 中文精译

具体落地步骤

  1. 工程师利用阶段三产出的 plan.md 将工作拆分为触及不同文件的独立任务。相互关联的任务则放在单个会话中按序执行。
  2. 为每个并行任务分配专属 Worktree,例如在不同终端中分别执行 claude --worktree feature-authclaude --worktree fix-rate-limit。Worktree 是独立分支上的独立检出目录,杜绝了文件冲突。
  3. 初学者建议从 2 到 3 个并行会话起步。上限取决于个人能够充分审查的工作流数量。
  4. 将重复性工作定义为子智能体,保存在 .claude/agents/ 的 Markdown 文件中,指定名称、触发时机与允许使用的工具。例如:精简冗余代码的简化器、运行应用验证行为的验证器、检索代码库并汇报总结的研究员。将定义提交至 Git 共享。
🇺🇸 English Original

What it looks like (.claude/agents/verifier.md)

---
name: verifier
description: Runs the app and checks the change works before the session
  reports done
tools: Bash, Read
---
Start the app with make run. Exercise the changed behavior and the two
nearest neighboring flows. Report what you ran, what you saw, and any
behavior that does not match plan.md. Do not fix anything; report only.
🇨🇳 中文精译

子智能体定义示例 (.claude/agents/verifier.md)

---
name: verifier
description: Runs the app and checks the change works before the session
  reports done
tools: Bash, Read
---
Start the app with make run. Exercise the changed behavior and the two
nearest neighboring flows. Report what you ran, what you saw, and any
behavior that does not match plan.md. Do not fix anything; report only.
🇺🇸 English Original

Governance considerations

More sessions means more output, so the controls have to come from configuration in the repo. Hooks and permission settings there apply to all sessions, and what a session does is logged and attributed to the engineer who ran it.

🇨🇳 中文精译

治理考量

会话增多意味着产出成倍增加,因此管控必须来自于仓库中的统一配置。Hooks 和权限规则对所有会话生效,会话的各项操作均被完整记录并归属到对应的运行工程师。

🇺🇸 English Original
How to measure it
Leading indicator
Concurrent sessions per engineer while review quality holds, counted from the OpenTelemetry export, and the share of the day spent steering rather than waiting.
Lagging indicator
Changes merged per engineer per week read alongside the rework rate as determined per the PR history.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
在审查质量保持高水准的前提下,每位工程师能够稳定并发运行的会话数,以及一天中用于统筹调度而非被动等待的时间占比。
滞后指标
每位工程师每周合并的变更数量,结合 PR 历史中记录的返工率综合评估。
🇺🇸 English Original
04

Test

Every session checks its own work before a human sees it, and the configuration that steers the agent gets regression-tested like the code it writes.
🇨🇳 中文精译
04

测试阶段 · Test

每个会话在人类介入前先行自我检验,而引导智能体的配置也像其生成的代码一样接受回归测试。
🇺🇸 English Original

Give Claude a feedback loop

Always give Claude a way to verify its own work, whether tests, a build, or a screenshot diff. A session checks its own work and fixes its own mistakes before an engineer sees them.

The feedback loop should not be confused with a verifier subagent (Stage 3: Build). The feedback loop runs through the whole task as many times as the work. The verifier subagent, on the other hand, is one way to package the final check by running a fresh context window once the session believes the work is done. This way the verdict is not colored by the assumptions that produced the code.

🇨🇳 中文精译

为 Claude 建立即时反馈循环

务必始终为 Claude 提供验证自身工作的途径,无论是自动化测试、构建流程还是截图对比。会话应当在工程师介入之前,自行检验工作并修复自身出现的错误。

即时反馈循环不应与验证子智能体(Verifier Subagent)混淆。反馈循环贯穿于任务全过程,反复多次运行;而验证子智能体是在会话认为工作全部完成后,通过独立的崭新上下文窗口执行最终检验,确保结论不受此前生成代码时的假设偏见所影响。

🇺🇸 English Original
Traditional The signal that code works arrives late. CI minutes later, a tester days later, production weeks later. With an agent producing the code, a late signal means a person has to check all of its output, and that person becomes the bottleneck.
AI-native The session is given a way to check its own work before a person sees it. Run the tests, run the build, take the screenshot. Claude iterates until the check passes, so what reaches the engineer has already passed it. Setting the loop up falls to the engineer running the session, and the steps below are written for them.
🇨🇳 中文精译
传统 SDLC 代码是否有效的反馈信号到达极慢:CI 在几分钟后,测试人员在几天后,生产环境在几周后。在由智能体编写代码时,滞后的信号意味着人类必须审查所有输出,人类随即成为瓶颈。
AI 原生 SDLC 在人类审阅之前,会话就拥有自我检查的能力:运行测试、执行构建、截取屏幕。Claude 持续迭代直到全部检查通过,交付给工程师的内容已先行验证。
🇺🇸 English Original
Getting started
Prerequisites
None.
Infrastructure
A test suite and a build that run locally with one command each. For the UI work, a way for Claude to see the result is crucial, either a browser tool or a screenshot utility wired in via MCP.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
无。
基础设施
能够分别通过一条命令在本地运行的测试套件与构建脚本。对于 UI 开发,通过 MCP 接入的浏览器工具或截图组件至关重要。
🇺🇸 English Original

How to execute it

  1. If checking the work today takes a sequence of commands and some environment knowledge, wrap it in a single target such as "make test" or "npm test" that exits non-zero on failure.
  2. In the CLAUDE.md's Commands section, list each command with an example of a healthy output.
  3. State a target and make it quantifiable so Claude can check the work without asking you, for example: "All tests in test_status.py pass," "the screenshot matches the attached mock," or "the endpoint returns 200 with the new field".
  4. For bug fixes, write the failing test first. Ask Claude to reproduce the bug as a test, run it, and confirm it fails for the reason you expect. Commit that test. Only then ask Claude to make it pass without editing the test, with the test-file hook from the final step enforcing the restriction. A test that existed before the fix, and that the agent couldn't rewrite, is proof the bug is gone.
  5. For UI work, close the loop with a visual check. Give Claude a browser or screenshot tool, give it the mock, and let it iterate. Implement, screenshot, compare, and adjust. Two or three rounds is normal, and the result should improve with each one.
  6. Make verification part of "done." Instruction lives in CLAUDE.md. Run the tests before reporting a task complete, and show the output.
  7. Finally, the loop itself needs protecting, because an agent fixing code must not be able to weaken the check on that code. A hook that blocks edits to test files during a fix task does this. The alternative is to check the diff in review and reject any change that touches a test.
🇨🇳 中文精译

具体落地步骤

  1. 如果目前的验证需要一系列复杂命令和环境配置,将其封装为一个单条命令(如 make testnpm test),确保在失败时返回非零退出码。
  2. CLAUDE.md 的 Commands 章节列出每条命令及其正常的预期输出示例。
  3. 设定量化的验收目标,以便 Claude 无需询问人类即可自行判断:例如“test_status.py 中的所有测试全部通过”、“UI 截图与所附原型一致”或“接口返回 200 并包含新字段”。
  4. 针对 Bug 修复,先写失败的测试:要求 Claude 先将 Bug 重现为测试用例,运行并确认其失败原因符合预期,提交该测试;随后要求 Claude 在不修改该测试文件的前提下修复代码(由 Hook 强制拦截)。一个在修复前存在且智能体无法篡改的测试,是 Bug 已彻底消除的最有力证据。
  5. 针对 UI 工作,建立视觉验证闭环:提供截图工具与原型图,让智能体执行“实现→截图→对比→微调”的循环。通常两到三轮迭代即可显著提升品质。
  6. 将验证作为“完成”的必要条件,写入 CLAUDE.md:在汇报完成前必须运行全部测试并附上执行输出。
  7. 保护验证循环本身:修复代码的智能体绝对不能有权限弱化对该代码的校验规则。通过 Hook 在修复期间禁止修改测试文件,或在 PR 评审中检查 diff 并驳回篡改测试的改动。
🇺🇸 English Original

What it looks like (CLAUDE.md verification block)

## Verifying your work

- Build: make build (must finish with "Build succeeded")
- Test: make test (all green; never skip or delete a failing test)
- Lint: make lint (zero warnings)

Run all three before reporting any task complete, and paste the output.
If a test fails, fix the code, not the test.
🇨🇳 中文精译

CLAUDE.md 验证规则块

## Verifying your work

- Build: make build (must finish with "Build succeeded")
- Test: make test (all green; never skip or delete a failing test)
- Lint: make lint (zero warnings)

Run all three before reporting any task complete, and paste the output.
If a test fails, fix the code, not the test.
🇺🇸 English Original
Governance considerations
What is enforced
Verification before a task is reported done, and the block on the agent editing test files during a fix, both implemented as hooks where the organization wants them guaranteed.
What the evidence is
The literal output of "make test," the build log, or the screenshot diff that Claude ran and pasted, so the evidence comes from the toolchain.
Where it is logged
In the session transcript, which the OpenTelemetry export forwards to the organization's observability stack, and in the PR's check run, where the reviewer and any later auditor can both see it.
Who approves
The code owner reviewing the PR, who can concentrate on intent and risk because the mechanical evidence is already attached.
🇨🇳 中文精译
治理考量
强制执行项
在汇报完成前必须执行验证,以及在修复期间禁止智能体编辑测试文件(均通过 Hook 强制保证)。
证明材料
make test 的控制台原始输出、构建日志或 Claude 运行并截取的图片对比差集,直接来源于工具链。
记录位置
记录在会话日志中(通过 OpenTelemetry 转发至可观测平台),并体现在 PR 的 Check Run 中供审阅者与审计人员核验。
审批人
审查 PR 的 Code Owner,由于机械性校验已通过且附带证据,审阅者可将精力集中于业务意图与风险把控。
🇺🇸 English Original
How to measure it
Leading indicator
First-pass CI success rate for agent-written changes, which the CI system already supports.
Lagging indicator
Review time per PR (from the PR metadata), which should fall once the tests catch what reviewers used to catch, and the change failure rate from an incident tracker.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
智能体生成的变更在 CI 中的首轮通过率(First-pass CI success rate)。
滞后指标
单个 PR 的评审耗时(随着测试捕获了以往需人工发现的问题,该时长应显著下降),以及线上事故中的变更失败率。
🇺🇸 English Original

Continuous evals in CI

Evals are the AI-native equivalent of stage-gate QA. In practice that means a suite that runs whenever the agent's configuration changes. When a new model is swapped in or a prompt is rewritten, the eval suite says whether the agent still does the work to the same standard.

The evals should be seen as a live suite. As models improve, cases that once discriminated stop doing so and new ones must be added that arise from ongoing monitoring.

Depending on the use case, some teams may prefer to run these evals offline on a set cadence rather than on every change. The steps below are for continuous evaluations.

🇨🇳 中文精译

在 CI 中运行持续自动化 Evals

Evals(智能体评测)是 AI 原生体系中阶段性质量保证(QA)的等价物。在实际应用中,它表现为一套在智能体配置发生变更时自动运行的评测套件。当更换新模型或重写 Prompt 时,Eval 套件能够明确指出智能体是否仍能保持既定的工程水准。

Evals 是一套动态演进的活套件。随着模型能力的提升,过去具有区分度的测试用例会逐渐失效,必须根据日常监控中发现的新问题不断补充新用例。

根据团队需求,部分团队可选择离线定期运行,部分团队则在每次变更时持续执行。以下步骤针对持续集成(CI)中的持续评测。

🇺🇸 English Original
Getting started
Prerequisites
The CLAUDE.md and feedback loop (Stage 4: Test).
Infrastructure
CI that can run Claude Code non-interactively, and an API key with budget for eval runs.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
CLAUDE.md 与即时反馈循环(阶段四)。
基础设施
支持非交互式运行 Claude Code 的 CI 环境,以及具备评测预算的 API 密钥。
🇺🇸 English Original

How to execute it

  1. The platform engineer collects 20 to 50 real tasks from recent work with its expected/accepted outcome.
  2. Write each task as an eval, meaning the prompt plus the checks that define acceptable (tests pass, lint clean, behavior unchanged, policy followed).
  3. The suite runs non-interactively in CI on a schedule and on any change to CLAUDE.md, skills or hooks, since that configuration steers the agent and deserves the regression testing that code gets.
  4. Gate configuration changes on the results. A skill change that drops the pass rate gets reviewed before it merges.
  5. Each production incident gets an eval, written by the team that owned the incident, and stays in the suite as a regression test.
🇨🇳 中文精译

具体落地步骤

  1. 平台工程师从近期实际研发工作中收集 20 到 50 个真实任务及其预期/可接受的交付成果。
  2. 将每个任务编写为 Eval:包括 Prompt 以及定义合格的校验规则(测试通过、Lint 无警告、行为未变、策略合规)。
  3. 在 CI 中定时或在 CLAUDE.md、Skills 或 Hooks 发生改动时非交互式运行该套件。因为这些配置负责指引智能体,理应像代码一样接受回归测试。
  4. 将配置变更与评测结果挂钩:降低通过率的 Skill 改动在修复前禁止合并。
  5. 每次生产事故发生后,由责任团队为其编写一个 Eval 用例,永久纳入套件作为回归防线。
🇺🇸 English Original

What it looks like (.github/workflows/agent-evals.yml)

name: Agent evals
on:
  pull_request:
    paths: ['CLAUDE.md', '.claude/**']
  schedule:
    - cron: '0 2 * * *'
jobs:
  evals:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g @anthropic-ai/claude-code
      - name: Run eval suite
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: |
          for eval in evals/*.json; do
            claude -p "$(jq -r '.prompt' $eval)" \
              --allowedTools "Read,Edit,Bash(make test)" \
              --output-format json > result.json
            ./evals/check.sh "$eval" result.json
          done
🇨🇳 中文精译

CI 工作流示例 (.github/workflows/agent-evals.yml)

name: Agent evals
on:
  pull_request:
    paths: ['CLAUDE.md', '.claude/**']
  schedule:
    - cron: '0 2 * * *'
jobs:
  evals:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g @anthropic-ai/claude-code
      - name: Run eval suite
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: |
          for eval in evals/*.json; do
            claude -p "$(jq -r '.prompt' $eval)" \
              --allowedTools "Read,Edit,Bash(make test)" \
              --output-format json > result.json
            ./evals/check.sh "$eval" result.json
          done
🇺🇸 English Original

Governance considerations

Evals give QA a gate that keeps up with agent output. The pass-rate threshold is enforced as a merge check, runs are logged so results can be compared over time, and the team that owns the configuration change approves it.

🇨🇳 中文精译

治理考量

Evals 为 QA 团队提供了一个能够跟上智能体产出吞吐速率的质量把关卡点。通过率阈值作为合并检查(Merge Check)强制执行,所有运行均被记录以便进行历史对比,配置的归属团队负责签署变更批准。

🇺🇸 English Original
How to measure it
Leading indicator
The eval pass rate over time, reported by the suite on every run, and how long a production incident takes to become a permanent eval.
Lagging indicator
Regressions caught in CI compared with regressions found in production derived from the incident tracker.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
评测套件随时间推移的通过率,以及线上事故转化为永久 Eval 用例所需的周期时长。
滞后指标
在 CI 中被成功拦截的回归缺陷数量,与从事故跟踪系统中统计到的逃逸到生产环境的回归缺陷进行对比。
🇺🇸 English Original
05

Deploy

Review runs in both directions, and governance is enforced as the agent acts. The agent does everything up to the production gate and nothing past it.
🇨🇳 中文精译
05

部署阶段 · Deploy

代码审查双向进行,在智能体操作的同时实时执行治理。智能体处理通往生产门禁之前的所有事务,但绝不越过门禁。
🇺🇸 English Original

AI in the PR review loop

Claude both gives and receives reviews. It reviews incoming PRs against the organization's policies and addresses review comments on its own PRs. This allows engineers to focus on behavior in their PR review, which boils down to judging intent and risk.

🇨🇳 中文精译

PR 评审流中的 AI 深度协作

Claude 在 PR 流程中同时扮演审查者与被审查者的双重角色:它对照组织策略审查提交的 PR,同时也负责在自身的 PR 中响应并处理人类提出的评审意见。这使工程师能够将精力集中在行为层面的审阅上,本质上即对意图与风险进行最终裁决。

🇺🇸 English Original
Traditional Review capacity was planned around human output. A PR waits for a reviewer to read all of it, review quality varies with the reviewer's load, and the author chases while the backlog grows.
AI-native All PRs get an identical set of review passes, with findings ranked by severity. Human attention moves up a level, to whether the change does what the plan intended and whether the risk is acceptable.
🇨🇳 中文精译
传统 SDLC 评审吞吐量受限于人类精力。PR 苦等审阅者逐行通读,审阅质量随审阅者的工作负荷波动,作者反复催促而积压列表不断变长。
AI 原生 SDLC 所有 PR 均接受标准一致的多轮自动化审查,发现的问题按严重级别排序。人类精力跃升至更高维度:改动是否符合既定计划?风险是否可控?
🇺🇸 English Original
Getting started
Prerequisites
An updated CLAUDE.md file from Stage 3: Build; skills if the review passes enforce written policies, defined subagents.
Infrastructure
A repo with the Claude integration installed, either the managed Code Review (research preview) service enabled by an admin or the claude-code-action running in your own CI, with model calls through AWS Bedrock, Google Vertex or Microsoft Foundry where needed (the CI/CD play covers the deployment options). Branch protection policies that require a code owner's approval are also worthwhile.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
阶段三构建的最新 CLAUDE.md;用于执行特定策略的 Skills;已定义的子智能体。
基础设施
安装了 Claude 集成的仓库,包括由管理员开启的托管版 Code Review 服务,或在自建 CI 中运行的 claude-code-action(支持通过 AWS Bedrock、Google Vertex 或 Microsoft Foundry 路由模型调用)。强制要求 Code Owner 审批的分支保护规则同样必不可少。
🇺🇸 English Original

How to execute it

  1. The managed Code Review service is the fastest start. An admin enables it and selects repositories. Run the review in your own CI with the claude-code-action when you need control of the pipeline or want API calls routed through your own cloud agreement (the CI/CD play covers that plumbing).
  2. The tech lead writes the review policy as REVIEW.md at the repo root, divided into the passes the organization cares about: bugs and logical errors; security and vulnerabilities; compliance against the spec (spec.md from the requirements play), the implementation plan (plan.md from the plan mode play) and design principles. REVIEW.md also defines what counts as Important as opposed to a Nit, and what to skip.
  3. The tech lead sets the human threshold. Findings do not approve or block a PR on their own, and branch protection still requires approval from a code owner. A platform engineer who wants to gate merges on findings can read the severity counts that the check run publishes as a machine-readable tally.
  4. When a reviewer or the author tags @claude on a review comment, Claude addresses the comment and pushes the fix. The PR thread records both the request and the change. This fix loop runs through the claude-code-action. In the managed service, commenting @claude review requests a fresh review instead. For PRs Claude opened, go further and let Claude babysit the PR to merge. Teams wrap the loop in a custom slash command that sweeps the unresolved review comments and failing checks on the PR, addresses them and pushes the fixes, until the PR is green and waiting only on code owner approval.
  5. Review findings feed back into CLAUDE.md. When a review flags a mistake for the second time, the correction goes into CLAUDE.md as part of that review, and because review reads CLAUDE.md the mistake is caught from the next PR onwards. Review also flags when a change has made CLAUDE.md outdated.
  6. Once a month the tech lead tunes the setup by rating findings so the reviewer improves and by capping Nit volume in REVIEW.md. Generated paths and anything CI already enforces are excluded.
🇨🇳 中文精译

具体落地步骤

  1. 托管版 Code Review 服务是起步最快的方案,由管理员启用并勾选指定仓库。若需完全掌控流水线或要求 API 流量走企业专属云协议,则使用 claude-code-action 在自建 CI 中运行。
  2. 技术主管在仓库根目录编写审查策略 REVIEW.md,划分为团队关心的审查轮次:Bug 与逻辑缺陷;安全与漏洞风险;对照需求规范(spec.md)、实施计划(plan.md)与设计原则的合规性。明确定义何为“重大隐患(Important)”,何为“琐碎挑刺(Nit)”以及应跳过的内容。
  3. 技术主管设定人工介入阈值:智能体的发现本身不直接批准或阻断 PR,分支保护依然强制要求 Code Owner 审批。平台工程师可读取 Check Run 输出的机器可读严重性统计,设立自动门禁。
  4. 当审阅者或作者在评论区 @claude 时,Claude 会自动分析意见并推送修复提交,PR 讨论区完整记录诉求与代码变更。在托管服务中,输入 @claude review 可请求重新评审。对于由 Claude 创建的 PR,更可让 Claude 全程跟进直至合并(通过自定义斜杠命令自动处理未决评论和失败检查,直至 PR 全绿等待批准)。
  5. 评审结论反哺 CLAUDE.md:当评审第二次发现同类错误时,该修正直接写入 CLAUDE.md;后续评审读取该文件,即可在下一次 PR 中提前拦截。
  6. 技术主管每月对发现的问题进行评分调优,并在 REVIEW.md 中限制 Nit 的数量上限,排除自动生成路径与 CI 已覆盖的常规检查。
🇺🇸 English Original

What it looks like (REVIEW.md)

# Review instructions

## Passes
Run three passes and tag each finding with its pass:
- Bugs: logic errors, broken edge cases, subtle regressions
- Security: injection risks, authentication gaps, PII in logs
- Compliance: the change matches spec.md, plan.md and our design principles

## What Important means here
Reserve Important for findings that would break behavior, leak data
or breach a policy. Style and naming are nits.

## Cap the nits
Report at most five nits per review; summarize the rest as a count.

## Do not report
Generated files under src/gen/ and anything CI already enforces.
🇨🇳 中文精译

评审规范定义 (REVIEW.md)

# Review instructions

## Passes
Run three passes and tag each finding with its pass:
- Bugs: logic errors, broken edge cases, subtle regressions
- Security: injection risks, authentication gaps, PII in logs
- Compliance: the change matches spec.md, plan.md and our design principles

## What Important means here
Reserve Important for findings that would break behavior, leak data
or breach a policy. Style and naming are nits.

## Cap the nits
Report at most five nits per review; summarize the rest as a count.

## Do not report
Generated files under src/gen/ and anything CI already enforces.
🇺🇸 English Original

Governance considerations

Separation of duties is preserved, because the agent that wrote the code has no way to approve it. The review policy in REVIEW.md is applied to all PRs, and findings, fixes, ratings and approvals are logged in the PR history, so the PR is the audit record. Approval comes from a human through branch protection, informed by the findings.

🇨🇳 中文精译

治理考量

严格维持职责分离原则(Separation of Duties):编写代码的智能体绝对没有权限自行批准 PR。REVIEW.md 中的审查策略统一作用于所有 PR,发现、修复、评分与批准全部留存在 PR 历史中构成不可篡改的审计档案。审批最终由人类通过分支保护机制完成。

🇺🇸 English Original
How to measure it
Leading indicator
Time to first review, which should fall to minutes, and the share of review comments resolved without a human touching the branch with data stored directly on Git.
Lagging indicator
Defects and vulnerabilities caught before merge set against those escaping to production, from the PR history and the incident tracker.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
获得首轮评审意见的时长(应骤降至几分钟内),以及在无需人类触碰分支的情况下成功解决的评审意见比例。
滞后指标
在合并前捕获的缺陷与漏洞数量,与逃逸到生产环境的问题数量进行对比分析。
🇺🇸 English Original

Hooks as approval gates

The build phase used hooks as guardrails, allowing or blocking actions with no human involved (Stage 3: Build). A hook can also ask, pausing the action until a specific person approves, which is what release gating needs.

The play sits in Stage 5: Deploy because the release gate is the clearest case, but hooks are not deploy-specific: they run wherever Claude acts. For example, hooks can block edits to migrations and infra without a change ticket during Stage 3: Build, and stop the agent editing test files during a fix task in Stage 4: Test.

🇨🇳 中文精译

Hooks 作为自动化审批门禁

构建阶段将 Hook 用作无人介入的确定性护栏(阶段三)。Hook 同样可以暂停操作并请求特定责任人批准,这正是发布门禁所必需的能力。

虽然该实践归在阶段五(部署),但 Hook 并不局限于部署:它在 Claude 操作的任何地方均可运行。例如在阶段三阻断无变更工单的数据库迁移与基础设施修改,或在阶段四修复缺陷期间阻止智能体篡改测试文件。

🇺🇸 English Original
Getting started
Prerequisites
None.
Infrastructure
A written list of the approvals the change process requires.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
无。
基础设施
变更流程所需审批权限的书面清单。
🇺🇸 English Original

How to execute it

  1. Engineering leadership, with change management and compliance, lists the human approval gates that must survive, such as change management sign-off, release authorization, and edits to protected paths.
  2. The platform engineer expresses each gate as a hook, a script that runs before Claude acts that can allow, ask, or block.
  3. Team hooks go in .claude/settings.json in git, and non-negotiable hooks go in managed settings owned by the platform or IT admin, where individual engineers cannot switch them off.
  4. A block should explain itself, so when a hook stops an action the reason and the route to approval appear in Claude's output.
🇨🇳 中文精译

具体落地步骤

  1. 工程管理层联合变更管理与合规部门,梳理必须保留的人工审批门禁(如变更管理审批、发布授权、受保护路径编辑)。
  2. 平台工程师将每个门禁编写为一个 Hook 脚本,在 Claude 操作前执行,可返回允许、询问或阻断。
  3. 团队级 Hook 配置在 Git 中的 .claude/settings.json,不可妥协的强制 Hook 配置在平台或 IT 管理员拥有的托管设置中,工程师个人无法关闭。
  4. 阻断操作时必须提供明确说明:当 Hook 拦截操作时,原因及申请审批的途径会直接显示在 Claude 的输出中。
🇺🇸 English Original

What it looks like (.claude/settings.json)

{
    "hooks": {
      "PreToolUse": [
        {
          "matcher": "Bash",
          "hooks": [
            { "type": "command",
              "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/production-gate.sh" }
          ]
        }
      ]
    }
}
🇨🇳 中文精译

Hook 配置 (.claude/settings.json)

{
    "hooks": {
      "PreToolUse": [
        {
          "matcher": "Bash",
          "hooks": [
            { "type": "command",
              "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/production-gate.sh" }
          ]
        }
      ]
    }
}
🇺🇸 English Original

And the gate itself (.claude/hooks/production-gate.sh)

#!/bin/bash
# Production deploys require a named release authorization
cmd=$(jq -r '.tool_input.command' < /dev/stdin)
if [[ "$cmd" == *"deploy"* && "$cmd" == *"production"* ]]; then
   if [ -z "$RELEASE_APPROVAL" ]; then
     echo "Production deploys need a release authorization." >&2
     exit 2 # exit 2 blocks the action; the message goes to Claude
   fi
fi
exit 0
🇨🇳 中文精译

门禁拦截脚本 (.claude/hooks/production-gate.sh)

#!/bin/bash
# Production deploys require a named release authorization
cmd=$(jq -r '.tool_input.command' < /dev/stdin)
if [[ "$cmd" == *"deploy"* && "$cmd" == *"production"* ]]; then
   if [ -z "$RELEASE_APPROVAL" ]; then
     echo "Production deploys need a release authorization." >&2
     exit 2 # exit 2 blocks the action; the message goes to Claude
   fi
fi
exit 0
🇺🇸 English Original

Governance considerations

Hooks are the approval gates. The gate condition is enforced every time, for everyone. Allow and block decisions are logged with a timestamp. The gate also defines what counts as approval, whether that's an approved change ticket or the release manager's sign-off.

🇨🇳 中文精译

治理考量

Hooks 即为审批门禁。门禁条件在任何时间对所有人一律强制执行。允许与阻断决定均带有时间戳归档。门禁明确定义了何为有效批准(无论是审批通过的变更工单还是发布经理的签字)。

🇺🇸 English Original
Worked example

Managed settings for a regulated enterprise

Deployed by the platform team via MDM or the admin console; engineers cannot edit or override any of it.

{
  "permissions": {
     "deny": [
        "Read(.env*)", "Read(./secrets/**)",
        "WebFetch", "Bash(curl *)", "Bash(wget *)"
     ],
     "allow": [
        "Bash(git *)", "Bash(make build)",
        "Bash(make test)", "Bash(make lint)"
     ],
     "disableBypassPermissionsMode": "disable"
  },
  "allowManagedPermissionRulesOnly": true,
  "sandbox": {
     "enabled": true,
     "failIfUnavailable": true,
     "allowUnsandboxedCommands": false,
     "network": { "allowedDomains": ["git.internal.example.com", "registry.npmjs.org"] },
     "credentials": {
        "files": [
          { "path": "~/.ssh", "mode": "deny" },
          { "path": "~/.aws/credentials", "mode": "deny" }
        ],
        "envVars": [ { "name": "GITHUB_TOKEN", "mode": "deny" } ]
     }
  },
  "allowManagedHooksOnly": true,
  "disableSideloadFlags": true,
  "allowManagedMcpServersOnly": true,
  "strictKnownMarketplaces": [
     { "source": "github", "repo": "example-corp/approved-plugins" }
  ],
  "requiredMinimumVersion": "2.1.193"
}

What each line buys, in control terms:

  • permissions.deny keeps secrets out of the agent's context and blocks arbitrary network egress through tools; permissions.allow pre-approves the safe inner loop so the deny list doesn't turn into prompt fatigue.
  • disableBypassPermissionsMode plus allowManagedPermissionRulesOnly means no engineer, project file or command-line flag can widen the rules.
  • sandbox closes the gap permissions cannot. A tool-level deny on WebFetch doesn't stop a shell command reaching the network; the OS-level domain allowlist blocks egress outright.
  • failIfUnavailable and allowUnsandboxedCommands make the sandbox a gate: Claude Code refuses to start when the sandbox cannot initialize, and a command that fails inside the sandbox cannot be retried outside it.
  • credentials closes the gap the deny rules leave open. permissions.deny governs Claude's file tools, but a sandboxed shell command could still read ~/.ssh or ~/.aws/credentials by default; this block denies those reads and strips the named secrets from the environment of every sandboxed command.
  • allowManagedHooksOnly means the approval gates from this play are the only hooks that run; nothing local can add to or replace them.
  • disableSideloadFlags and strictKnownMarketplaces mean every skill, agent, hook and MCP server on an engineer's machine arrived through the organization's approved plugin marketplace, never from a home directory.
  • allowManagedMcpServersOnly makes the agent's tool surface an allowlist owned by the platform team.
  • requiredMinimumVersion refuses to start on a version below the approved floor, so the controls are enforced by a build the organization has actually assessed.

Consider the above a starting point to tailor, rather than a recommendation to copy. Every deny trades against capability, and the right balance depends on the data classification of the repo. The settings reference documents every key, including the managed-only ones: code.claude.com/docs/en/settings

🇨🇳 中文精译
实战案例 · Worked Example

强监管企业的集中管控设置 (Managed Settings)

由平台团队通过 MDM 或管理控制台集中部署;工程师个人无法编辑或覆盖任何规则。

{
  "permissions": {
     "deny": [
        "Read(.env*)", "Read(./secrets/**)",
        "WebFetch", "Bash(curl *)", "Bash(wget *)"
     ],
     "allow": [
        "Bash(git *)", "Bash(make build)",
        "Bash(make test)", "Bash(make lint)"
     ],
     "disableBypassPermissionsMode": "disable"
  },
  "allowManagedPermissionRulesOnly": true,
  "sandbox": {
     "enabled": true,
     "failIfUnavailable": true,
     "allowUnsandboxedCommands": false,
     "network": { "allowedDomains": ["git.internal.example.com", "registry.npmjs.org"] },
     "credentials": {
        "files": [
          { "path": "~/.ssh", "mode": "deny" },
          { "path": "~/.aws/credentials", "mode": "deny" }
        ],
        "envVars": [ { "name": "GITHUB_TOKEN", "mode": "deny" } ]
     }
  },
  "allowManagedHooksOnly": true,
  "disableSideloadFlags": true,
  "allowManagedMcpServersOnly": true,
  "strictKnownMarketplaces": [
     { "source": "github", "repo": "example-corp/approved-plugins" }
  ],
  "requiredMinimumVersion": "2.1.193"
}

各配置项在合规管控层面的核心价值解析:

  • permissions.deny 阻止密钥凭据进入智能体上下文,并拦截工具发起的任意网络外联;permissions.allow 预先批准安全的开发循环命令,避免频繁确认引发操作疲劳。
  • disableBypassPermissionsMode 配合 allowManagedPermissionRulesOnly 确保任何工程师、项目文件或命令行参数都无法放宽权限。
  • sandbox 补齐工具层无法覆盖的安全缝隙:工具级的 WebFetch 拦截无法阻止 Shell 命令访问网络,而操作系统级的域名白名单从底层直接阻断未授权外联。
  • failIfUnavailableallowUnsandboxedCommands 将沙箱变为强制门禁:沙箱无法初始化时 Claude Code 拒绝启动,在沙箱内失败的命令绝对禁止在沙箱外重试。
  • credentials 封堵权限死角:permissions.deny 管控文件读取,但沙箱中的 Shell 命令默认仍可能读取 ~/.ssh~/.aws/credentials;此配置直接禁止此类读取,并从每个沙箱命令的环境变量中剥离指定敏感 Token。
  • allowManagedHooksOnly 确保本实践中的审批门禁是唯一生效的 Hook,本地配置无法覆盖或追加。
  • disableSideloadFlagsstrictKnownMarketplaces 确保机器上的所有 Skill、Agent、Hook 和 MCP 服务全部来自组织审核的官方插件市场,杜绝从个人目录侧载。
  • allowManagedMcpServersOnly 使智能体的工具扩展接口成为平台团队统一管理的白名单。
  • requiredMinimumVersion 强制要求客户端版本不低于指定基线,确保安全合规控制由经过企业评估的构建版本所执行。

上述配置可作为根据自身业务定制的基准参考。每项阻断都需要在安全性与工程效率之间权衡,更多高级配置可参阅官方文档:code.claude.com/docs/en/settings

🇺🇸 English Original
How to measure it (for the hooks themselves)
Leading indicator
Time spent waiting on each approval gate. Every hook decision is written to the OpenTelemetry export with a timestamp and an allow or block verdict, so the wait is visible per gate.
Lagging indicator
Gate violations reaching production before and after hooks from the incident tracker.
🇨🇳 中文精译
度量指标(针对 Hooks 自身)· How to measure it
先导指标
在各个审批门禁上的平均等待耗时。每个 Hook 的裁决均带有时间戳和允许/阻断结果记录在 OpenTelemetry 导出中。
滞后指标
引入 Hooks 前后,生产环境中发生的门禁违规事件数量对比。
🇺🇸 English Original

CI/CD integration and deployment

Run Claude Code non-interactively inside the CI/CD pipeline, sandbox the execution so long-running agents run safely, expose deployment through MCP integrations, and rehearse the rollback paths before the agent ever needs them.

🇨🇳 中文精译

CI/CD 深度集成与自动化部署

在 CI/CD 流水线中非交互式运行 Claude Code,对执行环境进行沙箱隔离以确保长时间运行的安全,通过 MCP 接口暴露部署工具,并在智能体实际使用前反复演练回滚路径。

🇺🇸 English Original
Traditional Pipelines run deterministic scripts, and anything that needs judgment waits for a human. For example, triaging the flaky test, writing the changelog, or working out why the build broke. Deployment and rollback are runbooks a human follows under pressure.
AI-native Claude runs non-interactively inside the pipeline for the judgment steps, in a sandbox with scoped credentials. Deployment tooling is exposed to the agent through MCP, so the workflow that wrote and tested the change can also ship it and roll it back, inside gates the organization defines per environment.
🇨🇳 中文精译
传统 SDLC 流水线执行确定性脚本,任何需要主观判断的步骤都必须停下来等待人类。例如排查偶发 Flaky 测试、编写发布日志或分析构建失败原因。部署和回滚则是人类在高压下手动执行的 Runbook。
AI 原生 SDLC Claude 在沙箱中以非交互方式在流水线内处理判断类任务。部署工具通过 MCP 暴露给智能体,负责编写和测试代码的工作流同样能够执行发布与回滚,全程受控于按环境划分的门禁体系。
🇺🇸 English Original
Getting started
Prerequisites
Claude in the PR review loop and hooks as approval gates, because the gates must exist before automation accelerates anything through them.
Infrastructure
A CI platform with the claude-code-action installed, or any runner that can call claude -p; model access through the API, or Bedrock, Foundry, or Vertex where traffic must stay on the organization's cloud agreement; MCP servers for the deployment targets; a sandbox profile for agent jobs with no standing production credentials.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
PR 评审流中的 AI 辅助与 Hooks 审批门禁(在自动化加速前必须先建立门禁)。
基础设施
安装了 claude-code-action 或支持调用 claude -p 的 CI 平台;通过 API、Bedrock、Foundry 或 Vertex 访问模型;面向部署目标的 MCP 服务;用于智能体任务的沙箱环境(默认不包含持久生产凭据)。
🇺🇸 English Original

How to execute it

  1. The platform engineer starts with read-only judgment steps. Use claude -p in a pipeline job to triage a failed build, summarize a flaky test, or draft the changelog.
  2. Add write steps behind the existing gates for jobs like fixing lint, updating generated docs, or addressing review comments via the @claude mentions. Anything the agent writes arrives as a PR through branch protection, and the agent has no route to push to main.
  3. Execution is sandboxed. Agent jobs run in containers under a network policy with short-lived scoped tokens, and hold no production credentials by default.
  4. Expose deployment through MCP. Deploy, status, and rollback become tools, scoped per environment, so the agent's deployment powers are an allowlist rather than a shell script with credentials.
  5. Tier the autonomy by environment. In development, the agent deploys freely. In production, the agent prepares the release and the release manager authorizes it, and a hook enforces the production gate. Staging sits somewhere in the middle.
  6. Rollback should be the most rehearsed path in the pipeline, a single command that the agent can run and that is exercised regularly in staging. The closing the loop play (Stage 6: Maintenance) calls this rollback when a control band is breached, so it has to be proven in advance.
🇨🇳 中文精译

具体落地步骤

  1. 平台工程师从只读类的判断任务切入:在流水线中使用 claude -p 分析构建失败日志、总结 Flaky 测试或起草更新日志。
  2. 在现有门禁后增加写入步骤:如自动修复 Lint、更新文档或响应 @claude 评论。智能体写入的内容均通过分支保护作为 PR 提交,无权直接推送到 main 分支。
  3. 对执行进行沙箱隔离:智能体任务在容器中运行,遵循网络策略与短期作用域 Token,默认不持有生产环境凭据。
  4. 通过 MCP 暴露部署能力:将部署、状态查询与回滚封装为按环境划分作用域的 MCP 工具,使智能体的部署权限成为受控白名单,而非持有凭据的裸 Shell 脚本。
  5. 按环境划分自治等级:在开发环境中智能体自由部署;在生产环境中智能体准备发布包并由发布经理授权,由 Hook 强制执行生产门禁;预发布环境介于两者之间。
  6. 将回滚打造为流水线中最经得起检验的路径:一条智能体可调用的单命令回滚,在预发布环境中定期演练。阶段六(运维)在指标失控时会调用该回滚,因此必须提前验证可靠性。
🇺🇸 English Original

What it looks like (pipeline step)

- name: Triage failed build
  if: failure()
  run: >
    claude -p "Read the build log at out/build.log. Identify the most
    likely cause, say whether the failure looks flaky or real, and write a
    three-line summary for the PR thread." >> triage.md
🇨🇳 中文精译

流水线步骤示例 (Pipeline Step)

- name: Triage failed build
  if: failure()
  run: >
    claude -p "Read the build log at out/build.log. Identify the most
    likely cause, say whether the failure looks flaky or real, and write a
    three-line summary for the PR thread." >> triage.md
🇺🇸 English Original

Governance considerations

The governing principle is that the agent may act up to the production gate and cannot pass it. The controls below enforce this principle.

  • Branch protection turns anything the agent writes into a PR, with no direct path to main.
  • The production deploy hook blocks the release until a named release manager authorizes it. Each non-interactive run acts under the agent's own identity, so the pipeline log separates what the agent did from what the engineer who triggered it did.
  • Per-environment permission tiers set how much the agent may do on the way to the gate.
🇨🇳 中文精译

治理考量

核心治理原则:智能体可以处理通往生产门禁之前的所有事务,但绝对无法单方面越过门禁。

  • 分支保护将智能体产出的所有代码转化为 PR,杜绝直接推送到 main 分支的可能。
  • 生产部署 Hook 阻断发布动作,直至获得指定发布经理的显式授权。非交互式运行在独立身份下执行,流水线日志清晰分离智能体操作与触发工程师的操作。
  • 按环境划分的权限阶梯严格限制智能体在通往门禁过程中的操作边界。
🇺🇸 English Original
How to measure it
Leading indicator
The share of pipeline failures triaged without paging a human taken from the CI/CD pipeline logs.
Lagging indicator
DevOps Research and Assessment (DORA) measures, which the CI system and deployment tooling already emit.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
在无需人工介入排查的情况下由智能体完成原因分析的流水线故障比例。
滞后指标
DORA 核心效能度量指标(部署频率、变更提前期、服务恢复时间、变更失败率)。
🇺🇸 English Original
06

Maintain

The loop closes. A trigger invokes Claude with no person in the invocation path, and what it finds re-enters the pipeline as intent.md.
🇨🇳 中文精译
06

运维阶段 · Maintain

研发闭环正式形成。触发事件自动调用 Claude 而无需人工排期,诊断发现的结果作为 intent.md 重新进入流水线。
🇺🇸 English Original

Maintenance and closing the loop

So far, we've discussed how to add Claude to each stage of the SDLC process, with each stage requiring a human to launch the initial steps. This stage, however, shifts the focus to autonomous running of Claude to close the loop.

For example, a continuously running monitoring agent could, off the back of a bug ticket being raised, create an intent.md, and flow through the requirements, plan, build test and review phases. Stage 6: Maintenance runs headless, with an independent confidence gate between stages, a deterministic check or an adversarial reviewing agent, deciding whether the previous stage's output continues or is escalated to a human.

🇨🇳 中文精译

运维与闭环流转

到目前为止,我们探讨了如何在 SDLC 的各个阶段引入 Claude,每个阶段仍需要人类发起初始动作。而阶段六则将重心转向 Claude 的自主运行,以彻底完成闭环。

例如,一个持续运行的监控智能体在收到 Bug 工单后,自动创建 intent.md,并自主流转推进需求、计划、构建测试与评审阶段。阶段六支持无头运行(Headless),阶段之间设立独立的置信度门禁(确定性检查或对抗性审查智能体),决定是将上一阶段成果继续向下流转还是升级转交人类。

🇺🇸 English Original
Traditional Maintenance is a reactive phase. All tickets or incidents wait on a person to act on it and restart the process. An alert fires at 3 a.m. and can be missed, a ticket can sit in the backlog until someone picks it up, and post-mortem actions may not reach the codebase at all if another fire starts first.
AI-native A trigger such as a control-band breach, a ticket, a channel message or a schedule invokes Claude without a person in the path. Claude diagnoses, acts only through gated routes, and writes what it finds as intent.md, which then goes through the stages described above. People triage and review that work, and no longer have to start it.
🇨🇳 中文精译
传统 SDLC 运维是被动响应式的。所有工单与事故都必须等待人员介入才能重启流程。凌晨 3 点的警报容易被漏掉,工单在待办列表中积压,一旦有新的突发故障,事故复盘中沉淀的改进措施根本无法落实到代码库中。
AI 原生 SDLC 控制带突破、新工单、频道消息或定时调度均可自动触发 Claude,无需人员在调用链路上守候。Claude 自动诊断、仅通过受控门禁采取行动,并将结论沉淀为 intent.md 进入标准研发流程。人类只需负责分类审阅,无需从头排期。
🇺🇸 English Original

Closing the loop

A deterministic script watches production and invokes Claude when a control band is breached. Monitoring of a breach is a helpful example of the pattern for the loop running autonomously, while the Claude Tag (public beta) section at the end of the stage covers work arriving through different channels.

🇨🇳 中文精译

闭环自愈

确定性脚本持续监控生产环境,并在指标突破控制带时调用 Claude。指标失控监控是自主闭环模式的典型范例,而本节末尾的 Claude Tag(公开测试版)则涵盖了来自沟通频道的实时工单处理。

🇺🇸 English Original
Getting started
Prerequisites
Intent.md which gives the loop a structured output to restart. Claude accelerated PR reviews, hooks as an action boundary, and a rollback path for CI/CD (which the highest autonomy tier invokes).
Infrastructure
A metrics store the detection script can query (Prometheus, the CI system's API, or equivalents), read access to the repository, a way to run Claude Code non-interactively in CI, or the Agent SDK for a service that receives webhooks.
🇨🇳 中文精译
准备起步 · Getting started
先决条件
intent.md(为闭环重启提供结构化输入);AI 辅助的 PR 审查;作为行动边界的 Hooks;以及 CI/CD 自动化回滚路径。
基础设施
检测脚本可查询的监控指标库(Prometheus、CI 系统 API 等);仓库读取权限;在 CI 中非交互式运行 Claude Code 的环境,或用于接收 Webhook 的 Agent SDK 容器。
🇺🇸 English Original

How to execute it

  1. The service owner or platform engineer picks one metric with a stable rolling baseline, such as CI test failure rate, post-deploy 5xx rate, or PR cycle time.
  2. They write the detection script, typically mean and standard deviation over a rolling window with rules (Western Electric or similar) so the bands catch slow drift as well as spikes. The script is version controlled and unit tested, and detection stays entirely deterministic, with no model involved.
  3. Response tiers are defined in version-controlled config (bands.yaml below). At 1σ the script only logs, at 2σ it invokes Claude read-only to diagnose, and at 3σ Claude may act, though only by opening a PR into the review gate or triggering a pre-approved runbook.
  4. The trigger layer can be a scheduled workflow in GitHub or GitLab, a webhook from the existing monitoring stack, or a Cron Job inside the network. Claude runs stateless, either as a non-interactive step on a CI runner or as an Agent SDK service in a sandboxed container, and the CI/CD play covers the deployment and model-access options. Because the run is stateless and non-interactive, a loop can begin and end without anyone starting it.
  5. The agent writes its diagnosis as intent.md in the Stage 1: Plan format, covering the anomaly and its evidence, a proposed outcome, the affected systems and any open questions. From there the finding goes through the pipeline like anything else.
  6. The service owner or on-call engineer triages the queue, routing product-facing findings to the product owner. Fix now, schedule, or dismiss. Dismissals tune the bands and help to reduce noise.
  7. When a fix ships, add an eval for the incident (the continuous evals play) to ensure that such issues are protected against going forwards.
🇨🇳 中文精译

具体落地步骤

  1. 服务负责人或平台工程师选择一项具有稳定滚动基线的核心指标(如 CI 测试失败率、发布后 5xx 错误率或 PR 周期时长)。
  2. 编写检测脚本,计算滚动窗口内的均值与标准差,并应用西方电气规则(Western Electric Rules),使监控既能捕获突发尖刺也能识别缓慢漂移。脚本纳入版本控制与单元测试,检测过程保持完全确定性,不引入模型推断。
  3. 在版本控制的配置文件中定义分级响应策略(如下方的 bands.yaml):1σ 仅记录日志;2σ 以只读方式调用 Claude 诊断原因;3σ 允许 Claude 采取行动(仅限发起 PR 进入评审门禁或触发预先批准的 Runbook)。
  4. 触发层可采用 GitHub/GitLab 定时工作流、现有监控系统的 Webhook 或内网 Cron Job。Claude 以无状态方式运行在 CI 运行器或沙箱容器中。由于运行是无状态且非交互式的,闭环可以自主启动与结束。
  5. 智能体将诊断结论以阶段一(规划)的 intent.md 格式输出,涵盖异常现象与证据、预期修复目标、受影响系统及未决疑问。随后该发现像常规需求一样进入流水线。
  6. 服务负责人或值班工程师对队列进行分类处理,将产品相关发现流转至产品负责人:立即修复、排期或忽略。忽略操作有助于进一步调优控制带、减少噪音。
  7. 当修复上线后,为该事故补充对应的 Eval 测试用例(阶段四的持续评测),确保同类问题在未来受到永久防护。
🇺🇸 English Original

What it looks like (for example, a bands.yaml monitoring CI test failure rate)

metric: ci_test_failure_rate
baseline: rolling_30d
rules: western_electric
tiers:
  1sigma: { action: log }
  2sigma: { action: diagnose,
            tools: "Read,Grep,Bash(gh run view *)" }
  3sigma: { action: propose,
            routes: [pull_request, runbook:rollback-deploy] }
🇨🇳 中文精译

监控规则配置 (bands.yaml)

metric: ci_test_failure_rate
baseline: rolling_30d
rules: western_electric
tiers:
  1sigma: { action: log }
  2sigma: { action: diagnose,
            tools: "Read,Grep,Bash(gh run view *)" }
  3sigma: { action: propose,
            routes: [pull_request, runbook:rollback-deploy] }
🇺🇸 English Original

Governance considerations

The tier boundaries are enforced from version-controlled config, with permissions and managed settings denying production access. Invocations, findings and triage decisions are logged with a timestamp. A service owner triages and approves findings, resulting changes go through the normal PR review gate, and the runbooks the agent may trigger were approved in advance.

🇨🇳 中文精译

治理考量

响应梯级边界由版本控制的配置文件严格限定,权限与集中托管设置禁止未授权的生产访问。调用记录、诊断结论与处理决定均带有时间戳归档。服务负责人对发现进行分类与审批,衍生出的代码改动通过常规 PR 评审门禁,智能体允许触发的 Runbook 均预先经过人工核准。

🇺🇸 English Original
How to measure it
Leading indicator
Time from band breach to an intent.md in the triage queue, against the old time from incident to post-mortem action. The detection script's log has the breach timestamp and tier of incident.
Lagging indicator
The share of findings that become merged fixes (triage queue against actual PR history), and repeat incidents of the same class, which should fall as the fixes add cases to the eval suite.
🇨🇳 中文精译
度量指标 · How to measure it
先导指标
从指标突破控制带到 intent.md 呈现在分类队列中的耗时,与过去从发生事故到采取复盘动作的时间进行对比。
滞后指标
成功转化为已合并修复 PR 的发现比例,以及同类事故的重复发生率(随着修复转化为 Eval 测试用例,重复率应显著下降)。
🇺🇸 English Original

Examples

  • When the CI test failure rate breaches 3σ, the agent quarantines the flaky test or opens a revert PR, and the review gate decides.
  • When the post-deploy 5xx rate breaches 3σ with a deployment in the window, the agent triggers the existing rollback pipeline.
  • When PR cycle time trips a drift rule, the agent writes a report for engineering leadership, which shows the harness works for process metrics as well as production ones.
Detection stays deterministic. Claude is invoked once a band is breached, and the tier sets what it may do.
🇨🇳 中文精译

实战案例场景

  • 当 CI 测试失败率突破 3σ 时,智能体自动隔离 Flaky 测试或创建 Revert 回滚 PR,由评审门禁作出裁决。
  • 当发布后 5xx 错误率在发布窗口内突破 3σ 时,智能体自动触发预设的回滚流水线。
  • 当 PR 周期时长触发漂移规则时,智能体自动为工程管理层输出诊断分析报告,证明该框架同样适用于研发过程指标。
指标检测保持绝对确定性。一旦突破控制带即调用 Claude,并由响应阶梯严格限定其行动范围。
🇺🇸 English Original

Claude on call with Claude Tag

Incidents can also arrive via other means such as workplace communication apps, like Slack or Teams. Incidents can look like a 10pm Slack message for an urgent fix on an incident channel and can now be actioned immediately. Claude Tag (public beta currently available in Slack) makes Claude a member of those channels under its own identity, so each new incident gets a first responder and the response itself becomes part of the loop and memory for future incidents.

The conversation and institutional knowledge stay in the channel, with anyone in the channel able to guide and action the response. Any team member can test hypotheses, explore new options and investigate in real time with the channel history adding to the auditability. Through access to MCP Claude verifies the metric is back at baseline and confirms it in the thread, writes the post-mortem to a version-controlled lessons file that future investigations can read.

Incidents are not the only work Claude Tag picks up. Tagged on a ticket over MCP or asked in the channel, Claude triages the work the same way. A small, well-bounded fix arrives as a PR through the review gate, and anything larger is written up as intent.md for Stage 1: Plan, at which point the loop starts feeding itself.

🇨🇳 中文精译

利用 Claude Tag 实现智能体线上值班与事故排查

线上事故同样可能源于工作协同应用(如 Slack 或 Teams)。例如深夜 10 点在应急响应频道收到的加急修复请求,现在可以被立即响应处理。Claude Tag(公开测试版目前已支持 Slack)使 Claude 能够以独立身份加入这些协作频道,使每起新事故都能获得第一响应者,响应过程本身也成为闭环与未来事故的知识沉淀。

对话与组织知识保留在频道中,频道内的任何成员都可以指导并参与响应。全员均可实时验证假设、探索新方案,频道历史记录进一步增强了审计可追溯性。通过 MCP 访问权限,Claude 验证指标恢复至基线并在讨论串中确认,将复盘总结写入版本控制的经验教训库供后续调查读取。

故障排障并非 Claude Tag 的唯一职责。无论通过 MCP 在工单中被标记还是在频道中被直接提问,Claude 都以相同方式分流工作:小范围修复直接发起 PR 进入评审门禁;较大需求则整理为 intent.md 进入阶段一(规划),研发闭环由此实现源源不断地自我驱动。

🇺🇸 English Original
The channel is the audit trail
Figure 4: The channel is the audit trail: request, diagnosis, human authorization and fix all stay where the incident was handled.
🇨🇳 中文精译
频道即完整审计线索
图 4:Slack 频道即完整审计线索:故障警报、智能体诊断、人类授权与自动修复方案全部沉淀在同一个事故响应会话中。
💡 图 4 核心名词解析 · Terminology Breakdown
Claude on call
智能体值班/告警自愈:当监控系统在 Slack 报警时,Claude 自动调取日志和监控图表,自动定位最近变更的代码并给出根因分析报告。
Human authorization
人工授权卡点:在执行任何高风险生产操作(如自动重启服务、发布修复补丁、执行数据库变更)前,必须由值班工程师在频道中点击确认授权。
Closing the loop
完成经验闭环:事故分析报告直接沉淀为经验知识库,并反哺回 CLAUDE.md 或作为新 intent.md,防止同类问题再次发生。
🇺🇸 English Original

Closing thoughts

Models and harnesses have become more advanced, allowing organizations to not just transform how they produce code, but the entire software development lifecycle.

This transformation keeps human judgement central to the process and considers the governance and regulation requirements of large enterprise organizations.

This guide consolidated many of the real best practices our Applied AI team executes on a daily basis for our customers, and we hope you found it a practical and actionable resource.

The loop keeps running. Human judgement stays above it.
🇨🇳 中文精译

结语与总结

基础模型与工程框架的进化,使组织不仅能够改变编写代码的方式,更能够重塑整个软件研发生命周期。

这种重塑始终将人类的专业判断置于核心决策位,并充分满足了大型企业组织严苛的治理与合规监管要求。

本指南凝聚了 Anthropic Applied AI 团队日常为客户落地实施的大量真实最佳实践,希望它能成为你团队行之有效的实操指南。

闭环永续流转,人类判断凌驾其上。
🇺🇸 English Original

Resources and acknowledgments

The documentation below is what a platform team needs to set those controls up, in roughly the order you would roll them out.

Thanks to Jim Blackhurst, Will Steuk, and Jamal Arif for their contributions to this guide, which was inspired by and built on much of their previous work.

🇨🇳 中文精译

参考资源与原文致谢

以下官方技术文档是平台团队搭建上述管控机制所需的全部参考,大致按实施先后顺序排列:

特别致谢:感谢 Jim Blackhurst、Will Steuk 与 Jamal Arif 对本指南作出的卓越贡献,本指南深受其前期开创性工作的启发并在此基础上构建而成。

Link copied to clipboard!