DEV Community

jidong
jidong

Posted on

5 Prompt Patterns That Make Claude Code 10x More Useful

1. Context First, Command Second

❌ "Add a button"
✅ "Add a dark mode toggle button to src/components/Header.astro.
   Place it on the right side of the nav, using Tailwind dark: prefix."
Enter fullscreen mode Exit fullscreen mode

Specify file path + location + tech stack and you get the right result on the first try.

2. The "Like This" Reference Pattern

"Build a layout like Stripe's dashboard — left sidebar + main content"
"Add auth checking like Next.js middleware.ts pattern"
Enter fullscreen mode Exit fullscreen mode

Instead of abstract descriptions, give concrete references. Claude builds the right mental model instantly.

3. State Your Constraints

"Create a React component. But:
- Pure CSS only, no external libraries
- Must include aria-labels for accessibility"
Enter fullscreen mode Exit fullscreen mode

Explicitly stating "don't do" and "must do" cuts revision rounds in half.

4. Break Down Big Tasks

❌ "Build me a full-stack blog"
✅ Step 1: "Create a /posts page that reads markdown files and shows a list"
   → After done → Step 2: "Add detail pages at /posts/[slug]"
Enter fullscreen mode Exit fullscreen mode

Smaller steps = higher quality at each stage.

5. Lock Context with CLAUDE.md

Create a CLAUDE.md in your project root:

# Project Conventions
- Astro + React + Tailwind
- Korean content uses -ko suffix in filenames
- Commit messages follow conventional commits
Enter fullscreen mode Exit fullscreen mode

This single file gives you consistent results across every session without re-explaining your project.


These patterns work because they reduce ambiguity. The less Claude has to guess, the better the output. Try them on your next project and see the difference.

Top comments (0)