The Technique — Plan First, Prompt Second
A developer built Sitewatch, a production SaaS with paying users, using Claude Code to write 60-70% of the codebase. The biggest lesson wasn't about prompting—it was about planning. Early on, they'd prompt Claude Code to "Build the check scheduling system" or "Add retry logic." It would deliver working code every time. The result three weeks later? A codebase full of individually functional features that didn't fit together: inconsistent data models, different error handling patterns, and messy state flow.
The solution was a complete workflow reversal: plan first, prompt second. Now, before writing any code, they think through data models, module boundaries, API surfaces, and error conventions. They write this down as a spec. Then, they hand Claude Code pieces of that spec, one at a time. This architectural forethought is what makes an AI-assisted codebase feel coherent, not stitched together.
Why It Works — Context and Conventions
This approach works because of how Claude Code operates. It excels at executing within a given context and replicating patterns it observes. If your first few files establish consistent patterns for API handlers, error formatting, and state management, Claude Code will reliably follow them. However, if those initial files are inconsistent, the AI's output will be too.
The developer's experience highlights a key principle: Claude Code handles the how, you provide the what and why. For Sitewatch, the domain expertise—understanding nuanced HTTP behaviors, CDN edge cases, and detection logic for broken 200 OK responses—had to come from the developer. Claude Code could write all the surrounding plumbing, but the core product value required human insight.
How To Apply It — A Step-by-Step Workflow
- Architect Before You Code: Don't open the terminal immediately. Use a
CLAUDE.mdfile or a separate document to outline:- Core data models and their relationships.
- Module responsibilities and boundaries.
- API endpoint designs and error response formats.
- Key business logic flows.

Bootstrap Patterns Manually: Intentionally write the first 2-3 core files yourself (e.g., a main API handler, a core data model). Establish your patterns for logging, error handling, and imports. This gives Claude Code a consistent template to learn from.
Delegate with Clear Specs: Feed Claude Code tasks derived from your plan. Instead of "add user authentication," try:
claude code "Implement the `POST /api/auth/login` endpoint per our spec. It should: - Validate email/password against the User model. - Use our standard error response format (see `lib/errors.js`). - Return a JWT matching the payload structure in `docs/auth.md`."Embrace the 80/20 Review: Accept that Claude Code will get the first 80% of a feature done in minutes. Your job is the last 20%: reviewing edge cases, failure modes, and integration nuances. Scale your review intensity with the stakes—boilerplate gets a scan, core business logic gets a line-by-line review.
Leverage AI for Quality: Use Claude Code's underrated strength: test generation. Prompt it with
claude code "Write comprehensive unit and integration tests forservices/checker.js, covering all edge cases and error paths."It will often find race conditions and boundary values you missed.
This workflow transforms Claude Code from a code generator into a precision implementation engine, allowing you to ship production-grade software faster while maintaining architectural integrity.





