Best Practices for Agentic Coding
Last updated
Was this helpful?
Last updated
Was this helpful?
Published April 2025
Agentic coding systems are transforming how software is built, enabling creation through natural language. This post covers emerging strategies for effectively using these tools across various projects, tech stacks, and environments. While this guide uses Memex, a desktop-based agentic builder, for specific examples, many principles apply broadly to other agentic coding systems.
The Wildfire Growth of Agentic Coding
Agentic coding tools are rapidly gaining popularity with both professional developers seeking accelerated workflows and tech saavy "vibe coders" (those who understand technical concepts but may lack deep programming expertise) looking to bring their ideas to life. This surge is driven by:
More Capable LLMs: Underlying language models are becoming increasingly powerful and adept at understanding intent and generating code.
Improved Tooling: The ecosystem around agentic coding, including tools for file manipulation/editing, execution, and search, has matured significantly.
Increased User Comfort: Developers and builders are becoming more accustomed to collaborating with AI partners in their workflows.
Agentic Coding vs. App Builders
It's helpful to distinguish agentic coding tools from simpler "App Builders." App Builders often take a prompt and generate a complete application, typically using backend templates and prompt engineering focused on specific, predefined tech stacks. While useful for certain tasks, they offer less flexibility.
Agentic Coding tools, like Memex, operate differently. At their core are general AI coding agents designed to use a variety of tools (like web search, file system access, command-line execution) to iteratively solve problems and build software based on conversational instructions. They are intentionally flexible and unopinionated, providing a natural language interface to create any type of software without forcing specific workflows.
This flexibility, however, presents a learning curve until users develop effective practices. This guide compiles learnings from thousands of users leveraging the Memex agentic coding tool across over 10,000 projects, providing patterns that have proven effective across various domains, codebases, languages, and environments. Nothing here is set in stone; consider these suggestions starting points for your own experimentation.
Agentic coding tools automatically gather context to understand your project. This context gathering is crucial for generating high-quality code, but you can optimize it through environment customization.
.memex/rules.md
)Many agentic systems allow you to provide project-specific context files. Memex, for example, uses a special .memex/rules.md
file that it automatically pulls into context. This is an ideal place for documenting:
Project architecture and structure
Core files and utility functions
Code style guidelines
Testing frameworks and methodologies
Development workflows
Environment setup instructions
Deployment processes
Any unique project requirements or constraints
The best part is that you often don't need to write this file manually. You can ask the agent to create it for you:
The required formats for such files vary. We recommend keeping them concise, organized, and human-readable markdown. For example (using Memex's rules.md
):
The agent will automatically reference this file when helping you, ensuring it understands your project's specific context and requirements.
Handling sensitive information like API keys or database credentials safely is crucial. Many agentic tools include built-in secrets management. Memex, for instance, allows this:
To configure secrets in Memex:
Open Memex and navigate to the Settings menu
Select "Secrets Management"
Add your secrets with descriptive names
Reference them in your conversations with Memex by name
For example, once you've added an API key called "OPENAI_API_KEY" in Memex, you can tell it: "Connect to the OpenAI API using the OPENAI_API_KEY secret" without exposing the actual key value.
Good systems store secrets securely (e.g., in the system's keychain), keeping them protected while making them available.
Agentic coding tools often allow you to control how autonomously they operate. Memex, for example, provides fine-grained control over its workflow.
There are three autonomy controls: Code Execution Approval, Turns Control, and Thinking.
These features can typically be managed from a settings panel. They add a layer of control, helping you ensure the agent doesn't perform unwanted actions.
Example Control: Code Execution Approval (Memex)
This features gives you the ability to have Memex ask for approval before running each code block. When turned on, you'll be able to review each code block to make sure it aligns with your expectations, and select if you'd like Memex to run it or skip it so you can provide more guidance.
After you choose to Run or Skip a specific code block, Memex will add a small visible note to let you know which action you selected if you need to review your work. This note also helps Memex know what action it took with that block, and inform its next steps accordingly.
Example Control: Turns Control (Memex)
With this feature you can set a maximum number of turns Memex can go through autonomously between user commands before stopping. This can be helpful when you want tighter control on specific parts of your projects, or just generally prefer to be more in the loop of the workflow.
The number of turns resets whenever there is a user message or a new conversation is started.
Example Control: Thinking Mode (Memex)
Thinking Mode enables Memex to engage in explicit reasoning when addressing your requests. Rather than simply generating direct answers, when Thinking Mode is activated, Memex deliberately works through problems step-by-step, breaking down complex tasks into a series of logical intermediate reasoning steps - similar to how humans approach problem-solving. When enabled, not only does Memex engage in reasoning, it also makes the process visible, allowing you to see how it interprets information, weighs different considerations, and arrives at conclusions. This transparency provides valuable insight into Memex's decision-making process and helps build understanding of how it approaches your requests. You can turn Thinking Mode on from the wrench settings menu. When on, you can select from four Thinking Levels: Level 1 provides basic reasoning for simpler tasks, while Level 4 offers detailed, comprehensive reasoning for complex problems requiring thorough analysis.
Thinking Mode tends to reduce credit consumption overall Although Thinking Mode might increase credit usage in an individual message, we've found it leads to more efficient results overall. By prompting Memex to follow a structured reasoning path, responses become more focused, accurate, and grounded in your specific task. The step-by-step approach reduces tangential responses and helps Memex avoid jumping to premature conclusions. It also creates natural pause points, preventing Memex from continuing unnecessarily when your request has been adequately addressed.
Many think of general AI coding agents as just coding tools, but their capabilities extend far beyond writing application code. They are adept at installing, configuring, and managing your entire development and deployment environment. Don't hesitate to ask your agent to:
Install Core Software: Handle installation of fundamental tools like Node.js, specific Python versions, compilers, or even large development suites like Xcode or Unity (especially helpful for those less familiar with manual installation steps).
Set Up Project Environments: Create and manage virtual environments (e.g., Python venv
, Conda environments).
Manage Dependencies: Install project dependencies using various package managers (npm install
, pip install -r requirements.txt
, go get
, etc.).
Configure Infrastructure: Create Dockerfiles and build Docker containers, set up basic CI/CD pipeline configurations (e.g., GitHub Actions workflows), or generate deployment scripts for platforms like Vercel or Heroku.
Handle Configuration: Manage environment variables or credentials (leveraging built-in secrets management where appropriate).
Run Initialization: Execute setup or initialization scripts required by your project.
For example, you could prompt:
Leveraging the agent's ability to execute commands (often via a CLI tool) for these tasks can save significant time, reduce manual errors, ensure consistency, and lower the barrier to entry for complex setups.
Agentic tools work best when they have comprehensive context about your goals, technical requirements, and vision. The more relevant information you provide, the more accurately the agent can implement your ideas.
Begin your project by describing your overall vision and goals. Rather than immediately diving into technical details, explain the purpose of your project, the problem it solves, and who will use it.
For example:
This high-level context helps Memex understand the complete picture before getting into implementation details.
Memex supports multimodal input, allowing you to communicate your ideas through:
Text descriptions
Wireframes and mockups
Screenshots of existing apps
Diagrams and flowcharts
Reference images
For visual elements like user interfaces or data visualizations, providing visual references dramatically improves Memex's output. Simply upload or drag-and-drop images directly into your conversation with Memex.
This is particularly effective when you want Memex to replicate a specific design or UI pattern. For example, you might say: "Build a dashboard that looks similar to this reference image, but with our company's blue color scheme."
When your project involves specific libraries, frameworks, or APIs, provide the agent with links to relevant documentation. Capable agents can fetch and comprehend documentation to ensure they follow best practices for that technology.
For example:
or simple:
The agent should fetch these resources and incorporate the information into its understanding of your project.
For common project types, consider starting with a Memex template. Templates provide pre-configured projects with appropriate structure, dependencies, and basic functionality.
Access templates by:
Opening Memex
Selecting a template to use as a starting point
Templates exist for web applications, mobile apps, data analysis projects, game development, and more. Each template includes:
Appropriate directory structure
Common dependencies
Basic configuration files
Starter code that follows best practices
Templates save time and ensure your project follows established patterns from the beginning.
Agentic tools often don't impose a specific workflow, giving you flexibility. Several effective patterns have emerged across the community:
A key best practice when working with Memex is to clearly separate the design phase from the execution phase:
Start with high-level requirements discussion: If you're not entirely sure what you want to build, begin by having a conversation with Memex about your goals. You might say: "I'm not sure about the requirements of my project. I want to build a dashboard that shows analytics from our API, but I need help working through the details. Don't jump to execution until I instruct you to."
Refine your vision together: Use Memex as a collaborative partner to explore options and define requirements before writing any code.
Signal when to begin execution: Once you're satisfied with the plan, explicitly tell Memex to start building.
This approach prevents Memex from jumping straight into coding before the requirements are fully formed, which often leads to better outcomes.
Rather than trying to build complex systems all at once, break your project into smaller, manageable steps:
Start with the simplest version that demonstrates core functionality. For example, instead of saying "build me a machine learning pipeline for customer churn prediction," begin with "set up a Python environment with Jupyter Notebook and create a 'hello world' notebook."
Verify each step works before moving to the next. Ask Memex to demonstrate or explain the functionality of what it's built.
Build progressively by adding features and complexity once the foundation is solid. For example, after getting a basic notebook working, say "Now create a second notebook that loads and explores our customer dataset."
This incremental approach significantly increases success rates by avoiding complexity too early in the process.
Agentic coding works best in an iterative development model:
Describe your initial idea in simple terms. For example: "I need a user dashboard that shows recent activity, usage statistics, and personalized recommendations."
Start with a minimal implementation. The agent will set up the project, install necessary dependencies, and create initial code.
Refine through natural language feedback. Once you see the first version, provide specific feedback like "Make the activity feed more compact" or "Add a date filter to the top."
Use visual input when possible. If the tool supports it, attach screenshots or mockups, and the agent can code changes based on what it sees.
This conversational approach yields far better results than trying to specify everything perfectly in a single prompt.
Take advantage of the tool's flexibility by switching between control modes (like the autonomy controls mentioned in section 1.d) depending on your task:
Use higher autonomy for rapid development when you want quick results without approving every step.
Switch to lower autonomy / manual approval when you need more precise control over how the agent implements specific features.
Manage task execution by giving the agent guidance on how long to work independently. For complex tasks that require multiple iterations, you might say "keep working until you really need my input."
This flexibility allows you to find the right balance between speed and control for each part of your project.
When the agent encounters challenges:
Take a step back if the agent seems stuck in a loop. You might say: "Stop. Let's take a step back. Is this really the best approach? Can we simplify things?"
Reassure the agent when needed. Sometimes agents might be hesitant to perform certain actions. Simple reassurance like "You have permission execute code on my machine. I believe in you. Do it." can help overcome these hesitations.
Provide external documentation when the agent might not have up-to-date information about specific APIs or frameworks.
The key is to maintain a collaborative attitude and help guide the agent back on track when needed.
The way you communicate with the agent significantly impacts the quality of results. These techniques will help you get the most from your interactions:
Agents perform best when given clear, specific instructions with prioritized requirements. Avoid vague requests and clearly distinguish between essential features and nice-to-haves.
Make me a weather app
Create a weather app that shows the 5-day forecast for the user's current location. It should display temperature, precipitation chance, and wind speed. Use React for the frontend and the OpenWeatherMap API for data. The UI should be clean and minimalist with a blue color scheme.
Fix the authentication bugs
Debug the authentication flow in auth.js. Users are being logged out unexpectedly after 10 minutes even though the JWT token expiration is set to 24 hours. Check for token refresh issues and session handling.
Make this code better
Refactor this code to improve performance. The database query is taking too long because it's loading all records instead of paginating. Implement proper pagination with a limit of 20 items per page and ensure we're using indexed fields for sorting.
Be explicit about constraints, requirements, and preferences instead of assuming the agent will infer them. When you have multiple requirements, consider numbering them or using bullet points for clarity.
Adjust your level of guidance based on the complexity of the task and your familiarity with the domain:
High-level guidance: "Build a shopping cart component for an e-commerce site using React" - works well when you trust the agent to make good architectural decisions for standard patterns.
Directed guidance: "Build a shopping cart component using React with these specific requirements: [detailed list]" - appropriate when you have specific requirements but flexibility on implementation.
Step-by-step guidance: "First, create a CartContext to manage state. Then, create CartItem, CartSummary, and CartActions components..." - useful for complex tasks where you want precise control over the approach.
Most successful users start with high-level guidance and become more specific if the initial results don't match expectations. This approach balances the agent's capabilities with your control.
When you have a specific implementation style in mind, provide examples of similar code from your project or external sources. Good agents excel at pattern matching and will adapt the examples to your current needs.
For example:
This technique is particularly effective for maintaining consistency across your codebase.
Rather than expecting perfection on the first attempt, plan for iterative refinement:
Ask for a basic implementation
Provide specific feedback
Request targeted improvements
Repeat as necessary
Breaking complex tasks into smaller iterations allows the agent to focus on specific aspects of the problem and generally produces better results than attempting to solve everything at once.
For example, instead of requesting a complete e-commerce platform in one go, you might:
First build the product catalog
Then add the shopping cart
Then implement user authentication
Finally add payment processing
Each step builds on the previous one, allowing for feedback and adjustment throughout the process.
Agentic coding systems include built-in tools that enhance their capabilities. Understanding and using these tools effectively can dramatically improve your results.
Agents can typically work with your local file system to:
Create new files and directories
Read existing files for context
Edit files with precision
Execute scripts and commands
Navigate and search your codebase
Explicitly tell the agent which files to focus on for best results. You can reference specific files or use patterns like "all JavaScript files in the src directory."
The agent's file editing capabilities are particularly powerful for making precise, targeted changes to large codebases.
An agent's Command Line Interface (CLI) tool allows it to:
Run shell commands
Execute package managers (npm, pip, etc.)
Build and test your code
Interact with version control systems
Deploy applications
Install dependencies
You can ask the agent to execute specific commands or let it determine the appropriate commands for a task. For example, you might say: "Install the necessary dependencies for a React project with TypeScript support and set up ESLint for code quality."
The CLI tool is particularly valuable for automating repetitive tasks and managing your development environment.
Search capabilities allow the agent to find relevant information from both your local project and the web:
Search your codebase for specific patterns or functionality
Find relevant documentation for libraries and frameworks
Research best practices for specific technologies
Look up error messages and solutions
Gather reference materials for your project
For example, you might ask: "Find examples in our codebase where we connect to the database and handle connection errors properly."
This tool helps the agent gain context about your project and ensure its implementations align with existing patterns.
For data-focused projects, some agents can generate visualizations:
Create charts and graphs using matplotlib, plotly, or other libraries
Generate network diagrams to show relationships
Visualize system architectures
Create UML diagrams for code structure
Simply describe the visualization you need, and the agent will attempt to generate the appropriate code to create it.
Some agents can help deploy your applications:
Package applications for distribution
Configure cloud services (AWS, GCP, Azure, etc.)
Set up containerization with Docker
Configure CI/CD pipelines
Deploy web applications to hosting services
Provide the agent with your deployment preferences and access to necessary credentials (ideally via a secure secrets management system), and it may be able to automate parts of the deployment process.
When working with an agent on complex codebases or projects, take time to help it understand before making changes.
Before asking the agent to modify existing code, help it build understanding:
Ask the agent to explain how existing code works: For example, "Can you explain how the user authentication flow works in this codebase? Which files are involved and how do they interact?"
Verify understanding: Once the agent provides an explanation, confirm whether its understanding is correct or guide it to a better understanding.
Then make changes: Only after the agent demonstrates proper understanding of the code should you ask it to implement changes.
This approach dramatically improves success rates when working with established codebases. Agents perform better when they have built a model of the code structure before attempting modifications.
Some systems offer templates for common project types:
Browse available templates when starting a new project. You'll find templates for web applications, mobile apps, data analysis projects, and more.
Customize the template to fit your specific requirements by describing what you want to change or add.
Extend gradually from the solid foundation the template provides rather than trying to build everything from scratch.
Templates can incorporate best practices for project structure, dependency management, and common patterns, saving you time and ensuring a quality foundation.
The most successful users of agentic coding approach projects with an iterative mindset:
Start small with a minimal implementation that demonstrates core functionality.
Get feedback early by testing what the agent builds and providing specific guidance on improvements.
Add features incrementally rather than trying to build a comprehensive solution in one go.
Document successes (e.g., by asking the agent to commit code if integrated with version control) when you're satisfied with a particular feature or change.
This approach aligns with modern software development practices and plays to Memex's strengths in adaptability and rapid implementation.
Take advantage of agents that can understand visual information:
Share design mockups by uploading images or screenshots directly into your conversation.
Use before/after examples when explaining desired UI changes or visual improvements.
Provide reference materials like diagrams, flowcharts, or examples from other applications to help Memex understand your vision.
Capture and share errors by taking screenshots of error messages or unexpected behaviors for the agent to troubleshoot.
Combining visual information with text descriptions often leads to more accurate implementations, especially for user interfaces and visual components.
Agentic coding excels in various domains through these proven application patterns:
Product managers, entrepreneurs, and vibe coders can use agentic tools for "vibe coding" - rapidly turning ideas into functional prototypes:
Describe your product vision in plain language, focusing on the user experience rather than technical details.
Let the agent build a basic prototype that demonstrates core functionality.
Gather feedback from stakeholders or potential users based on the working prototype.
Iterate quickly to refine the product based on feedback, all through natural language instructions.
This approach dramatically reduces the time from idea to testable prototype, allowing you to validate concepts before committing significant resources.
Data scientists and analysts can leverage agentic tools to accelerate data exploration and insight generation:
Ask the agent to set up a data analysis environment with appropriate libraries and tools.
Describe the data and analysis goals in plain language.
Request specific visualizations or statistical tests to explore relationships in the data.
Iterate on analyses by asking follow-up questions based on initial findings.
Create reproducible notebooks that document the entire analysis process.
This collaborative approach to data analysis combines your domain expertise with the agent's technical capabilities.
Teams can use Memex to build custom internal tools without diverting engineering resources:
Describe the business problem the tool needs to solve.
Specify integrations with existing systems like databases, APIs, or authentication services.
Start with core functionality before adding advanced features.
Deploy internally for testing and feedback.
This approach enables teams to create tailored solutions for internal needs without competing with product development for engineering time.
Connect systems and services through agent-built integrations:
Identify the systems that need to communicate and what data needs to flow between them.
Provide access credentials securely (e.g., through the tool's secrets management).
Describe the desired workflow between systems.
Test with sample data before deploying to production.
Agents can build APIs, webhooks, data transformations, and other integration components to connect disparate systems, even when off-the-shelf integrations aren't available.
Agentic tools help you build and modify projects through conversation. But what happens if a change doesn't work out? Safety mechanisms, like Memex's "Checkpoints," provide an automatic safety net.
Imagine having a "time machine" for your project files that automatically saves snapshots. Checkpointing in Memex does exactly that.
Whenever you send a message, or whenever Memex modifies files or runs code, it automatically creates a Checkpoint, capturing the exact state of all project files.
Peace of Mind: Experiment freely! If an AI suggestion or code execution doesn't pan out, you can easily undo it.
Effortless Versioning: Reduces the need to constantly commit changes manually just because the agent is involved. Checkpoints (in Memex) handle it automatically within the session.
Track Changes: See exactly when file changes occurred in the context of your conversation.
Go Back in Time: Easily revert your entire project to a state from earlier in your chat.
You'll notice small icons in Memex appearing next to certain messages signifying a Checkpoint was saved:
Next to your messages: A Checkpoint was saved before Memex started working on your request.
Hovering over these icons might show you quick details about the saved Checkpoint.
Made a wrong turn? Want to go back? Restoring is simple:
Find the message in your chat history that corresponds to the state you want to return to.
Look for the action menu on that message (often where you find options like "Copy").
Click the "Restore" button (it might have an icon like a clock or rewind symbol).
You'll see a confirmation asking if you're sure. Restoring will:
Revert all files in your project back to how they were at that Checkpoint.
Adjust your current chat history, removing messages that came after the Checkpoint you restored to. This keeps your chat consistent with your project's files.
Confirm, and Memex will restore the files and update the chat view.
It's like rewinding both your project and the conversation to that specific point in time.
Good agentic coding tools should not interfere with standard version control. Memex's Checkpointing feature, for example, is designed to work alongside Git without interference:
It doesn't create any messy .git
files or folders in your project directory.
It respects your .gitignore
file automatically.
Your own commits and Git history remain completely separate and unaffected.
Think of features like Checkpoints as a complementary layer of safety specifically for the changes happening within the agentic coding session.
Safety mechanisms provide a powerful way to safeguard your work and explore ideas without fear. Enjoy the confidence of knowing you can always step back if needed!
Some agentic tools provide ways to share your process and results.
Memex lets you easily share your conversations, privately or publicly (e.g., in the Memex Universe community).
Mastering agentic coding is about finding the right balance between clear direction and leveraging the AI's capabilities. By following these best practices—customizing context, providing clear goals, iterating, using tools effectively, and guiding the agent—you can harness these powerful systems to build sophisticated software solutions, regardless of your technical background.
Remember that agentic coding is a rapidly evolving field. New features and capabilities are constantly being added to tools like Memex and others. Keep exploring, experimenting, and sharing your experiences with the broader community.
Most importantly, embrace the iterative, collaborative nature of agentic coding. The most successful users view the process as a partnership between human creativity and AI implementation, with each iteration bringing the project closer to their vision.
This guide draws upon best practices observed across the Memex user community and reflects patterns seen more broadly in the emerging field of agentic coding. Special thanks to the "citizen builders" and professional developers whose innovative approaches and workflows continue to inspire us.
Agentic coding tools continue to evolve based on user input, guided by the vision of technology that augments human capabilities and advances our collective knowledge.
Looking for more detailed information on Memex features? Our comprehensive documentation at covers specifics mentioned in this post and provides additional examples, implementation details, and advanced techniques.