The Future of Coding: AI Agents & the Next Tech Revolution // Ricky Doar
Ricky Doar, VP of Solutions at Cursor, shares best practices for leveraging AI in software development, focusing on effective problem decomposition, context management, and navigating both new and legacy codebases. He highlights common anti-patterns, such as over-reliance on AI, and offers strategies for debugging, model steerability, and building effective agent harnesses.
Working with AI is a new skill, adjacent to but distinct from traditional engineering. Just as great engineers learn to think in specific ways rather than just memorizing syntax, developers are now learning how to think alongside LLMs to be effective. The most successful developers excel at breaking down large problems into bite-sized tasks that an AI is likely to accomplish, avoiding prompts that are either too large or too small, which can lead to hallucinations.
The Art of Managing Context
A common myth is that providing more context to an AI will always yield a better result. In reality, model performance can suffer a steep drop-off in accuracy as context windows become bloated.
- Keep it Pristine: The goal is to provide as much context as is necessary, but no more. The context should be highly relevant to the specific task at hand.
- Isolate Tasks: A key best practice is to start a new chat window for each new task. This prevents context from a previous, adjacent problem from confusing the AI and leading it to make poor arbitrary decisions.
- Debugging: This is especially critical for debugging. Attempting to fix a bug in the same chat window where the feature was created is a common anti-pattern. The AI is biased by the context that led to the bug and will struggle to identify the root cause. Start a fresh chat for a more objective analysis of the problem.
Greenfield vs. Brownfield: AI in Legacy Codebases
While AI is often associated with greenfield projects, its capabilities in existing, large-scale (brownfield) codebases have advanced significantly. The idea that AI is only good for starting from scratch is an outdated myth.
Modern tools like Cursor index an entire codebase to create a semantic search layer. When a developer asks to “add authentication to this page,” the tool can intelligently identify the most relevant files from across millions of lines of code to inform the AI’s response.
The key to success in a brownfield project is to minimize the number of arbitrary decisions the LLM has to make. By providing the AI with examples from the existing codebase, you can guide it to follow established patterns.
You can add different files and say, “Hey, you know, I really love how this API framework is set up. I want to add a new endpoint… have it map the architectural choices that have been made before.”
This is also crucial for front-end development, where you can direct the AI to adhere to a specific design system, using pre-defined components, colors, and frameworks.
Common Pitfalls and Anti-Patterns
- Over-reliance: A frequent anti-pattern is becoming too reliant on the AI, which can lead to laziness and increasingly vague prompts. Developers must not abdicate their responsibility to think strategically and make key architectural decisions. The AI is a powerful assistant, but the developer must remain in the driver’s seat.
- Shipping Code You Don’t Understand: When an AI suggests a solution that differs from the developer’s own approach, it’s tempting to just accept it. However, an engineer is always responsible for the code they ship. The best path is to use the AI as a learning tool. Ask it: “What are the pros and cons of my way versus your way?” This allows you to make an informed decision rather than blindly trusting a black box.
- Blaming the AI: A healthy engineering culture recognizes that you cannot blame the AI for a bug in production. The developer who commits the code is ultimately responsible for understanding and validating it.
Steerability and Agent Harnesses
A major challenge in working with AI is its non-deterministic nature. Guiding an AI to follow specific rules is an ongoing area of research, but there are practical strategies.
- Hard vs. Soft Rules: You can use plain English to convey the priority of a rule. A prompt like, “This is a rule to always follow,” will be treated with more weight than, “Please try to keep functions under 21 lines of code.” However, this is not foolproof, as different models have different “personalities” and levels of steerability.
- Deterministic Hooks: For absolute, must-follow rules, the solution is to use deterministic code. Tools like Cursor provide “hooks” that allow you to run deterministic checks at various points in the AI’s workflow, such as checking for copyleft licenses in the generated code before it’s finalized.
- Optimizing the Harness: The “harness” is the framework of tools and instructions that guides an agent. For complex agents that interact with a codebase, a prescriptive and well-tested harness is critical. Small changes can have a massive impact; a single bug fix in Cursor’s internal harness for a new model improved a benchmark score from 45% to 65%. Continuous A/B testing and optimization of the agent harness are essential for achieving the best results.