CodingIdeas.ai

AI Coding

AI Coding Best Practices

20 principles synthesised from the r/vibecoding and r/ChatGPTCoding communities, Andrej Karpathy's context engineering writing, and the senior architect methodology. From prompting discipline to knowing when to stop the model.

The core principle

The r/vibecoding and r/ChatGPTCoding communities have converged on one idea: AI coding is a skill, not a shortcut. The developers shipping the best products aren't prompting faster — they're thinking more clearly before they prompt at all. These 20 practices are the difference between shipping clean, maintainable code and debugging a codebase no one understands — including the AI that wrote it.

🧠 Mindset

1

You are the engineer, AI is the tool

AI coding is a skill, not a shortcut. The best results come from developers who set the direction, define the constraints, and verify every output — not from those who accept whatever the model produces.

2

Strategic guidance beats passive acceptance

Review every suggestion critically. Accepting AI output blindly is how codebases become unmaintainable. You own every line that ships — regardless of who wrote it.

✍️ Prompting

3

Prompting is a skill — invest in it

The quality of your output is directly proportional to the quality of your input. Vague prompts produce vague code. Specific, constrained prompts produce production-ready output.

4

Be specific about constraints

Tell the AI the language, framework, patterns you're using, and what you don't want — not just what you do. Constraints reduce hallucination and scope creep.

5

Give context, not just tasks

Explain the surrounding system, not just the isolated function. AI needs the why, not just the what. The more context, the more consistent the output.

6

Refine with diffs, not rewrites

When output is close but not right, reply with a targeted correction rather than asking for a full rewrite. Full rewrites discard working code; targeted diffs preserve it.

🔁 Stop Repeating Yourself

7

Use custom instructions / rules files

Set your coding standards, preferred stack, and project context once in AGENTS.md (or CLAUDE.md / .cursorrules) so you never re-explain them every session.

8

Create reusable prompt templates

For recurring tasks — write a test, review a PR, scaffold a component — keep a library of proven prompts. Stop solving the same problem twice.

🔄 Workflow

9

Plan before you prompt

Define the architecture and data model yourself first. Hand the AI a clear spec, not an open-ended problem. The Architect Prompt methodology does this in three structured steps.

10

Treat AI like a pair programmer

Talk through the problem before asking for code, just as you would with a colleague. Pair programmers don't silently implement — they discuss first.

11

Break work into small, reviewable chunks

Large one-shot generations are harder to verify and course-correct than small incremental steps. One task only. Stop when complete. Confirm it works before moving on.

12

Commit to git before and after every AI task

AI-generated changes are the hardest to untangle without a clean rollback point. A commit before each task is the cheapest insurance you can buy.

🤖 Multiple Agents & Parallelism

13

Run parallel agents for parallel tasks

Use multiple AI agents simultaneously on independent parts of the codebase to multiply output. Assign each agent a clearly bounded, non-overlapping scope.

14

Use git worktree to isolate agents

Each agent gets its own working directory from the same repository — same codebase, different working trees — so parallel sessions never conflict or overwrite each other.

15

Assign agents specific scopes

Give each agent a clearly bounded task. Agents that wander produce unpredictable results. Scope boundaries should be as explicit as the task itself.

🛑 Know When to Stop

16

Pull the plug when the AI is looping

If the AI produces the same broken output twice — stop. Revert to the last commit, shrink the task scope, and re-prompt. A looping AI digs deeper into the wrong direction with every attempt.

17

Don't let AI dig the hole deeper

The longer you let a failing AI session run, the more tangled the output becomes. Cut early — it's always cheaper to revert a small change than to untangle a large one.

18

Some problems need human thinking first

Complex bugs, architectural decisions, and security-sensitive code should start with your brain, not the AI's. Use AI to implement a solution you've already reasoned through.

🧩 Leverage AI Where It Excels

19

AI excels at tests, docs, and code review

Leverage AI most heavily for the work developers avoid: writing tests, generating documentation, and reviewing diffs. The Critique Loop after every build step uses exactly this.

20

You are responsible for the output

Every line of AI-generated code that ships is your code. You own it, you maintain it, you explain it. Sign off on it with the same rigour you'd apply to code you wrote yourself.

FAQ

What are the most important AI coding best practices?

The five highest-leverage practices are: (1) plan before you prompt, (2) use an AGENTS.md rules file so every session has context, (3) work one task at a time, (4) commit to git before and after every AI task, and (5) pull the plug when the AI loops — revert and re-scope rather than letting it dig deeper.

What is the difference between AI coding and vibe coding?

AI coding is the broad practice of using AI tools to write software. Vibe coding lets the AI generate the entire app from natural language, without structured planning. Strategic AI coding combines vibe coding speed with engineering discipline: clear specs, one-task execution, and a critique loop after every step.

What is AGENTS.md and why does it matter?

AGENTS.md is the 2026 cross-tool standard for AI context files — supported by Claude Code, Cursor, Windsurf, Sourcegraph Cody, and Google Jules. It captures your tech stack, conventions, and scope boundaries so every IDE session starts with full context. Without it, the AI re-learns your project from scratch every session.

How do I use git worktrees with AI agents?

git worktree lets you create multiple working directories from the same repository. Each AI agent gets its own worktree — same codebase, different working tree — so parallel sessions never overwrite each other. Run `git worktree add ../feature-branch feature-branch` to set one up.

Put these into practice

Every idea on CodingIdeas.ai ships with an Architect Prompt that applies these practices automatically — plan first, execute one task at a time, critique loop after every step.

Synthesised from r/vibecoding, r/ChatGPTCoding, Andrej Karpathy's context engineering writing, and the Plan-First senior architect methodology used across the Cursor and Windsurf communities.