# Command Namespacing

Reference for organizing commands into logical groups.

## Directory Structure

```
.claude/commands/
├── dev/                  # Development commands
│   ├── lint.md          → /dev:lint
│   ├── review.md        → /dev:review
│   └── test.md          → /dev:test
├── git/                  # Git operations
│   ├── commit.md        → /git:commit
│   └── pr.md            → /git:pr
├── ops/                  # Operations
│   ├── deploy.md        → /ops:deploy
│   └── logs.md          → /ops:logs
└── quick-fix.md         → /quick-fix
```

## Invocation Syntax

| File Path | Invocation |
|-----------|------------|
| `commands/review.md` | `/review` |
| `commands/dev/review.md` | `/dev:review` |
| `commands/git/commit.md` | `/git:commit` |

## Recommended Namespaces

| Namespace | Purpose | Example Commands |
|-----------|---------|------------------|
| `dev` | Development workflows | lint, review, test, format |
| `git` | Version control | commit, pr, branch, merge |
| `ops` | Operations | deploy, rollback, logs |
| `docs` | Documentation | readme, changelog, api-docs |
| `db` | Database operations | migrate, seed, backup |
| `onboard` | New team members | setup, tour, intro |

## Scoping Rules

### Project Commands
Location: `.claude/commands/` in project root

Only available when Claude Code runs in that project directory.

### Global Commands
Location: `~/.claude/commands/`

Available across all projects.

### Priority
Project commands override global commands with the same name.

## Naming Conventions

| ✅ Good | ❌ Avoid |
|---------|----------|
| `code-review.md` | `CodeReview.md` |
| `dev/lint.md` | `Dev/Lint.md` |
| `quick-fix.md` | `quick_fix.md` |

## Discovery

List available commands:
- Type `/` to see autocomplete
- Type `/dev:` to see namespace contents
- Use `/help` for descriptions

## Example Organization

```
.claude/commands/
├── dev/
│   ├── lint.md           # /dev:lint - Run linters
│   ├── review.md         # /dev:review - Code review
│   └── test.md           # /dev:test - Run tests
├── git/
│   ├── commit.md         # /git:commit - Structured commit
│   ├── pr.md             # /git:pr - Create PR
│   └── branch.md         # /git:branch - Create branch
├── onboard/
│   ├── setup.md          # /onboard:setup - Dev setup
│   └── tour.md           # /onboard:tour - Codebase tour
└── quick-fix.md          # /quick-fix - Fast fixes
```
