What's the Best Workflow for Using AI Coding Assistants on Structured Projects?
After months of experimenting with AI coding assistants on established projects, I’ve learned the hard way that treating them as simple code generators is a recipe for frustration. Context drift, over-confident execution, and inconsistent output quality plagued my early attempts. Here’s what actually works.
The Core Problem
When you integrate an AI assistant into a project that already has conventions, architecture decisions, and coding standards, things get messy fast. The AI doesn’t know your team’s preferred patterns. It makes assumptions. It forgets what you told it three phases ago. And before you know it, you’re spending more time correcting its output than writing code yourself.
I remember one particularly painful session where I asked an AI to add authentication to an Express.js API. It generated code that worked—but used completely different error handling patterns, logging approaches, and testing conventions than the rest of our codebase. The pull request review was brutal.
What Actually Works: Spec-Driven Development
The breakthrough came when I started treating AI assistants as collaborative partners that need structured guidance, not magic code generators. Here’s the workflow that changed everything:
Phase 1: High-Level Description
Start with the “what” and “why,” not the “how.” Be explicit about your goals.
I need to add user authentication to our Express.js API.The system should support email/password login, OAuth providers(Google, GitHub), and session management. Security is critical.This seems obvious, but I used to skip this step and jump straight into implementation details. Big mistake.
Phase 2: Request a Roadmap
Ask the AI to break down the work into logical phases with clear dependencies.
Create a detailed roadmap with phases for implementing this feature.Each phase should have clear deliverables and dependencies.The output should look something like:
| Phase | Deliverable | Dependencies |
|---|---|---|
| 1 | Database schema and models | None |
| 2 | Core authentication logic | Phase 1 |
| 3 | OAuth integration | Phase 2 |
| 4 | Session management | Phase 2 |
| 5 | Testing and security audit | All phases |
Phase 3: Exhaustive Execution Plans
For each phase, request comprehensive planning before any code generation.
For Phase 2 (Core authentication logic), create an exhaustiveexecution plan. Discuss the what's and whys of each decision.Ask me what information you need before proceeding.The key here is the last sentence: “Ask me what information you need.” This is where most people (including me, initially) go wrong. They skip this checkpoint and end up with code that makes wrong assumptions.
Phase 4: Information Gathering Checkpoint
Before implementation, the AI should ask clarifying questions:
What input or information do you need from me to proceedwith Phase 2 without making assumptions about:- Password hashing algorithm preferences- Rate limiting requirements- Error handling conventions in this codebaseI learned to answer these questions thoroughly. They reveal gaps in the AI’s understanding that would otherwise result in inconsistent code.
Phase 5: Context Sharing
Provide the AI with your project’s conventions upfront:
Before starting, here's our project context:- We use TypeScript strict mode- All errors follow ApiError class pattern- Services are dependency-injected- Testing requires 80%+ coverageThis prevents the AI from making style decisions that conflict with your existing patterns.
Phase 6: Checkpoint Reviews
After every 2-3 phases, conduct a review:
Review the implementation against the original roadmap.Identify any deviations and assess if they were necessary.Suggest refinements for remaining phases.This catches small issues before they compound into major problems.
Codex vs Opus: When to Use Which
This was another lesson learned through trial and error. Different AI models excel at different tasks:
| Model | Best For | Why |
|---|---|---|
| Opus | Architecture exploration, complex debugging, initial project setup | Deeper reasoning, better at handling ambiguity |
| Codex | Following established patterns, incremental features, refactoring, test writing | Faster execution, more consistent with existing code style |
I wasted a lot of time using Opus for straightforward implementation work—expensive and unnecessary. Then I tried using Codex for architectural decisions and got shallow, generic recommendations. Matching the tool to the task matters.
Common Mistakes I’ve Made
Mistake 1: Skipping the Roadmap
I used to jump directly into implementation. The result? Fragmented, inconsistent code that needed constant revision. Now I always start with a high-level plan, even for small features.
Mistake 2: Not Providing Project Context
The AI made assumptions about conventions, leading to style mismatches. I now share coding standards, existing patterns, and architectural decisions upfront—before any code generation.
Mistake 3: Ignoring the AI’s Questions
When the AI asked “what information do you need?”, I’d skip it and say “just implement it.” Big mistake. Those questions reveal gaps in understanding. Answer them thoughtfully.
Mistake 4: No Checkpoint Reviews
I’d let the AI run through all phases without checking in. Small issues compounded into major problems by the end. Regular reviews prevent this.
When This Workflow Overkill
Not every task needs this level of structure. For simple fixes—single-file bug fixes, straightforward refactoring, isolated utility functions—a direct approach works fine. But for:
- Features affecting multiple files/modules
- Changes to core architecture
- Security-critical implementations
- Work spanning multiple sessions
The spec-driven approach saves far more time than it costs.
The Trade-offs
Benefits:
- Reduced rework through better planning
- Consistent alignment with project conventions
- Auditability through documented decisions
- Predictable quality
Costs:
- Upfront time investment
- Risk of over-documentation for simple features
- Context transfer overhead when switching between models
What I’ve Learned
The most effective workflow for AI coding assistants on structured projects is spec-driven, phase-by-phase execution with explicit information gathering checkpoints. Start with high-level goals, request detailed roadmaps, create exhaustive execution plans per phase, and always ask the AI what context it needs before implementation.
This approach maximizes the strengths of tools like Codex for structured execution while preventing context drift and ensuring alignment with project conventions. It’s not faster in the short term, but it produces better, more maintainable code—and that’s what actually matters.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments