(Estimated Read Time: 20 minutes)
As we integrate AI tools more deeply into our coding workflows, it's essential to establish practices that ensure we're using them effectively, responsibly, and sustainably. This lesson, drawing heavily from the insights shared in by the community , introduces the "Human in the Loop" philosophy and covers the first set of recommended practices. The core idea is that AI is a powerful assistant, but the developer remains the architect and the ultimate decision-maker.
The "Human in the Loop" (HITL) philosophy is central to the responsible use of AI in coding. It means that while AI can automate, suggest, and generate, the human developer retains control, provides critical oversight, and makes the final judgments. AI tools are not infallible; they can misunderstand context, generate suboptimal or incorrect code, and may not always align with broader project goals or quality standards. Therefore, your expertise, critical thinking, and domain knowledge are more important than ever. These practices are designed to help you maintain that crucial human oversight while leveraging the best of what AI has to offer.
Core Principle: Effective AI assistance hinges on the AI's understanding of the specific context of your project, team, and the particular piece of code you're working on. This includes understanding the project's architecture, its strengths and weaknesses, and even the team's communication structures, as highlighted by Conway's Law (the structure of a system will mirror the communication structure of the organization that built it).
Why It Matters for AI Coding: Without sufficient context, AI tools tend to produce generic, irrelevant, or even counterproductive suggestions. AI assistants, while proficient in syntax, often struggle with "contextual intelligence"—the specific business logic, rules, and objectives unique to a project. Providing this context helps align the AI's output with your project's standards, architectural realities, and specific needs.
Core Principle: Clearly define what needs to be achieved (the requirements and acceptance criteria) rather than vaguely describing a solution or asking the AI to make fundamental design or architectural decisions.
Why It Matters for AI Coding: This practice ensures that the AI focuses on solving the correct problem and doesn't inadvertently introduce unwanted architectural changes, inappropriate design patterns, or overly complex solutions. AI tools are generally not equipped to make high-level strategic decisions about system design or architecture; they can't innovate or think critically about these aspects in the same way a human expert can.
Core Principle: Employing static typing in your codebase provides crucial information that AI tools can leverage.
Why It Matters for AI Coding: Static types make the structure of your data and the signatures of your functions explicit. This clarity allows AI coding assistants to better understand your code's intent, leading to more accurate code generation, more relevant suggestions, and a reduction in type-related bugs that might otherwise be introduced by AI-generated code.
Key Actionable Advice for LatAm Engineers:
Maintain a practice of strong typing in your projects. This is a good software engineering practice in general, and it pays additional dividends when working with AI tools.
When prompting an AI to generate new functions or methods, if the types are not easily inferable from the surrounding context you've provided, specify the expected types for inputs and outputs in your prompt. This helps the AI generate code that integrates seamlessly.
Core Principle: Actively provide relevant documentation to your AI assistant. This can include official documentation for libraries and frameworks, API specifications, or even internal project documentation.
Why It Matters for AI Coding: AI models are trained on vast datasets, but this data may not always be up-to-date or cover all specific nuances of a particular library version or internal API. By feeding the AI current and relevant documentation , you guide it to produce suggestions that are more accurate, use libraries correctly, and avoid deprecated features or insecure practices.
Key Actionable:
Utilize features in AI tools that allow you to provide context through URLs, document uploads, or by referencing specific files within your project that contain documentation or specifications (e.g., WindSurf's local and external context feature , or Cursor's ability to reference files).
When working with complex third-party libraries or internal APIs, explicitly point the AI to the relevant documentation pages or sections in your prompt. For example: "Generate a Python script to interact with the X API (docs at https://api.example.com/v2/docs) to retrieve user profiles."
Core Principle: Be consciously aware of how your AI coding tools track changes, manage their context or "memory," and what parts of your project they might be configured to ignore (e.g., through .cursorignore files or .cursor/rules ). The name "Memento" alludes to the movie about memory and the importance of keeping track.
Why It Matters for AI Coding: Understanding the AI's operational parameters helps prevent accidental overwriting of important code, ensures the AI doesn't operate on sensitive files , and allows you to manage its context window effectively. If an AI's context window is limited, it might "forget" earlier parts of a long conversation or instructions, leading to inconsistent or irrelevant suggestions.
Key Actionable Advice:
Diligently configure ignore files (like .gitignore and tool-specific ones such as .cursorignore) to protect sensitive information and prevent the AI from processing irrelevant or build-artifact directories.
Use the IDE rules system for recurrent prompts (such as .cursor/rules)
By internalizing these first five practices, you'll be well on your way to a more productive and controlled collaboration with AI coding assistants, ensuring they serve as true force multipliers for your development efforts.
Core Principle: "Mise en place" is a French culinary term meaning "everything in its place." In coding, it translates to having your environment, dependencies, tools, and a clear plan prepared before engaging AI for significant tasks. This includes robust version control.
Why It Matters for AI Coding: AI tools operate most effectively within a well-structured and well-prepared environment. Attempting to use AI in a chaotic project with unclear goals, missing dependencies, or no version control can lead to frustrating interactions, wasted effort, and potentially harmful changes. The cautionary tale on Reddit about Cursor "f*cking up 4 months of work" underscores the critical importance of backups and version control before letting any tool, AI or otherwise, make significant changes.
Key Actionable Advice:
Always ensure your project is under diligent version control (e.g., Git) and commit any pending changes before you start a session involving AI-assisted code generation or refactoring. This provides a safety net.
Clearly define the specific, small task you want the AI to help with. Avoid vague, large-scale requests.
Set up your development environment correctly, including virtual environments (like Python's VENV ), necessary libraries, and any required configurations, so the AI has a stable base to work from.
Core Principle: If an AI chat session or interaction becomes confusing, unproductive, or if the requirements change significantly mid-stream, it's often more effective to stop, reset, and start a new interaction, or even solve the problem manually.
Why It Matters for AI Coding: AI models can get "stuck" on an initial interpretation or struggle to adapt to evolving requirements within a single, continuous conversation. Persisting in such a situation can lead to compounded errors, increasingly irrelevant suggestions, and wasted time.
Core Principle: Understand that current AI tools have limitations, particularly when dealing with very large or complex projects, codebases with poorly applied design patterns, nuanced management of libraries, or when they propose overly intricate solutions for relatively simple problems.
Why It Matters for AI Coding: Over-relying on AI in scenarios where its capabilities are stretched can lead to suboptimal, incorrect, or overly complicated code that becomes a maintenance burden. AI assistants are generally poor at deep contextual intelligence regarding specific business objectives or navigating highly complex, existing architectures with inherent design flaws.
Key Actionable Advice:
For large projects, use AI to assist with well-defined, smaller, modular tasks rather than expecting it to grasp the entire system's complexity at once.
Be especially critical of AI suggestions when working in areas of your codebase that are known to be fragile, have significant technical debt, or involve intricate interactions with multiple libraries. The AI lacks the deep historical and implicit knowledge you or your team might possess about such areas.
Core Principle: Avoid asking AI tools to perform massive, complex refactoring tasks in a single prompt or operation. Instead, break down the refactoring effort into smaller, manageable, incremental steps, much like a human developer would approach such a task. It's not possible to give it a giant problem and ask it to solve it – or if you do, you're gambling with the odds.
Why It Matters for AI Coding: Large, vague refactoring prompts (like the exaggerated example of migrating Next.js from version 10 to 15 in one go ) are highly likely to fail, produce incomplete results, or introduce subtle errors that are hard to detect. A step-by-step approach allows for review, testing, and correction at each stage, maintaining control and quality. "Es mejor pensar cómo nosotros hacemos refactorizaciones. Y dividir el problema por partes" (It's better to think about how we do refactorings. And divide the problem into parts).
Key Actionable Advice:
When facing a significant refactoring task, first identify a logical sequence of smaller, independent changes. For example, instead of "refactor this entire module," try prompts like: "Convert this class-based React component to a functional component using hooks," then, "Update the data fetching logic in this newly functional component to use the async/await pattern with our project's standard error handling."
For each step, provide the AI with the specific code snippet to be refactored and clear instructions for that increment. Use context features to guide the AI for each specific sub-task.
Core Principle: You, the developer, are ultimately responsible and accountable for any code that goes into production. Use AI as a powerful tool for support, research, brainstorming, and learning, but never as a complete replacement for your critical thinking, design decisions, and final judgment. "Al final de cuentas, el código que pasa a producción es tu responsabilidad. No renuncies a esa responsabilidad dejando que la IA haga todo por ti" (Ultimately, the code that goes to production is your responsibility. Don't give up that responsibility by letting AI do everything for you). The idea of "MCP" (Master Control Program from Tron) implies maintaining ultimate authority and oversight.
Why It Matters for AI Coding: Blindly accepting AI suggestions without understanding and vetting them can lead to serious issues: bugs, security vulnerabilities, performance problems, or code that violates architectural principles or licensing agreements. The responsibility for code quality, security, and ethical implications always rests with the human developer.
Key Actionable Advice:
Always thoroughly review, understand, and test any code generated or modified by an AI tool before committing it or deploying it.
Instead, use it to bounce ideas around, to support you in researching a problem. It can also be an excellent learning tool because it has infinite patience and won't judge you.
Make the final architectural, design, and implementation decisions yourself. The AI assists, you direct.
These ten practices, derived from real-world experience and insights , form a robust framework for interacting effectively and responsibly with AI coding assistants. They emphasize the developer's central role in guiding the AI, ensuring quality, and maintaining control. This summary table serves as a quick reference, a set of guiding principles to keep in mind as you integrate these powerful new tools into your daily work. For Latin American engineers, adopting these practices will be key to harnessing AI's potential while upholding the high standards of professional software development.