Skip to main content
rule CX Codex

directory-structure — Claude Code rule: what it does, how to install

directory-structure defines a standard top-level repository layout for your AI coding assistant, mapping source files, tests, and configuration.

no license ★ 1,054 updated 2025-07-17

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/directory-structure.mdc
Open on GitHub

What directory-structure does

The rule outlines the project tree using a Mermaid diagram. It establishes standard locations for application code in src/, test suites in test/, shared helpers in utils/, configurations in config/, and data files in data/.

It also reserves directories for project tasks, documentation in docs/, and assistant configuration folders such as .clinerules. Because alwaysApply is set to false, the assistant references this layout only when project structure decisions arise.

What it helps with

  • organize newly created files into standard project folders
  • separate documentation, tests, and configuration cleanly
  • guide the AI agent when generating top-level directories

Example prompts for the agent

  • Set up a new repository layout following the directory structure rule
  • Where should I place integration tests according to the project layout?
  • Review our project tree against directory-structure

How to install directory-structure

Manually: put the files in place

.cursor/rules/directory-structure.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about directory-structure

How to install directory-structure in Claude Code?

Save the rule file to .claude/rules/directory-structure.md in your project repository.

What does directory-structure define?

It provides a top-level directory layout mapping folders like src/, test/, config/, and docs/.

Does the rule run on every prompt?

The frontmatter specifies alwaysApply: false, so the model only pulls the layout when folder structure is relevant.

Similar IDE rules

All IDE rules for Agent setup: memory, context, orchestration →

From the same set11

The whole set →
architecture-understanding The architecture-understanding rule has the agent read docs/architecture.md and check code changes against its architecture. Use it when a project documents its design in a Mermaid diagram. CX Codex +1 ★ 1,054repo stars debug The debug rule sets the order for troubleshooting: gather evidence and context, explain the cause, then edit code. It applies when an error persists or a fix is incomplete. CX Codex +1 ★ 1,054repo stars cursor-rules-location cursor-rules-location keeps repository rule files organized by rejecting any .mdc files created outside the .cursor/rules directory. CX Codex +1 ★ 1,054repo stars develop-mcp-server The develop-mcp-server rule structures MCP server work from planning to validation, with setup guidance for Node.js and Python projects. CX Codex +1 ★ 1,054repo stars plan Makes the agent read your docs, task notes and source before planning, ask clarifying questions, and only then propose a solution. CX Codex +1 ★ 1,054repo stars implement implement enforces a strict coding protocol with dependency checks, step-by-step edits, simulation passes, and automated test coverage before finalizing changes. CX Codex +1 ★ 1,054repo stars memory This rule organizes project memory across docs/, tasks/, and .cursor/rules/. It helps an agent retain plans, context, errors, and project decisions between tasks. CX Codex +1 ★ 1,054repo stars memory Keeps project memory in a fixed set of files the agent reads before work: requirements, architecture, stack, task plan, current state. CX Codex +1 ★ 1,054repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open