Repository folder and file layout: dot-prefixed folders for project material outside the application architecture (.docs/, .docker/), the Markdown files allowed at the root, the agent instructions in one of two layouts (AGENTS.md with .agents/, or CLAUDE.md with .claude/), the root file as a short index of the profile, the standing instructions, and the rules, skills, and hooks, lowercase rule files such as rules/git.md, how Claude Code loads each layout, a second root file that only points t...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Repository Structure?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/the-up-repository-structure)
---
name: repository-structure
description: "Repository folder and file layout: dot-prefixed folders for project material outside the application architecture (.docs/, .docker/), the Markdown files allowed at the root, the agent instructions in one of two layouts (AGENTS.md with .agents/, or CLAUDE.md with .claude/), the root file as a short index of the profile, the standing instructions, and the rules, skills, and hooks, lowercase rule files such as rules/git.md, how Claude Code loads each layout, a second root file that only points to the index, the files Git tracks and the personal ones it doesn't, and one command per code block in Markdown so each step copies and runs on its own. Load when adding a folder, a Markdown file, agent instructions, a rule, a skill, or a hook, or commands to a Markdown file."
---
# Repository Structure
- Start folders that relate to the project but aren't part of the application architecture with a dot (for example `.docs/`, `.docker/`).
- Keep only standard Markdown files at the root: `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, `AGENTS.md`, `CLAUDE.md`. Put other Markdown files under `.docs/`.
- Keep the instructions for the AI agents that work on a repository in one of two layouts, and don't mix them: `AGENTS.md` at the root with an `.agents/` folder, or `CLAUDE.md` at the root with a `.claude/` folder. Keep the layout the repository has; in a repository with neither, use `AGENTS.md` with `.agents/`, because most coding agents read it. When a repository mixes the two, for example with a second root file that holds instructions of its own, or names its files another way, don't move or rewrite them during another task: report it and propose the cleanup as separate work, such as moving the second file's content into the index, as the [Core Rules](../core-rules/SKILL.md) say.
- Make the root file an index, not the rule book: the project's profile, as the [Project Profile](../project-profile/SKILL.md) rules describe, the standing instructions that hold for every task, as the [Task Management](../task-management/SKILL.md) rules describe, and a list of the rule files, skills, and hooks with a line each on when to read it. Keep it under 200 lines: it loads into every session and comes back after compaction, so each of its lines costs context every time, and a longer file is followed less well. That's also why what holds for every task goes into the index itself: what's read only on demand doesn't come back after compaction.
- Keep everything else under the folder, so that the index stays short, and give it lowercase kebab-case names: `rules/<topic>.md`, one topic per file, such as `rules/git.md` or `rules/production.md`; `skills/<name>/SKILL.md`; and `hooks/<name>.<ext>`. The index and `SKILL.md`, whose name the skill format fixes, are the only uppercase names. A repository with `AGENTS.md` looks like this:
```text
AGENTS.md
.agents/
rules/
git.md
production.md
skills/
release/
SKILL.md
hooks/
check-branch.sh
.claude/
settings.json
```
A repository with `CLAUDE.md` looks like this:
```text
CLAUDE.md
.claude/
rules/
git.md
production.md
skills/
release/
SKILL.md
hooks/
check-branch.sh
settings.json
```
- Claude Code reaches the two layouts differently, so write each one for the way it's read:
- **`.claude/`:** Claude Code loads the rules by itself. A rule without `paths` loads at launch in every session, and a rule with a `paths` field in its frontmatter loads when Claude reads, writes, or edits a file that matches it, so give a rule `paths` when it covers only part of the code. Claude Code discovers the skills in `.claude/skills/`, and `.claude/settings.json` wires the hooks.
- **`.agents/`:** Claude Code loads nothing under it by itself, neither the rules nor the skills: the index's list is what gets a rule or a skill read, so each line there says when to read the file. Such a repository keeps only its settings files under `.claude/`, which Claude Code reads only there, for the hook wiring and the permissions.
- When a repository has both root files, the one that matches its folder is the index and the other only points to it: with `.agents/`, `CLAUDE.md` is the single line `@AGENTS.md`, which makes Claude Code load `AGENTS.md` with it at launch; with `.claude/`, `AGENTS.md` is a single line that sends other agents to `CLAUDE.md`. When the other file already holds instructions of its own, it's the mixed layout described above: leave it as it is during another task, and propose moving its content into the index as separate work.
- By default Claude Code reads `AGENTS.md` only when there's no `CLAUDE.md`, `.claude/CLAUDE.md`, or `CLAUDE.local.md` in the working directory or a folder above it, so without that import, or the user setting from the [Machine Setup](../machine-setup/SKILL.md) rules, an `AGENTS.md` index and the profile in it don't reach the session. The import helps only for a root `CLAUDE.md`: a `.claude/CLAUDE.md`, a `CLAUDE.local.md`, or a `CLAUDE.md` in a folder above the repository hides `AGENTS.md` too, and there only the user setting loads it.
- Make sure Git tracks the index, the second root file that only points to it, the `rules/`, `skills/`, and `hooks/` folders, and `.claude/settings.json`, because a repository may ignore `.claude/`, and the second root file's pointer, such as the `@AGENTS.md` line, reaches other people's sessions only when it's committed. Leave `.claude/settings.local.json` and `CLAUDE.local.md` untracked, because they belong to one person.
- In every Markdown file, such as a README, an `AGENTS.md`, or a skill, put each command the reader runs in its own fenced code block tagged with its shell (`bash`, `powershell`), one block per step, so that copying a block copies one command and pasting it runs. Don't stack several commands in one block: copied together, they reach the terminal as one line and fail. A single command that spans lines, such as a heredoc or a `\` continuation, stays in one block.