Chapter 1. Defining tasks and instructing agents
Learning objectives
- Rewrite vague feature requests into task instructions with observable done criteria.
- Break large features into small tasks that can be executed, verified, and reverted one by one.
- Assess the uncertainty and scope of impact of a task to choose whether to request a plan first or delegate immediately.
- Review plans produced by the agent to eliminate unnecessary steps and adjust the scope.
- Distinguish what to include in repository instruction files (AGENTS.md, CLAUDE.md, GEMINI.md) versus what to move to other mechanisms.
Introduction
One Friday evening, a solo founder delegated a task to a coding agent, asking it to "make sign-up a bit smoother," and went out for dinner. Upon returning, the founder found that the agent had reported "Task completed" while altering the form design, password rules, and even the package list. With no criteria to judge what had improved and what had broken, the founder ended up reverting everything.
This did not happen because the agent was incompetent. The agent worked diligently within the instructions it received, and stopped at the moment it 'looks done'. The problem lay in the fact that the instructions lacked where the end was, how far it was permitted to touch, and what would prove the result.
This chapter covers the skill of delegating work. First, we examine the definition of done and the structure of good task instructions, and see how to break large features into smaller pieces and have the agent follow existing code patterns. Next, we learn when to request a plan first and how to review that plan, as well as how to place instructions that would otherwise be repeated every time into repository instruction files. Going deeper covers features without established rules and unattended tasks.
Key concepts
What delegating work means
Even when assigning work to a coding agent, responsibility for the result remains with the human. There are four responsibilities for the person giving instructions:
- Setting goals: Define what to build, why to build it, and where the end is.
- Reviewing plans: Check whether the method chosen by the agent aligns with the goals and scope.
- Confirming results: Judge the results by evidence rather than reports (Chapter 2).
- Deciding whether to release: Document (Chapter 3), inspect risks (Chapter 4), and decide whether to release to users (Chapter 5).
The Claude Code best practices documentation explains this relationship in a single sentence: an agent stops 'when it looks done', and if there is no check it can run itself, that 'it looks that way' becomes the only signal. At that point, the human becomes the verification owner and must find every mistake manually. It is like telling an interior design company only to "make the living room pretty"—you have no basis for objection even if you dislike the result. If you specify "white walls, two warm-colored lights, and leave the built-in closet as is," you can confirm each item one by one when it is done.
Definition of done: Defining the 'end' in advance
A definition of done is a set of conditions written in advance so that anyone checking whether the work is finished will reach the same conclusion. A good definition of done can be judged as pass or fail by looking at the screen or running a command. Adjectives such as "well", "neatly", and "fast" vary from person to person and cannot serve as a definition of done.
| Vague request | Verifiable definition of done |
|---|---|
| Make the sign-up screen better | If the email format is invalid, red helper text appears below the input field and the submit button is disabled |
| Make search fast | In test data containing 10,000 products, search results are displayed within 1 second |
| Fix the bug | Add a test containing reproduction steps, and both that test and existing tests pass |
| Make it look good on mobile too | At 360px width, no horizontal scrollbar appears and buttons are not clipped |
Splitting the definition of done into two categories reduces omissions. Functional criteria specify what must work ("clicking a 4-star rating displays only 4-star reviews"), while quality criteria specify what conditions must be maintained ("all existing tests pass", "do not add new packages", "does not break on narrow screens").
Claude Code best practices recommend providing the definition of done as checks that the agent can run directly. If you write a few sample inputs and expected outputs and specify "run the tests after implementation," the agent fixes things on its own until it passes the checks.
Four elements of good task instructions
Good task instructions typically contain four elements. Think of them as a small contract:
- Goal: What is being built. What will the user be able to do.
- Done when: What must be confirmed for the task to be finished.
- Scope and constraints: How far it is permitted to modify, and what must not be touched.
- Verification method: What command or confirmation procedure proves completion, and what must be shown as evidence.
Goal: Add a filter to the order history screen to view only 'In Transit' orders.
Done when:
- Selecting 'In Transit' in the filter displays only orders with an in-transit status.
- Selecting 'All' returns to the original list.
- Add tests verifying both cases above, and all npm test checks pass.
Scope and constraints:
- Modify only files within src/pages/orders/.
- Do not modify order data structures or payment-related code. Do not install new packages.
Verification method:
- Show the executed test command and its complete output, along with a screen capture at 360px width.
When all four elements are present, instructions can be short. Conversely, even if you write ten lines of adjectives, you cannot evaluate the result without a definition of done and scope.
Specifying states beyond a single screen
When describing a feature, people usually picture a single screen where everything went well. However, real applications pass through multiple states before reaching that screen. If these states are missing from instructions, the agent decides them arbitrarily or omits them entirely.
| State | Example | Written as a definition of done |
|---|---|---|
| Empty state | There are no orders yet | The message "No order history" and a browse products button are displayed |
| Loading | Waiting for a server response | A loading indicator appears in place of the list and buttons cannot be clicked |
| Failure | Network disconnected | An error notice with a retry button is displayed |
| Unauthorized | Not logged in | Redirects to the login screen, and returns to the original screen after login |
The trick to finding states without omissions is to map out the user flow first. Write down in sequence where users enter, what they click, and where they finish, and ask at each step: "What if there is no data here? What if it is slow? What if it fails? What if they leave midway?" The answers that emerge from these questions directly become the definition of done.
Breaking into smaller pieces: Vertical slicing
The larger the delegated task, the more files change, the harder review becomes, and the more difficult it is to identify which change caused a problem when something goes wrong. Therefore, large features are broken into smaller tasks before delegation. The direction of slicing matters here.
Think of a cake. If you divide it by layer (sponge only, cream only, fruit only), no one can taste it until an entire slice is finished. Slicing it vertically ensures every piece contains all layers, allowing you to taste it from the very first slice. Work is the same.
| Slicing method | Example: Product review feature | Problem or advantage |
|---|---|---|
| By layer (horizontal) | (1) Database table (2) Server API (3) Screen | Operation can only be verified for the first time after all three tasks are finished |
| Vertical | (1) View review list (2) Write a review (3) Report a review | Each task yields a result that users can actually use |
Vertically sliced tasks can each be independently executed, verified, and reverted. Whether a task is of appropriate size is judged by two criteria: can the changes be explained in a single sentence, and can the review be completed in a single sitting? Just as you label the contents on each moving box, splitting tasks into 'One Task = One Purpose' makes confirmation and reverting easy.
In Anthropic's long-running agent experiments as well, assigning only one feature per session was decisive, and creating a commit for each feature allowed returning to the previous state if problems occurred.
Delegating by pointing to existing patterns
Agents know multiple ways to build the same feature. If instructions say nothing, it picks one of them, which may differ from this repository's conventions. When error formats, input validation methods, and component structures vary from file to file, the app becomes increasingly difficult to maintain.
The solution is to point directly to an example to follow. Claude Code best practices also recommend pointing to an existing file as a good example to follow its approach, and setting the scope to prohibit using libraries other than those already in use. This is more effective than long explanations because the agent uses the actual code in this repository as its baseline.
First read how src/api/products.ts validates input and returns errors.
Using the same pattern, create the coupon lookup API in src/api/coupons.ts.
Use only packages already in package.json.
Getting a plan first
When adding a feature spanning multiple files to unfamiliar code, it is safer to request a plan first rather than having the agent write code right away. This is because at the planning stage, you can review and adjust the files to be modified, the order of tasks, and the scope to leave untouched in advance. The cost of revising a plan is far cheaper than the cost of reverting code.
Claude Code best practices recommend four stages: explore, plan, implement, and commit. Exploration and planning take place in plan mode. Plan mode reads files and explores with read-only commands but does not modify source files; you switch by pressing Shift+Tab until the status bar shows plan mode is enabled, or start a session with claude --permission-mode plan. The received plan can be edited directly in a text editor with Ctrl+G before proceeding. Approving the plan or pressing Shift+Tab again to switch modes advances to the implementation stage.
Other tools have similar mechanisms. Gemini CLI provides a plan value for --approval-mode. In tools without a plan mode, you can still request "create only a plan first and do not modify files," but because these words do not alter permissions, they do not actually prevent file modifications. If modifications must be blocked, use plan mode or read-only permissions.
Caution
Planning also has a cost. Official best practices advise directly delegating small tasks with clear scope, such as fixing a typo, adding a single line of logging, or renaming a variable. The rule of thumb is: "Can this diff be summarized in a single sentence?" If it can, skip the plan. Use planning when the approach is uncertain, when multiple files will change, or when the code to be modified is unfamiliar.
Five questions for reviewing a plan
A plausible list of steps does not necessarily make a good plan. Upon receiving a plan, ask the following five questions in turn:
- Does it connect to requirements: Can each step be matched to the requirement it serves? Any step without a match is likely out of scope.
- Does it exceed scope: Are prohibited files or unrelated cleanup tasks ("while we're at it, let's also clean up shared components") slipping in?
- Are there irreversible actions: Are there steps that batch-modify existing data, alter database schemas, or send emails externally? If so, isolate that step and confirm it separately.
- Is there a verification step: Does the end of the plan specify which checks verify what?
- Is the size appropriate: Is the plan excessively large relative to a small requirement? Are unrequested major decisions hidden within, such as adopting new libraries or restructuring folders?
Return review feedback specifically. Stating the step number along with the reason—such as "Remove step 3. Do not modify existing member data" or "Insert a test-writing step before step 5"—enables the agent to adjust accurately.
Repository instruction files: How each tool reads them
A repository is a folder containing a project's files and change history. An instruction file placed in a repository is a briefing note that the agent reads first every time a session starts, preventing the team from repeating the same instructions. It is similar to an onboarding guide handed to a new employee.
| Tool | Default file | Observed behavior |
|---|---|---|
| Codex | AGENTS.md | Reads the file in the global folder (~/.codex) first, then descends from the project root to the current folder, concatenating one file per folder. Files closer to the current folder are appended later and override preceding instructions. Once the combined size reaches project_doc_max_bytes (default 32 KiB), no more files are appended |
| Claude Code | CLAUDE.md | Reads CLAUDE.md (or .claude/CLAUDE.md) and CLAUDE.local.md from the current folder and its ancestor folders at session start, and reads files in subfolders when working with files in those folders. If CLAUDE.md is absent and only AGENTS.md exists, it reads that instead |
| Gemini CLI | GEMINI.md | Concatenates ~/.gemini/GEMINI.md with files in the working folder and its ancestor folders, sending them with each request. context.fileName in settings.json allows using different file names (a list is also possible) |
Teams that use multiple tools together often want to manage content in a single file. Claude Code documentation explains that when both CLAUDE.md and AGENTS.md are present, it reads only CLAUDE.md by default, and instructs that to share a single file, one should import it by writing @AGENTS.md at the very top of CLAUDE.md. You can also choose a personal configuration setting (claude-md-and-agents-md) that reads both files together. @path is Claude Code's import syntax, and Gemini CLI also supports @file imports in GEMINI.md. Codex can recognize instruction files with other names via project_doc_fallback_filenames in ~/.codex/config.toml.
@AGENTS.md
## Claude Code specific
- When modifying under src/billing/, present the plan first in plan mode.
You can confirm whether instructions were actually read. In Claude Code, you inspect loaded files with /context, while Gemini CLI displays concatenated content with /memory show. Codex documentation describes asking the agent to summarize instructions to confirm the order in which they were read.
What to put in an instruction file
There is only one criterion: include only what cannot be known from reading the code alone, but causes mistakes if not known. Claude Code best practices suggest asking for each line, "If this line is removed, will the agent make a mistake?" and deleting it if not. This is because when instructions become long, genuinely important rules get buried and ignored.
| Include | Do not include |
|---|---|
| Run and test commands the agent cannot guess | Per-file descriptions that can be learned by reading the code |
| Team-specific rules that differ from defaults (branch names, commit conventions) | Already known content such as standard language conventions |
| Folders that must not be touched and the reasons why | Full texts of long API documentation (replace with links) |
| Development environment pitfalls, such as required environment variable names | Secret values like passwords and API keys |
| Architecture decisions unique to this project | Frequently changing information, platitudes like "write clean code" |
Manage the length as well. Claude Code documentation recommends keeping a single CLAUDE.md file under 200 lines. Content that exceeds this should be moved to other locations depending on its nature.
| Nature of content | Appropriate location (Claude Code baseline) |
|---|---|
| Short rules needed for all tasks | CLAUDE.md |
| Rules needed only for specific folders or file types | Rules with paths specified in files under .claude/rules/. Loaded only when handling those files |
| Infrequently used procedures or reference knowledge | Skills (.claude/skills/<name>/SKILL.md). By default, only the description is loaded upfront, and the body is loaded when used. If disable-model-invocation: true, used only when invoked by a human |
| Actions that must occur without exception | Hooks. Automatically run scripts at defined points |
While @path imports help organize long files, they do not reduce volume because imported files are also loaded at session start. When creating an instruction file for the first time, start with a draft-generation command such as Claude Code's /init (which analyzes the codebase to create a draft, or suggests improvements if one already exists), and then have a human supplement details that cannot be discerned from code.
Caution
Instruction files are context, not locks. Claude Code documentation treats CLAUDE.md as 'context, not enforcement', and advises preventing actions that must be blocked regardless of agent judgment with PreToolUse hooks. Enforcement mechanisms such as permission rules and sandboxes are covered in Chapter 4.
Common skill format: The Agent Skills standard
In the Agent Skills specification, a skill is a single folder. It must contain SKILL.md, and if necessary, include scripts/, references/, and assets/ folders alongside it. SKILL.md consists of YAML frontmatter and a Markdown body.
| Field | Rule |
|---|---|
name |
Required. 64 characters or fewer. Lowercase ASCII letters, numbers, and hyphens only; cannot start or end with a hyphen |
description |
Required. Non-empty, 1024 characters or fewer. State both what it does and when to use it |
| Optional fields | license, compatibility (500 characters or fewer), metadata (string map), allowed-tools (experimental) |
The reason descriptions must be written carefully lies in the loading order. The specification divides progressive disclosure into three phases: discovery, activation, and execution. At startup, the agent loads only the name and description for each skill (roughly 100 tokens). It reads the body only when assigned work matches the description, and opens files referenced by the body only when needed. Keep the body under 5,000 tokens, keep SKILL.md under 500 lines, and move long reference materials to separate files.
If the description is merely "deployment helper", the agent will not know when to invoke this skill. Writing both what it does and when to use it—such as "Staging deployment and rollback procedures. Use when asked to deploy or revert"—provides the rationale for selecting it.
Different tools also add their own rules. Cursor requires name to match the parent folder name. While adhering to the standard, Claude Code adds invocation control, subagent execution, and dynamic context injection, offering frontmatter fields such as disable-model-invocation, context: fork, and paths. In skill listings, the combined text of description and when_to_use is truncated at 1,536 characters, but this number is merely a Claude Code extension. If a skill is meant to be shared across multiple tools, adhere to the standard's 1024-character limit for description.
Resolving overlaps in Claude Code
In Claude Code, custom commands have been consolidated into skills. Previously, commands in .claude/commands/ and skills in .claude/skills/ were distinct mechanisms. Now, .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy and behave identically. Existing command files can continue to be used without being moved.
Skills with identical names are selected according to a defined precedence.
| Overlap | Executed side |
|---|---|
| Enterprise and personal | Enterprise skill |
| Personal and project | Personal skill |
| Plugin and other skills | No collision. Plugin skills are invoked as /plugin-name:skill-name |
A plugin is a folder containing components such as skills, agents, hooks, and MCP servers. The manifest is typically placed at .claude-plugin/plugin.json, where this JSON file sets the plugin name and adds information such as version and description. When distributing the same procedures across multiple repositories, packaging them as a plugin adds a namespace so they do not collide with skills present in individual repositories.
For example, if a team has polished a release-notes skill in the repository, but an older skill with the same name remains in a team member's personal folder, the /release-notes invoked by that person is the personal skill. If only one person's output deviates from the team format, confirm name collisions first.
Instruction files can also overlap. Claude Code reads CLAUDE.md from the working folder and all its parent folders at startup, and reads files in subfolders when needed. When multiple teams share a single repository, even CLAUDE.md files unrelated to the task at hand take up context. In such cases, specifying absolute path glob patterns in claudeMdExcludes skips those files. This setting can be placed at any of user, project, local, or managed scopes, and arrays are merged across scopes. The team can place a default exclusion list in project scope, while individuals can add a few lines in local scope.
Using AGENTS.md and skills across multiple tools
OpenAI made AGENTS.md public in August 2025. When the Linux Foundation announced the establishment of the Agentic AI Foundation (AAIF) on December 9, 2025, it was named as one of three founding projects alongside MCP and goose. At the time of announcement, over 60,000 open-source projects and agent frameworks were already using this file. Agent Skills was initially created by Anthropic, released as an open standard, and donated to the same foundation on October 22, 2026. Following the donation, the primary maintainers are David Soria Parra and Mahesh Murag, and maintainers participate in their individual capacities rather than as corporate representatives.
Even for the exact same file, the scope of reading varies across tools and surfaces.
| Tool/surface | Observed behavior |
|---|---|
| Copilot coding agent | Reads root AGENTS.md and folder-level nested AGENTS.md starting August 28, 2025. Previously, it read instructions from .github/copilot-instructions.md and .github/instructions/*.instructions.md. Renamed to Copilot cloud agent on April 23, 2026 |
| Copilot per-surface support | Whether AGENTS.md, CLAUDE.md, and GEMINI.md are read varies across surfaces. In the support matrix, the VS Code Chat entry includes only AGENTS.md among the three, and REVIEW.md appears only in the GitHub.com code review entry |
| VS Code | Discovering nested AGENTS.md in local sessions is experimental and disabled by default |
Because Copilot cloud agent sessions run on GitHub Actions for up to 59 minutes, slice work to a size where even tests complete within that window. Running in a cloud sandbox respects firewall allowlists for the repository and organization, but custom compute, GitHub Actions-specific setup steps, and self-hosted runners cannot be used. For example, test commands written in apps/shop/AGENTS.md are passed to Copilot cloud agent, but in local VS Code sessions, nested discovery must be enabled for them to be passed.
Going deeper
Features without rules yet: interviews and specifications
There are times when you try to write completion criteria but cannot. This happens when business rules have not yet been decided, such as how many minutes of priority to give to waitlisted people when a reservation spot opens up, or whether to pass it to the next person if there is no response. If you hand off implementation directly to an agent at this point, the agent fills in the blanks with plausible guesses, and those guesses spread throughout the codebase.
Claude Code best practices recommend that for larger features, you should have the agent interview the human first. Give it only a brief explanation and let it ask detailed questions using the AskUserQuestion tool, but omit obvious questions and have it dig into difficult areas that the human may not have thought through—such as implementation methods, screens, edge cases, concerns, and the pros and cons of options. When questioning is finished, have it write the results to a specification file such as SPEC.md.
A good specification is self-contained. It lists related files and interfaces by name, clarifies what will not be done, and ends with an end-to-end procedure to confirm that the entire feature works. Once the specification is complete, start implementation in a new session. This ensures that the agent works in a clean context without the long conversation from the interview process remaining, relying solely on the specification file as its baseline. The documentation also states that time spent refining the specification is more valuable than time spent watching the implementation.
Interviews are also useful for uncovering human blind spots. Questions like "What if two waitlisted people accept almost simultaneously?" or "What if the class is canceled during the priority window?" help operators discover cases they missed on their own. However, deciding the rules remains the human's responsibility.
Context as a budget
Everything that an agent references in a single conversation (messages, read files, command outputs) is called context. Context has limits, and Claude Code documentation calls it the most important resource to manage, noting that as context fills up, the agent may forget previously received instructions or make more mistakes.
Therefore, keep instruction files short (since they load in every session), and clear the context with /clear between unrelated tasks. A 'grab-bag session'—where you ask an unrelated question in the middle of a task and return—is the most common form of waste. Investigations that scan dozens of files should be delegated to subagents (subagent). Because a subagent reads files in a separate context and returns only a summary, the context of the conversation where implementation is underway is preserved.
Unattended tasks
In tasks left to run overnight, batch changes applied across hundreds of files, or tasks entrusted to agents running in the cloud, there is no human available to answer questions along the way. For such tasks, instructions must be all the more self-contained.
| What to prepare | Reason |
|---|---|
| Completion criteria and check commands to confirm them | Since there is no human, the check is the sole arbiter |
| Prohibited scope in both instructions and permission settings | Instructions can be forgotten, while permission settings are enforced |
| Execution environment preparation (dependency installation, test database) | If you cannot run checks, you cannot prove completion |
| Result reporting format | Allows you to make judgments in the morning by looking only at evidence |
For batch tasks, the order matters. The method introduced by Claude Code best practices is as follows. First, extract the list of targets to change into a file, and write a script that invokes non-interactive execution (claude -p "instruction") for each target. However, test it on two or three targets before running all of them, and refine the instructions according to the issues revealed there. Pre-allow necessary tools with --allowedTools, and provide --permission-mode dontAsk so that calls that would normally ask for approval are rejected without asking (operations that do not require approval, such as reading files within the working folder, execute as normal). Setting an upper limit on the number of turns with --max-turns stops executions that get lost on a single target. Filtering out mistakes first with small tests prevents the same mistake from spreading across all targets.
The same applies to cloud agents. Codex's cloud environment settings include items for specifying dependency installation scripts, environment variables and secrets, whether to allow internet access, and domain scopes. Prepare what is needed for tests in advance, but grant access only as much as necessary.
At work
Alleyway Books: After reverting eleven files
Yoon-seo, the owner of the neighborhood bookstore 'Alleyway Books', wanted to add a star-rating filter to the reader review board. Initially, she assigned it by saying, "Please improve the review page a bit," and the agent modified eleven files, including design, sorting, and the submission form. Unable to determine what was done correctly, Yoon-seo reverted everything.
The second time, she rewrote it with all four elements in place.
- Goal: Place star-rating (1–5) filter buttons above the review list.
- Completion criteria: Clicking star-rating 4 shows only reviews with a 4-star rating, and clicking 'All' shows all reviews. If there are no reviews for that star rating, "There are no reviews with this rating yet" is displayed. Add tests to confirm these three cases, and
npm testmust Pass to be Done. - Scope and prohibitions: Modify only the review list screen. Do not modify the review submission form or the database schema.
- Verification: Show test output and a browser screen capture.
Yoon-seo initially omitted the empty state, but added it while mapping out the user flow. Some customers would click rating 2, and if there were no 2-star reviews at all, a blank screen would appear.
Expecting multiple files to change, she started by obtaining a plan in plan mode. The plan contained a step to "Add a star-rating index to the reviews table." Yoon-seo scanned the plan against the five questions. This step was not paired with any requirement (Question 1), fell under the prohibited scope because it touched the database (Question 2), and filtering on the screen was sufficient because there were only about 200 reviews (Question 5). Yoon-seo removed that step and had the filtering done on the screen.
The agent showed the test output and the screen capture, and Yoon-seo accepted it after testing it directly in the browser. The difference between the two attempts lay not in the agent's capability, but in the structure of the instructions. Completion criteria indicated where to stop, and the scope filtered out unnecessary steps from the plan.
Wave Sound Surf School: Slicing a large feature vertically
Do-yoon, the head of 'Wave Sound Surf School', which operates a lesson booking app, wanted to build a feature to "notify reservation holders and process refunds when lessons are canceled due to dangerous waves." The feature spanned the admin screen, reservation data, SMS dispatch, and payment refunds.
There were three approaches Do-yoon initially considered.
- Assigning everything at once: It felt like it would finish in a single instruction. However, more than twenty files would change, and if a refund went out incorrectly, it would be difficult to trace which change caused it. He rejected this.
- Dividing by layer: This approach assigns work in the order of data structure, server, and screen. Until all three tasks were finished, nothing actually worked, making intermediate confirmation impossible. He rejected this.
- Slicing vertically: This approach divides work into units of outcomes that users can actually use. He chose this.
Do-yoon first realized that the rules were not yet fully defined. It had not been decided whether a cancellation two hours before a lesson meant a full refund or if customers could choose an alternative lesson. Therefore, he had the agent conduct an interview first, establishing the rules while answering questions such as "Do we also send an SMS to someone who has already chosen an alternative lesson?" and recording them in SPEC.md.
He then sliced it into three tasks.
- When the administrator changes a lesson to 'Weather Cancellation', a cancellation mark appears on the reservation list screen. SMS dispatch and refunds are not performed yet.
- When a Weather Cancellation occurs, a notification SMS is sent to reservation holders only once. In tests, only a dispatch log is recorded instead of actual sending.
- When a reservation holder selects 'Refund' from the notification link, a payment cancellation request is issued and the reservation status changes to 'Refund Completed'.
For each task, he assigned it in a new session based on SPEC.md. Only for the third task touching payment code did he obtain a plan in plan mode, and seeing that a step to "Clean up shared error handling in the payment module" was slipped into the plan, he removed it as out of scope. From the day the first task was finished, the administrator could actually use the cancellation mark. Even when a calculation error in the refund amount occurred during the third task, because everything up to the previous task had already been verified, he only had to look for the cause within the changes of the third task.
Common mistakes
- "The longer and more detailed an instruction is, the better." It is easy to feel that length creates precision. However, even if you string together ten lines of adjectives, if there are no conditions to confirm, you cannot judge the result. Even if it is short, an instruction with clear Done criteria, scope, and verification methods is better.
- "If you write it in the instruction file, the agent will definitely follow it." Rules written in a file look like rules. However, instructions are merely reference material that the agent consults for judgment, so if the content is long or inconsistent, lines will be missed. Actions that must be prevented at all costs should be entrusted to enforcement mechanisms such as permission rules or hooks.
- "To be prudent, you must receive a plan first for every task." Prudence is a virtue, but planning is effective for uncertain and large tasks. Receiving a plan even for a modification that can be explained in a single sentence only consumes time.
- "Assigning a lot at once is efficient because it reduces round trips." If you only look at the number of instructions, that is true. However, the increased review time and the cost to Revert are greater than the reduced round trips. If a problem occurs, you may have to discard All of the large bundle.
- "When dividing features, dividing them in the order of data, server, and screen is the standard." Dividing along technical architecture looks clean. However, you cannot confirm behavior until the final layer is finished. Cut vertically into units of work that a user can do.
- "The agent made the plan, so the plan can be trusted." A plausible list of steps is convincing. However, a plan may contain a mix of cleanup work that was not in the requirements, data changes that are difficult to Revert, and missing verification steps. Review with the five questions before approving.
Summary at a glance
| Topic | What to remember |
|---|---|
| Done criteria | Must be verifiable as true or false by observing or running. Write them divided into functional criteria and quality criteria |
| Task instructions | Four elements: goal, Done criteria, scope and prohibitions, and verification method |
| States | Include empty states, loading, failure, and no permission in the Done criteria |
| Slicing | Cut vertically. A size that can be explained in one sentence and reviewed at one time |
| Existing patterns | Point directly to files to follow, and restrict new libraries |
| Planning | Receive when there is uncertainty, multiple files, or unfamiliar code. Skip for single-sentence modifications |
| Plan review | Connecting requirements, scope, tasks that are difficult to Revert, verification steps, and size |
| Instruction files | Only what cannot be known from code and would cause mistakes if unknown. Keep CLAUDE.md under 200 lines |
| Other places | Path-specific rules for folder-specific rules, skills for occasionally used procedures, hooks for mandatory actions |
| Unattended tasks | Check commands, enforced scope, environment preparation, reporting format. Test batch tasks with a few items first |
Check the official docs
- Claude Code: Best practices — Providing verification means, explore→plan→implement→commit, when to skip planning, interviews and specifications, batch execution
- Claude Code: How Claude remembers your project — CLAUDE.md locations and loading order,
@imports,.claude/rules/, handling AGENTS.md - Claude Code: Skills — Skill file locations and
disable-model-invocation - Codex: Custom instructions with AGENTS.md — AGENTS.md search order, size limits, alternative file names
- Gemini CLI: GEMINI.md — Instruction file hierarchy,
@imports,/memory,context.fileName - Anthropic: Effective harnesses for long-running agents — Assigning one feature at a time and logging progress
- Agent Skills: Specification — Skill directory structure,
nameanddescriptionrules and optional fields, volume by progressive disclosure stage - Claude Code: Plugins — Plugin components and the
.claude-plugin/plugin.jsonmanifest - Claude Code: Large codebases — Timing of loading CLAUDE.md,
claudeMdExcludesconfiguration scope and array merging - GitHub Docs: Custom instructions support — AGENTS.md, CLAUDE.md, GEMINI.md, and REVIEW.md supported by each Copilot surface
Self-check
1-1. There are two requests: (A) "Polish the notification settings screen to make it easy to use" (B) "When notifications are turned off, the morning summary email does not arrive the next day, and the turned-off state is maintained even when refreshing the settings screen." Which one has Done criteria? How would you rewrite the other?
1-2. You intend to delegate a list screen showing a customer's past reservation history. Aside from the screen where everything succeeded, name four states that should be included in the instructions, and write one line of Done criteria for each.
1-3. You want to add a 'Group Reservation Inquiry' feature to a workshop experience reservation app. An inquiry form, an admin confirm screen, and a receipt confirmation email are required. Divide this feature into three vertically sliced tasks, and attach one Done criterion to each task.
1-4. Among the steps in a plan received in Claude Code's plan mode, you want to directly modify the phrasing of only one step before proceeding. Which key do you use? In addition, give an example of a task that can be delegated directly without going through plan mode.
1-5. You received a plan to add a 'Request Restock Notification' button to the product detail screen. The steps were: ① Add request button and request Done text ② Add API to store request history ③ Clean up colors and margins for All button components in the app ④ Work Done report. Looking through the five questions, what is the problem with this plan, and how would you send it back with instructions to fix it?
1-6. The repository only had the AGENTS.md used by the team, and Claude Code was reading this file properly. When one team member created CLAUDE.local.md containing personal notes in the root, the team rules stopped being followed only in that team member's session. Explain why this happened and what the solution is.
1-7. A team decided to manage agent instructions in a single TEAM_GUIDE.md file. Which settings do you change so that Codex and Gemini CLI each read this file as their instructions?
Hands-on tasks
Exercise
Instruction file and first task instruction (40 minutes)
- Prepare a practice repository (if you do not have one, a small app like a to-do list app), and create the instruction file suitable for the tool you use (one of AGENTS.md, CLAUDE.md, or GEMINI.md) at the top of the repository.
- Write run commands, verification commands, and folders that must not be touched within five lines. For each line, ask "Will the agent make a mistake if I delete this line?", and delete it if not.
- Choose one small feature and write task instructions with the four elements: goal, Done criteria, scope and prohibitions, and verification method. Include one or more empty states or failure states in the Done criteria.
- Delegate to the agent, and when finished, ask it to show the executed commands, outputs, and screen captures.
- Cross-check and mark the Done criteria line by line. If there was a criterion that could not be confirmed, rewrite that sentence.
Done when: There is a record of the agent running the verification commands from the instruction file on its own, all Done criteria of the task instruction are marked as true, and if there are rewritten sentences, both the before and after versions are preserved together.
Exercise
Receiving and modifying a plan (45 minutes)
- Choose a feature where two or more files are likely to change (e.g., adding sorting and search together to a list).
- Receive a plan using plan mode. If using a tool without a plan mode, request only the plan, and after receiving it, confirm with
git statusthat no files have changed. - Mark each step using the five questions (requirement linkage, scope, things that are difficult to Revert, verification steps, and size).
- Send it back specifying step numbers and reasons to remove or modify at least one step and to insert any missing verification step.
- Delegate implementation using the revised plan, and then compare the list of actually changed files (
git diff --stat) against the plan.
Done when: The original plan, step-by-step review marks, revised plan, and the list of actually changed files are organized in a single document, and if files not in the plan were changed, the reasons for them are documented.