BoilerPrompt
Windsurf

Windsurf prompt to build a REST API

Paste this into Windsurf's Cascade panel and it will scaffold the routes, wire up the database layer, and run its own integration tests in the built-in terminal before reporting back. You end up with a working CRUD API, a migration, a seed script, and a file list you can review in one pass.

Last updated

Prompt
Have Cascade draft a short plan first, naming the modules it will create, then execute it. Goal: a {{language}} REST service over {{database}} exposing /api/{{resource}}. Handlers: create, fetch a single record, PATCH updates, delete, and a listing route accepting page, limit (never above 100), and sort. A body failing validation gets a 400 whose payload is an array of per-field messages; an unrecognized id gets 404; inserting a duplicate into a unique column gets 409. Every query must go through this repo's ORM or prepared statements; SQL assembled from strings is banned. Include a schema migration plus a seeder inserting sample rows. In the editor terminal, run the integration suite until it passes; required cases: complete CRUD flow, malformed body, id that matches no row, and a page request beyond the final page. Finish with the created-file list and the command that boots the server locally.

Customize it

Runs in your browser. Nothing you type here is sent anywhere.

Your customized prompt
Have Cascade draft a short plan first, naming the modules it will create, then execute it. Goal: a TypeScript REST service over PostgreSQL exposing /api/users. Handlers: create, fetch a single record, PATCH updates, delete, and a listing route accepting page, limit (never above 100), and sort. A body failing validation gets a 400 whose payload is an array of per-field messages; an unrecognized id gets 404; inserting a duplicate into a unique column gets 409. Every query must go through this repo's ORM or prepared statements; SQL assembled from strings is banned. Include a schema migration plus a seeder inserting sample rows. In the editor terminal, run the integration suite until it passes; required cases: complete CRUD flow, malformed body, id that matches no row, and a page request beyond the final page. Finish with the created-file list and the command that boots the server locally.

Same task in other tools

Questions about this prompt

Which framework will Cascade pick for the API?

In an existing repo it reads your dependencies and follows them: Express or Fastify if the project is Node, FastAPI or Flask for Python, and so on. In an empty folder it falls back to a common default, so name the framework in your first line if you have a preference.

Cascade wrote the endpoints but never ran the integration tests. How do I fix that?

Long flows sometimes end with a summary instead of execution. Reply with 'run the test suite now and show the output' and Cascade will execute it in the built-in terminal and repair failures it sees. Keeping the verification instruction as the prompt's final sentence reduces how often this happens.

Can I generate several resources in one flow?

You can list more than one {{resource}}, but validation quality drops when the agent fans out. Build the first resource with this prompt, correct anything you dislike, then ask Cascade to replicate the reviewed pattern for the remaining resources. It copies your corrections, not its first draft.

Related prompts