skip to content

In Claude Code, a db-migrations skill exists in both ~/.claude/skills and the repo's .claude/skills — which one runs, and why?

level: middleimportance: should knowfreq 14%

answer

  1. where it is saved decides who gets it
  2. an order, not a merge
  3. the home directory outranks the repo
  4. plugins avoid it with a namespace
  5. nested folders wait for a file touch

basics

~10 s

The personal one: on a name clash Claude Code ranks enterprise over personal and personal over project, so /db-migrations runs the copy in ~/.claude/skills. Plugin skills never collide because they are namespaced as /plugin-name:skill-name.

solid answer

~40 s

Where a skill is saved decides who gets it: enterprise skills in the managed settings directory reach everyone on machines where the organisation deploys them, `~/.claude/skills/` reaches all your projects on this machine, `.claude/skills/` reaches everyone working in the repository, nested `<subdir>/.claude/skills/` folders apply to work in that subdirectory, and plugin skills reach wherever the plugin is enabled. When two of enterprise, personal and project share a name, enterprise beats personal and personal beats project, so your old personal `db-migrations` silently shadows the team's updated project copy. A skill beats a `.claude/commands/` file of the same name. Plugin skills load alongside because they are invoked as `/plugin-name:skill-name`, and a nested skill whose name clashes with a root skill stays available under a directory-qualified name.

go deeper

for a junior

Recall the two everyday locations: ~/.claude/skills for yourself and .claude/skills in the repository for the team.

for a middle

Explain the clash order (enterprise, personal, project), why plugin skills never collide, and when nested skills in a monorepo become available.

for a senior

Diagnose a teammate running a stale personal copy that shadows the updated project skill, and pick the location that makes a skill reach cloud sessions.

for a principal

Decide which skills belong in the repository, a shared plugin or managed deployment, balancing review, reach and the ability to outrank personal copies.

## Where a skill can live A skill's location decides which sessions load it. Claude Code reads skills from several places: | Location | Path | Loads in | | :- | :- | :- | | Enterprise | `.claude/skills/<name>/SKILL.md` inside the managed settings directory (for example `/etc/claude-code/` on Linux) | Every user on machines where the organisation deploys it | | Personal | `~/.claude/skills/<name>/SKILL.md` | All your projects on this machine | | Project | `.claude/skills/<name>/SKILL.md` | Sessions in this repository, for everyone who clones it | | Nested | `<subdir>/.claude/skills/<name>/SKILL.md` | Work in or below that subdirectory | | Additional directory | `.claude/skills/` in a directory passed with `--add-dir` | That session | | Plugin | `<plugin>/skills/<name>/SKILL.md` | Wherever the plugin is enabled, as `/plugin-name:name` | A `<name>` folder in the enterprise, personal or project location can also be a symlink to a directory elsewhere; Claude Code reads `SKILL.md` from the target and loads the skill once even if several locations point at it. Two folder names are reserved: `synced`, which Claude Code uses for skills downloaded from claude.ai, and `anthropic-skills`. Note too that the `permissions.additionalDirectories` setting grants file access only and loads no skills; only `--add-dir` or `/add-dir` loads an added directory's `.claude/skills/`. Project skills are found in `.claude/skills/` of the directory where you start Claude Code **and every parent directory up to the repository root**, so starting in `packages/api/` still picks up root skills. ## Who wins on a name clash Names are resolved by **origin**, not merged: | Same name in | Which one runs | | :- | :- | | Two of enterprise, personal and project | Enterprise over personal, personal over project | | A skill and a `.claude/commands/` file | The skill | | A local skill and a bundled skill or built-in command | Your skill replaces it, but not its aliases (for a built-in, in a local terminal session) | | A plugin skill and any local skill | Both load; the plugin's is `/plugin-name:name` | | A root skill and a nested skill | Both load; the nested one is directory-qualified | The ordering surprises people in one direction in particular: **personal beats project**. A developer who once copied the team's skill into `~/.claude/skills/db-migrations/` keeps running that stale copy after the team updates the repository version, with no warning. The fix is to delete or rename the personal copy. ## Nested directories in a monorepo Skills in a `.claude/skills/` folder **below** the starting directory do not load at startup: - They load the first time Claude reads or edits a file in that subdirectory, and then stay for the session. - Until then they are not in the `/` menu and cannot be invoked by name; running `/add-dir` with the subdirectory's path loads them sooner. - If a nested skill's directory name matches another skill, both stay available. With `db-migrations` at the root and in `services/billing/.claude/skills/`, `/db-migrations` runs the root skill and `/services/billing:db-migrations` runs the nested one; Claude is told to pick the variant whose directory holds the files it is working on. ## Reaching other kinds of session Location also decides which **environments** see a skill: 1. Cloud sessions, including routines, and Cowork sessions do not read `~/.claude/skills/` on your machine, so a personal-only skill is reported as not found there. 2. Cloud sessions do load project skills committed to the cloned repository, so committing the skill is one way to make it available. 3. Skills enabled for a claude.ai account sync into terminal sessions signed in with that account, under `~/.claude/skills/synced/`; a local skill with the same short name wins over a synced one. An organisation can also restrict which locations load at all through a managed setting, `strictPluginOnlyCustomization`, which limits skills to plugin, bundled and managed sources; administering that lock is a managed-settings subject. ## Choosing a location for the migration skill - **Project** (`.claude/skills/`) when the conventions belong to this repository: reviewed in pull requests, versioned with the schema. - **Personal** for private shortcuts, with the shadowing rule in mind. - **Plugin** when twenty repositories need the same skill, accepting the namespaced command. - **Enterprise** when every developer on managed machines must have it and it must outrank personal copies. - **Nested** when one service in a monorepo has its own migration tooling.

  • A skill lives in services/billing/.claude/skills/ and you start Claude Code at the repository root. When can you use it?
    Not at startup. Nested skills load the first time Claude reads or edits a file in that subdirectory and then stay for the session; before that they are absent from the `/` menu. Running `/add-dir services/billing` loads them sooner. If the name clashes with a root skill, both stay: `/db-migrations` runs the root copy and `/services/billing:db-migrations` the nested one.
  • Your personal skill works at your desk, but a routine reports that it was not found. Why?
    A routine runs as a fresh cloud session, and cloud sessions do not read `~/.claude/skills/` on your machine. Commit the skill to the repository's `.claude/skills/`, which cloud sessions load from the cloned repo, or enable it for your claude.ai account so it is synced into those sessions.

  • Project skills override personal ones because the repository is more specific.
  • A plugin skill with the same name silently replaces your project skill.
  • Skills in a subdirectory's .claude/skills load at startup like root ones.
  • A .claude/commands file beats a skill of the same name because it came first.
  • Personal skills in ~/.claude/skills follow you into cloud sessions and routines.