⚡ AI Coding Guide & Best Practices

Stop AI From Writing Buggy Code

Learn a simple workflow that helps ChatGPT, Claude, Gemini, and Cursor build cleaner, more reliable software from your very first prompt.

The Golden Rule of AI Coding

Treat AI tools like eager junior assistants: incredible execution power, but they need clear rules, explicit instructions, and human verification.

✓ Write clear specifications first
✓ Run automated safety checks
✓ Never blindly accept generated code

1. Why AI Makes Coding Mistakes

AI doesn't know when it's wrong—it's designed to be confident, even when hallucinating.

🌀

Inventing Non-Existent Code

AI will happily write fake library functions or outdated methods that look real but crash instantly when executed.

🧠

Forgetting Requirements

As conversations grow longer, AI silently drops earlier rules, leading to broken edge cases and missing security checks.

🧹

Rewriting Working Code

When asked to make a small edit, AI often rewrites entire files, introducing hidden regressions in code that already worked.

2. Core Rules to Guide AI

Give AI clear boundaries so it stays focused and produces production-grade code.

🚫

Strict Data Typing

Instruct AI to explicitly define data structures instead of using loose or mystery types.

Bad Prompt "Just grab whatever data from the API"
Good Prompt "Create a strict User interface for the API response"
🔒

No Hiding Errors

Forbid AI from wrapping broken code in silent try/catch blocks that hide bugs from you.

Bad Prompt "Make sure it doesn't crash if it fails"
Good Prompt "Log explicit errors and throw useful exceptions"
📦

No Unapproved Packages

Require AI to ask before adding random third-party dependencies to your project.

Bad Prompt "Install whatever package you need"
Good Prompt "Use vanilla JS or ask before adding npm libraries"

3. Three Simple Safety Checks

Before accepting any AI-generated code, always verify it with this 3-step workflow.

1

Check 1: Does it compile & pass static checks?

Run your project's linter or typechecker to catch syntax mistakes and missing variables immediately.

Static Linter Type Checker Zero Syntax Errors
2

Check 2: Does it pass automated tests?

Ask AI to write automated unit tests first, then verify that the newly generated code passes all tests.

Automated Unit Tests 100% Green Test Suite Security Check
3

Check 3: Did a human review it?

Never blindly merge code. Inspect the changes, verify the logic, and make sure it solves your actual problem.

Human Review Surgical Edits Matches Intent

4. Never Just Say "Build Me an App"

Learn the Spec-Driven workflow: write down your requirements before asking AI to code.

1-spec.md — Define What & Why

Clearly state the problem, the desired goal, and what the AI should explicitly NOT build.

# Feature: User Authentication

## 1. Problem & Goal
* **Problem:** Users need a secure way to log into the application.
* **Goal:** Provide email sign-in with JWT session tokens.
* **Out of Scope (Do NOT Build):** Custom SMS verification or social logins.

## 2. Acceptance Requirements
* **WHEN** user submits valid credentials **THEN** return session token and redirect to dashboard.

5. Interactive Spec Generator

Fill in the details below to generate a clean specification you can paste directly into ChatGPT or Claude.

New Feature / Foundation
Edit Existing Code
Bug Fix / Cleanup

6. Live Spec Rating & Editor

Paste your AI prompts or specs here to score their clarity and check for missing rules in real time.

100%

AI Specification Clarity Rating

Automated evaluation checking for clear non-goals, strict instructions, and safety constraints.

7. Ready for Advanced Engineering Standards?

Once you master the basics, dive into enterprise CLI tools, automated CI/CD pipelines, and Spec-Driven Development toolkits.

🚀

Otrobonita Project Bootstrapper

Injects ready-to-use project rules, GitHub Actions workflows, and specification templates into any repository.

./setup.sh /path/to/project
🐙

GitHub Spec Kit & Benchmarks

Explore formal Spec-Driven Development standards used by leading software engineering organizations worldwide.

github.com/github/spec-kit ↗