Context Files for Every AI Tool

Tool-specific configuration files that teach AI coding assistants to follow your engineering standards automatically.

Why Context Files Matter

AI coding assistants like Cursor, Claude, and GitHub Copilot are powerful, but without proper guidance, they can:

  • Commit secrets - API keys, passwords, and credentials directly in code
  • Generate inconsistent code - Different styles, no type hints, poor documentation
  • Introduce security vulnerabilities - SQL injection, XSS, insecure configurations
  • Skip best practices - No error handling, improper file operations, unsafe scripts

Context files solve this problem by teaching AI assistants your project's standards, security requirements, and coding conventions. Each AI tool reads its specific configuration format automatically.

Cursor (.cursor/rules/*.mdc)

Configuration Format

Cursor uses .mdc (Markdown Configuration) files with scoped rules and priorities.

---
title: Security Standards
priority: 100
scope: "**/*"
---

# NEVER Commit Secrets

 API keys, tokens, passwords
 Private keys (SSH, TLS)
 Use .env files (gitignored)

## Example: Proper Secret Handling
import os
api_key = os.environ.get("API_KEY")

📍 When These Files Are Used

Cursor automatically loads all .mdc files in .cursor/rules/ when:

  • Opening the project
  • Creating new files
  • Editing existing code
  • Generating completions

Files Included

  • 001_workspace.mdc - Repository context and structure
  • 002_design_principles.mdc - Core architectural principles
  • 003_bash_standards.mdc - Shell scripting standards
  • 004_python_standards.mdc - Python coding conventions
  • 005_yaml_json_standards.mdc - Data format guidelines
  • 006_security.mdc - Security requirements (HIGHEST PRIORITY)
  • 007_precommit.mdc - Pre-commit workflow
  • 008_documentation.mdc - Documentation standards

Priority System

Rules have priorities (0-100). Higher priority rules override lower ones:

  • 100 - Security (always enforced)
  • 80 - Critical standards (bash, Python)
  • 50 - General guidelines
  • 10 - Suggestions and preferences

Claude Desktop (CLAUDE.md)

Configuration Format

Claude Desktop reads CLAUDE.md for comprehensive, conversational instructions.

# AI Coding Assistant Guidelines

You are assisting with a professional software engineering project.
Follow these standards:

## Security (CRITICAL)
 NEVER commit API keys, passwords, or credentials
 ALWAYS use environment variables

## Code Quality
- Python: Type hints required for public functions
- Bash: Use set -euo pipefail
- All code must pass pre-commit hooks

📍 When This File Is Used

Claude Desktop reads CLAUDE.md when:

  • Starting a new conversation in the project directory
  • You explicitly mention the file
  • Claude needs context about project standards

Tip: Add to your prompt: "Please read CLAUDE.md first"

Claude Projects (.claudeprompt)

Configuration Format

Claude Projects uses .claudeprompt for single-line configuration.

You are a professional software engineer. Read CONTEXT.md for standards. Never commit secrets. All code must pass pre-commit hooks. Use type hints in Python and set -euo pipefail in Bash.

📍 When This File Is Used

.claudeprompt is loaded automatically for every Claude Projects conversation.

GitHub Copilot (.github/copilot-instructions.md)

Configuration Format

GitHub Copilot reads instructions from .github/copilot-instructions.md.

# Copilot Instructions

## Security Rules
- Never generate hardcoded secrets
- Use environment variables for credentials
- Validate all user inputs

## Code Style
- Python: Use type hints and docstrings
- JavaScript: Use const/let, never var
- Always include error handling

📍 When This File Is Used

GitHub Copilot reads this file continuously while coding:

  • During code completions
  • When generating new functions
  • During Chat interactions

Aider (.aider/.aider.conf.yml)

Configuration Format

Aider uses YAML configuration with auto-read files.

auto-commits: true
read:
  - CONTEXT.md
  - CONTRIBUTING.md
lint-cmd: "pre-commit run --files"
test-cmd: "pytest tests/"

📍 When This File Is Used

Aider loads .aider.conf.yml on startup and:

  • Automatically reads specified files into context
  • Runs lint commands before commits
  • Executes test commands after changes

Continue.dev (.continue/config.yaml)

Configuration Format

Continue.dev uses a comprehensive YAML configuration with rules, prompts, and context providers.

rules:
  - "Read CONTEXT.md for coding standards"
  - "Never commit secrets or credentials"
  - "All commits must pass pre-commit hooks"

customCommands:
  - name: "review"
    prompt: "Review this code for security issues"
  - name: "test"
    prompt: "Generate unit tests for this function"

contextProviders:
  - "code"
  - "diff"
  - "terminal"

📍 When This File Is Used

Continue.dev loads config when:

  • VS Code/JetBrains IDE starts
  • Project is opened
  • Custom commands are invoked
  • Context is being gathered

Windsurf (.windsurfignore + .vscode/settings.json)

.windsurfignore

Exclude files from AI context (like .gitignore for AI).

# Dependencies
node_modules/
venv/
.venv/

# Build outputs
dist/
build/
*.pyc

# Large files
*.log
*.db

.vscode/settings.json

Configure formatters and linters for Windsurf.

{
  "python.formatting.provider": "black",
  "python.linting.enabled": true,
  "editor.formatOnSave": true,
  "files.exclude": {
    "**/__pycache__": true,
    "**/.pytest_cache": true
  }
}

📍 When These Files Are Used

Windsurf uses these files continuously:

  • .windsurfignore - Filters files from AI context
  • .vscode/settings.json - Configures editor behavior
  • Both are loaded when opening the project

Setup Guide

Quick Setup (All Tools)

# Clone the Guardrails-AI repository
git clone https://github.com/christopherpaquin/Guardrails-AI .ai-guardrails

# Copy context files
cp .ai-guardrails/AGENTS.md .
cp .ai-guardrails/CONTEXT.md .
cp .ai-guardrails/CONTRIBUTING.md .

# Copy tool-specific configs
cp .ai-guardrails/.cursor/ . -r          # Cursor
cp .ai-guardrails/CLAUDE.md .            # Claude Desktop
cp .ai-guardrails/.claudeprompt .        # Claude Projects
cp .ai-guardrails/.github/copilot-instructions.md .github/ # Copilot
cp .ai-guardrails/.aider/ . -r           # Aider
cp .ai-guardrails/.continue/ . -r        # Continue.dev
cp .ai-guardrails/.windsurfignore .      # Windsurf
cp .ai-guardrails/.vscode/ . -r          # VS Code/Windsurf

Tool-Specific Setup

Cursor

  1. Copy .cursor/rules/ directory to your project root
  2. Open project in Cursor - rules load automatically
  3. Verify: Start typing code, Cursor should follow standards

Claude Desktop

  1. Copy CLAUDE.md to your project root
  2. Open Claude Desktop in the project directory
  3. Prompt: "Please read CLAUDE.md first, then help me..."

GitHub Copilot

  1. Create .github/copilot-instructions.md
  2. Copy content from the guardrails repo
  3. Restart VS Code - Copilot reads it automatically

Verification

Test that context files are working:

# Test 1: Ask AI to create a script with secrets
# Expected: AI should refuse and suggest environment variables

# Test 2: Ask AI to write Python without type hints
# Expected: AI should include type hints automatically

# Test 3: Ask AI to write a bash script
# Expected: Should include set -euo pipefail

Ready to Get Started?

Clone the repository and set up context files in 2 minutes.

View on GitHub