04
Docs

Agentic Engineering Principles

Principles and prompt patterns for working effectively with AI agents

1. Define the Goal, Not the Steps

2. Provide Context, Not Instructions

3. Verify, Don't Trust

4. Iterate in Loops

5. Invest in Infrastructure

6. Use the "Best of N" Pattern

Generate multiple versions, cherry-pick the best:

You: "Generate 3 different approaches to this authentication flow.
     For each, explain the tradeoffs."

Then:

Why it works: AI generates diverse solutions. You bring judgment to select.

7. Branch First, Experiment Freely

Always create a git branch before major AI-assisted changes:

git checkout -b feature/ai-experiment

Prompt Patterns

Effective patterns for getting better results from Claude Code.

Pattern 1: The Specification Prompt

Front-load all context, then state the task:

Context:
- This is a React 18 app with TypeScript
- We use Tailwind for styling
- Components go in /src/components
- We follow the existing Button component pattern

Task: Create a Modal component that:
- Accepts title, children, and onClose props
- Has animated entrance/exit
- Closes on backdrop click and Escape key
- Is accessible (focus trap, aria labels)

Pattern 2: The Critique Prompt

Have Claude review its own work:

You: "Now review the code you just wrote. Check for:
     - Security vulnerabilities
     - Edge cases not handled
     - Performance issues
     - Accessibility problems

     Then fix any issues you find."

Pattern 3: The Three Experts

Get multiple perspectives on design decisions:

You: "Approach this problem as three experts would:
     1. A senior security engineer
     2. A performance optimization specialist
     3. A UX-focused developer

     What would each prioritize? Where do they disagree?"

Pattern 4: The Incremental Build

For complex features, build in stages:

Step 1: "Create the data model and types"
Step 2: "Add the API layer"
Step 3: "Build the UI components"
Step 4: "Connect everything and add error handling"
Step 5: "Write tests for the critical paths"

Pattern 5: The Constraint Prompt

Limit scope to get focused output:

You: "Implement ONLY the login form. Do not:
     - Add routing
     - Create the API client
     - Set up state management

     I'll handle those separately."