Windsurf AI Rules

How to write Windsurf
AI rules and system prompts

Windsurf's Cascade AI has strong multi-file context awareness by default. Learn how .windsurfrules files and global settings configure Cascade to work safely and consistently across your entire codebase.

⏱ 9 min read Updated 2026 Works with Windsurf on all platforms
Quick start

How to add rules to Windsurf

Windsurf uses a .windsurfrules file in your project root. Here is the fastest way.

1
Create .windsurfrules in your project root directory
2
Add rules in plain text or markdown - language preferences, architecture context, scope limits
3
Open Windsurf Settings → AI → Rules for global rules across all projects
4
Open a new Cascade session to load your rules and test with a coding task
Build your Windsurf prompt free →
12
AI tools covered
3
Prompt types built
5min
To your first prompt
$0
To start
Windsurf .windsurfrules file location and global Settings
Windsurf — .windsurfrules (project root) + Settings → AI → Rules (global)Use TypeScript. Prefer functional components. Never modify files outside scope.Write tests for all new functions. Ask before adding dependencies.Architecture: [describe your stack and patterns here]...

How Windsurf uses system prompts via rules

Windsurf AI rules are system prompts that configure Cascade - Windsurf's AI engine - to understand your codebase, follow your coding standards, and operate safely within the boundaries you define. Windsurf differs from Cursor in a key way: Cascade has stronger default multi-file awareness, understanding how files relate to each other without requiring explicit scope definitions in every request.

Cascade's default multi-file understanding
Windsurf's Cascade reads your entire project structure before responding. It understands imports, dependencies, and how components relate without being explicitly told. Your .windsurfrules should focus on standards and preferences rather than spending all the rule budget on scope restrictions that Cascade handles naturally.

What to include in .windsurfrules

Organize your .windsurfrules with clear markdown section headers. Cover three categories:

# Tech stack
- TypeScript for all new files, strict mode enabled
- React 18 with functional components and hooks
- Tailwind CSS for styling, no CSS modules
- Zustand for state management

# Architecture
- Components live in src/components/, organized by feature
- API calls go through src/lib/api/ using the existing client
- Auth is handled by src/lib/auth/ - do not reimplement it
- Shared types are in src/types/ - check here before creating new ones

# Safety
- Ask before refactoring more than the file I specify
- Ask before adding new dependencies
- Write tests for all new utility functions
- If uncertain about the right approach, present options rather than guessing
💡
Commit .windsurfrules to your repository
Committing the file ensures every team member who uses Windsurf on the project gets the same context and safety rules. Keep personal preferences in a global config rather than .windsurfrules so team-specific rules do not include individual preferences.

Common questions

Does .windsurfrules support markdown formatting?

Yes. Cascade understands both plain text and markdown. Using headers, bullet points, and code blocks makes the rules more readable for both Cascade and your team.

How does Windsurf compare to Cursor for large codebases?

Windsurf's Cascade tends to have stronger default context awareness across large projects. Cursor offers more granular rule scoping with multiple .mdc files. For most projects both are effective. See our Cursor guide for comparison.

Can I have different rules for different branches?

Not directly - .windsurfrules applies at the repository level. For different instruction contexts, maintain separate .windsurfrules per project or use global settings for universal preferences.

Build your Windsurf system prompt now

Answer a short set of questions and get a master prompt engineered specifically for Windsurf. Free, no account needed.

Build free with Windsurf →

Windsurf prompts free · 3 builds/month · Pro is $19/month for unlimited builds and Advanced mode

System prompts optimized for
understandingAI · free newsletter
Get more from your AI tools
Practical tips on system prompts, prompt engineering, and getting real results from AI. No fluff.

No spam. Unsubscribe anytime.