Workflow
Development Loop

The Development Loop

This is the execution loop β€” steps 5-7 of the full 7-Step Process. Use this once you've built context (steps 1-4).

This loop assumes you've already: loaded user rules, indexed the codebase, read specific files, and researched documentation. If you haven't, start with The 7-Step Process.

The Execution Loop

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  5. WRITE β€” Code + tests together               β”‚
β”‚                    ↓                            β”‚
β”‚  6. TEST β€” Run tests, compile, lint             β”‚
β”‚                    ↓                            β”‚
β”‚  7. FIX β€” Read logs, fix issues                 β”‚
β”‚                    ↓                            β”‚
β”‚     β†Ί Loop until passing                        β”‚
β”‚                    ↓                            β”‚
β”‚  βœ… COMMIT when working                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Step 5: Write Code + Tests

Write implementation AND tests together. Never write code without a test.

⚠️

Bad: "Add authentication"

Good: "Add email/password auth using NextAuth.js. Use the existing User model. Write the implementation AND test file together. Follow the pattern in /app/api for route handlers."

Step 6: Test

Run everything. Catch errors before they become commits.

npm run test   # Run tests
npm run build  # Compile
npm run lint   # Check style

Step 7: Fix (The Oneshot Way)

When tests fail, use the Oneshot Paradigm:

❌ DON'T: "Fix this error" β†’ "Still broken" β†’ "Try this" β†’ Chaos

βœ… DO: Go back to original prompt + error log + "Avoid X"

Example:

"Implement the login flow.

Previous attempt failed with:
- Error: Cannot read property 'user' of undefined
- The session object structure is { data: { user } } not { user }

Requirements:
- Handle the actual session structure
- Add null checks
- Return graceful error on missing session"

Commit

Only commit when tests pass:

git add .
git commit -m "Add user authentication"

Loop Speed Over Time

ExperienceLoop Speed
Week 1Slow, lots of refinement
Month 1Finding patterns
Month 32-3x productivity
Month 6AI becomes invisible

When to Break the Loop

  • AI keeps failing β†’ Use Tornado Building: Research + Logs + Tests
  • Context polluted β†’ Start a new chat with fresh context
  • Tiny change β†’ Just type it yourself
  • Fundamental misunderstanding β†’ Check your Horizon: what context did you miss?

For the full process including context-building, see The 7-Step Process β†’