---
name: skill-export
description: Exports one or more skills and their agent wrappers into a self-contained package ready to share with teammates. Supports three project config modes: no config, template with placeholders, or full config as-is.
schema-version: 1
model: haiku
requires: []
inject-fields: []
allowed-tools:
  - Read
  - Write
  - Bash
  - Glob
  - AskUserQuestion
token-budget:
  skill-load: 400
  per-invocation: 5000
  warn-threshold: 10000
---

# Export Skill

Packages one or more skills (and their agent wrappers) into a portable folder ready to share with teammates or add to a team dotfiles repo.

Supports three project config modes so you can control what gets shared:
- **None**: Just the skills, no project config.
- **Template**: Project config structure with personal values replaced by `{PLACEHOLDER}`.
- **Full**: Project config as-is (useful when the teammate works on the same project with shared credentials).

## Usage

```bash
/skill-export
/skill-export git-commit git-branch git-pr
/skill-export git-*
```

## Instructions

### Step 1: List available skills and projects

Run in parallel:

```bash
ls ~/.claude/skills/
ls ~/.claude/agents/
ls ~/.claude/skills/config/
ls ~/.claude/hooks/ 2>/dev/null
```

Also read `~/.claude/settings.json` and extract the `hooks` key to know which hooks are configured.

For each project folder (excluding path-based ones like `-Users-*`), read its `project.md` to get the display name.

### Step 2: Ask what to export

Use AskUserQuestion with ALL questions in one message.

IMPORTANT: The AskUserQuestion `options` array has a max of 4 items — never put individual skill names as options. Instead, put the full skill list in the `question` text and use the options for selection METHOD only.

Question 1 — Skills to export:
- `question` field: include the full numbered list of skills inline, followed by selection instructions.
- `options`: ["Todas", "git-*", "task-*", "Elegir por nombre (escribí en Other)"]

```
¿Qué skills querés exportar?

**Skills disponibles:**
{numbered list: N. skill-name — description}

Podés seleccionar una opción rápida o escribir nombres separados por coma en "Other"
(ej: "git-commit, git-branch, task-analyze").

---

**¿Incluir agentes wrapper** para las skills seleccionadas? (Sí / No)

---

**Project config** — Las skills usan archivos en `~/.claude/skills/config/{project}/`
para reglas específicas por proyecto. ¿Qué querés incluir?

Proyectos disponibles (leídos dinámicamente de ~/.claude/skills/config/):
{numbered list: N. project-folder-name — display name from project.md}

Modos:
1. **Sin config** — Solo las skills. El destinatario crea su propio project config.
2. **Template** — Config con valores personales reemplazados por `{PLACEHOLDER}`.
3. **Config completa** — Exporta tal cual.
4. **Elegir por proyecto** — Diferente modo para cada proyecto.

IMPORTANT for AskUserQuestion: put the full project list in the `question` text.
Use options: ["Sin config", "Template", "Config completa", "Elegir por proyecto"].

---

**Hooks** — Los hooks son scripts en `~/.claude/hooks/` + config en `settings.json`.
Son genéricos (sin datos personales) y necesarios para que las skills funcionen correctamente.

{If hooks exist: list detected hook scripts}

¿Incluir hooks? Use options ["Sí (recomendado)", "No"].

---

**¿Dónde guardar el export?**
- Path de carpeta (ej: `~/Desktop/skills-export`)
- Path de zip (ej: `~/Desktop/skills.zip`)

**¿Incluir README con instrucciones de instalación?** (Sí / No)
```

### Step 3: Resolve skill and agent lists

For each requested skill name (expand wildcards if needed):
1. Check `~/.claude/skills/{name}/SKILL.md` exists → add to skill list
2. If agent wrappers requested: check `~/.claude/agents/{name}.md` exists → add to agent list
3. Warn and skip if not found

### Step 4: Resolve project config files

For each selected project and mode:

**Mode 1 — None:** Skip. No project files included.

**Mode 2 — Template:**
Read each file in `~/.claude/skills/config/{project}/`. For each:
1. Read the content
2. Apply placeholder substitution (see Personal fields table below)
3. Write the templated version to `{output-dir}/projects/{project}/{filename}`

**Mode 3 — Full:**
Copy each file in `~/.claude/skills/config/{project}/` as-is.

**Filtering:** Only include per-skill files that correspond to exported skills. Always include `project.md`.

Example: exporting `git-commit` and `git-pr` from project `acme`:
- Include: `project.md`, `commit.md`, `manage-pr.md`
- Skip: `tracking-daily.md`, `analyze-tech-details.md`, etc.

### Step 5: Personal fields — placeholder substitution (Template mode)

Scan each project file for these patterns and replace:

| Pattern | Placeholder |
|---------|-------------|
| Jira Account ID: `712020:...` or UUID-like user ID | `{YOUR_JIRA_ACCOUNT_ID}` |
| GitHub username after `**User**: ` | `{YOUR_GITHUB_USERNAME}` |
| GitLab username after `**User**: ` | `{YOUR_GITLAB_USERNAME}` |
| PR assignee value | `{YOUR_GITHUB_USERNAME}` |
| Email addresses (`name@domain.com`) | `{YOUR_EMAIL}` |
| ClickUp user ID numbers | `{YOUR_CLICKUP_USER_ID}` |

**Do NOT replace:** Project keys (SCRUM, DSC, etc.), base URLs, repository names, MCP prefixes, branch names, estimation config, checklists, detection signals.

### Step 5b: Resolve hook files (if hooks included)

Hook scripts are generic — no personal data, always exported as-is.

1. Copy each script from `~/.claude/hooks/` to `{output-dir}/hooks/`
2. Generate `{output-dir}/hooks/settings-hooks.json` with only the `hooks` key extracted from `~/.claude/settings.json`.

### Step 6: Build the export package

```
{output-dir}/
├── README.md                              ← If requested
├── skills/
│   ├── {skill-name}/
│   │   └── SKILL.md
│   └── ...
├── agents/
│   ├── {agent-name}.md                    ← If wrappers included
│   └── ...
├── projects/                              ← If config mode 2 or 3
│   └── {project-name}/
│       ├── project.md
│       └── ...
└── hooks/                                 ← If hooks included
    ├── session-start.sh
    └── settings-hooks.json
```

### Step 7: Generate README.md (if requested)

Include:
- List of skills with descriptions and usage commands
- Installation instructions for skills, agents, project config, hooks
- List of MCP server dependencies detected from allowed-tools
- How to fill in placeholders (template mode)
- Footer: `Generated by /skill-export on {date}`

### Step 8: Create zip (if requested)

```bash
cd {output-parent-dir}
zip -r {zip-filename} {output-dir-name}/
rm -rf {output-dir-name}/
```

### Step 9: Confirm

```
Export completado.

Skills: {list}
Agentes: {count or "no incluidos"}
Project config: {mode} para proyectos: {list}
Hooks: {list or "no incluidos"}
Guardado en: {path}

{If template mode:}
Placeholders a completar: grep -r "YOUR_" {path}/projects/
```

## Important Notes

- **Personal credentials**: Mode 2 (template) is the recommended default for sharing with teammates on the same project.
- **Snapshot**: The export is a point-in-time copy. Changes to originals won't propagate.
- **Agent wrappers are optional**: Skills work without them.
- **Project files are filtered**: Only per-skill config files relevant to the exported skills are included. `project.md` is always included when a project config is selected.
