Claude Coding Prompt Pack
What This Pack Solves
Most developers use Claude like a search engine: "how do I do X?" These prompts turn Claude into a senior engineering partner. Each prompt is structured to give Claude the context it needs to produce production-quality code on the first try — not tutorial code, not example code, but code you'd actually merge.
The difference between a good prompt and a great prompt is context. These prompts front-load the decisions Claude needs: framework version, file structure, coding conventions, and constraints. The result is code that fits your project, not generic code you have to adapt.
When To Use
- You're building a TypeScript/React project and want Claude to generate code that matches your patterns
- You're debugging a complex issue and want structured analysis instead of guesswork
- You need architecture advice grounded in your specific constraints
- You want code review feedback that catches real issues, not style nitpicks
Prompts
Prompt 1: Architecture Decision
I need to make an architecture decision for my [project type] built with [tech stack].
**Context:**
- Current structure: [describe relevant file/folder structure]
- Scale: [user count, data volume, team size]
- Constraints: [budget, timeline, existing dependencies]
**Decision:**
[Describe the specific choice you're weighing, e.g., "Should I use Server Actions or API routes for mutations?"]
**Options I'm considering:**
1. [Option A] — [brief rationale]
2. [Option B] — [brief rationale]
Expected output: Structured trade-off analysis with a decisive recommendation, not a wishy-washy "it depends."
Prompt 2: Feature Implementation
Implement [feature name] in my [framework] project.
**Project context:**
- Framework: [Next.js 15+ App Router / etc]
- Key libraries: [list with versions]
- File structure: [paste relevant tree or describe]
- Coding patterns: [e.g., "Server Components by default, 'use client' only for interactivity"]
**Feature requirements:**
- [Requirement 1]
- [Requirement 2]
- [Requirement 3]
**Constraints:**
- Must work with [existing component/system]
- Must handle [edge case]
- Do NOT [anti-pattern to avoid]
Write production-ready code. Include TypeScript types. Handle errors. No placeholder comments like "// TODO" — complete the implementation. If you need information I haven't provided, ask before generating code.Expected output: Complete, merge-ready code for the feature with proper error handling and types.
Prompt 3: Debugging Assistant
I have a bug in my [framework] application. Help me find and fix it.
**Symptoms:**
- Expected: [what should happen]
- Actual: [what actually happens]
- Reproduction: [steps to reproduce]
**Error output (if any):**[paste error message, stack trace, or console output]
**Relevant code:**
```typescript
[paste the code you suspect is involved]
What I've tried:
- [attempt 1 and result]
- [attempt 2 and result]
Don't guess. Analyze the code and error systematically. If you need to see more code to diagnose, tell me which files. Explain the root cause before providing the fix.
**Expected output**: Root cause analysis followed by a targeted fix, not a shotgun of suggestions.
### Prompt 4: Code Review
```text
Review this code for production readiness. Focus on bugs, security issues, and performance problems — not style preferences.
**Context:**
- This code [describe what it does]
- It runs in [environment: server component, client component, API route, etc.]
- It handles [describe the data/user interaction]
```typescript
[paste code to review]
Rate severity of each issue: 🔴 must fix (bug/security), 🟡 should fix (performance/maintainability), 🟢 nice to have.
Don't comment on formatting, naming conventions, or missing JSDoc. Only flag issues that could cause bugs, security vulnerabilities, or measurable performance problems.
**Expected output**: Prioritized list of real issues, not a wall of style suggestions.
### Prompt 5: Refactoring Guide
```text
Refactor this code to [specific goal: improve readability / extract reusable logic / reduce complexity / improve performance].
**Current code:**
```typescript
[paste code]
Why it needs refactoring:
- [specific problem: "this function does 3 things", "this component is 400 lines", "this pattern is repeated in 5 files"]
Constraints:
- Don't change the public API / props / function signature
- Must pass existing tests
- [any other constraints]
Show the refactored code with a brief explanation of each change. If the refactoring requires changes in other files, list them.
**Expected output**: Clean refactored code with explanations of what changed and why.
### Prompt 6: Test Generation
```text
Write tests for this [function/component/API route]:
```typescript
[paste code to test]
Testing setup: [Jest/Vitest, React Testing Library, etc.]
Focus on:
- Happy path with typical inputs
- Edge cases: [list specific edge cases]
- Error handling: [what should fail gracefully]
Don't test:
- Implementation details (internal state, private methods)
- Styling or CSS classes
- Third-party library behavior
Write tests that would catch real regressions. Each test name should describe the behavior being verified, not the implementation.
**Expected output**: Focused tests that verify behavior, not implementation details.
### Prompt 7: Database Query Optimization
```text
Optimize this database query/pattern in my [Drizzle/Prisma] project:
**Current code:**
```typescript
[paste query code]
Problem:
- [slow response time / N+1 queries / high memory usage / etc.]
- Table sizes: [approximate row counts]
- Called: [how often — every page load, on user action, in background job]
Database: [PostgreSQL on Neon / etc.]
Show the optimized query with explanation. If indexes are needed, show the migration. If the schema should change, explain the trade-off.
**Expected output**: Optimized query with performance explanation and any required schema changes.
### Prompt 8: Type-Safe API Contract
```text
Design a type-safe API contract for [feature/resource]:
**Requirements:**
- Operations: [list CRUD operations needed]
- Auth: [public / authenticated / role-based]
- Validation: [list constraints on each field]
**Tech stack:**
- API: [Next.js Route Handlers / Server Actions]
- Validation: Zod
- Database: [Drizzle / Prisma] with [database]
Generate:
1. Zod schemas for request/response types
2. TypeScript types inferred from schemas
3. Route handler or Server Action implementation
4. Client-side fetch wrapper with proper typing
Everything must be end-to-end type-safe. A change in the Zod schema should propagate types to both server and client code.
Expected output: Complete type-safe API implementation from schema to client wrapper.
Tuning Notes
- Always include your tech stack and versions. Claude's code quality jumps dramatically when it knows the exact framework version.
- Paste real code, not descriptions of code. "My auth middleware" is ambiguous. The actual middleware file is not.
- Specify what you don't want. "No TODO comments", "No console.log", "No any types" — negative constraints prevent the most common AI code quality issues.
- Chain prompts for complex features. Use Prompt 1 for the architecture decision, then Prompt 2 for implementation, then Prompt 4 for review. Each prompt builds on the previous output.
Common Failure Modes
- Claude generates outdated patterns — Always specify your framework version. "Next.js 15 App Router" prevents Pages Router code.
- Generic code instead of project-specific code — Paste your existing code patterns as context. Claude matches your style when it can see examples.
- Over-engineering — Add "Keep it simple. No abstractions I won't use in the next 2 weeks." to any prompt.
- Missing error handling — Explicitly request error handling. Claude tends to write happy-path code unless you ask for error cases.
Context to Provide
Before using these prompts, have ready:
- Your
package.jsondependencies (or key library versions) - Your file structure (at least the relevant directory tree)
- Any existing patterns you want Claude to follow (paste an example file)
- The specific framework version you're targeting