Skip to content
TheBestSuperintelligence
Menu

Best AI Prompts for Claude Code (2026)

Prompts for Claude Code#

Five starting points#

Full brief
Read this repository and draft a CLAUDE.md of under 200 lines. Include only what you could not work out from the code: the exact build, lint and single-test commands, code style that differs from the defaults, branch and PR conventions, and required environment variables. Then ask me about anything you could not determine, and list each line you were unsure earns its place. My stack is [DESCRIBE YOUR STACK AND PACKAGE MANAGER].
Advanced
Start in plan mode. Read [PASTE THE DIRECTORIES OR FILES TO CHANGE] and write a plan to refactor [DESCRIBE THE CHANGE], listing every file you would touch and what is out of scope. Wait for my approval. Then implement it in small steps, run [PASTE YOUR TEST AND TYPECHECK COMMANDS] after each step, fix any failure at its root cause, and show me the test output when you finish.
Advanced
Look at the failing build log I pasted: [PASTE THE ERROR OUTPUT]. Find the root cause rather than suppressing the error, write a failing test that reproduces it, fix it, and confirm the build passes. Then create a branch named [PASTE YOUR BRANCH NAMING RULE], commit with a message in our convention [DESCRIBE YOUR COMMIT FORMAT], and open a pull request with gh that links the issue.
Specialized
Write a shell script that loops over the files in files.txt and runs claude -p once per file to [DESCRIBE THE PER-FILE TASK], ending each answer with OK or FAIL. Pre-approve only the tools the task needs with --allowedTools, use --permission-mode dontAsk, run with --bare, and log each result as JSON. Run it on the first three files and show me the output before you run the rest.
Specialized
Audit how Claude Code is configured on this [DESCRIBE THE MACHINE, E.G. SHARED CLOUD VM]. Propose a .claude/settings.json with deny rules for [LIST SECRETS FILES AND DANGEROUS COMMANDS, E.G. .env, curl, rm], an allowlist limited to the commands we actually use, and a PreToolUse hook for anything that must never run. Explain each rule in one line, and note what a Bash deny rule would not catch.

What to add to any Claude Code prompt#

  • A check Claude can run. Anthropic's best-practices page says a test suite, build exit code or linter lets Claude iterate until it passes, and asks for the evidence (test output) rather than a claim of success.
  • Files, symptoms and patterns by name. Reference files with @, describe the symptom and likely location, and point to an existing file to copy the pattern from.
  • Scope and exclusions. Say which files are in play and what is out of scope. Anthropic's own spec advice is to name the files and interfaces involved and state what is out of scope.
  • Why a rule exists. Anthropic's prompting guide says explaining the reason behind an instruction helps Claude deliver more targeted results.
  • Plan mode for multi-file work. Anthropic suggests exploring and planning first when you are unsure of the approach or the change touches several files, and skipping the plan if you could describe the diff in one sentence.
  • A fresh session after repeated corrections. After two failed corrections on the same issue, Anthropic recommends /clear and a better first prompt.

A worked example#

This fills in the second prompt for a hypothetical Next.js repository.

Code
Start in plan mode. Read @src/lib/billing/ and @src/app/api/invoices/ and write a plan to refactor invoice totals so all rounding happens in one function, src/lib/billing/money.ts, instead of in three route handlers. List every file you would touch. Out of scope: the Stripe webhook code and any database schema change. Wait for my approval. Then implement it in small steps, run `npm run typecheck && npx vitest run src/lib/billing` after each step, fix any failure at its root cause, and show me the test output when you finish.

A good result for this task has these parts:

  • A plan that names the files and states the out-of-scope items back to you before any edit.
  • A characterization test or existing test that passes before the refactor and still passes after it.
  • Test and typecheck output pasted into the reply, not a statement that it passed.
  • A diff that touches only the listed files; anything outside the plan is flagged and asked about.
  • No test edited to make it pass, and no error suppressed.

For unattended runs, review the allowlist before you start. --allowedTools pre-approves tools, and Anthropic notes a deny rule on one Bash form does not match the same program invoked another way, so it is not a security boundary on its own. Pair it with the sandbox for anything that must hold. Without --bare, a claude -p run loads the hooks and MCP servers in the project's own settings, even in a folder you have not trusted, so read those first. Keep API keys out of prompts and shell history.

The full prompt library is on our prompt library page.

Limits of this guide#

This page covers how to ask and configure, as Anthropic documents it on 2026-10-22. It does not show that any wording makes Claude Code more accurate, and we did not run these prompts. Claude Code ships changes often, and flags such as --bare, --permission-prompts and the auto permission mode depend on your installed version, so check claude --help first. We could not read OpenAI's prompt-engineering guide through the Internet Archive from our tooling, so the cross-vendor points come from OpenAI's live page and Google's guide.

Sources & Further Reading#

All sources were fetched on 2026-10-22.

Claim Source Section or date
CLAUDE.md is context, not enforced configuration; use a PreToolUse hook to block an action; target under 200 lines; /init generates a starter How Claude remembers your project (Anthropic) CLAUDE.md vs auto memory; Size; undated
What to include and exclude in CLAUDE.md; prune it; emphasis on one line; verification, plan mode, /clear after two failed corrections, subagents, claude -p loops, --allowedTools, dontAsk, failure patterns, spec advice Best practices for Claude Code (Anthropic) Sections as named; undated
claude -p, --bare, --output-format json, --json-schema, --allowedTools, --continue, hooks and MCP load without --bare Run Claude Code programmatically (Anthropic) Basic usage; Examples; undated
Hooks run deterministically at lifecycle points Automate actions with hooks (Anthropic) Opening section; undated
Subagent file location, tools allowlist, description guides delegation Create custom subagents (Anthropic) Frontmatter fields; Writing a good description; undated
Deny rules are evaluated first; a Bash deny rule is not a security boundary for the program Configure permissions (Anthropic) Rule precedence; Bash rule limits; undated
Be explicit; explain why; give examples; ask for self-checks Prompting best practices (Anthropic) Clear instructions; Context; Examples; undated
Pin model snapshots and build evals; provide context Prompt engineering (OpenAI) Roles; Context; Snapshots; undated
Be specific, give context, iterate Prompt design strategies (Google) Key strategies; undated

Need a different task?

Browse all 36 tasks and 180 prompts, with search and level filters.

Open the prompt library →

Frequently asked questions

What are the best AI prompts for Claude Code?

Ask Claude Code for one scoped task and give it a check it can run, such as tests or a build. Keep standing rules in a short CLAUDE.md. Anthropic says CLAUDE.md is advice, so enforce hard limits with hooks or deny rules.

What should go in a CLAUDE.md file?

Anthropic says to include commands Claude cannot guess, style rules that differ from defaults, test instructions, branch and PR etiquette, and environment quirks. Leave out what Claude can read from the code. Its test for each line is whether removing it would cause mistakes. It targets under 200 lines per file.

How do I run Claude Code from a script or CI?

Use claude -p with your prompt. Add --output-format json to parse the result, --allowedTools to pre-approve only the tools the job needs, and --bare in CI so hooks, plugins and CLAUDE.md on the host are not loaded. Anthropic recommends testing on two or three files before a full loop.

By TheBestSuperintelligence Editorial Team. Last reviewed .

How we sourced this. Model names, features and limits change often. The prompts below are our own untested starting points, and we did not measure which wording performs best. Facts are as printed on each source page on the date shown. Methodology