sina_codes
فا
docs/
Outline

---

title: Use AI like a tech lead: the rules and plans I use

slug: ai-setup

lang: en

published: 2026-11-17

words: 1092

lines: 120

size: 5.6 KB

read: 6 min read

reel: Use AI like a tech lead

---

Use AI like a tech lead: the rules and plans I use

Use AI like a tech lead

You asked your AI to build a simple feature. Seconds later it has touched 25 files. Half of them you do not understand why it changed at all, and for the other half you know why but not what it did. Now you get to spend an hour talking to it, finding out what it did, what it did not do, and why.

This is how I work with AI so that does not happen, in the order a feature goes through it. It is the second episode of the Production Ready series.

Why AI does this

Whatever you do not tell your AI, it guesses. The names, where files go, which system should change and which should not, the pattern the code should follow. Every guess is a file you did not expect. So the problem is not the model, it is what you did not tell it.

That is why, before AI writes a single line, I do two things: I set the project up with hard rules for it, and we write a full plan, so nothing is left to guess.

1. Hard rules inside the project

A rule that lives only in my head, AI does not know about. A rule that lives only in a file, AI can forget. So every rule lives in two places: a file the agent reads at the start of every session, and a tool that fails the build when the rule is broken.

The real rules of this site (the Python backend):

  • Linting with every Ruff rule on, and formatting with Ruff.
  • Types with mypy in strict mode.
  • The import direction between layers checked by import-linter (api, services, selectors, models).
  • Every public function and class has a Google style docstring, and comments explain why, not what.
  • No numbers or strings hard coded in logic: they all live in validated config.
  • Tests with at least 90 percent coverage.
  • And before every push, one command checks all of it together.
toml
[tool.ruff.lint]
select = ["ALL"]

[tool.mypy]
strict = true
bash
make check

A block ready for your agent's rules file (for example CLAUDE.md), to fill in with your own project:

markdown
## Rules for every change
- Run `make check` before you say a task is done. It must pass with zero warnings.
- Follow the layers: api -> services/selectors -> models. Never import the other way.
- Every public function and class has a docstring. Comments explain why, not what.
- No magic numbers or strings in logic: values go in config.
- Tests for every change. Coverage stays at or above 90 percent.
- If the plan does not say it, do not decide it: stop and ask.

The last line matters most. An agent that is not allowed to decide on its own does not guess either.

2. A full plan, before a single line of code

Small feature or big, before building it I sit with AI for a few hours, sometimes a few days, and we write a precise plan of how the feature gets built, in full detail, inside the codebase we already have.

The plan answers these up front:

  • What the feature does, and what it does not do.
  • Which existing systems change, and how each one changes.
  • Where the new system sits in the project and how it works with the rest.
  • Names, data, errors and tests.
  • What must not be touched.
markdown
# Plan: <feature>

## Goal
What it does, and what it does not do.

## Systems that change
- <system>: what changes, why, and how it stays compatible.

## The new part
Where it lives, its names, its data, how it talks to the rest.

## Decisions
Every choice made up front: names, formats, errors, limits.

## Out of scope
Files and systems that must not be touched.

## Tests
What proves it works, and what proves nothing else broke.

Everything is decided in advance. The same plan is then the source for the agent that writes the code and for the agent that reviews it.

3. AI does not touch the code until you are sure

Until I am completely sure of the plan, I do not let AI touch a single line of code. Sure means I can explain the feature to someone from start to finish without looking at the plan, and say why every file changes.

Any part of the plan I cannot explain is exactly where AI is going to guess.

4. Think first, then plan, then build

The Superpowers skill teaches an agent this same order: first think and ask, then plan, then build. If you work with Claude Code, it is a good place to start bringing that order into your everyday work.

5. One agent writes, another one reviews

At the end, one agent builds your plan and another agent reviews it. A separate agent means the one reviewing the code is not the one who wrote it, and has no reason to defend its own work.

The reviewer has its own rules too, separate for each stack: for Python, things like Ruff and mypy, full test coverage, separated layers and docstrings. Both work from the same plan, so the reviewer knows what the code was supposed to do, not only whether it is clean.

The same feature today

I want that same simple feature today. Instead of spending a whole week debugging the system, I spend one day writing a proper plan so problems like these never come up. AI changes the same files, but this time every one of them was in the plan, and I know why each one changed.

AI is a hundred times better at writing code than we are. Our job is to know exactly what gets built.

Check your own setup

  • Are your project's rules written where the agent reads them at the start of every session?
  • If the agent breaks a rule, does a tool stop it, or only you?
  • Does your plan say which systems change and which must not be touched?
  • Can you explain the feature start to finish without looking at the plan?
  • Is the one who reviews the code the same one who wrote it?

Every "no" or "I'm not sure" is a place where your AI is going to guess.

Next episode: the same agent that reviews the PRs instead of me.

You asked your AI to build a simple feature. Seconds later it has touched 25 files. Half of them you do not understand why it changed at all, and for the other half you know why but not what it did. Now you get to spend an hour talking to it, finding out what it did, what it did not do, and why.
This is how I work with AI so that does not happen, in the order a feature goes through it. It is the second episode of the Production Ready series.
## Why AI does this
Whatever you do not tell your AI, it guesses. The names, where files go, which system should change and which should not, the pattern the code should follow. Every guess is a file you did not expect. So the problem is not the model, it is what you did not tell it.
That is why, before AI writes a single line, I do two things: I set the project up with hard rules for it, and we write a full plan, so nothing is left to guess.
## 1. Hard rules inside the project
A rule that lives only in my head, AI does not know about. A rule that lives only in a file, AI can forget. So every rule lives in two places: a file the agent reads at the start of every session, and a tool that fails the build when the rule is broken.
The real rules of this site (the Python backend):
- Linting with every Ruff rule on, and formatting with Ruff.
- Types with mypy in strict mode.
- The import direction between layers checked by import-linter (api, services, selectors, models).
- Every public function and class has a Google style docstring, and comments explain why, not what.
- No numbers or strings hard coded in logic: they all live in validated config.
- Tests with at least 90 percent coverage.
- And before every push, one command checks all of it together.
```toml
[tool.ruff.lint]
select = ["ALL"]
[tool.mypy]
strict = true
```
```bash
make check
```
A block ready for your agent's rules file (for example `CLAUDE.md`), to fill in with your own project:
```markdown
## Rules for every change
- Run `make check` before you say a task is done. It must pass with zero warnings.
- Follow the layers: api -> services/selectors -> models. Never import the other way.
- Every public function and class has a docstring. Comments explain why, not what.
- No magic numbers or strings in logic: values go in config.
- Tests for every change. Coverage stays at or above 90 percent.
- If the plan does not say it, do not decide it: stop and ask.
```
The last line matters most. An agent that is not allowed to decide on its own does not guess either.
## 2. A full plan, before a single line of code
Small feature or big, before building it I sit with AI for a few hours, sometimes a few days, and we write a precise plan of how the feature gets built, in full detail, inside the codebase we already have.
The plan answers these up front:
- What the feature does, and what it does not do.
- Which existing systems change, and how each one changes.
- Where the new system sits in the project and how it works with the rest.
- Names, data, errors and tests.
- What must not be touched.
```markdown
# Plan: <feature>
## Goal
What it does, and what it does not do.
## Systems that change
- <system>: what changes, why, and how it stays compatible.
## The new part
Where it lives, its names, its data, how it talks to the rest.
## Decisions
Every choice made up front: names, formats, errors, limits.
## Out of scope
Files and systems that must not be touched.
## Tests
What proves it works, and what proves nothing else broke.
```
Everything is decided in advance. The same plan is then the source for the agent that writes the code and for the agent that reviews it.
## 3. AI does not touch the code until you are sure
Until I am completely sure of the plan, I do not let AI touch a single line of code. Sure means I can explain the feature to someone from start to finish without looking at the plan, and say why every file changes.
Any part of the plan I cannot explain is exactly where AI is going to guess.
## 4. Think first, then plan, then build
The [Superpowers](https://github.com/obra/superpowers) skill teaches an agent this same order: first think and ask, then plan, then build. If you work with Claude Code, it is a good place to start bringing that order into your everyday work.
## 5. One agent writes, another one reviews
At the end, one agent builds your plan and another agent reviews it. A separate agent means the one reviewing the code is not the one who wrote it, and has no reason to defend its own work.
The reviewer has its own rules too, separate for each stack: for Python, things like Ruff and mypy, full test coverage, separated layers and docstrings. Both work from the same plan, so the reviewer knows what the code was supposed to do, not only whether it is clean.
## The same feature today
I want that same simple feature today. Instead of spending a whole week debugging the system, I spend one day writing a proper plan so problems like these never come up. AI changes the same files, but this time every one of them was in the plan, and I know why each one changed.
AI is a hundred times better at writing code than we are. Our job is to know exactly what gets built.
## Check your own setup
- Are your project's rules written where the agent reads them at the start of every session?
- If the agent breaks a rule, does a tool stop it, or only you?
- Does your plan say which systems change and which must not be touched?
- Can you explain the feature start to finish without looking at the plan?
- Is the one who reviews the code the same one who wrote it?
Every "no" or "I'm not sure" is a place where your AI is going to guess.
Next episode: the same agent that reviews the PRs instead of me.
Markdown UTF-8 en 1092 words 120 lines 6 min read
esc
↑↓Move ↵Open