A repeatable loop for getting AI to write production code the way I would write it, and the commands that came out of it.
Repeat5-6xuntil it holds
How the loop works
- 1
Build the first feature by hand
No AI on this one. It sets the patterns, the naming, and the structure that everything after it gets measured against. If the foundation is generated, there is nothing to hold the rest of the codebase to.
- 2
Generate custom rules from it
That first feature becomes the source of truth. The rules capture how I structure components, how I name things, how I handle state, and where the edge cases live. They are my patterns, not generic best practices someone else published.
- 3
Build the next feature with the rules
The AI writes it from those rules plus my direction. I read every line before it lands, the same way I would review a teammate's pull request.
- 4
Examine, test, and sharpen
This is the loop. Whatever the model got wrong becomes a new rule, so the next pass starts from a sharper baseline. It usually takes five or six features before the output stops needing correction.
- 5
Compose commands from multiple rules
Once a set of rules holds steady, I bundle them into a single command. That is where the commands below came from: repeated work, collapsed into one instruction I can run on the next project.
- 6
The part that stays manual
Manual testing, code review, and continuous context engineering. AI generates 85 to 90% of the code, but the remaining slice is the part that decides whether the feature actually ships.
A User Page, end to end
The same feature followed from the database to the screen, so you can see which command runs at each layer rather than take my word for it.
- 1
Backend
The users endpoint
The user schema becomes a typed API route.
/scaffold-endpoint - 2
Data
A typed client for it
The route becomes a typed client the page can call.
/wire-to-endpoint - 3
Page
The users list page
The users resource becomes a list page.
/scaffold-list-page - 4
UI
The user row and detail card
The Figma frames become pixel-perfect components.
/figma-to-component
Commands I run every day
/scaffold-endpointschema → typed API route/wire-to-endpointAPI route → typed client/scaffold-list-pageresource → list page/figma-to-componentFigma frame → pixel-perfect UI
- features until the rules converge
- 5-6features until the rules converge
- of the code AI-generated, in my patterns
- 85-90%of the code AI-generated, in my patterns
- manually tested and reviewed by me
- 100%manually tested and reviewed by me