agentleFS
HKTITANHKTITAN/cursor-best-practices/.cursor/rules/codebase-structure.md

cursor-best-practices / rules

Cursor rule7 starsChanged 10 months agoMITView on GitHub

Codebase structure and organization for cursor-best-practices skill repository. Understanding repository layout, file organization, skill structure, rule files, commands, agents, references, indexes. How to navigate this codebase, find files, understand organization, work with skill structure.

The file

We split this codebase-structure.md into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create file in appropriate rules/ subdirectory

    line 97
  2. Very specific:

    Use rules/_template.md as template

    line 98
  3. Very specific:

    Add entry to rules/_sections.md

    line 99
  4. Distinctive:

    Update relevant index files

    line 100
  5. Distinctive:

    Update when adding major sections

    line 107
  6. Very specific:

    Check rules/_sections.md for categorized list

    line 111
  7. Very specific:

    Use indexes/query-index.md for query mapping

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
codebase-structure.md

Codebase Structure

This repository is a Cursor Agent Skill that provides best practices for using Cursor.

Repository Layout

cursor-best-practices/
├── README.md                    # Main documentation
├── CHANGELOG.md                 # Version history
├── CONTRIBUTING.md              # Contribution guidelines
├── LICENSE                      # MIT license
├── metadata.json                # Skill metadata
├── .gitignore                   # Git ignore patterns
├── .cursor/                     # Project-specific Cursor config
│   ├── AGENTS.md               # This codebase guide
│   └── rules/                  # Project-specific rules
└── cursor-best-practices/       # Actual skill content
    ├── SKILL.md                # Main skill file
    ├── rules/                  # 250+ rule files
    ├── commands/               # Command templates
    ├── agents/                 # Subagent templates
    ├── skills/                 # Skill recommendations
    ├── references/             # Deep-dive guides
    └── indexes/                # Navigation indexes

Skill Structure

The skill follows the Agent Skills Specification:

  • SKILL.md - Main skill file with frontmatter (name, description, license, metadata)
  • rules/ - Rule files organized by category
  • commands/ - Optional command templates
  • agents/ - Optional subagent templates
  • references/ - Optional deep-dive guides
  • indexes/ - Optional navigation indexes

File Organization

Rules Directory

Rules are organized by category:

  • agent/ - Agent modes, patterns, use cases
  • context/ - Rules, commands, MCP, skills, subagents, semantic search, mentions
  • features/ - Tab, Inline Edit, Bugbot, CLI, Cloud, Transcripts
  • integrations/ - GitHub, Slack, GitLab, Linear, Git, Deeplinks
  • configuration/ - Extensions, ignore files, languages, migrations, shell, shortcuts, themes
  • cookbook/ - Examples, patterns, workflows
  • troubleshooting/ - Common issues and solutions
  • get-started/ - Quickstart, concepts, models, pricing

Rule File Format

Each rule file:

  • Has frontmatter with description, tags, optional globs
  • Follows Do/Don't or Incorrect/Correct pattern
  • Includes "Related Queries" section
  • Links to related rules in "See Also"
  • Kept under ~500 lines

Commands Directory

Command templates:

  • Plain Markdown files
  • Filename = command name (e.g., code-review.md → /code-review)
  • Users copy these to their .cursor/commands/ folder
  • Include clear instructions and examples

References Directory

Deep-dive guides:

  • Longer narrative content
  • Comprehensive explanations
  • Linked from SKILL.md
  • Cover complex topics in detail

Indexes Directory

Navigation indexes:

  • Help users discover relevant content
  • Map queries to rules
  • Organize by feature, use case, pattern
  • Enable quick discovery

Working with This Codebase

Adding a Rule

  1. Create file in appropriate rules/ subdirectory
  2. Use rules/_template.md as template
  3. Add entry to rules/_sections.md
  4. Update relevant index files
  5. Ensure keyword-rich frontmatter

Modifying SKILL.md

  • Keep under ~500 lines
  • Link to rules/, commands/, agents/, skills/, references/
  • Update when adding major sections

Finding Content

  • Check rules/_sections.md for categorized list
  • Use indexes/query-index.md for query mapping
  • Browse by category in rules/ subdirectories
  • See references/ for deep dives

Key Principles

  1. One practice per file - Each rule covers one specific practice
  2. Keyword-rich descriptions - Help with relevance matching
  3. Clear organization - By category and use case
  4. Link, don't duplicate - Reference guides link to rules
  5. User-focused - Help users understand and use Cursor

Deep Understanding

For Cursor to understand this codebase at the deepest level:

  1. Read AGENTS.md first - Comprehensive codebase guide with architecture details
  2. Understand architecture - See .cursor/rules/architecture-and-design.md for design decisions
  3. Follow content patterns - See .cursor/rules/content-patterns.md for writing conventions
  4. Check maintenance guidelines - See .cursor/rules/skill-maintenance.md for workflow
  5. Review SKILL.md - Main skill file with overview and navigation
  6. Browse rules/_sections.md - Complete rules index organized by category
  7. Use indexes - Multiple discovery paths in indexes/ directory
  8. Check codebase index - See .cursor/indexes/codebase-index.md for quick reference

See Also

  • AGENTS.md - Deep codebase guide with comprehensive details
  • Architecture and Design - Design decisions and rationale
  • Content Patterns - Writing conventions and patterns
  • Skill Maintenance - Maintenance guidelines
  • Codebase Index - Quick navigation reference
  • Rules
  • Commands
  • Agent Skills Specification
  • skills.sh Documentation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.