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?"
Tooling
- Cursor - Native context injection.
- GitHub Copilot - Autocomplete flow.
- Claude 3.5 Sonnet - The current king of coding reasoning.
Code is a liability. Only functionality is an asset.