To get AI agents to perform complex tasks in existing code, a three-stage workflow is key. First, have the agent research and objectively document how the codebase works. Second, use that research to create a step-by-step implementation plan. Finally, execute the plan. This structured approach prevents the agent from wasting context on discovery during implementation.

Related Insights

To get superior results from AI coding agents, treat them like human developers by providing a detailed plan. Creating a Product Requirements Document (PRD) upfront leads to a more focused and accurate MVP, saving significant time on debugging and revisions later on.

The most significant productivity gains come from applying AI to every stage of development, including research, planning, product marketing, and status updates. Limiting AI to just code generation misses the larger opportunity to automate the entire engineering process.

Before delegating a complex task, use a simple prompt to have a context-aware system generate a more detailed and effective prompt. This "prompt-for-a-prompt" workflow adds necessary detail and structure, significantly improving the agent's success rate and saving rework.

High productivity isn't about using AI for everything. It's a disciplined workflow: breaking a task into sub-problems, using an LLM for high-leverage parts like scaffolding and tests, and reserving human focus for the core implementation. This avoids the sunk cost of forcing AI on unsuitable tasks.

Instead of codebases becoming harder to manage over time, use an AI agent to create a "compounding engineering" system. Codify learnings from each feature build—successful plans, bug fixes, tests—back into the agent's prompts and tools, making future development faster and easier.

Instead of asking an AI to directly build something, the more effective approach is to instruct it on *how* to solve the problem: gather references, identify best-in-class libraries, and create a framework before implementation. This means working one level of abstraction higher than the code itself.

Documentation is shifting from a passive reference for humans to an active, queryable context for AI agents. Well-structured docs on internal APIs and class hierarchies become crucial for agent performance, reducing inefficient and slow context window stuffing for faster code generation.

Borrowing from classic management theory, the most effective way to use AI agents is to fix problems at the earliest 'lowest value stage'. This means rigorously reviewing the agent's proposed plan *before* it writes any code, preventing costly rework later on.

The most effective way to build a powerful automation prompt is to interview a human expert, document their step-by-step process and decision criteria, and translate that knowledge directly into the AI's instructions. Don't invent; document and translate.

For complex, one-time tasks like a code migration, don't just ask AI to write a script. Instead, have it build a disposable tool—a "jig" or "command center”—that visualizes the process and guides you through each step. This provides more control and understanding than a black-box script.