Table of Contents
- Agent AI rules
- Windsurf (as of April 2025)
- Cursor (as of April 2025)
- Best Practices and Tips
- Universal Code Style Guide
Agent AI rules
Agentic AI tools use rules to define and enforce configuration, workflow, or policy rules. Most tools support both global (applies to all workspaces) and project (applies to the current workspace) rules for flexible, hierarchical configuration. Each tool handles rules differently, so be sure to check the documentation for the tool you’re using.
This page is focused on Cursor and Windsurf.
Windsurf (as of April 2025)
Global Rules
This is a configuration of your Windsurf IDE for all projects. It’s not located in your workspace, but applies to all workspaces. You can find in Windsurf Settings -> Edit Global Rules.
Project Rule
The .windsurfrules file is a rule for a particular project. This file can be created in the root of your project and should be committed to your git repository.
If you have both global and project rules, the global rules will be applied first and the project rules will be applied second.
Both global and project rules are limited to 6000 characters each. More than that will be truncated. docs
Cursor (as of April 2025)
Global Rules
These are called User rules and are the Global rules for your Cursor IDE which applies to all projects. This file is found at Cursor Settings -> Rules -> User Rules.
Project Rules Directory
These are rules for a particular project. Adding a new Project file will create a directory at .cursor/rules in your project root, and the individual rule files will be put here. This .cursor directory should be committed to your git repository.
Rules have types and can be applied in different ways:
Always- Always included in the model contextAuto Attached- Included when files matching a glob pattern are referencedAgent Requested- Rule is available to the AI, which decides whether to include it. Must provide a descriptionManual- Only included when explicitly mentioned using@ruleName
If you have both global and project rules, the global rules will be applied first and the project rules will be applied second.
Try and keep rule files to under 500 characters, as a general target. docs
Best Practices and Tips
Most Agentic AI tools will have best practices of their own:
Some personal tips from folks here at Integrity:
- The more prescriptive your prompts are the less creative the Agent will be - can be a double edged sword.
- Be careful not to list contradictory rules which will create inconsistent responses.
- Test your rules and make sure they are working as expected.
Universal Code Style Guide
Integrity team members brainstormed and discussed a common Global ruleset for our cross-language codebases that can be used with any Agentic AI tool. We’ve provided the following set of rules in Universal code style guide for Agentic LLM usage. This is always open for discussion, and we expect it to evolve over time. We recommend you put this in the Global rules of your Agentic AI tool:
# Universal Code Style Guide for Agentic LLM usage
G.0.0.0 - When applying these guidelines, reference the specific rule id (e.g., "Applied G.4.0.0") in your response, but not in the code itself.
G.1.0.0 - Keep the codebase very clean and organized.
G.2.0.0 - Follow the DRY principle (Don't Repeat Yourself). Extract methods or variables rather than re-declaring.
G.3.0.0 - Follow the YAGNI principle (You Ain't Gonna Need It). Avoid adding code that is not used or needed to accomplish the current goal.
G.4.0.0 - Follow the KISS principle (Keep It Stupid Simple). Prefer simple solutions that don't have the average developer think too hard to understand.
G.5.0.0 - Follow the Single Responsibility Principle, avoid mutation, and prefer immutability.
G.6.0.0 - Add code comments only when they provide meaningful context, explain complex logic, or clarify intent.
G.7.0.0 - Prefer type declaration of variables and functions (parameters and return value) if the language supports them.
G.8.0.0 - Consider what other methods and areas of code might be affected by code changes.
G.9.0.0 - Never modify an .env file without asking permission.
G.10.0.0 - Avoid magic numbers by defining constants.
G.11.0.0 - Edit only what is requested and when you well understand what is being changed and how it relates to what was asked for.
G.12.0.0 - Avoid making major changes to the patterns, architecture, and technology of how a feature works after it has been shown to work well, unless explicitly instructed.
# Command Execution
When a prompt begins with `/t ` or `/terminal ` then execute all text after as a terminal command, and you don't need to announce it.