# Local Registry

SkillLane maintains a local registry of installed skills in `~/.skilllane/registry.json`.

---

## Storage Layout

```
~/.skilllane/
├── config.json          # User configuration
├── registry.json        # Installed skills index
├── skills/              # Skill directories (copied on install)
│   ├── systematic-debugging/
│   ├── agent-code-review/
│   └── ...
└── runs/                # Run history (JSON files)
    └── run_1234567890_abc123.json
```

---

## registry.json

A JSON array of registry entries:

```json
[
  {
    "name": "systematic-debugging",
    "version": "0.1.0",
    "title": "Systematic Debugging",
    "description": "A structured approach to diagnosing and fixing code errors",
    "category": "engineering",
    "targets": ["codex", "opencode", "codra", "tera"],
    "tags": ["debugging", "engineering", "diagnostics", "troubleshooting"],
    "path": "/root/.skilllane/skills/systematic-debugging",
    "installedAt": "2026-01-15T10:30:00.000Z",
    "builtin": true
  }
]
```

### Entry Fields

| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Skill identifier (kebab-case) |
| `version` | string | Semver version |
| `title` | string | Display name |
| `description` | string | What the skill does |
| `category` | string | Skill category |
| `targets` | string[] | Supported agent targets |
| `tags` | string[] | Searchable tags |
| `path` | string | Absolute path to installed skill |
| `installedAt` | string | ISO 8601 install timestamp |
| `builtin` | boolean | Whether it was installed from built-in skills |

---

## Install Flow

When you run `skilllane install`:

1. Source is resolved (local path, git URL, or built-in)
2. Skill is loaded and validated
3. Files are copied to `~/.skilllane/skills/<name>/`
4. Registry entry is added or updated
5. `registry.json` is written

---

## Registry Management

### Show registry path

```bash
skilllane registry path
# Output: /root/.skilllane/registry.json
```

### Rebuild registry

If `registry.json` gets out of sync with the `skills/` directory:

```bash
skilllane registry rebuild
```

This scans `~/.skilllane/skills/`, reads each `metadata.json`, and rebuilds the registry from scratch.

### Show statistics

```bash
skilllane registry stats
```

Output includes total skill count, breakdown by category, and breakdown by tag.

---

## Skill Directory

Each installed skill is a complete copy of the original source, stored in `~/.skilllane/skills/<name>/`. This means:

- Skills are self-contained and portable
- Removing a skill deletes its directory
- Updating a skill requires `--force` to overwrite
- Built-in skills are copied from the package's `skills/` directory
