These are skeletons, not finished prompts: copy one into the Cascade pane, replace every [BRACKETED_PLACEHOLDER] with your specifics, delete the lines you do not need, and send. Each template already wires into real Windsurf mechanics — @-mentions, Write/Chat mode, acceptance criteria, and the .windsurf/rules, Memories, and /workflow systems — so you only supply the blanks.
For finished, paste-ready examples see the 40 best Windsurf prompts. For the reasoning behind the structure, read how to prompt Windsurf (Cascade) for coding.
Feature & build templates
Build templates work best when you state a goal, point Cascade at exact context with @-mentions, scope what it may touch, and give testable acceptance criteria. Run these in Write mode.
1. Build-a-feature template
GOAL: Implement [FEATURE_NAME] so that [USER_OUTCOME].
CONTEXT (read first):
@file [PATH/TO/PRIMARY_FILE]
@folder [PATH/TO/RELATED_DIR]
@codebase [PLAIN_ENGLISH_DESCRIPTION_OF_WHERE_THIS_LIVES]
@docs [LIBRARY_OR_FRAMEWORK_NAME]
SCOPE:
- Only modify files under [ALLOWED_PATHS]. Do NOT touch [DO_NOT_TOUCH_PATHS] or unrelated files.
- Match the existing patterns for [NAMING / ERROR_HANDLING / STYLE].
ACCEPTANCE CRITERIA (done when all true):
- [OBSERVABLE_BEHAVIOR_1]
- [OBSERVABLE_BEHAVIOR_2]
- `[TEST_OR_BUILD_COMMAND]` passes with no new failures or type errors.
PROCESS:
1. Propose a short plan and list the files you will change. Wait for my OK.
2. Implement, then run `[TEST_OR_BUILD_COMMAND]` and fix anything it reports.
3. Show me the per-file diff and a one-line summary of each change.When to use: any non-trivial feature you want scoped and self-verified.
Example (filled): GOAL: Implement CSV export so that users can download their invoices … ACCEPTANCE: `npm test` passes; button appears on /invoices.
2. Scaffold-a-component template
Create a new [FRAMEWORK] component named [COMPONENT_NAME] at [PATH/TO/COMPONENT].
Requirements:
- Props: [PROP_1: TYPE], [PROP_2: TYPE], [PROP_3: TYPE].
- Behavior: [WHAT_IT_RENDERS_AND_DOES].
- Match the structure and styling conventions in @file [PATH/TO/EXISTING_SIMILAR_COMPONENT].
- Add types/prop-types and a minimal usage example in a comment.
Do not wire it into any page yet and do not modify other files.
When done, list the exported names and the file path.When to use: a fresh UI unit that should mirror an existing one. The @file anchor keeps conventions consistent.
3. Build-from-spec-file template
Implement the spec described in @file [PATH/TO/SPEC.md].
Treat that file as the source of truth. Before coding:
- Restate the spec as a checklist of acceptance criteria.
- List every file you expect to create or edit under [ALLOWED_PATHS].
- Flag anything in the spec that is ambiguous or conflicts with @file [PATH/TO/EXISTING_CODE].
Then implement it, run `[TEST_COMMAND]`, and iterate until the checklist is fully satisfied. Do not add features that are not in the spec.When to use: you already wrote a spec or ticket and want Cascade to execute it faithfully.
Debug & fix templates
Give Cascade the actual error text (via @terminal), a reproduction path, and permission to run commands. It reads the output and self-corrects. Start read-only in Chat mode for diagnosis, switch to Write mode to apply.
4. Root-cause-from-error template
I hit this error. Find the root cause before proposing a fix.
@terminal
@file [PATH/TO/FILE_IN_THE_STACK_TRACE]
@codebase [WHAT_THE_FAILING_FEATURE_DOES]
Symptom: [WHAT_YOU_EXPECTED] but [WHAT_ACTUALLY_HAPPENS].
Trigger: [STEPS_OR_COMMAND_THAT_PRODUCES_IT].
First explain the root cause in 2-3 sentences and which line is responsible.
Do NOT edit anything yet — wait for me to confirm the diagnosis.When to use: a stack trace you do not fully understand. Diagnosis-first prevents a blind patch. See more in Windsurf debugging prompts.
5. Reproduce-then-fix template
Fix the bug where [BUG_DESCRIPTION].
Step 1 — Reproduce: write a failing test at [PATH/TO/TEST_FILE] that captures the wrong behavior ([INPUT] should give [EXPECTED] but gives [ACTUAL]). Run it and show me it fails for the right reason.
Step 2 — Fix: change only what is needed in @file [PATH/TO/SUSPECT_FILE] to make that test pass. Do not touch unrelated files.
Step 3 — Verify: run `[TEST_COMMAND]` (the full suite) and confirm nothing else broke. Show the diff.When to use: any bug you can describe in terms of input and expected output. The captured test also prevents regressions.
6. Trace-across-codebase template
Trace how [DATA_OR_VALUE] flows from [ENTRY_POINT] to [WHERE_IT_GOES_WRONG]. Read-only — do not change any code.
@codebase [FEATURE_OR_MODULE_NAME]
@function [FUNCTION_OR_SYMBOL_NAME]
For each hop, list: the file and line, what transforms the value, and any place it could become [WRONG_STATE: null / undefined / stale / duplicated].
End with the single most likely point of failure and why.When to use: the bug spans many files and you need the map before touching anything. Run in Chat mode so nothing is edited.
Refactor templates
Refactors need one guardrail above all: no behavior change. Pin the tests as your safety net and forbid unrelated edits.
7. Safe-refactor (no behavior change) template
Refactor [WHAT: FUNCTION / MODULE / FILE] in @file [PATH/TO/FILE] to improve [READABILITY / DUPLICATION / NAMING / STRUCTURE].
Hard constraint: NO behavior change. Public API, inputs, and outputs stay identical.
Before starting, run `[TEST_COMMAND]` and confirm the suite is green.
After each change, run it again. If any test fails, revert that step.
Do not modify [DO_NOT_TOUCH_PATHS]. Show the diff and explain what improved and why it is behavior-preserving.When to use: tidy-ups where correctness must be provably unchanged. More at Windsurf refactoring prompts.
8. Extract and split template
@file [PATH/TO/BIG_FILE] is too large / mixes concerns. Split it.
Extract [WHAT: the X logic / the Y helpers] into [NEW_PATH]. Keep [WHAT_STAYS] in the original.
Update all imports across the repo so nothing breaks — use @codebase to find every reference.
Constraints: no behavior change, no new dependencies, keep public exports working. Run `[TEST_COMMAND]` after and show the file-by-file diff.When to use: a god-file or mixed-concern module. @codebase catches every importer.
9. Cross-file-rename template
Rename [OLD_NAME] to [NEW_NAME] everywhere it applies.
@codebase [OLD_NAME]
Cover: definitions, all usages, imports/exports, [OPTIONAL: strings, config keys, docs, test names]. Do NOT rename unrelated identifiers that merely contain the substring — only the intended [FUNCTION / CLASS / VARIABLE / FILE].
List every file you will change first. After renaming, run `[TEST_OR_TYPECHECK_COMMAND]` to confirm nothing dangles.When to use: a rename that IDE find-and-replace would botch (partial matches, strings, config).
Test templates
Cascade can write tests and run them, so always ask it to execute the suite and report results rather than just producing test code.
10. Write-and-run unit tests template
Write unit tests for @function [FUNCTION_OR_SYMBOL_NAME] in @file [PATH/TO/FILE].
Use [TEST_FRAMEWORK] and follow the patterns in @file [PATH/TO/EXISTING_TEST].
Cover: the happy path, [EDGE_CASE_1], [EDGE_CASE_2], and error/invalid input.
Put them at [PATH/TO/NEW_TEST_FILE].
Then run `[TEST_COMMAND]` and paste the results. If any fail, decide whether the test or the code is wrong, explain which, and fix accordingly.When to use: new or untested code. Pointing at an existing test file keeps style consistent.
11. Coverage-gap template
Find the biggest test-coverage gaps in [PATH/TO/MODULE] and close them.
@folder [PATH/TO/MODULE]
@terminal (I just ran the coverage report above)
List the untested branches/functions ranked by risk. Then write tests for the top [N] using [TEST_FRAMEWORK], run `[TEST_COMMAND]`, and report the new coverage. Do not change production code except to fix a genuine bug the new tests expose — flag any such bug separately.When to use: you have a coverage report and want the highest-value tests first.
12. Regression-test-after-fix template
We just fixed [BUG_DESCRIPTION] in @git (see the recent diff). Add a regression test so it can never silently return.
Write a test at [PATH/TO/TEST_FILE] that fails on the OLD behavior and passes on the current fix. Name it clearly for [BUG_ID_OR_DESCRIPTION].
Run `[TEST_COMMAND]` to confirm it passes now, then briefly confirm it would have caught the original bug.When to use: immediately after fixing something, using @git to reference the just-made change.
Review & ship templates
Use @git to feed Cascade the exact diff, and keep review templates in Chat mode so it critiques without silently rewriting your work.
13. Diff-review template
Review my uncommitted changes as a senior reviewer. Read-only — do not edit.
@git
For each issue give: file:line, severity ([blocker / warning / nit]), the problem, and a concrete fix. Check specifically for: [BUGS / EDGE_CASES], [ERROR_HANDLING], [NAMING / READABILITY], [PERFORMANCE], and anything that violates our rules in @file [PATH/TO/.windsurfrules]. End with a go / no-go verdict.When to use: a self-review before you commit or open a PR.
14. Security-pass template
Do a focused security review of @git (or @folder [PATH/TO/AREA]). Read-only.
Check for: injection ([SQL / command / XSS]), missing authn/authz on [ENDPOINTS_OR_ACTIONS], secrets or keys committed in code, unsafe deserialization, unvalidated [USER_INPUT], and insecure defaults.
For each finding: severity, exact location, exploit scenario in one line, and the minimal fix. Ignore style; security only.When to use: before shipping anything that touches auth, input, or external data.
15. Commit-message and PR-description template
Read my staged changes and draft release text.
@git
1. A [CONVENTIONAL_COMMITS?] commit message: a <=72-char subject plus a body explaining WHAT and WHY.
2. A PR description with sections: Summary, Changes, How to test, Risk/rollback, [LINKED_ISSUE].
Keep it factual to the diff — do not invent changes that are not there. Do not modify any code.When to use: the final step before pushing. Grounding it in @git keeps the text honest.
Config templates
These skeletons go into Windsurf’s durable config so you stop repeating yourself: .windsurf/rules for conventions, .windsurf/workflows for repeatable recipes, and Memories for facts that outlive a session. Remember precedence: Global Rules → .windsurfrules → Memories → your prompt.
16. Reusable .windsurfrules / rule-file skeleton
---
trigger: [always_on | manual | model_decision | glob]
# if trigger is glob:
globs: [PATTERN, e.g. src/**/*.ts]
# if trigger is model_decision, describe when to load:
description: [WHEN CASCADE SHOULD APPLY THIS RULE]
---
# [RULE_TITLE, e.g. TypeScript conventions]
- Language / framework: [STACK].
- Style: [FORMATTER / LINT RULES]; never [BANNED_PATTERN].
- Errors: [HOW ERRORS ARE HANDLED].
- Tests: put tests in [PATH]; run `[TEST_COMMAND]` before claiming done.
- Do not touch: [PROTECTED_PATHS].
- When unsure which files matter, use @codebase first.When to use: save as .windsurf/rules/[name].md (scoped) or repo-root .windsurfrules (project-wide). Best practice is a short always-on rule that says “follow the matching glob rules” plus several scoped glob files.
17. /workflow skeleton
---
description: [ONE LINE: what this workflow does, e.g. set up, test, and open a PR]
---
# /[workflow-name]
Follow these steps in order. Stop and report if any step fails.
1. [STEP_1, e.g. run `npm install` and `npm run build`].
2. [STEP_2, e.g. run `[TEST_COMMAND]`; if red, fix and re-run].
3. [STEP_3, e.g. update @file [CHANGELOG_PATH] with a one-line entry].
4. [STEP_4, e.g. draft a commit message from @git and show it].
Do not modify [PROTECTED_PATHS]. Summarize what you did at the end.When to use: save at .windsurf/workflows/[workflow-name].md and invoke with /[workflow-name]. Make one whenever you would otherwise retype the same multi-step prompt weekly.
18. Create-a-memory skeleton
Create a memory: [SINGLE DURABLE FACT ABOUT THIS PROJECT].
Examples of the shape to fill in:
- "This project uses [PACKAGE_MANAGER]; the test command is `[TEST_COMMAND]`."
- "[MODULE] must never import from [OTHER_MODULE]."
- "Deploys go through [PROCESS]; never edit [GENERATED_PATH] by hand."
Keep it to one or two sentences so it stays cheap to load every session.When to use: a fact you keep re-explaining. Memories are workspace-scoped and survive across sessions, removing the warm-up prompt. For the full mechanics, see the Windsurf prompt cheat sheet.
Frequently Asked Questions
How do I use these Windsurf prompt templates?
Copy a template into the Cascade pane, replace every [BRACKETED_PLACEHOLDER] with your specifics (file paths, criteria, goal), delete lines you do not need, then send. Each skeleton already references real Windsurf mechanics like @-mentions, Write/Chat mode, and acceptance criteria, so you only fill the blanks.
What is the difference between Write mode and Chat mode?
Write mode is agentic: Cascade edits files and runs terminal commands. Chat (Ask) mode is read-only for questions and planning. Use Chat mode for the trace and review templates, and Write mode for build, fix, refactor, and test templates.
Which @-mentions do the templates rely on?
The templates use @codebase for repo-wide semantic search, @file and @folder for exact files, @function or a symbol name for one unit, @docs for library docs, @terminal for recent output, and @git for diffs and commit context. Swap in the mention that matches what Cascade should read.
Should I put templates in Rules, Workflows, or paste them as prompts?
Paste one-off templates directly into Cascade. If you repeat a template weekly, turn it into a .windsurf/workflows file invoked with /workflow-name. Put durable conventions into .windsurf/rules or .windsurfrules so you stop restating them in every prompt.
Why include acceptance criteria in every build template?
Acceptance criteria give Cascade a testable definition of done, such as npm test passes with no new failures. Because Cascade runs commands and reads output, a concrete finish line lets it self-correct until the criteria are met instead of stopping early.
Do these templates work with any model?
Yes. You pick the model per Cascade chat (Claude Opus 4.8, Sonnet 5, GPT-5.x, Gemini, or a fast/auto option). The templates are model-agnostic because they focus on context and scope, which matter more than model choice.