|
| 1 | +--- |
| 2 | +name: gh-skill |
| 3 | +description: Manage agent skills with gh skill. Use this skill to discover, preview, install, update, and publish Agent Skills so an agent can self-manage the skills available in its environment. |
| 4 | +--- |
| 5 | + |
| 6 | +# Managing skills with `gh skill` |
| 7 | + |
| 8 | +`gh skill` installs, previews, searches, updates, and publishes |
| 9 | +[Agent Skills](https://agentskills.io). An agent can use it to keep its |
| 10 | +own skill set in sync with one or more GitHub repositories. |
| 11 | + |
| 12 | +The command is also aliased as `gh skills`. Prefer the canonical singular |
| 13 | +`gh skill` in scripts and docs. |
| 14 | + |
| 15 | +## Search |
| 16 | + |
| 17 | +```bash |
| 18 | +gh skill search <query> # free-text search |
| 19 | +gh skill search <query> --owner <org> # restrict to one owner |
| 20 | +gh skill search <query> --limit 20 --page 2 |
| 21 | +gh skill search <query> --json skillName,repo,description |
| 22 | +``` |
| 23 | + |
| 24 | +## Preview before installing |
| 25 | + |
| 26 | +```bash |
| 27 | +gh skill preview <owner>/<repo> <skill-name> |
| 28 | +gh skill preview <owner>/<repo> <skill-name>@v1.2.0 # pin a version |
| 29 | +``` |
| 30 | + |
| 31 | +## Install |
| 32 | + |
| 33 | +```bash |
| 34 | +gh skill install <owner>/<repo> <skill-name> |
| 35 | +gh skill install <owner>/<repo> <skill-name>@v1.2.0 |
| 36 | +gh skill install <owner>/<repo> skills/<scope>/<skill-name> # exact path, fastest |
| 37 | +gh skill install ./local-skills-repo --from-local |
| 38 | +``` |
| 39 | + |
| 40 | +`<owner>/<repo>` and `<skill-name>` are both required. |
| 41 | + |
| 42 | +Useful flags: |
| 43 | + |
| 44 | +- `--agent <id>` - target host (e.g. `github-copilot`, `claude-code`, |
| 45 | + `cursor`, `codex`, `gemini-cli`). Repeat for multiple. Default is |
| 46 | + `github-copilot` when non-interactive. You should know what agent you are, |
| 47 | + so set this appropriately to install for yourself. |
| 48 | +- `--scope project|user` - `project` (default) writes inside the current |
| 49 | + git repo; `user` writes to the home directory and applies everywhere. |
| 50 | +- `--pin <ref>` - pin to a tag, branch, or commit SHA. Mutually exclusive |
| 51 | + with `--from-local` and with inline `@version` syntax. |
| 52 | +- `--allow-hidden-dirs` - also discover skills under dot-directories such |
| 53 | + as `.claude/skills/`. Don't use this unless you need to, it comes with risks. |
| 54 | +- `--force` - overwrite an existing install. |
| 55 | + |
| 56 | +## Update |
| 57 | + |
| 58 | +```bash |
| 59 | +gh skill update --all # update every installed skill |
| 60 | +gh skill update <skill> # update one |
| 61 | +gh skill update <skill> --force |
| 62 | +gh skill update --unpin # drop the pin and move to latest |
| 63 | +``` |
| 64 | + |
| 65 | +## Publish |
| 66 | + |
| 67 | +Publishing turns a repo into a discoverable skill source. Skills are |
| 68 | +discovered with these conventions: |
| 69 | + |
| 70 | +- `skills/<name>/SKILL.md` |
| 71 | +- `skills/<scope>/<name>/SKILL.md` |
| 72 | +- `<name>/SKILL.md` (root-level) |
| 73 | +- `plugins/<scope>/skills/<name>/SKILL.md` |
| 74 | + |
| 75 | +Each `SKILL.md` needs YAML frontmatter: |
| 76 | + |
| 77 | +```yaml |
| 78 | +--- |
| 79 | +name: my-skill # must equal the directory name |
| 80 | +description: One sentence... # required, recommended <= 1024 chars |
| 81 | +license: MIT # optional but recommended |
| 82 | +--- |
| 83 | +``` |
| 84 | + |
| 85 | +### Validate, then publish |
| 86 | + |
| 87 | +```bash |
| 88 | +gh skill publish --dry-run # validate only, no release |
| 89 | +gh skill publish --dry-run ./path/to/repo # validate a specific dir |
| 90 | +gh skill publish --fix # auto-strip install metadata |
| 91 | +gh skill publish --tag v1.0.0 # non-interactive publish |
| 92 | +gh skill publish # interactive publish flow |
| 93 | +``` |
| 94 | + |
| 95 | +`--fix` and `--dry-run` are mutually exclusive. `--fix` only rewrites |
| 96 | +install-injected `metadata.github-*` keys and does not publish; commit |
| 97 | +the result and re-run `publish`. |
| 98 | + |
| 99 | +The publish flow will: |
| 100 | + |
| 101 | +1. Add the `agent-skills` topic to the repo (so search can find it). |
| 102 | +2. Use `--tag` (or prompt for one in a TTY). |
| 103 | +3. Auto-push any unpushed commits. |
| 104 | +4. Create a GitHub release with auto-generated notes. |
| 105 | + |
| 106 | +Always pass `--tag` so it doesn't fall through to the interactive flow. |
| 107 | + |
| 108 | +## Self-management pattern for agents |
| 109 | + |
| 110 | +A reasonable loop: |
| 111 | + |
| 112 | +1. `gh skill search <topic> --json skillName,repo,namespace` |
| 113 | +2. `gh skill preview <repo> <skill>` to inspect the `SKILL.md`. |
| 114 | +3. `gh skill install <repo> <skill> --agent <host> --pin <ref>` for a |
| 115 | + reproducible install. |
| 116 | +4. Periodically `gh skill update --all` to refresh. |
0 commit comments