English | Français | Español | 中文 | 日本語 | Русский
Usable AI coding-rule files for Cursor, Windsurf or Devin Desktop, GitHub Copilot, Claude Code, and cross-agent AGENTS.md setups.
The value of this repository is the rules/ directory: complete, opinionated, copy-pasteable rule configurations rather than abstract advice. The examples cover Python/FastAPI, TypeScript/React, and security-focused development.
| File | What it is |
|---|---|
| agents/AGENTS.python-fastapi.md | Tool-neutral AGENTS.md FastAPI policy |
| agents/AGENTS.security-focused.md | Tool-neutral AGENTS.md security policy |
| agents/AGENTS.typescript-react.md | Tool-neutral AGENTS.md React policy |
| claude-code/CLAUDE.security-focused.md | Claude Code root memory style security baseline |
| claude-code/rules-python-fastapi.md | Claude Code path-scoped Python rule |
| claude-code/rules-typescript-react.md | Claude Code path-scoped React rule |
| copilot/path-specific/python-fastapi.instructions.md | Copilot path-specific Python instructions with applyTo |
| copilot/path-specific/security-focused.instructions.md | Copilot path-specific security baseline with applyTo |
| copilot/path-specific/typescript-react.instructions.md | Copilot path-specific React instructions with applyTo |
| copilot/repo-wide/python-fastapi.copilot-instructions.md | Copilot repository-wide FastAPI instructions |
| copilot/repo-wide/security-focused.copilot-instructions.md | Copilot repository-wide security baseline |
| copilot/repo-wide/typescript-react.copilot-instructions.md | Copilot repository-wide React instructions |
| cursor/current/python-fastapi.mdc | Current Cursor project rule scoped to Python files |
| cursor/current/security-focused.mdc | Current Cursor security baseline scoped to all files |
| cursor/current/typescript-react.mdc | Current Cursor project rule scoped to TypeScript and React files |
| cursor/legacy/python-fastapi.cursorrules | Legacy root-file Cursor rules for a FastAPI service |
| cursor/legacy/security-focused.cursorrules | Legacy root-file Cursor security baseline |
| cursor/legacy/typescript-react.cursorrules | Legacy root-file Cursor rules for a React application |
| windsurf/legacy/python-fastapi.windsurfrules | Legacy Windsurf single-file rules for FastAPI |
| windsurf/legacy/security-focused.windsurfrules | Legacy Windsurf single-file security baseline |
| windsurf/legacy/typescript-react.windsurfrules | Legacy Windsurf single-file rules for React |
| windsurf/modern/python-fastapi.md | Modular Windsurf or Devin rule with glob activation |
| windsurf/modern/security-focused.md | Modular always-on Windsurf or Devin security baseline |
| windsurf/modern/typescript-react.md | Modular Windsurf or Devin rule with glob activation |
Cursor project rules live in .cursor/rules/ and must use the .mdc extension. Example:
mkdir -p .cursor/rules
cp /path/to/ai-coding-rules/rules/cursor/current/python-fastapi.mdc .cursor/rules/python-fastapi.mdc
cp /path/to/ai-coding-rules/rules/cursor/current/security-focused.mdc .cursor/rules/security-focused.mdcCursor uses frontmatter to decide when a rule loads:
---
description: FastAPI service conventions
globs: "**/*.py"
alwaysApply: false
---Important behavior:
alwaysApply: trueincludes the rule in every chat session.alwaysApply: falseplusglobsattaches it when matching files are in context.alwaysApply: falseplusdescriptionlets the agent select it when relevant.alwaysApply: falsewithout description or globs makes it manual.
Cursor's root .cursorrules file is the legacy single-file mechanism. The examples in rules/cursor/legacy/ are still useful as content sources, but new setups should prefer .cursor/rules/*.mdc because scoped activation keeps context smaller and more relevant.
Windsurf rules are in transition because the Windsurf product documentation now lives in the Devin documentation. Current guidance should be checked before rolling this out across a team, but the practical layout is:
.devin/rules/*.md: preferred modern location in current Devin documentation..windsurf/rules/*.md: legacy modular location that current versions continue to read as a fallback..windsurfrules: legacy single root file, still read for backward compatibility in documented setups.AGENTS.md: cross-agent markdown instructions.
Example modern installation:
mkdir -p .devin/rules
cp /path/to/ai-coding-rules/rules/windsurf/modern/python-fastapi.md .devin/rules/python-fastapi.md
cp /path/to/ai-coding-rules/rules/windsurf/modern/security-focused.md .devin/rules/security-focused.mdIf your team is still standardized on Windsurf's older layout, use .windsurf/rules instead. Do not load identical copies from both .devin/rules and .windsurf/rules; duplicate instructions waste context and can conflict after edits.
Legacy single-file installation:
cp /path/to/ai-coding-rules/rules/windsurf/legacy/python-fastapi.windsurfrules .windsurfrulesOnly one .windsurfrules file can exist at the root. If you need Python, React, and security rules together, merge them deliberately or use modular rules.
Repository-wide custom instructions live at:
.github/copilot-instructions.md
Path-specific instructions live at:
.github/instructions/NAME.instructions.md
Example installation:
mkdir -p .github/instructions
cp /path/to/ai-coding-rules/rules/copilot/repo-wide/security-focused.copilot-instructions.md .github/copilot-instructions.md
cp /path/to/ai-coding-rules/rules/copilot/path-specific/python-fastapi.instructions.md .github/instructions/python-fastapi.instructions.mdA path-specific file uses applyTo frontmatter:
---
description: Python FastAPI service standards
applyTo: "**/*.py, **/pyproject.toml"
---Copilot also supports reusable task prompts in .github/prompts/*.prompt.md; those are manually invoked and are different from always-on custom instructions.
Claude Code reads CLAUDE.md at session start. It can also read modular rules from .claude/rules/; rules with paths: frontmatter load when matching files are read, written, or edited.
Example installation:
cp /path/to/ai-coding-rules/rules/claude-code/CLAUDE.security-focused.md CLAUDE.md
mkdir -p .claude/rules
cp /path/to/ai-coding-rules/rules/claude-code/rules-python-fastapi.md .claude/rules/python-fastapi.mdClaude instructions are guidance, not enforcement. If a command or tool operation must be blocked regardless of model judgment, use permissions or hooks in .claude/settings.json as well.
AGENTS.md is increasingly useful as a shared baseline because several coding-agent harnesses read it. Example:
cp /path/to/ai-coding-rules/rules/agents/AGENTS.security-focused.md AGENTS.mdA practical multi-tool layout is:
AGENTS.md # stable cross-tool baseline
.cursor/rules/security.mdc # Cursor activation metadata and tool-specific details
.devin/rules/security.md # Devin or Windsurf activation metadata
.github/copilot-instructions.md # Copilot repository baseline
.github/instructions/*.instructions.md
CLAUDE.md # Claude Code root memory, or a thin pointer to AGENTS.md
.claude/rules/*.md
Avoid copying large bodies blindly into every file. Either maintain a generated sync process or keep tool files thin and point to canonical repository documentation.
Effective rules are:
- Specific: "Use parameterized SQL through the ORM query API" changes behavior; "write secure code" usually does not.
- Actionable: the agent can observe or perform the rule in a file, diff, test, or review.
- Scoped: language and framework rules load only where relevant. Security invariants may remain global.
- Short enough to survive context: one focused file is better than a style-guide dump. Windsurf documents a 12,000-character limit per modular rule file; even without a hard limit, context cost is real.
- Grounded in project reality: mention real architecture, commands, ownership, forbidden files, and canonical examples.
- Prioritized: state what is non-negotiable versus preferred. Otherwise every rule competes at the same strength.
- Tested: try tasks where the agent previously failed, then revise the rule based on observed behavior.
- Enforced outside the model when necessary: CI, type checkers, permissions, hooks, branch protection, and runtime validation beat instructions.
Rules usually fail for predictable reasons:
- They are too vague. Models cannot operationalize "be clean" or "use best practices."
- They are too long. Important constraints are diluted by generic advice the model already knows.
- They conflict. One file says always use async; another says use sync SQLAlchemy. The model picks one unpredictably.
- They are loaded at the wrong time. A React rule does not help if it is only manually invoked and nobody mentions it.
- They describe taste rather than risk. Models and reviewers pay more attention when the rule names the failure being prevented.
- They duplicate linters. If
ruff,eslint, or CI can enforce a rule, automate it there and keep AI context for judgment calls. - They are stale. A rule referencing dead commands or old frameworks teaches the agent to distrust all rules.
- They are treated as security boundaries. Natural-language instructions can reduce mistakes but cannot guarantee a tool will not be called.
| Rule type | Recommended activation | Why |
|---|---|---|
| Security baseline | Always-on where supported | Applies to every file and review, but keep it concise |
| Language rules | File glob | Python rules should not consume React context |
| Framework rules | File glob or model decision | Load when relevant files or tasks appear |
| Rare workflows | Manual | Database migration or release rules can be invoked only when needed |
| Architecture orientation | Always-on or AGENTS.md | Stable context the agent needs for almost every change |
- Start with the smallest security baseline and one stack-specific file.
- When the agent repeats a mistake, add a rule that would have prevented that exact mistake.
- Include the observable evidence: command, file pattern, invariant, or review behavior.
- Remove rules that linters, tests, type checkers, or platform controls now enforce better.
- Re-test after major tool updates. Rule file formats and activation behavior change.
- Review rule diffs like code. Rules influence every future generated change.
| Concern | Python/FastAPI | TypeScript/React | Security baseline |
|---|---|---|---|
| Boundary validation | Yes | Yes | Yes |
| Authorization and tenant isolation | Yes | Indirectly at client boundary | Yes |
| Secrets and logging | Yes | Yes | Yes |
| Testing behavior | Yes | Yes | Security-negative tests |
| Tool-specific activation | Cursor, Windsurf or Devin, Copilot, Claude | Cursor, Windsurf or Devin, Copilot, Claude | Cursor, Windsurf or Devin, Copilot, Claude, AGENTS.md |
MIT. See LICENSE.
Maintained by aixisstudio.