Our best prompts for OpenClaw post went up about a year ago and it's still one of the most-visited pages on this site. That's partly because good prompts don't expire — but it's also because most people are still figuring out what OpenClaw is actually capable of beyond "fix this bug."
This is the 2026 update. Expanded categories, prompts refined based on what actually produces useful output, and a new section on CLAUDE.md templates that's become essential for getting consistent results across sessions. Drop these in as-is, or save them as OpenClaw skills in .claude/commands/ for one-keystroke access. Anything in [BRACKETS] — replace before sending.
How to use these templates
Three ways to use these:
- Copy-paste directly into your OpenClaw session as needed.
- Save as a skill — create a
.mdfile in.claude/commands/your-command-name.mdand trigger it with/your-command-name. More on this at the end. - Add to CLAUDE.md — for prompts that describe how you want OpenClaw to behave across your whole project (the CLAUDE.md section covers this in detail).
Code review
The goal with code review prompts is specificity. A vague "review this code" gets you vague feedback. These two templates force prioritization and give you output you can act on immediately.
This first one works well when you want a full diff reviewed before merging:
Review this diff/file and give me a prioritized list of issues:
1. Security vulnerabilities (any severity)
2. Logic bugs or incorrect behavior
3. Performance bottlenecks
4. Missing error handling for realistic failure cases
5. Anything that breaks our patterns in [DESCRIBE YOUR CODEBASE PATTERNS]
For each issue: file, line, severity (critical/high/medium/low), and specific fix suggestion.
Skip stylistic nitpicks — I want real problems.
This second one is better when you need a harder pass — production-bound code, a critical path, or work from a junior engineer you want fully vetted:
You are a senior engineer doing a pre-merge review. Be direct — this is going to production.
Check for:
- Edge cases the author probably didn't test
- Race conditions or concurrency issues
- Inputs that would cause unexpected behavior
- Dependencies being imported but not needed
- Security: SQL injection, XSS, unvalidated input, exposed secrets
Format: [CRITICAL/HIGH/MEDIUM] Line X: description. Fix: one-line suggestion.
Debugging
The mistake most people make when debugging with OpenClaw is asking for a fix before the root cause is understood. These templates build in the diagnostic step before any code changes happen.
Start here when you don't fully understand the bug yourself — it forces you to articulate it clearly, which often surfaces the answer before OpenClaw even responds:
I have a bug. Before you try to fix it, ask me questions to understand it better.
Start with: What's the exact error or unexpected behavior? What did you expect to happen?
Keep asking until you understand the root cause. Only then suggest a fix.
Use this when you have a stack trace and want a structured diagnosis, not just "here's what changed on line 47":
Here's a stack trace/error: [PASTE ERROR]
File context: [PASTE RELEVANT FILES]
1. Identify the most likely root cause (not just where it crashed — why)
2. List 2-3 other possible causes in order of likelihood
3. For the most likely cause, give me the minimal fix
4. Tell me how to verify the fix worked
Performance bugs are their own category — this one is built for slow functions or queries where you need line-level specificity, not general advice:
This code is slow: [PASTE FUNCTION/QUERY]
Profile it mentally — where are the bottlenecks?
Rank by: time complexity, N+1 queries, unnecessary re-computation, blocking calls.
Give me specific line-level changes, not a general "use caching" suggestion.
CLAUDE.md starter templates
CLAUDE.md is the file OpenClaw reads at the start of every session to understand your project. Think of it as onboarding documentation written for an AI — it sets the context, conventions, and constraints so you don't have to re-explain them every time. Without it, every session starts cold.
These two templates cover the most common project types. The first is general-purpose for any codebase:
# [PROJECT NAME] — OpenClaw Instructions
## Stack
[LIST YOUR TECH STACK]
## Architecture
[DESCRIBE KEY ARCHITECTURAL DECISIONS — e.g., "API routes in /app/api, business logic in /lib, no logic in components"]
## Conventions
- [NAMING CONVENTIONS]
- [FILE ORGANIZATION RULES]
- [CODE STYLE SPECIFICS]
## Never do
- [LIST ANTI-PATTERNS — e.g., "Never use any, always type everything strictly"]
- [e.g., "Never write raw SQL — always use the ORM"]
- [e.g., "Never commit .env files"]
## Always do
- [PATTERNS TO FOLLOW — e.g., "Always handle errors at the boundary, not deep in the stack"]
- [e.g., "Always add JSDoc to exported functions"]
## Testing
[DESCRIBE YOUR TEST STRATEGY AND HOW TO RUN TESTS]
## When stuck
[ESCALATION PATH — e.g., "If you can't find a pattern for X, ask before inventing one"]
The second is trimmed for backend services where the critical info is the entry point, data layer, and error-handling contract:
# [SERVICE NAME] — Backend Service
## Purpose
[ONE SENTENCE: what this service does]
## Key files
- Entry point: [PATH]
- Routes: [PATH]
- Models: [PATH]
- Config: [PATH]
## Environment
Required env vars: [LIST]
Dev setup: [COMMANDS]
## Database
[DB TYPE + ORM + migration approach]
## Error handling convention
[HOW ERRORS BUBBLE UP — e.g., "Throw typed errors, catch at controller layer, return RFC 7807 problem JSON"]
## Do not
- [CRITICAL ANTI-PATTERNS FOR THIS SERVICE]
A few things that consistently improve CLAUDE.md quality: be specific about what not to do (it's more useful than general style guidance), describe your architecture in terms of where things live, not just what they are, and include the actual commands to run tests. OpenClaw will use them.
Documentation generation
Documentation prompts work best when you give OpenClaw a specific artifact to produce rather than asking it to "document this." These three templates each produce a distinct, usable output.
For a project README that a new developer can actually follow:
Generate a README for this project based on what you see in the codebase.
Include: What it does, Installation, Configuration (env vars), Usage examples, API reference (if applicable), Contributing guide.
Write it for a developer who has never seen this project. Be specific — don't just say "configure the app", show the actual commands.
For TypeScript/JavaScript codebases where you need proper inline documentation:
Write JSDoc / TSDoc comments for all exported functions in [FILE].
For each function: @param with type and description, @returns with type and description, @throws if it can throw, @example with a realistic usage example.
Skip obvious getters/setters. Focus on anything that has non-obvious behavior or edge cases.
For generating a CHANGELOG entry that actually helps the person doing the upgrade:
Generate a CHANGELOG entry for these changes: [PASTE DIFF OR DESCRIPTION]
Format: Keep a Changelog style (Added/Changed/Fixed/Removed).
Write for the person who will upgrade — focus on what they need to know, not implementation details.
Refactoring
Refactoring prompts need hard constraints or OpenClaw will over-engineer. The key guardrails: don't change behavior, don't change the public API, don't touch what doesn't need touching. The first template builds all of that in and adds a planning step before any code changes:
Refactor [FILE/FUNCTION] to improve [readability / performance / testability].
Constraints:
- Do not change behavior — same inputs must produce same outputs
- Do not change the public API
- Run the existing tests to verify nothing broke
- Make the smallest change that achieves the goal — no gold-plating
Walk me through your plan before making changes.
Functions that try to do too many things are the most common refactoring target. This template handles the decomposition without losing the original orchestration logic:
This function is doing too much: [PASTE FUNCTION]
Break it into smaller, single-responsibility functions.
Rules:
- Each function should have one clear job you can name in 3-5 words
- No function over 30 lines
- Keep the original function as a thin orchestrator calling the new ones
- Don't change behavior
Architecture and planning
These two templates are for before you build something. The first one is genuinely one of the highest-value prompts in this list — getting a codebase analysis before writing a single line avoids a lot of "I should have looked at how we do X elsewhere" problems:
Before we build [FEATURE], explore the codebase and answer:
1. What existing patterns should this follow?
2. What existing utilities or helpers could be reused?
3. What could break if we add this?
4. What's the simplest implementation that solves the problem?
Don't write any code yet. Just give me your analysis.
For teams that write ADRs — or should be writing them — this one produces a draft you can drop straight into your docs:
Write an Architecture Decision Record (ADR) for this decision: [DESCRIBE DECISION]
Format:
## Context
[Why does this decision need to be made?]
## Decision
[What was decided?]
## Rationale
[Why this option over alternatives?]
## Alternatives considered
[What else was considered and why rejected?]
## Consequences
[What changes as a result of this decision?]
Saving prompts as OpenClaw skills
Any prompt in this post can be saved as a reusable skill. Create a .md file in .claude/commands/ in your project directory — for example .claude/commands/code-review.md — and paste the prompt in. Then trigger it with /code-review from your OpenClaw session.
The naming convention matters: use hyphens, keep it short, make it easy to remember under pressure. cr is faster to type than code-review and you'll know what it means.
The full guide to creating and managing OpenClaw skills is in our custom skills and plugins post.
The SOUL.md shortcut
CLAUDE.md is per-project. SOUL.md is per-you. It lives in your home directory and OpenClaw reads it across every project, every session. It's the right place for preferences that transcend any single codebase: code style opinions, communication preferences, how you like to work through problems.
A few examples of what belongs in SOUL.md: "I prefer functional style over class-based code," "use tabs, not spaces," "don't add comments unless the logic is genuinely non-obvious," "when you're unsure about something, say so instead of guessing."
The detail on how to structure and get the most out of SOUL.md is in our SOUL.md guide.
Wrapping up
These templates compound. The first time you use the pre-build codebase analysis prompt, you'll spend ten minutes on setup. The fifth time, it's automatic — you don't start a feature without it. Same with CLAUDE.md: once you've written a good one for a project, every session starts with context instead of catching up.
The original best prompts for OpenClaw collection is still worth keeping open alongside this — there's no overlap, so together they cover most of what you'll need for day-to-day work.



