Skip to main content

Claude Code Prompts

Copy-paste prompts that leverage Claude Code's unique capabilities: file references, extended thinking, pipes, and slash commands.

Codebase Exploration

Project Overview

give me an overview of this codebase. focus on:
- directory structure and key entry points
- tech stack and major dependencies
- architecture patterns used

Understand a Flow

ultrathink: trace the complete request flow for user login.
Start from @src/pages/Login.tsx, follow through API calls,
middleware, and database queries. Draw the dependency chain.

Find Patterns

find all API endpoints in this codebase. for each one list:
- HTTP method and path
- auth requirements
- request/response types

Code Review

Review a Diff

git diff main | claude -p "review this diff for bugs,
security issues, and missing edge cases.
be specific about line numbers."

Security Audit

audit @src/api/ for security issues:
- SQL injection / NoSQL injection
- XSS vectors in response data
- missing auth checks on endpoints
- secrets or keys in source code
- unsafe deserialization

Pre-PR Self-Review

review my staged changes (git diff --cached) for:
- potential bugs and race conditions
- missing error handling
- breaking API changes
- test coverage gaps
then suggest a PR title and description.

Writing Code

Test-Driven Development

write failing tests first for this feature:
[describe feature]

Put tests in @src/__tests__/. Use the existing test patterns
in that directory. Then implement the feature to make
all tests pass. Do not modify the tests after writing them.

Refactor with Safety Net

refactor @src/utils/legacy-parser.ts:
- reduce cyclomatic complexity
- extract pure functions
- add TypeScript types where missing

run the existing tests after each change to ensure
nothing breaks. commit after each successful refactor.

Create a PR

create a pr for the current changes.
include a summary of what changed and why.
link any related issues.

Debugging

Trace a Bug

ultrathink: I'm getting this error in production:
[paste error/stack trace]

Trace from @src/server.ts through the call chain.
Identify the root cause and suggest a fix with a test.

Analyze Logs

tail -100 /var/log/app.log | claude -p "summarize errors,
group by type, and suggest fixes for the most frequent ones"

Find Similar Bugs

we just fixed a null check bug in @src/checkout.ts.
scan the entire codebase for similar patterns where
we access properties without null/undefined guards.

Automation & Ops

Database Migration

look at @prisma/schema.prisma and create a migration
that adds a "preferences" JSONB column to the User table.
generate the migration file and update the TypeScript types.

Fix CI

the CI pipeline is failing. look at @.github/workflows/
and the latest error output below:
[paste CI error]

diagnose and fix the issue.

What makes a great prompt?

These prompts work because they follow key patterns: providing context with @ file references, triggering deep reasoning with ultrathink, and constraining output format. These are fundamental prompt engineering principles.

Learn Prompts & Structured Output fundamentals

Next Steps

  • Workflows — Complete development workflows using these prompts
  • Debugging Tips — Systematic debugging approach
  • Hooks — Automate prompt patterns with hooks