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
.cursor/rules/directory-structure.mdcWhat 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.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/directory-structure.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/directory-structure.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/directory-structure.mdManually: put the files in place
.clinerules/directory-structure.mdStep 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.