How to Use an AI Agent on a First Task You Can Check
Use an installed AI agent on one bounded coding task: preserve a clean baseline, reproduce the bug, review the diff and run the same check after the fix.
Updated · Markdown version
Using an AI agent well starts with a task small enough to check. This guide assumes Claude Code is already installed and signed in. Preserve a baseline, reproduce one bug, let the agent propose a bounded fix, and check the result yourself.
Start the session
If needed, first follow the first-session workflow or the OS-specific installation guide, then check claude --version and sign in. This article begins after that prerequisite.
Confirm the intended project directory and run git status --short. Preserve any existing work before the agent edits it; do not discard or commit unrelated changes merely to make the output clean. A separate clean branch or worktree can isolate the exercise when the project already uses Git.
If Git reports that this is not a repository, you cannot commit yet. Decide whether initializing Git belongs in this project. Before git init, inspect the files and create appropriate ignore rules for credentials, local configuration, generated files and dependencies. If you initialize, stage only reviewed paths, inspect git diff --cached and then commit the baseline. If Git initialization is inappropriate, use an isolated local copy or backup and compare the changed files directly instead.
Before submitting a task, use /permissions to inspect the current mode and existing allow rules. The current documentation calls the default mode Manual in the CLI; Shift+Tab cycles modes. Choose Manual for this first exercise and verify the mode indicator. Existing allow rules can still approve tools, so review them instead of assuming every edit must prompt. The current permission documentation explains labels and behavior for your version; stop if the displayed mode differs from what you intended.
Scope the first task
A good first task names one file or function, one behavior to change, and one way to check the result. For example:
Reproduce the blank screen after a wrong password. Change only the login handler and its regression test. First run the new test against the unchanged handler and report the expected failure. Then propose the fix and rerun the same test.
A vague request such as "fix login" invites changes across the codebase, and you will spend more time reviewing than the fix took. The narrow version produces a diff you can read in a few minutes and a test you can run yourself. Anthropic recommends starting with the simplest solution that works and adding complexity only when it clearly helps. The same guidance draws a line between tasks with a known sequence, which a fixed workflow handles, and problems whose length you cannot predict up front. A first task with a known path is a poor fit for a fully open-ended agent run.
Run and check the change
- Record the existing baseline and the exact focused test command. Keep current work safe in the chosen clean branch, worktree or isolated copy.
- Ask for the regression test before production code changes. Run it yourself against the unchanged handler and confirm the expected bug causes failure. If it already passes, improve the reproduction instead of accepting it as proof.
- Let the agent propose the scoped fix. Read each edit before approval. Run
git status --short,git diff --statand the fullgit diffto check that only the handler and its test changed. Do not reset unrelated files to clean up the diff. - Run the same regression test unchanged after the fix, then the project's relevant existing tests. Record the results rather than relying on the agent's assertion that they passed.
- Manually try the wrong-password case. The expected error message should appear, the regression test should now pass, and the diff should stay within the named scope. Preserve both the pre-fix failure and post-fix result in the review notes.
Pitfalls
- The task grows mid-session. You notice it when
git diff --statlists more files than you expected. Reject the extra edits and restate the scope in a new prompt, naming the one file you want changed. - The agent cannot tell whether it is right. Anthropic notes that agents need ground truth from the environment, such as tool results or code execution, to judge progress. If the agent reports success but nothing ran, put the project's test command in the prompt and ask it to run that command.
- Windows shell mismatch. Without Git for Windows, Claude Code falls back to PowerShell, so Bash-style commands in your prompt or in project scripts can fail. Install Git for Windows, or ask for PowerShell syntax explicitly.
- Approving edits in bulk. If you approve a run of edits without reading them, a bad change lands unnoticed. For a first session, approve one edit at a time.
- One prompt with many steps. A long list of changes in one request produces a large, hard-to-review diff. Split the work into numbered steps and run the check after each step.
When to use a skill instead
A one-time fix needs no setup beyond a clear prompt and a test run. A skill becomes useful when you repeat the same scoping and review routine across many tasks, because the routine stays the same each time. task-breakdown-coach turns a goal you cannot yet start into one first action and short timed steps, which helps when you do not know how to scope the first task. reviewing-code-changes looks at a diff for problems outside the changed lines, such as callers an edit may have broken or tests that became weaker, which fits the review step after the agent finishes. Use either one alongside your own test run, not in place of it.
FAQ
How big should a first task for an AI agent be?
Small enough that you can read the whole diff in a few minutes and run one test to check it. Name one file or function, one behavior to change, and one check. Anthropic recommends starting with the simplest solution that works.
What should I do when the agent edits files I did not name?
Reject the edits outside the scope, then ask for a narrower revision in a new prompt. If the agent keeps widening the change, split the request into numbered steps and run the check after each one.
When should I stop an agent run?
Anthropic recommends human checkpoints and exit conditions, such as a maximum iteration count, for agents. Stop when the diff grows past the scope you named, when a test you expected to fail still passes, or when the agent repeats the same edit.
Related skills in this catalog
Platform Score is our assessment under a published method. It is not a safety guarantee.
Related guides
- Claude Code first session: a plan, edit, review loop
- Install Claude Code: Native, Homebrew, WinGet, or npm
- No-code AI agent builders: what to check first
- Create a Sitemap XML: Generate, Validate and Submit
- How to Use AI at Work: Pick Tasks Where a Check Is Cheap
- Check a Resume for ATS Problems With an AI Agent
Terms this guide uses
This item is a worked example in the AI glossary for:
Sources
- https://code.claude.com/docs/en/quickstart (accessed 2026-11-25)
- https://www.anthropic.com/engineering/building-effective-agents (accessed 2026-11-25)
- https://code.claude.com/docs/en/permissions (accessed 2026-11-25)