20 Prompts for AI Coding Agents Like Cursor

20 prompts for AI coding agents: Cursor, Codex, Antigravity and Windsurf (now Devin Desktop). Plan, fix bugs, write tests, review diffs and set project rules.

Cover illustration for 20 Prompts for AI Coding Agents Like Cursor

The best prompts for AI coding agents name the behavior you want, point to the files involved, and say how the agent should prove the change works. The 20 prompts below work in Cursor, OpenAI Codex, Google Antigravity and Windsurf, which is now called Devin Desktop. For tool-specific sets, browse the Cursor prompts and Codex prompts libraries. They cover planning, bug fixes, building, tests, review and project rules.

Fill in the square brackets with your paths and commands. Each section notes where a tool does something differently, based on its official docs.

Which AI coding agents do these prompts work in?

All four agents read plain-language prompts, edit files and run commands in your project. They differ in how you plan, attach files and store standing rules:

  • Cursor. Cursor's Plan Mode asks clarifying questions, researches the codebase and writes a plan before any code. Press Shift+Tab in the chat input to switch to it. Project rules live in .cursor/rules as .mdc files, and Cursor also reads AGENTS.md.
  • OpenAI Codex. The Codex prompting guide says a useful prompt names the behavior you want and explains how to verify the change. Type /plan for multi-step work, and use @ to attach file paths.
  • Google Antigravity. Antigravity reads standing rules from AGENTS.md, GEMINI.md or .agents/rules/, as its rules docs explain. Its agent produces artifacts such as an implementation plan and a walkthrough that you can review.
  • Windsurf, now Devin Desktop. On June 2, 2026, Windsurf became Devin Desktop, according to the Devin Desktop FAQ. Its local agent, Devin Local, still reads your existing .windsurf/rules files.

Write one AGENTS.md for every agent

AGENTS.md is a plain Markdown file at the root of your repo that tells coding agents how your project works. Cursor, Codex, Antigravity and Devin Desktop all read it, so one file covers every tool. The open format is described at agents.md. Start with this template:

# AGENTS.md

## Commands
- Install: [command]
- Run tests: [command]
- Run one test file: [command with path]
- Typecheck and lint: [command]

## Rules
- Follow existing patterns in [folder]. No new libraries without asking.
- Never edit [generated or protected folders].
- Every change needs a test. Run the tests before saying you're done.

## Gotchas
- [environment variable, service or setup step the code doesn't show]

Keep it short. Codex, for example, stops reading project instruction files at 32 KiB combined by default, per its AGENTS.md guide.

Planning prompts (1-4)

Use these in Plan Mode in Cursor, after /plan in Codex, or in Antigravity's planning flow.

1. Plan before any edits

Don't change any files yet. Read [folder or files] and write a plan for [change]: the files to edit in order, the risks, the tests that prove it works, and anything you need me to decide. Wait for my OK.

2. Ask me questions first

I want to build [feature]. Before planning, ask me up to 6 questions about scope, edge cases, data and what is out of scope. Then write the spec to SPEC.md and a short plan below it.

3. Map an unfamiliar repo

Give me a map of this repo: the main folders, the entry points, how a request moves from [entry point] to [data layer], and where tests live. One line per item. Don't edit anything.

4. Split a big feature into tasks

Split [feature] into tasks small enough to review one at a time. For each task, list the files, the dependency on other tasks, and the test that shows it's done. Order them so the app still builds after each task.

Bug-fix prompts (5-8)

5. Reproduce, then fix

Bug: [symptom] when [steps to reproduce]. Expected: [behavior]. Look at [suspected files]. First write a test that fails because of this bug and run it. Then fix the cause and run the test again. Show both outputs.

6. Root cause from an error

Here's the error and stack trace. Find the root cause, not just the line that throws. Explain it in 3 sentences, propose the smallest fix, and tell me what test would have caught it.

[paste error and stack trace]

7. Bug that appeared after a change

[feature] worked before [commit, branch or date] and is broken now. Compare the changes since then in [files or folder], find the change that broke it, and fix it without undoing the rest of that change.

8. Front-end bug with a screenshot

[attach screenshot]
On [page], [element] looks like this at [width]. It should match [component or design]. Fix it with the smallest change, then check it at mobile and desktop widths and tell me how you checked.

In Antigravity, the agent can use a browser and return screenshots as artifacts. Ask it to attach before and after screenshots.

Building prompts (9-12)

9. Follow the existing pattern

Build [new feature] following the pattern in [existing file]. Same structure, naming, error handling and test style. No new dependencies. Run the tests when you're done.

10. Turn a design into code

Build [component] from this design. Use our existing [UI library or components] and design tokens from [file]. Include empty, loading and error states, keyboard access and a test for each state.

[attach design or describe it]

11. Add an endpoint with validation

Add a [method] endpoint at [path] that [does what]. Validate input, return clear errors, and add tests for success, bad input and missing auth. Don't change existing endpoints.

12. Keep going until the checks pass

Implement [change]. After each step run [test command] and [lint or typecheck command]. Keep going until both pass. Paste the final output of both commands at the end.

Test and review prompts (13-16)

13. Write tests for untested code

List the functions in [file or folder] that have no tests. Write tests for the 5 most important ones, covering normal input, edge cases and errors. Run them and report which pass.

14. Review the diff like a senior engineer

Review the changes on this branch. Report bugs, missing edge cases, security issues and missing tests. Give the file and line for each, and a concrete fix. Skip style comments unless they hide a bug.

15. Check the work against the spec

Compare the changes on this branch with SPEC.md. List each requirement as done, partly done or missing, with the file that implements it. Say which edge cases have tests and which don't.

16. Explain the change for a pull request

Write a pull request description for the changes on this branch: what changed, why, how to test it, and any risk or follow-up. Keep it under 200 words and list the commands a reviewer should run.

Rules and setup prompts (17-20)

17. Draft AGENTS.md from the repo

Read this repo and draft an AGENTS.md with only what an agent can't work out from the code: install, test, typecheck and lint commands, setup steps, and rules that aren't obvious. Keep it under 60 lines.

18. Write a Cursor project rule

Write a Cursor project rule in .cursor/rules/[name].mdc for [rule, e.g. how we write API handlers]. Use "Apply to Specific Files" for [glob pattern]. Keep it under 30 lines with one short example.

Cursor rules have four types: Always Apply, Apply Intelligently, Apply to Specific Files and Apply Manually. A manual rule runs when you mention it with @ in chat, as the Cursor rules docs explain.

19. Write an Antigravity or Devin Desktop rule

Write a rule file for [rule] with frontmatter trigger: glob and globs: [pattern]. Put it in [.agents/rules/ for Antigravity, or .devin/rules/ for Devin Desktop]. Keep it short and specific.

Both tools use the same four triggers in rule frontmatter: always_on, model_decision, glob and manual.

20. Clean up old instructions

Read AGENTS.md and any rule files in this repo. Remove duplicates, rules the code already makes obvious, and rules that conflict. Show me the removed lines and why, then write the shorter version.

Ready-made prompts for each coding agent

PromptiFex keeps free prompt collections for each agent:

A few prompts tagged for all of these agents:

To put these prompts in order, follow the AI coding agent workflow: plan, add context, review the diff, then save what worked. Browse the coding and development prompts for more.

Every agent also reads a system prompt, which is why the AGENTS.md file above matters so much. Save the prompts that worked for your repo in prompt packages, and share them with your team in shared team workspaces. Not sure a ready-made prompt beats your own? See ready-made prompts vs writing your own.

Related guides: Claude Code prompts for Anthropic's terminal agent, and AI prompt examples for the basics of a clear prompt.

Frequently asked questions

What are good prompts for Cursor?

Good Cursor prompts name the behavior you want, point to files with @, and say which test or command proves the change works. For bigger changes, switch to Plan Mode with Shift+Tab and review the plan first.

Is Windsurf still available?

Windsurf became Devin Desktop on June 2, 2026. Its local agent is Devin Local, and it still reads existing Windsurf rules. The prompts in this guide work the same way there.

Do I need a different prompt for each coding agent?

No. The task prompts are plain text and work in all four agents. What changes is the setup: rule file locations, how you start planning and how you attach files.

What is an AGENTS.md file?

It's a Markdown file in your repo that gives coding agents standing instructions, such as test commands and project rules. Cursor, Codex, Antigravity and Devin Desktop all read it.