Cursor

Verified against Cursor · 2026-08-05

Brief Cursor's Agent mode to build a multi-file feature without wandering into untouched files

A Composer/Agent-mode brief that names the files in scope, the data contract between them, the codebase's existing conventions, and what to leave alone, plus a forced pre-edit plan, so an autonomous multi-file build stays inside the feature you actually asked for instead of expanding into whatever the semantic index surfaces as related.

Cursor 2.25 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

You are working in Cursor's Agent mode with multi-file edit access across this repository's indexed codebase. Build the feature below end to end, but treat every boundary in this brief as a hard constraint, not a suggestion you can override if you find a "better" way mid-edit.

FEATURE
Add a "save search" button on the results page that stores the current filters under a name and lists saved searches in the sidebar for the logged-in user.

FILES YOU MAY CREATE OR MODIFY
app/search/results/page.tsx, app/search/results/SavedSearches.tsx (new), lib/searches/store.ts (new), app/api/searches/route.ts (new)

DATA CONTRACT BETWEEN THESE FILES
SavedSearch = { id: string, name: string, filters: FilterState, createdAt: string }. The API route returns SavedSearch[]; the sidebar component takes searches: SavedSearch[] as a prop.

OUT OF SCOPE — DO NOT TOUCH EVEN IF IT LOOKS RELATED
Do not touch the existing filter-parsing logic in lib/search/parseFilters.ts, and do not modify the results table component itself.

CODEBASE CONVENTIONS TO MATCH
API routes return { data, error } tuples, never throw across the route boundary. Shared types live in lib/types/, never inline in a component file. Errors are logged via lib/logger.ts, never console.log.

BEFORE WRITING ANY CODE
List every file you intend to create or modify, in the order you'll edit them, and state which sentence of the feature description each edit satisfies. If that plan requires a file outside FILES YOU MAY CREATE OR MODIFY, stop here and name it explicitly before touching it — do not expand scope silently mid-session just because the codebase index surfaced a plausible "related" file while you were searching for something else.

WHILE EDITING
- Keep the data contract above literal on both ends of every file boundary it crosses. If satisfying the feature actually requires changing a field name or shape, say so and wait for confirmation rather than adapting one side quietly while the other goes stale.
- Do not add a new dependency, even a small one, without naming it and the specific reason it's needed first — a "simpler" implementation using an existing utility is always the default unless one genuinely doesn't exist.
- Match the codebase conventions given above exactly — naming patterns, error-handling style, where types live — rather than defaulting to whatever pattern is most common in your own training data. A new file that's individually well-written but stylistically foreign to everything around it has failed this brief even if it works.
- Do not run a workspace-wide build, lint, or test command when the change only touches a handful of files; use the narrowest scoped command available and say which one you ran.

WHEN DONE
List every file changed, one line each, mapped to the specific requirement it satisfies. Separately, list anything from the feature description you could not finish and exactly why — a missing dependency, an ambiguous requirement, a conflict with an existing pattern — rather than silently shipping a partial implementation dressed up as complete. If you made any judgment call the brief didn't explicitly cover, name it and the reasoning, so it can be checked rather than discovered later.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

Agent mode's usefulness on a multi-file feature comes directly from its ability to semantically search the whole indexed codebase and open whatever file looks relevant without being told the exact path — which is also exactly what makes it capable of touching five files you never mentioned, because "looks relevant" and "is in scope" are not the same test, and only a human brief can supply the second one. Naming FILES YOU MAY CREATE OR MODIFY converts an implicit assumption into a hard boundary the model can actually check itself against, and requiring a file-by-file plan before any edit lands means you see the blast radius as a list while it's still cheap to correct, not as an already-applied diff spread across the repo that has to be reverse-engineered back into scope. The DATA_CONTRACT field solves a different problem specific to multi-file agent work: the model writes the producer and the consumer of a shape in separate tool calls within the same session, and without a literal contract to check both sides against, a field silently renamed on one end (filters becomes filterState) leaves the other end stale while every individual file still looks internally correct — the kind of bug that a single-file review never catches because no single diff shows the mismatch. CODEBASE_CONVENTIONS earns its place because Cursor's underlying model has strong priors from its own training distribution about how a search feature or an API route "should" look, and those priors are frequently at odds with a specific codebase's actual house style; stating conventions explicitly overrides the model's default pattern-matching with the one pattern that actually matters here. Finally, requiring the model to report unfinished work by name rather than silently ship a partial implementation matters because a confident closing summary is the default output regardless of completeness — the brief has to ask for the gap explicitly, or it simply won't surface on its own.

What you get back

Plan before editing: 1. lib/searches/store.ts (new) — SavedSearch type + storage adapter, following the { data, error } convention. 2. app/api/searches/route.ts (new) — GET/POST using the store, errors logged via lib/logger.ts. 3. app/search/results/SavedSearches.tsx (new) — renders searches, calls POST on save. 4. app/search/results/page.tsx (edit) — add the Save button, wire it to SavedSearches. Proceeding in that order. Nothing outside the listed files touched — filter parsing and the results table untouched. Summary: - lib/searches/store.ts: added, satisfies "store the current filters under a name." - app/api/searches/route.ts: added, satisfies "list saved searches" (GET) and the save action (POST). - app/search/results/SavedSearches.tsx: added, satisfies "lists saved searches in the sidebar." - app/search/results/page.tsx: edited only to add the Save button and mount the sidebar component. Not completed: per-user scoping was described as "for the logged-in user" but no auth context is wired into this route group yet — flagging rather than guessing at an auth pattern that isn't there.

Verified against

Cursor 2.2 · 2026-08-05

Changelog

  • 2026-08-05 Initial publish, verified against Cursor 2.2 Agent mode multi-file edits.

Need this built into your business?

If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
Force Cmd+K to change only the highlighted lines, not the whole block around themA Cmd+K inline-edit instruction that states the transformation, an explicit byte-identical preserve list, and a fallback rule for when the transformation can't be done cleanly, tuned for the selection-scoped inline editor rather than a whole-file Agent pass.Cursor 2.22026-07-22Point Cursor BugBot at the actual risk in a PR instead of a generic pass over the diffA PR description written for BugBot, Cursor's automated PR-review agent, that states risk areas and known trade-offs up front and defines exactly how findings must be classified and cited, so its comment thread concentrates on real logic and security risk instead of restating the diff or re-litigating a deliberate choice.Cursor BugBotCursor 2.22026-07-30Write a Background Agent brief that survives running with nobody watchingA self-contained task brief for Cursor's Background Agents — the async, remote-run agent mode — with success criteria, a conservative-default policy for ambiguity, and a reviewable-PR requirement, since no one answers follow-up questions while it works in an isolated container.Cursor Background AgentsCursor 2.22026-08-02Turn Cursor's Agent-mode checkpoints into a real rollback plan for a risky refactorA refactor brief that breaks a risky change into checkpoint-sized steps and tells the agent to stop and name the last good checkpoint on failure — instead of patching a bad step with a second speculative fix — plus a named rollback trigger phrase for mid-session use.Cursor 2.22026-08-06
All Cursor prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY