Windsurf Prompts for Security Engineers
Security engineers need help reviewing code and configs for vulnerabilities, drafting threat models, writing detection rules, and summarizing incidents for different audiences. These Windsurf prompts start from that: fill in your situation once and reuse it. The worked example below is a security review task, one of the most common for security engineers.
I'm a security engineer and need help with [task, e.g. security audits]. What I have: - [the material involved: code, draft, notes or data] What a good result looks like: - [the outcome and its format] Ask me one clarifying question if something important is missing, then give the result. About my work - System and exposure: [e.g. public REST API, handles payment data, behind a WAF] - Scope and authorization: [e.g. internal code review, authorized pentest of staging only] - Standards to map to: [e.g. OWASP Top 10, SOC 2 controls, internal policy] Context - Files involved: [list the files, or reference them in the chat] - How I build and test: [e.g. npm test]
How to use this prompt
- 1
Open Windsurf
Open the Cascade panel in Windsurf and paste the prompt.
- 2
Give it context
Mention the files, folders or functions involved so Cascade starts from the right place in your codebase.
- 3
Review and iterate
Cascade can edit several files and suggest terminal commands. Review each change and command before you accept it.
- 4
Save what you repeat
Save conventions you repeat as rules so Cascade applies them without being told each time.
Working in Windsurf
- •Cascade acts on your workspace, so say which parts it must not touch.
- •Ask for a short plan before edits on anything larger than one file.
- •Run your tests after it finishes and paste failures back into the same conversation.
Example task: Security Review
What you give it
Framework: Python, Flask, sqlite3
What it does: returns a user's id and email by name.
Who can reach it: anyone on the internet.
@app.route("/user")
def get_user():
name = request.args.get("name")
row = db.execute("SELECT id, email FROM users WHERE name = '" + name + "'").fetchone()
return {"id": row[0], "email": row[1]}What a good answer looks like (shortened)
High: SQL injection (the db.execute line)
Exploit: a request with name set to ' OR '1'='1 returns the first user, and crafted UNION payloads can read other tables.
Fix: use a parameterized query.
row = db.execute("SELECT id, email FROM users WHERE name = ?", (name,)).fetchone()
Medium: email exposed with no authentication
Exploit: anyone can collect user emails by guessing names.
Fix: require login and return email only to the account owner or an admin.
Low: unhandled missing user
If no row matches, row[0] raises and returns a 500 that may leak a stack trace in debug mode.
Fix: if row is None: return {"error": "not found"}, 404Tips for better results
- •State the exposure (who can reach the system and what data it holds) before asking for a review. Severity ratings mean little without it.
- •Mention the files, folders or functions involved so Cascade starts from the right place in your codebase.
- •Check this before you use the output: remove secrets and customer data before pasting anything, and confirm every reported vulnerability is real before filing it, since false positives waste remediation time.
Check before you use it: Remove secrets and customer data before pasting anything, and confirm every reported vulnerability is real before filing it, since false positives waste remediation time.
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Task
Security Review: Replace the first line with: Do a security review of the code below.
Threat model first
Add this line to Instructions: Before reviewing, list the three most likely attackers and what each would want from this code.
Second task
Change the task line to: [Vulnerability assessments].
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;security-windsur in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;security-windsur.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
Can AI replace a manual security review?
No. It is good at spotting common patterns like injection or missing auth checks, but it misses business logic flaws and context-specific risks. Use it as a first pass alongside tooling and human review.
Will Windsurf change files on its own?
Cascade proposes edits and commands, and you review them. Asking for a plan first, as the prompt does, makes those changes easier to check.
How do I stop Cascade from changing unrelated code?
List the files it may edit in the prompt and add a line such as "Do not modify any other files."
How do I reuse this prompt without copying it every time?
Click Add to Retext to save it as a snippet. Then type ;security-windsur in any Mac app, including your AI tool, and the full prompt is pasted in.
Related Templates
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.