最新资讯
dev.to 你的 Agent Harness 应具备的 17 项能力 dev.to 离线 AI 记忆中 0.8 余弦阈值为何失效 dev.to Kimi K3.1 Pro 开放权重:自托管 2.8T 模型前的开发者清单 dev.to 如何通过工具调用引导模型以提升 Harness 质量 dev.to AI Agent 审计轨迹不等于对话记录 dev.to 精简 MCP server 工具数量:更少工具、更小影响面,双重收益 dev.to 为什么 git checkout 无法撤销 AI 编码 agent 的改动? wechat AI短剧门槛降降降!实测即梦短剧工作室:剧本分镜预演一条龙,伙伴计划长期护航 dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围 dev.to 银行 77 意图分类最便宜 LLM:GPT-6.1 Terra 每次成功任务 $0.000727 theinformation.com Chesky的副业:Airbnb向CEO新设AI实验室出售IP
多元动态
登录 注册
AI编码 dev.to · @Nael M. Awadallah

Claude Code 中的 intent.md 是什么?附示例的实用指南

原文 我的收藏

文章解释 intent.md 是 Anthropic AI-Native SDLC playbook 中的工作流产物,用于在确定技术方案前记录想要变更的内容与原因,并非 Claude Code 的新命令或自动发现的配置文件。文中给出一个订单规划页面的示例:在分页结果中“全选”存在歧义,intent 文件应明确是当前页还是所有匹配筛选条件的订单,并列出待决问题,避免 agent 静默替人做决定。作者强调这是对 playbook 的简化解读,示例为说明性内容,不是 Claude Code 要求的模板。

AI推荐理由 文章澄清了 intent.md 是 Anthropic AI-Native SDLC playbook 中的工作流产物,而非 Claude Code 的命令或自动发现的配置文件,并给出一个分页结果全选场景的示例,指出 intent 文件应暴露未决问题而非让 agent 自行决定。局限在于内容为作者对 playbook 的简化解读,示例为说明性而非官方模板,未提供可验证的效果数据。

62

正文

You ask Claude Code to build a feature. Minutes later, the code looks reasonable—but it solves a slightly different problem from the one your team had in mind. That is the problem behind intent.md, an artifact in Anthropic's AI-Native SDLC playbook. It captures the desired change before the team settles on a technical solution. Here is what the file means, how it fits with Claude Code, and a practical example you can adapt. The key distinction: intent.md records what someone wants to change and why. It is a proposed workflow artifact, not a new Claude Code command or a special configuration file that Claude automatically discovers. The workflow at a glance Stage Artifact Question it answers Reviewer Capture intent.md What problem and outcome matter? The person or product owner requesting the change Design spec.md What behavior and requirements follow? Product owner, with relevant specialists Build plan.md How will we change this codebase? Engineer Verify PR and tests Does the change meet the agreed behavior? Engineering team This is a simplified reading of Anthropic's playbook. The point is the order: agree on the outcome before committing to an implementation. Anthropic describes the originator brainstorming with Claude, correcting the draft intent.md, and having a product owner review it before it moves to the spec stage. A practical intent.md example Imagine an order-planning screen with filters and paginated results. Someone requests a Select All checkbox. “Add Select All” leaves an important ambiguity: does all mean the visible page or every order matching the filter? This is the sort of decision I would put in an intent file: # Intent: Select orders across paginated results Status: Draft Owner: Order planning team ## Problem Planners see only one page of orders at a time. The current selection flow makes it difficult to act on all orders matching their filters. ## Desired outcome Planners can select every order matching the current filters, even when the results span several pages. The interface shows how many orders the action will affect. Orders selected individually remain selected when filters change. A bulk selection applies only to the filter used to create it. ## Affected users Planners assigning orders to vehicles. ## Constraints The count displayed in the UI must match the set of orders processed. Existing manual selection behavior should remain available. ## Open questions - Can the API process the active filters directly? - If the API requires IDs, how will it obtain IDs across all pages? - What should happen if an order stops matching the filter before submit? Enter fullscreen mode Exit fullscreen mode This is an illustrative example, not a template required by Claude Code. The open questions are intentional. An intent file should expose unresolved decisions instead of silently letting the agent make them. Notice what the example does not say: “add a Zustand store,” “change this controller,” or “create an endpoint.” Those may become good implementation choices later, after someone inspects the existing system. intent.md vs. CLAUDE.md vs. spec.md The filenames look similar, but their jobs differ: File Useful contents Scope CLAUDE.md Repository commands, conventions, architecture, recurring pitfalls Ongoing project guidance intent.md Problem, desired outcome, affected users, constraints, unknowns One proposed change spec.md Requirements and design decisions derived from accepted intent One defined change plan.md Steps to implement the spec in the existing codebase Engineering execution Anthropic describes CLAUDE.md as context Claude Code reads for a repository. Its intent lesson describes a separate, reviewed artifact that starts a particular change. Once accepted, Claude can turn that intent into a more detailed requirements and design spec. An intent.md does not replace a ticket, a product decision, or review. If your team already has a reliable source of truth in another tool, keep the relationship between that record and the Markdown file explicit. How to try it with Claude Code Start with a problem, not a file path. For example: Help me draft an intent.md for this feature. First ask me about the affected users, the current problem, the desired outcome, constraints, and unresolved questions. Keep the document about behavior and intent. Do not choose an architecture or edit code yet. Enter fullscreen mode Exit fullscreen mode Review the resulting document yourself or with the person requesting the change. Check especially for statements that Claude inferred but nobody actually approved. Once the intent is accepted, move to codebase investigation: Read intent/select-orders.md and inspect the existing implementation. Identify the UI, state, and API behavior relevant to this request. Separate confirmed facts from assumptions. Propose a spec that preserves the accepted intent and calls out unresolved decisions. Do not implement yet. Enter fullscreen mode Exit fullscreen mode Anthropic suggests an intent/ folder in a product repository as one simple place to keep these files. The directory and filename are workflow choices; you still need to direct the agent to the relevant intent when asking it to work on the change. When is this worth the extra file? For a typo fix or an obvious one-line bug, a separate artifact may add little. I would consider intent.md when a change involves several people, crosses frontend and backend, or contains words like “all,” “active,” “done,” or “same as before” that different people may interpret differently. The value is not that Markdown makes requirements correct. The value is that the proposed outcome is visible, reviewable, and available when the team asks whether the eventual implementation solved the right problem. My takeaway: the faster an AI agent can write code, the more useful it becomes to agree on the intent before it starts. Would you add intent.md to an existing project, or keep this information in your issue tracker? Sources: Anthropic's AI-Native SDLC playbook, Capture as intent.md, and Requirements and design.

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容