PROMPT GUIDE

Prompts for AI Coding Agents (Cursor, Claude Code, Codex…)

Agentic coding tools — Cursor, Claude Code, Codex, Muse Code, OpenCode — can see your whole codebase and run commands. Prompting them is not like prompting a chatbot: the best prompts reference files and behavior, set constraints, and make the agent prove its work. Here is the pattern, plus a free generator tuned for it.

Generate your prompt — free, no sign-up

How to write AI coding prompts that work

Reference files and behavior, not screens

The agent can read your repo. "The submit handler in BookingForm.tsx double-fires on slow connections" beats any UI-level description of the symptom.

State the stack and conventions once

"This is a Next.js app; follow the existing patterns in src/features." Agents imitate surrounding code when told to — and invent their own when not.

Make it run and report

"Run the tests (or the app) and report the results before finishing." An agent that verifies catches most of its own mistakes — this one habit separates good sessions from frustrating ones.

Ask for a change summary

"Summarize the files you changed and what needs manual testing." Your review takes minutes instead of a full diff excavation.

One task per session

Agents drift across stacked requests. Land the bugfix, then start the refactor in a fresh session with clean context.

A starter template

Context: [stack + where the relevant code lives]. Follow existing code conventions.

Task: [the change, referencing files and behavior].

Requirements:
- [Checkable outcome]
- [Edge case to handle]

When done: build/run the app or tests, report results, then summarize the files you changed and anything needing manual testing.

Frequently asked questions

Do Cursor and Claude Code need different prompts?

Less than you would think — both are agentic and repo-aware. The same task prompt (context, files, checkable outcomes, run-and-report) works across Cursor, Claude Code, Codex, Muse Code, and OpenCode. The free generator produces exactly this shape.

Why does the agent rewrite code I did not ask about?

Usually unstated scope. Add "only modify what this task requires" and name the files. Agents respect explicit fences far better than implied ones.

How much context should I paste?

Point, do not paste: file paths and a sentence of behavior beat a wall of code. The agent reads the repo itself — your prompt should aim it, not duplicate it.

Related guides

replit · chatgpt · v0