## Tip: Provide File Examples for Pattern Matching

**Category**: prompting

**Problem**: Claude generates code that doesn't match your existing codebase style or patterns.

**Solution**: Reference specific files as examples when requesting new code.

**Example**:

❌ **Vague Request**:
```
"Create a new API endpoint for users"
```
Result: Code that might not match your patterns

✅ **With Example Reference**:
```
"Create a new API endpoint for users. Follow the same pattern as 
src/api/posts.ts - use the same error handling, validation structure, 
and response format."
```
Result: Code that matches your existing patterns

**Even Better**:
```
"Create a new API endpoint for users. It should:
- Follow the pattern in src/api/posts.ts
- Use the same validation approach as src/api/comments.ts
- Include tests like tests/api/posts.test.ts

Open those files for reference."
```

**Why It Works**:
- Claude can see and match your patterns
- Ensures consistency across codebase
- Reduces need for refactoring
- Faster to review and integrate

**Pro Tip**: Keep a list of "reference files" for common patterns:
- Authentication: `src/auth/login.ts`
- API endpoints: `src/api/posts.ts`
- Components: `src/components/UserCard.tsx`
- Tests: `tests/unit/utils.test.ts`

**Tags**: #prompting #claude-code #consistency #best-practices
