Why manually approve every action when your agent can work on its own? This lesson shows you how to build a truly autonomous agent by giving it pre-approved "tools" like web search and file editing capabilities. You will learn a powerful technique: using Claude's own documentation as context to teach the agent how to configure itself with the allowedTools flag. By combining this with a system prompt that requires it to perform research, you'll create an agent that can take a high-level goal, research the topic, and generate a detailed plan—all without any manual intervention.
The Core Technique: Documentation as Context
The foundation of this workflow is providing Claude with the knowledge it needs to configure itself. By copying the official Claude Code settings documentation and pasting it into a new session, you give the AI the complete context required to understand and implement its own configuration flags.
Configuring the Agent for Autonomy
Once the context is provided, you can instruct Claude to modify its own runner script. The goal is to add the allowedTools flag, which tells the agent which actions it can perform without asking for permission.
Directing the Agent with System Prompts
With tools pre-approved, you can use a system prompt to enforce their use. By adding a simple instruction to the agent's core prompt, you can ensure it always performs research before acting.
This combination results in an agent that can receive a high-level task, research it, and generate a detailed plan, all in a single, non-interactive execution.
Bonus: Generating TypeScript Types from Documentation
The same documentation context can be used for improving the developer experience. You can ask Claude to generate precise TypeScript types for all available flags, giving you type safety and autocompletion in your agent's configuration.
Running the Agent as a CLI Tool
Finally, the script can be adjusted to accept a user prompt directly from the command line, turning your agent into a reusable and powerful CLI tool.
This allows you to execute complex, multi-step tasks with a single command.
Spoken Prompts
Terminal Commands
