# Skill Official Updater

> At the start of a new session, do a cheap check for new or updated official Anthropic skills (github.com/anthropics/skills) and automatically add or update them in skills_library/ (no user prompt). Also use on explicit request ("check for official skill updates", "sync official skills").

- Skill: `sergeyitaly/skill-official-updater` (Agent Skill)
- Install (CLI): `npx skillmds@latest add sergeyitaly/skill-official-updater`
- Raw SKILL.md: https://api.skillmd.com/api/skills/sergeyitaly/skill-official-updater/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: sergeyitaly (https://skillmd.com/u/sergeyitaly)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/sergeyitaly/skill-official-updater

---


# Official Anthropic Skills Updater

Keeps a local copy of Anthropic's official skills
(https://github.com/anthropics/skills, under `skills/`) in sync with this
repo's `skills_library/`, without silently overwriting unrelated or
hand-edited skills.

## State file

`skills_library/.official-skills-state.json` (create if missing):

```json
{
  "repoSha": "<last-synced commit SHA of anthropics/skills>",
  "skills": {
    "pdf": "<commit SHA of skills/pdf/ at last sync>",
    "docx": "<commit SHA of skills/docx/ at last sync>"
  }
}
```

Only skill names listed under `skills` are "managed" by this updater - a
same-named skill in `skills_library/` that ISN'T listed there is assumed to
be a hand-written/customized skill and must never be overwritten without an
explicit user decision.

## 1. Cheap check (every session)

**Automation:** When the Claude Skills extension is active and this workspace
has `skills_library/`, it installs a Claude Code `SessionStart` hook
(`official-skills-watch.js`) that runs the check below on `startup`,
`resume`, and `clear`. If updates exist, the hook injects context telling
you to read this skill and **sync immediately** — do not ask the user which
skills to pull.

Manual / fallback (same logic):

```sh
git ls-remote https://github.com/anthropics/skills.git HEAD
```

Compare the returned SHA to `repoSha` in the state file (treat a missing
file as "no state yet"). If unchanged, say nothing further - this step
should be silent and near-instant.

VS Code: **Claude Skills: Check Official Anthropic Skill Updates** runs the
same check from the Command Palette. **Enable Official Skills Session Check**
re-installs the SessionStart hook if needed.

## 2. When the repo SHA has changed (or no state file yet)

List the current skill directories upstream:

```sh
gh api repos/anthropics/skills/contents/skills --jq '.[].name'
```

For each upstream skill name, compare against `skills_library/`:

- **New** - upstream name not present locally: candidate to add.
- **Managed + changed** - name is in the state file's `skills` map AND
  `git log -1 --format=%H -- skills/<name>` (in a shallow clone, see below)
  differs from the stored SHA: candidate to update.
- **Unmanaged** - a local skill with the same name exists but isn't in the
  state file's `skills` map: skip, and report it as "name collision, not
  touched" so the user is aware but nothing changes automatically.

**Auto-sync policy (default — do not ask the user):**

- Pull **every** `new` and `managed + changed` candidate automatically.
- **Never** overwrite an `unmanaged` collision (same local name, not in state
  `skills` map) — list those in the completion summary only.
- Do **not** stop to ask "which skills" or "all 17?" — proceed with the sync
  unless `git`/`gh` is unavailable or the sparse clone fails.

Briefly note what you are syncing (counts + names), then run the pull.

## 3. Pulling skills (all actionable candidates)

Use a temporary shallow sparse clone so only the needed skill directories are
fetched. On Windows, do **not** pass `-q` to `git sparse-checkout set`.

```sh
git clone --depth 1 --filter=blob:none --sparse https://github.com/anthropics/skills.git <tmpdir>
cd <tmpdir>
git sparse-checkout set skills/<name1> skills/<name2> ...
```

For each actionable skill (`new` or `managed + changed`), copy
`<tmpdir>/skills/<name>/` to `skills_library/<name>/`. Delete `<tmpdir>`
afterwards.

To record per-skill SHAs for managed skills, after checkout run
`git log -1 --format=%H -- skills/<name>` inside `<tmpdir>` for each synced
skill.

## 4. Manifest entries

For each newly added skill, add an entry to `skills_library/manifest.json`:

- `description`: the skill's SKILL.md frontmatter `description`, trimmed to
  one line (unwrap YAML `|-` blocks to a single line).
- `detect_globs`: use the table below; do not ask the user.

| Skill | `detect_globs` |
|---|---|
| `docx` | `["**/*.docx"]` |
| `pptx` | `["**/*.pptx"]` |
| `xlsx` | `["**/*.xlsx", "**/*.xlsm", "**/*.csv", "**/*.tsv"]` |
| `pdf` | `["**/*.pdf"]` |
| `webapp-testing` | `["**/package.json", "**/playwright.config.*", "**/vite.config.*"]` |
| `mcp-builder` | `["**/mcp*.json", "**/*mcp*", "**/package.json"]` |
| `claude-api` | `["**/*.py", "**/*.ts", "**/*.js", "**/package.json"]` |
| `skill-creator` | `["**/.claude/skills/**", "**/skills_library/**", "**/SKILL.md"]` |
| all other official skills | `["**/*"]` |

For updated skills, refresh the manifest `description` if the upstream
frontmatter changed meaningfully.

## 5. Update state and finish

- Write the new `repoSha` and per-skill SHAs (for every skill added or
  updated) to `skills_library/.official-skills-state.json`.
- If `extension/` exists, run `npm run sync-skills` inside `extension/` to
  refresh the bundled copy (or tell the user if you cannot run commands).
- Summarize what was synced: added count, updated count, skipped collisions.
- If this workspace uses the deployer extension, note that **Install Skill
  Library** (or `py generate_skills.py install`) republishes to
  `~/.claude/skills/` — run or suggest only if skills were actually changed.

## 6. No `git`/`gh` available

If neither `git` nor `gh` is available, say so and stop - don't attempt to
fetch individual files via raw URLs as a substitute, since that won't
reliably capture a skill's full directory (scripts, references, assets).

