Three rules for development with an AI assistant: from requirements to maintainable code

Developers have long been afraid to hand over their code to an AI assistant. The fear makes sense: an assistant can violate requirements, break legacy code, or write unmaintainable solutions. But these fears are solvable — you need rules. ## The Problem: AI Without Requirements The first issue is that AI invents requirements instead of following them. You give the assistant a task like "add authentication," but it adds something different from what you described in the spec—something of its own. Fixing it later takes longer than writing it yourself.

AI-processed from Habr AI; edited by Hamidun News
Three rules for development with an AI assistant: from requirements to maintainable code
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Write a spec with input/output examples
Key metric #2Show existing code (how things are structured in the project)
Key metric #3Specify anti-patterns ("don't do this because...")

Developers have long been afraid to hand over their code to an AI assistant. The fear makes sense: an assistant can violate requirements, break legacy code, or write unmaintainable solutions. But these fears are solvable — you need rules.

The Problem: AI Without Requirements

The first issue is that AI invents requirements instead of following them. You give the assistant a task like "add authentication," but it adds something different from what you described in the spec—something of its own. Fixing it later takes longer than writing it yourself.

The second issue is backward-compatibility. Changes to the code break the old functionality: a bug in one place, and the entire legacy system stops working. AI can't see this if you don't explicitly tell it.

The third issue is quality gates. AI can write code that works but is impossible to maintain: poor variable names, giant functions, missing tests.

Three Rules for Managing AI

First rule — document your requirements. Not a verbal explanation, but a document. AI works with text, so:

  • Write a spec with input/output examples
  • Show existing code (how things are structured in the project)
  • Specify anti-patterns ("don't do this because...")
  • Provide a list of tests that should pass

Second rule — ensure backward-compatibility. Before merging, the code must pass:

  • Regression tests (old functionality works)
  • Type-checking (TypeScript or Mypy)
  • Linters (consistent style)
  • Build-check (production build won't break)

Third rule — quality code review. Don't rely only on AI. We use:

  • Automated checks (lint, type, build)
  • Manual review by a second developer
  • Smoke tests before deployment

How It Works in Practice

When these three rules are in place, AI becomes an effective helper. The assistant follows the spec precisely, its code passes all checks, and backward-compatibility is guaranteed. The developer can focus on architecture while delegating routine work. The result: faster feature implementation, fewer bugs, easier-to-maintain code. And this isn't theory — it works on real, complex products where every change is critical.

We're not afraid of AI because we know the rules of the game.

What This Means

AI in development is not a threat if you follow three rules: requirements, compatibility, quality gates. Then the assistant works like a junior developer with good discipline.

Key Questions Answered

What are the key details on The Problem: AI Without Requirements?

The first issue is that AI invents requirements instead of following them. You give the assistant a task like "add authentication," but it adds something different from what you described in the spec—something of its own. Fixing it later takes longer than writing it yourself. The second issue is backward-compatibility. Changes to the code break the old functionality: a bug in one place, and the entire legacy system stops working. AI can't see this if you don't explicitly tell it. The third issue is quality gates. AI can write code that works but is impossible to maintain: p

What are the key details on Three Rules for Managing AI?

First rule — document your requirements. Not a verbal explanation, but a document. AI works with text, so: Write a spec with input/output examples Show existing code (how things are structured in the project) Specify anti-patterns ("don't do this because...") Provide a list of tests that should pass Second rule — ensure backward-compatibility. Before merging, the code must pass: Regression tests (old functionality works) Type-checking (TypeScript or Mypy) Linters (consistent style) Build-check (production build won't break) Third rule — quality code review. Don't rely only

How It Works in Practice?

When these three rules are in place, AI becomes an effective helper. The assistant follows the spec precisely, its code passes all checks, and backward-compatibility is guaranteed. The developer can focus on architecture while delegating routine work. The result: faster feature implementation, fewer bugs, easier-to-maintain code. And this isn't theory — it works on real, complex products where every change is critical. We're not afraid of AI because we know the rules of the game.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…