Claude Prompt Library

Claude Code Prompts for Agentic Coding

21 copy-paste prompts

21 prompts for Anthropic's Claude Code CLI. Plan before you build, set up CLAUDE.md memory, implement features, fix tests, and handle git and PRs, all from the terminal.

In short: This page contains 21 copy-paste ready prompts, organized into 5 categories with a description and pro tip for each. The first 5 prompts are free instantly, no signup needed. Hand-curated and tested by the AI Academy team.

Louis Corneloup
By Louis Corneloup ยท Founder, Techpresso
Last updated ยทHand-curated & tested by the AI Academy team

Planning & Exploration

4 prompts

Explore Before Coding

1/21

โœจ What it does

Claude explores how [feature/area] works today: the files, the data flow, and the entry points, and writes a summary you can check before any code changes. Confirm or correct that picture, then let it touch the repo only after you agree.

Don't write any code yet. Explore this codebase and explain how [feature/area] currently works: which files are involved, how data flows, and the key entry points. Read the relevant files first, then summarize your understanding so I can confirm it before we make changes.

๐Ÿ’ก

Pro tip: Leading with 'don't write code yet' is the single highest-leverage habit, it forces exploration and prevents premature, misguided edits.

Make a Plan First

2/21

โœจ What it does

Claude writes a step-by-step plan for adding [feature], including files, order, edge cases, and tests, and waits before coding. Redirect any wrong step, then approve the plan when you are ready.

I want to add [feature]. Don't implement it yet. Make a step-by-step plan: the files you'll create or change, the order of changes, edge cases to handle, and where tests are needed. Show me the plan and wait for my approval before writing any code.

๐Ÿ’ก

Pro tip: Reviewing a plan is far cheaper than reviewing a diff, fix the approach here and the implementation usually goes right the first time.

Think Through a Hard Problem

3/21

โœจ What it does

Claude lays out two or three approaches to [tricky task] with trade-offs, risks, and a recommendation, and does not write code yet. Pick the path you want, then ask for the implementation only after you decide.

Before proposing a solution, think hard about how to [tricky task, e.g. migrate this data without downtime]. Lay out two or three approaches with their trade-offs, the risks of each, and your recommendation. Don't write code, I want to decide on the approach with you first.

๐Ÿ’ก

Pro tip: Prompting it to weigh multiple approaches surfaces risks you would otherwise only discover halfway through the implementation.

Set Up CLAUDE.md Memory

4/21

โœจ What it does

Claude creates or updates a CLAUDE.md with commands, architecture, conventions, and gotchas, grounded in the real repo. Skim it for anything a new teammate would miss, then save the file so your later sessions start with that context.

Create or update a CLAUDE.md for this project. Include the key commands (build, test, lint, run), the architecture and where things live, our coding conventions, and any gotchas or rules a new contributor must know. Read the codebase to ground it in reality, and keep it concise and scannable.

๐Ÿ’ก

Pro tip: Keep CLAUDE.md tight and factual, every line is loaded as context each session, so bloat dilutes the signal that actually changes behavior.

XML tags are just the start. Learn the full Claude workflow.

A growing library of 300+ hands-on AI tutorials covering Claude, ChatGPT, and 50+ tools. New tutorials added every week.

Start 7-Day Free Trial

Implementing Features

4 prompts

Implement an Approved Plan

5/21

โœจ What it does

Claude implements the approved plan for [feature] in logical steps, matching CLAUDE.md and existing patterns, and reports after each major step. Watch those updates, and stop it if a step drifts or it wants a new dependency you did not approve.

Implement the plan we agreed on for [feature]. Follow the conventions in CLAUDE.md, match the patterns in the existing files you read, and make the changes in logical steps. After each major step, briefly tell me what you did. Don't add new dependencies without asking.

๐Ÿ’ก

Pro tip: Referencing the earlier plan keeps the implementation anchored, Claude Code won't drift into scope you didn't approve.

Build From an Existing Pattern

6/21

โœจ What it does

Claude adds [new thing] by copying the structure, validation, and error handling in [existing file], and flags where the new case must differ. Read those differences, then keep only the ones you truly need.

Add [new thing, e.g. a new API route] by following the pattern in [existing file]. Read that file first, then replicate its structure, validation, and error handling for the new case. Point out anywhere the new case genuinely needs to differ from the template.

๐Ÿ’ก

Pro tip: Naming a concrete file to mimic beats describing the pattern, Claude Code copies an actual example more faithfully.

Implement Incrementally

7/21

โœจ What it does

Claude builds [feature] from [smallest working piece] upward, pausing after each increment so you can verify. Run the check it names, then tell it to continue only when that piece works.

Build [feature] in small, verifiable increments. Start with [smallest working piece], confirm it works, then add the next piece. After each increment, run the relevant tests or tell me how to verify it manually. Pause between increments so I can review.

๐Ÿ’ก

Pro tip: Pausing between increments turns a risky large change into a series of small, easy-to-trust ones.

Use a Subagent for a Sub-Task

8/21

โœจ What it does

Claude keeps working on [main task] while a subagent independently handles [parallel sub-task] and brings back a findings list. Stay on the main thread, then use the list when your subagent reports.

While we work on [main task], dispatch a subagent to independently [parallel sub-task, e.g. audit the codebase for all places that call the old API]. Have it report back a findings list. Keep our main thread focused on [main task] in the meantime.

๐Ÿ’ก

Pro tip: Subagents shine for broad searches and audits, offloading them keeps your main context clean and on-task.

Tests & Debugging

4 prompts

Write and Run Tests

9/21

โœจ What it does

Claude writes tests for [feature/file] in your existing framework, runs them, and iterates until they pass, then says what is covered and what was skipped. Read the gaps, then add a case if something important is missing.

Write tests for [feature/file] using our existing test framework and conventions. Cover the happy path, edge cases, and error handling. Run the tests yourself, fix any failures, and keep iterating until they pass. Then summarize what's covered and what you left out on purpose.

๐Ÿ’ก

Pro tip: Let Claude Code run the test suite itself, the run-fail-fix loop in the terminal is where the agentic workflow pays off most.

Fix a Failing Test Suite

10/21

โœจ What it does

Claude runs the suite, says whether each failure is a bad test or bad code, and fixes the real issue without weakening assertions. Review those calls, then re-run locally if you want a second check.

Run the test suite. For each failing test, investigate the actual cause before changing anything and tell me whether the test or the code is wrong. Fix the genuine issues, don't just make tests pass by weakening assertions, and re-run until everything is green.

๐Ÿ’ก

Pro tip: Explicitly forbidding weakened assertions stops the agent from 'fixing' tests by deleting the checks that mattered.

Debug From an Error

11/21

โœจ What it does

Claude traces [paste error/stack trace] from [steps to reproduce] to the root cause, applies the smallest fix, and adds a regression test. Confirm the explanation matches what you saw, then keep the test so the bug cannot sneak back.

I'm hitting this error: [paste error/stack trace]. It happens when [steps to reproduce]. Trace it to the root cause by reading the relevant files, explain what's actually going wrong, then apply the smallest fix. Add a regression test so it can't silently come back.

๐Ÿ’ก

Pro tip: Asking for a regression test alongside the fix turns a one-off bug into a permanently guarded one.

Reproduce Before Fixing

12/21

โœจ What it does

Claude first writes a failing test or tiny script that reproduces [reported bug] for the right reason, and only then implements the fix. Watch the reproduction fail, then let it prove the test passes after your change.

Before fixing [reported bug], first write a failing test or a minimal script that reproduces it, and show me it actually fails for the right reason. Only once we've confirmed the reproduction should you implement the fix and prove the test now passes.

๐Ÿ’ก

Pro tip: A confirmed reproduction prevents the classic trap of 'fixing' a bug that was never actually the cause of the symptom.

These prompts give you the what. Tutorials give you the why.

Learn when to use extended thinking, how to build Claude Projects, and workflows that compound. 300+ tutorials and growing.

Try AI Academy Free

Refactoring & Codebase

5 prompts

Refactor Safely

13/21

โœจ What it does

Claude adds tests for [file/module] if needed, then refactors in small steps without changing behavior, running tests after each change. Follow the explanations, and halt if something it flags as risky looks wrong to you.

Refactor [file/module] to improve clarity and reduce duplication without changing its behavior. First make sure there are tests covering it (write them if not), then refactor in small steps, running tests after each. Explain each change and flag anything that feels risky.

๐Ÿ’ก

Pro tip: Establishing test coverage before refactoring is non-negotiable, it's what lets you trust that nothing broke.

Answer Questions About the Code

14/21

โœจ What it does

Claude answers where [behavior] lives, the path from [entry point] to [outcome], and which files you would touch to change [something], with file and function citations. Open those spots yourself, then plan the edit from the map.

Without changing anything, answer: where is [behavior, e.g. user authentication] implemented, what's the full path from [entry point] to [outcome], and which files would I touch to change [something]? Read the code to answer accurately and cite the specific files and functions.

๐Ÿ’ก

Pro tip: Asking it to cite specific files and functions keeps the answer verifiable instead of a plausible-sounding guess.

Find and Remove Dead Code

15/21

โœจ What it does

Claude lists unused exports, uncalled functions, and dead branches with locations and why they look unused, and deletes nothing yet. Review the list, then tell it exactly what you want removed.

Search the codebase for unused code: exports nobody imports, functions never called, and dead branches. List what you find with its location and why you believe it's unused. Don't delete anything yet, I'll review the list and tell you what to remove.

๐Ÿ’ก

Pro tip: Always review the dead-code list yourself, 'unused' can hide dynamic references or public API the tool can't see.

Create a Custom Slash Command

16/21

โœจ What it does

Claude turns [describe it] into a reusable slash command in .claude/commands and tells you how to invoke it. Try the command once, then share it with the team if the arguments look right.

Create a custom slash command for our repeated workflow: [describe it, e.g. run lint, type-check, and tests, then summarize failures]. Put it in .claude/commands as a reusable prompt with any needed arguments, and tell me how to invoke it.

๐Ÿ’ก

Pro tip: Project slash commands live in .claude/commands and are shared via git, encode your common chores once and everyone benefits.

Onboard to an Unfamiliar Repo

17/21

โœจ What it does

Claude orients you on a newly cloned repo: what it does, main directories, how to run it locally, where core logic lives, and the first two or three files to read. Start with those files, then run it locally using the steps it gave you.

I just cloned this repo and don't know it yet. Give me an orientation: what the project does, the main directories and their purpose, how to run it locally, where the core logic lives, and the two or three files I should read first to understand it. Read the code to answer, don't guess.

๐Ÿ’ก

Pro tip: Run this first in any new repo, then have it write the findings into CLAUDE.md so future sessions skip the rediscovery.

Git & Workflow

4 prompts

Commit With a Clear Message

18/21

โœจ What it does

Claude reviews the staged diff, proposes a conventional commit message, splits unrelated changes if needed, and will not push. Approve the message, then let it commit only when the grouping looks right to you.

Review the staged changes, then create a git commit with a clear, conventional message that explains what changed and why. Group unrelated changes into separate commits if needed. Show me the message before committing and don't push.

๐Ÿ’ก

Pro tip: Have it review the diff before writing the message, the result describes what actually changed rather than what you intended.

Open a Pull Request

19/21

โœจ What it does

Claude pushes the branch and opens a pull request whose description is grounded in the actual diff: change, why, tests, and risks. Open the PR URL, then edit any reviewer note that does not match what you meant.

Push the current branch and open a pull request. Write a PR description that summarizes the change, why it's needed, how it was tested, and any reviewer notes or risks. Base it on the actual diff, not assumptions, and share the PR URL when done.

๐Ÿ’ก

Pro tip: Pointing it at the real diff for the PR body produces an accurate summary instead of a generic template.

Review a Diff Before Merging

20/21

โœจ What it does

Claude reviews the branch diff like a careful reviewer, listing bugs, missing edges, security issues, and CLAUDE.md mismatches by severity, without fixing them. Decide what you will fix now, then send those items back as follow-ups.

Review the diff on this branch as a careful reviewer would. Flag bugs, missing edge cases, security concerns, and anything inconsistent with our conventions in CLAUDE.md. List issues by severity and don't fix them yet, just report so I can decide.

๐Ÿ’ก

Pro tip: A pre-review pass against CLAUDE.md catches convention slips and obvious bugs before they waste a teammate's review time.

Resolve a Merge Conflict

21/21

โœจ What it does

Claude walks each conflict after [merging/rebasing] [branch], explains both sides, preserves both intents, then runs tests. Check the resolutions, and rerun the suite if anything still looks one-sided to you.

I have merge conflicts after [merging/rebasing] [branch]. Walk through each conflicted file, explain what each side changed and why, and resolve it preserving the intent of both changes. Don't just pick one side blindly. After resolving, run the tests and confirm nothing broke.

๐Ÿ’ก

Pro tip: Asking it to explain each side before resolving stops the common mistake of silently dropping a teammate's change.

Free tool

Prompt Optimizer

Turn a rough idea into a structured, professional AI prompt.

Try it free โ†’

Frequently Asked Questions

Claude Code is Anthropic's agentic command-line coding tool. It runs in your terminal, reads and edits files, runs commands and tests, and works with git, all driven by natural-language prompts. It's designed for real software workflows: exploring a codebase, planning, implementing, testing, and shipping.
CLAUDE.md is a project memory file Claude Code reads automatically at the start of a session. It holds your key commands, architecture notes, conventions, and gotchas, so the agent starts every task with the right context. Keeping it concise and accurate is one of the biggest levers for good results.
Asking Claude Code to explore and produce a plan before writing code lets you catch wrong assumptions and redirect the approach while it's cheap. Reviewing a short plan is far faster than reviewing a large diff, and it dramatically reduces wasted, off-target implementation work.
Subagents let Claude Code delegate a self-contained task (like a codebase-wide audit) to a separate context so your main thread stays focused. Slash commands are reusable prompts stored in .claude/commands that encode repeated workflows, like a lint-test-summarize routine, and can be shared with your team via git.
Give it context and structure: maintain a tight CLAUDE.md, tell it to explore and plan before coding, work in small verifiable increments, and let it run tests and iterate. Be explicit about constraints (what not to touch, no weakened assertions) and keep control over commits and pushes.

Is Claude Code worth paying for?

Read our honest, no-hype breakdown with the real pricing.

Read review โ†’

Prompts are the starting line. Tutorials are the finish.

A growing library of 300+ hands-on tutorials on ChatGPT, Claude, Midjourney, and 50+ AI tools. New tutorials added every week.

7-day free trial. Cancel anytime.