AI AgentsDevelopment

The Secret Sauce to Making AI Agents Work For You

Leveraging AI agents for software development and other complex tasks can be a game-changer, but it comes with its own set of challenges and best practices.

129 views

Leveraging AI agents for software development and other complex tasks can be a game-changer, but it comes with its own set of challenges and best practices. Based on extensive experimentation, here's the secret sauce to making AI agents truly work for you, minimizing costs and maximizing efficiency.

Understanding AI Limitations and Strengths

  • Cost Management is Crucial: AI agents, especially with high-tier models, can be expensive. A side project can quickly rack up costs (e.g., $300 for an MVP using Claude 4 Sonnet MAX). It's recommended to avoid very expensive models like Claude Opus or anything from OpenAI, and instead explore more cost-effective yet powerful alternatives like Gemini 2.5 MAX when we want big context and changes. Or Claude Sonnet standard (which is the bets cost-effective model at the date this article was written). Max mode and custom high-tier models should be reserved for initial prompts only, as they consume significantly more credits.

  • Data Format Matters: AI struggles with editing Markdown files, so it's best to make AI agents use JSON for AI-driven activities where modifications are frequent.

  • Leverage Visuals (Carefully): While passing images to prompts might not work well, AI's understanding of ASCII art is uncannily good. When GPT 3.5 was just out in the market, we used to jailbreak it, or, with better intentions, we got the AI to return visual representations of its understanding.

  • Context Window Limitations: All models have limited context windows, and the longer the conversation, the more prone the AI is to making mistakes. Think of it as an expert with Alzheimer's, it's crucial to keep the focus on small parts of the problem.


Effective Prompt Engineering

  • Plan Before You Code: Always instruct the AI to "Don't code, look around and come up with a complete and detailed plan" at the end of your prompt. This allows you to identify and fix mistakes before the AI starts generating extensive code.

  • Prioritize Clarity: Follow up with "If you don't understand something, ask questions, never proceed to code without complete clarity" after reviewing the plan. Asking questions is always preferred over uncontrolled coding.

  • Break Down Prompts: Complex prompts should be broken down into smaller, manageable sub-tasks. You can even use AI to help you break them down and brainstorm ideas, then correct them before sending.

  • Use Test Driven Development. Write your tests first, then craft the implementation. Tweaking tests just to make them pass IS NOT a valid solution. Tests should only change if requirements change.


Optimizing Workflow and Tools

  • Organize Your Files: Pass down all necessary files and folders relevant to the prompt's scope. While AI can find them, it introduces "noise" into the process.

  • Integrate Documentation: Copy-pasting web documentation links directly into the prompt will update the AI's context. This includes your own Swagger API documentation. And even this article's guidelines.

  • MCP: When possible, connect Cursor with MCP tools (if stack-specific and available), as this can significantly speed up processes and reduce costs.

  • Define Rules: Utilize /.cursor/rules.txt to define persistent rules that will be passed down with every prompt, making it harder for the AI to unconsciously deviate.

  • Stay Engaged: Don't just set the AI loose. Read all of its output and ask clarifying questions. Losing track of what it's doing is very easy, especially with large code outputs, and can leave you out of the loop.

  • Leverage Adaptability: AI agents are generally reliable for adapting existing functionalities or translating code between languages (e.g., "Adapt this view functionality (from another project) into our project" or "adapt this code from Java to Python").


Continuous Improvement

  • Kanban-style Tracking: Implement an AI-readable Kanban board using JSON formats to track changes, process, and blockers. This allows the AI to understand the overall status and pick up exactly where it left off in previous conversations, breaking down work into manageable iterations.

  • Automated Validation: Incorporate a conversational development validation framework where every iteration begins by reviewing the overall status.


By adhering to these principles, you can transform AI agents from expensive experiments into powerful, efficient collaborators for your projects.

Pablo Dominguez

Pablo Dominguez

Full Stack Developer passionate about building interesting projects and learning new skills.

Stay Updated

Subscribe to get notified about new blog posts and projects.

What would you like to receive?