Claude Code Prompts

Copy-paste prompts that leverage Claude Code's unique capabilities.

Codebase Exploration

Project Overview

text
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

text
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

text
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

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

Security Audit

text
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

text
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.

Second Opinion

text
/advisor opus
review the current plan and identify the strongest objection.
Only call out issues that would change the implementation.

Writing Code

Test-Driven Development

text
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

text
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

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

Debugging

Trace a Bug

text
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

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

Find Similar Bugs

text
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

text
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

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

diagnose and fix the issue.

Large Fan-Out Task

text
ultracode: inspect every API route for missing auth checks.
Use separate workflows for discovery, verification, and patching.
Before editing, report the risk categories you found.

Keep Working Until Done

text
/goal migrate the test suite to vitest until npm test passes
and no imports reference the old jest setup.

What makes a great prompt?

These prompts work because they follow key patterns: providing context with @ file references, being specific about what you need, and constraining output format. These are fundamental prompt engineering principles.

Learn Prompts & Structured Output fundamentals

Related Reading

  • Workflows — Complete development workflows using these prompts
  • Dynamic Workflows — Scale prompts into workflow scripts
  • Automation — Keep a prompt running until a condition holds
  • Advisor — Add second-opinion review to prompts
  • Debugging Tips — Systematic debugging approach
  • Hooks — Automate prompt patterns with hooks

Continue with practice

You have finished the core ideas of Claude Code Prompts.

If you want to turn the idea into something reusable, continue practicing on AgentWay.