Advice for coding with AI
More folks are picking up coding than ever before thanks to advancements in AI. Here are the top tips for ensuring a smooth experience.
1. Never delegate understanding
AI tools can generate code and automate plenty, but you still need to understand how the system works.
You’re responsible for the architecture, the data flow, and each component’s role. When something breaks (and it will), you need to know where to look and how to fix it.
Use AI to speed things up but never to replace real comprehension.
2. Provide the “What” and the “How.”
When prompting AI, be explicit about:
- What you want to build: e.g., “A REST API that handles user authentication and stores profiles in a database.”
- How you plan to build it: e.g,. “We’ll use Golang, a PostgreSQL database, and token-based auth.”
This keeps code generation aligned and avoids wasted cycles on irrelevant scaffolding.
3. Context is king
AI shines when it has context. Whether you’re building a CLI tool or a full-stack app, always provide:
- System constraints and environment variables
- Project structure (filenames, dependency versions, etc.)
More context = better completions. There are many great tools for ensuring the model you’re working with always has the right context.
Learn about them in Context is king: tools for feeding your code and website to LLMs.
4. Use a Spec or “Grounding” file
Create a SPEC.md or README.md that outlines the system:
- Architecture and stack choices
- Key endpoints, models, schemas
- Data flow and external integrations
- Intended User Experience
This file becomes your source of truth, especially when using AI tools that support file referencing (like @SPEC.md in Cursor).
Keep it up to date, and then use it as a constant reference during prompt-driven sessions.
💡 Want to go deeper? Check out our guide on Cursor Rules to see how to encode best practices, patterns, and constraints directly into your grounding files—giving AI a more structured understanding of your codebase.
5. Git is your ideal save system
Before writing any code:
- Initialize a new Git repository and make your first commit with the spec file
- Commit often—especially between AI-driven changes
- Use branches to test ideas without risk
Git lets you roll back, track your thinking over time, and create meaningful milestones as your project evolves.
6. Understand the tech first
Large language models generate guesses—not guarantees.
If you don’t understand how something like token-based authentication or event-driven systems work, you might miss subtle (or huge) mistakes in the output.
Use the model to teach yourself what you don’t know.Ask it:
- “Give me a one-paragraph summary of how token-based auth works.”
- “What’s the difference between JWT and opaque tokens?”
- “Walk me through how this specific library handles sessions.”
You can rapidly fill knowledge gaps in real time, leveling up your understanding alongside your project.
Yes, you always need to be on guard about hallucinations, but you can cross-reference information you’re unsure about with other sources.
For most non-destructive changes, you can quickly create a test file to prove out a given pattern or approach.