Sub topic 2
What the Agent Can Do: Built-in Tools
Assume you can edit files, run terminal commands, and use Git diffs. This chapter focuses on how an IDE agent uses those abilities to complete a multi-step task.
Built-in tools
Agent mode combines several tools in a loop:
- Search finds files, symbols, and text related to the task.
- Read loads relevant source files, configuration, and tests.
- Edit creates, changes, or deletes files.
- Terminal runs commands such as tests, formatters, and build scripts.
The agent observes each result before deciding what to do next. For example, it might search for createUser, read its implementation and tests, edit the validation logic, then run the test suite.
Approving tool calls and terminal commands
An agent should not automatically receive unlimited access. Depending on the IDE and settings, it may ask before editing files, running commands, or starting external services. Review the exact action, its working directory, and its arguments.
Approve a read-only search when its scope is clear. Inspect commands that install packages, modify generated files, access the network, or remove data. Deny a command when it is broader than the task requires.
Teaching the agent your project
An instructions file records conventions that should apply across tasks. Keep it short, precise, and version-controlled.
# Project instructions
- Install dependencies with `npm ci`.
- Run checks with `npm test`.
- Use named exports.
- Put application code in `src/`.
- Do not edit `dist/` directly.The agent can then use these rules when choosing files, commands, and implementation patterns. Update the file when the project workflow changes.
Writing prompts for multi-step tasks
State the goal, scope, acceptance criteria, verification command, and constraints. Name the files when you know them.
Add input validation to createUser in src/users.ts.
Reject empty names and malformed email addresses with clear errors.
Add tests next to the existing tests.
Run npm test and fix failures.
Do not change the public function signature.This structure gives the agent a finish condition and limits unnecessary edits.
Exercise
Why should a prompt include both acceptance criteria and a verification command?
Show answer
Acceptance criteria define the required behavior, while the verification command gives the agent a concrete way to check that behavior.