Skip to content
Promptsmith
Chapters

Code & Dev

Prompt Engineering for Developers: 10x Cursor and Claude Code

Inscribed July 5, 2026 7 min read

A dark monitor displaying source code, lit by ambient LED light

There is a strange gap between developers using the same AI coding tools. One person calls Cursor a toy that writes plausible-looking garbage. Another ships real features with it daily. They are usually on the same model. The difference is almost entirely in how they prompt.

Here is the whole method in one paragraph, so you can start now: give the tool the repository context it cannot see, state explicitly what it must NOT change, ask for tests in the same breath as code, and break anything large into prompt-sized tasks instead of one giant “build me X.” Those four moves turn slop into shipped work. Everything below is each move in detail, plus five templates you can paste.

Why the tool is rarely the bottleneck

Modern AI coding assistants are strong. In 2026 comparisons, Claude Code has been rated at or near the top for repository context handling, complex refactoring, and test generation — the exact jobs where prompting quality matters most. GitHub’s own prompt-engineering guidance for Copilot says the same thing in different words: describe a broad goal first, then list specific requirements, and break complex tasks into multiple smaller prompts.

Notice what both of those imply. The capability is there. What determines your results is whether you feed the tool the right context and constraints. That is a prompting skill, and it is learnable in an afternoon.

Move 1: Give it the context it cannot see

The model does not know your codebase the way you do. Even tools that read your repo need pointing. Before asking for anything, tell it:

  • The stack, with versions: Next.js 14, TypeScript, Drizzle ORM, Postgres, Tailwind.
  • The relevant files, by path: where the thing you are touching lives.
  • The conventions it must follow: how you handle errors, name things, structure modules.
  • How auth/session/state works if the task touches any of it.

A prompt that opens with this context gets code that fits your project. A prompt without it gets code that fits a project — usually a tutorial’s.

Move 2: Say what NOT to change

This is the single most underused instruction in AI coding. Left unconstrained, the model will happily “improve” things you did not ask it to touch: renaming variables, reformatting untouched files, swapping a library. Every one of those is a diff you now have to review and probably revert.

Add a hard boundary to every non-trivial prompt:

Do NOT modify any file outside the ones listed.
Do NOT change existing function signatures.
Do NOT add new dependencies without flagging them first.
Keep the existing error-handling pattern.

The constraint list is not bureaucracy. It is what keeps a 20-line feature from arriving as a 400-line diff you cannot trust.

Move 3: Ask for tests in the same prompt

Requesting code and tests together is more than a convenience. It forces the model to commit to what the code is supposed to do before it writes the implementation, which surfaces its assumptions where you can see them. A test that encodes the wrong behavior is a fast, obvious signal that the model misunderstood — far better than discovering it three files later.

Write one test for the core logic covering the happy path and one edge case costs you nothing extra and buys you an executable spec.

Move 4: Prompt-sized tasks, not epics

“Build me a full authentication system” is not a prompt, it is a project. The model will produce a large, confident, hard-to-verify blob, and you will spend more time auditing it than you saved.

Break it down the way you would break down a ticket:

  1. Add the database schema for users and sessions.
  2. Add the sign-up endpoint with validation.
  3. Add the login endpoint and session creation.
  4. Add the middleware that guards protected routes.

Each of those is small enough to read, test, and trust before moving on. You stay in control, and every step is a clean checkpoint you can roll back to.

The four moves at a glance

What each move buys you
The moveWhat it prevents
Give repository context Stack, file paths, conventions, auth model up front Generic code that fits a tutorial, not your project
State what NOT to change Explicit boundaries on files, signatures, dependencies A small feature arriving as a sprawling, unreviewable diff
Request tests with code One happy-path and one edge-case test in the same ask Silent misunderstandings you only find at runtime
Prompt-sized tasks Break epics into small, verifiable steps A large confident blob you can't audit or trust

Five templates worth saving

1. Feature build

I need to build [FEATURE] in my [STACK] project.
Context:
- Stack + versions: [...]
- Related files: [paths]
- How auth/state works here: [...]
It must: [behavior]
It must NOT: [constraints — files, signatures, deps]
Steps:
1. List the files you'll create or modify before writing code.
2. Write the complete implementation, no placeholders.
3. Add types for all new data structures.
4. Write one Vitest test for the core logic.
Make the most reasonable assumption rather than asking; note it.

2. Bug debug

Bug I can't solve.
- Expected: [...]
- Actual: [...]
- Error (if any): [paste]
- Relevant code: [paste]
- Already tried: [...]
- Stack: [...]
Process:
1. Rank the 3 most likely root causes by probability.
2. For each, explain why it would produce this exact symptom.
3. Give me the one diagnostic step to confirm or rule out each.
4. Once confirmed, give the minimal fix — no refactoring unless required.

3. Refactor

Refactor [file/module] for [goal: readability / performance / testability].
Constraints:
- Behavior must be identical — no functional changes.
- Do not change the public interface.
- Do not touch files outside this module.
Deliver: the refactored code, plus a short list of what changed and why.
Flag anything you're unsure preserves behavior.

4. Test generation

Write tests for [function/module] using [test framework].
- Cover: happy path, boundary values, and the error cases.
- Use the existing test style in [example test file].
- Do not modify the code under test; if it's untestable as written,
  tell me what would need to change rather than changing it.

5. Code review

Review this diff as a senior engineer.
[paste diff]
Focus on, in order: correctness bugs, security issues, then edge cases.
For each finding: the specific line, why it's a problem, and the fix.
Skip style nitpicks unless they cause real bugs. If it's solid, say so.

A note on the “prompt engineering” hype

You have seen the headlines about demand for prompt-engineering skills exploding and the market ballooning into the hundreds of millions. Some of those figures come from vendor-adjacent reports and should be read as directional, not gospel. The durable point underneath them is simpler and true: developers who can direct these tools precisely get dramatically more out of them than developers who type vague requests. You do not need a certification. You need the four moves above and the habit of using them.

Common questions

Common questions

Isn't good prompting just writing a clear spec?

Largely, yes — and that is the point. The skill transfers directly from writing a good ticket. The AI-specific parts are giving context the model can't see, stating what not to change, and sizing tasks so each output is verifiable.

Should I let the tool make changes across many files at once?

Only after you've scoped it. Multi-file changes are where unreviewable diffs come from. Break the work into steps, keep each step to a small set of named files, and add an explicit 'do not touch anything else' boundary.

Why ask for tests if I'm going to review the code anyway?

Because the test forces the model to state the intended behavior before implementing it. If the test encodes the wrong behavior, you catch the misunderstanding immediately instead of at runtime. It's an executable spec that costs one extra line to request.

Does this apply to Cursor and Claude Code equally?

Yes. These are structural prompting habits, not tool tricks. Context, constraints, tests, and task sizing improve output on any capable AI coding assistant. The templates above work in either tool with minor wording tweaks.

Start with one template

Do not try to adopt all four moves at once. Pick the feature-build template, use it on your next real task, and pay attention to how much smaller and more trustworthy the diff is when you tell the model what not to change. That single result usually converts people. From there, the other templates are just the same discipline applied to debugging, refactoring, and review.

More dev prompts live in the library — free to copy, structured exactly like the templates above.

Advertisement

The Promptsmith Letter

New specimens, every week.

The prompts that earned a place in the catalog — tested, annotated, ready to copy. No fluff. Free.