Coding
The infinite intern that never sleeps, but often hallucinates. Your job is to be the Architect; the AI is the Builder.
Code is the direct translation of will into structure.
The Engineering Loop
| Step | Human (Architect) | AI (Builder) |
|---|---|---|
| 1. Spec | Define the what and why (Constraints) | - |
| 2. Draft | - | Generate implementation |
| 3. Review | Audit against standards | - |
| 4. Refine | "Fix the edge case" | Iterate |
| 5. Ship | Verify and merge | - |
Techniques
1. Context Injection
Code doesn't exist in a vacuum. The model needs to "see" the repository.
- The Dump: Paste relevant file contents before your request.
- The Graph: Explain how File A imports File B.
- The Stack: Explicitly state: "Next.js 14, App Router, Tailwind, TypeScript".
2. Role Prompting
Define the expertise level to avoid generic solutions.
"Act as a Senior Systems Engineer. Review this code for security vulnerabilities and performance bottlenecks, ignoring style nitpicks."
3. The Debug Protocol
Don't just paste the error.
- Paste the error.
- Paste the suspect code.
- Prompt: "Explain why this error is happening, then propose 3 potential fixes ranked by probability."
4. Refactoring with Intent
Never just say "clean this up".
"Refactor this function to improve readability and separate concerns. Extract the data transformation logic into a utility function. Maintain all current type safety."
Common Pitfalls
- The Silent Breaking Change: AI changes an API signature without updating the caller.
- The Library Hallucination: Importing a perfect utility function that doesn't exist.
- The Loop: Getting stuck in a cycle of error -> fix -> new error -> revert to original error. Break the loop by stepping back and asking: "Are we solving the right problem?"
The Prompt
A complete system design and code review prompt. Shows context injection (stack declaration), role prompting (senior engineer), and structured output (ranked fixes).
Act as a Senior Systems Engineer specializing in TypeScript, React 19,
and Node.js. You have 15 years of experience building production systems
that serve millions of users.
STACK CONTEXT:
- Frontend: Next.js 15 (App Router), React 19, TailwindCSS v4
- Backend: Node.js, Supabase (Postgres + Auth + Realtime)
- State: React Query for server state, Zustand for client
- Testing: Vitest + React Testing Library
- Deploy: Vercel
CODEBASE CONTEXT:
[Paste the relevant files, imports, and type definitions here]
THE PROBLEM:
[Describe the bug, feature, or architectural question]
YOUR TASK:
1. DIAGNOSIS
- What is the root cause? Not the symptom — the cause.
- Which file(s) own the problem?
- Is this a logic error, a data flow error, or an architecture error?
2. PROPOSED FIXES (ranked by probability)
- Fix A: [Most likely] — explain why, show the diff
- Fix B: [Alternative] — when would this be better?
- Fix C: [If the problem is deeper] — what refactor is needed?
3. SIDE EFFECTS
- What else breaks if we apply Fix A?
- Which callers, tests, or types need updating?
- Any API signature changes?
4. PREVENTION
- What test would have caught this?
- Write the test. Make it fail first, then pass with the fix.
CONSTRAINTS:
- Show complete code, not pseudocode
- Preserve all existing type safety
- No new dependencies unless absolutely necessary
- Explain the WHY, not just the WHAT
Paste into Claude Code, Cursor, or GitHub Copilot with your codebase context.
Tools
| Tool | Strength | Link |
|---|---|---|
| Claude Code | Autonomous coding agent, full repo context | claude.ai |
| Cursor | Native context injection, inline editing | cursor.sh |
| GitHub Copilot | Autocomplete flow, IDE integration | github.com/features/copilot |
| Windsurf | Full codebase understanding | codeium.com |
| v0 | UI component generation from prompts | v0.dev |
Context
- AI Coding — Full workflow integration
- Claude — Current best for coding reasoning
- Standards — What code should conform to
- Prompts — First principles across all modalities
Code is a liability. Only functionality is an asset.
Questions
When the AI writes the code, what's left that makes you the architect?
- At what point does context injection become a crutch that hides poor system design?
- If the debug protocol works better than your intuition, should you always use it — or does that atrophy the skill?
- What's the cost of "The Library Hallucination" vs the cost of not trusting the suggestion?