
labels-as-code
Manage a GitHub repository's labels as a version-controlled file and auto-label pull requests by changed path. Export current labels, diff them against a proposed .github/labels.yml, sync the difference (one-shot or via a scheduled workflow using one verified, SHA-pinned action), and wire path-based PR labeling with actions/labeler and .github/labeler.yml. Use when the user says "standardize labels", "sync labels", "auto-label PRs by path", "labels as code", or invokes /labels-as-code. Do NOT use for org-wide label policy across many repos — route that to /safe-settings, which reconciles labels (rename, exclude) from a central admin repo. Do NOT use for issue forms or templates — that is /oss-hygiene. Label deletions are never automatic; the skill asks for explicit authorization first.
- Installs
- 53
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/paulnsorensen/git-gouda --skill labels-as-code- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads labels-as-code automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
labels-as-code
Brings a single GitHub repository's labels under version control and keeps pull-request labeling in sync with the files that changed.
Where this skill fits
| Concern | Skill |
|---|---|
| One repo's label set, tracked in a file, synced on demand or on schedule | /labels-as-code (this skill) |
| Path-based PR auto-labeling for one repo | /labels-as-code (this skill) |
| Label policy across many repos, reconciled from one admin repo | /safe-settings |
| Issue forms, PR templates, community health files | /oss-hygiene |
/safe-settings can also manage labels org-wide through its labels block (rename via oldname, exclusion patterns), reconciled every full-sync run. Reach for /safe-settings when label policy must stay in sync across many repos from a central admin repo. Reach for this skill when the scope is one repository and the file lives in that repository.
What gets configured
| File | Purpose |
|---|---|
.github/labels.yml | The label set: name, color, description per label |
.github/labeler.yml | Path-to-label rules consumed by actions/labeler |
.github/workflows/labels-sync.yml (optional) | Scheduled/on-push sync of .github/labels.yml to the repo |
.github/workflows/labeler.yml (optional) | Runs actions/labeler on every pull request |
Protocol
1. Export current labels and diff
gh label list --json name,color,description
Compare the export against the proposed .github/labels.yml (create it from assets/labels.yml if the file does not exist yet). Print the diff — labels to create, labels to recolor or redescribe, and labels present on GitHub but absent from the file — before proposing any change.
2. Propose a default label set
assets/labels.yml ships a starting set grouped by prefix:
type/*— one label per Conventional Commits type (feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert), aligned with the types/pr-title-lintchecks in the PR title.priority/*—critical,high,medium,low.status/*—blocked,in-progress,needs-review.good first issue,help wanted— GitHub's own community-standards labels.dependencies— Dependabot and manual dependency-bump PRs.breaking— a breaking change, called out at release time.
Read references/label-scheme.md for the full table and for how type/* and breaking map onto /gh-bootstrap's .github/release.yml categories (that file's Breaking changes bucket keys on breaking-change/breaking; its Features/Fixes/Documentation/Internal buckets key on bare Conventional-Commits-style names, not the type/ prefix). If the repo already runs /gh-bootstrap's release notes, either keep both label spellings on the affected PRs or extend release.yml's category lists with the type/* names — /gh-bootstrap owns that file; this skill only documents the mapping.
Ask the user whether to adopt the default set as-is, trim it, or start from the exported labels instead. Do not assume — a repo with an established label set may prefer to keep its own names.
3. Sync options
Two ways to apply .github/labels.yml to the repo. Ask the user which one before doing either.
The workflow templates in this step and in step 4 pin Node 24 actions. Before you copy either workflow, confirm that any self-hosted runner is Actions Runner v2.327.1 or later. GitHub-hosted runners already meet this requirement.
One-shot sync
# Create or update one label (never deletes):
gh label create "<name>" --color "<hex>" --description "<text>" --force
# Clone another repo's full label set (adds only; existing labels keep
# their color/description unless the label doesn't exist yet):
gh label clone <owner>/<repo>
--force overwrites color/description on an existing label; it does not delete labels that are absent from the source. Never delete a label without explicit, per-label user authorization — list the labels that would be removed and wait for a yes before running gh label delete.
Scheduled sync workflow
For drift correction without a human running gh label create by hand, copy assets/labels-sync.yml to .github/workflows/labels-sync.yml. It runs crazy-max/ghaction-github-labeler, the maintained action verified for this skill (see references/label-scheme.md for the verification command and the current pinned SHA). The template ships with skip-delete: true — labels absent from .github/labels.yml are left alone, not deleted. Flip skip-delete to false only after the user explicitly authorizes deletions; the diff in step 1 shows exactly which labels that would remove. The template runs weekly on a schedule trigger, on each push to main that changes .github/labels.yml or the workflow file itself, and on manual workflow_dispatch.
EndBug/label-sync is a viable alternative with the same shape (sync from a YAML file, delete-by-default gated by an option). Verify either action's latest release and SHA with gh api repos/{owner}/{repo} and the tag-to-commit lookup in references/label-scheme.md before pinning — do not reuse a SHA from this skill without re-verifying it against the current release.
4. Path-based PR labeling
Copy assets/labeler.yml to .github/labeler.yml and adapt the path globs to the repo's directory layout — the shipped file is an example, not a fit-all config. Copy assets/pr-labeler.yml to .github/workflows/labeler.yml; it runs actions/labeler with permissions: contents: read, pull-requests: write (the minimum the action needs to read changed files and write labels).
Verify the pinned SHA before relying on it:
LATEST=$(gh api repos/actions/labeler/releases/latest --jq '.tag_name')
gh api repos/actions/labeler/git/ref/tags/"$LATEST" --jq '.object.sha'
If the returned SHA does not match the comment in assets/pr-labeler.yml, update both the uses: line and its trailing version comment together — a stale comment next to a fresh SHA is worse than no comment.
5. Verify
gh label list --json name,color,description
Confirm the output matches .github/labels.yml exactly (same names, colors, descriptions — modulo any labels the user chose to keep unmanaged). Then open a pull request that touches a path matched in .github/labeler.yml and confirm the expected label lands on it, either by watching the labeler.yml run or with:
gh pr view <number> --json labels --jq '.labels[].name'
Report what was created, updated, and left alone, and which labels (if any) are still pending user authorization to delete.
What this skill is NOT for
- Org-wide label policy reconciled across many repos — use
/safe-settings - Issue forms, PR templates, or other community-health files — use
/oss-hygiene - Deleting labels without the user's explicit, per-label go-ahead
- Branch protection, merge settings, or release-notes plumbing — use
/gh-bootstrap
Gotchas
gh label create --forceis idempotent for color/description but never deletes. Deletion is a separate, explicitgh label deletecall — never bundle it into a routine sync without asking first.crazy-max/ghaction-github-labelerdeletes labels that are absent from the YAML file unlessskip-delete: trueis set. Confirm that flag before wiring the workflow into a repo with labels the file doesn't enumerate.actions/labeler'ssync-labelsinput removes a path-based label when the PR no longer touches that path. Leave it at its default (false) unless the user wants that behavior — it is a form of automatic deletion.- Label colors in
gh label create --colortake a bare hex string without#;.github/labels.ymlconventionally also stores the hex without#foractions/labeler's upstream ecosystem, butcrazy-max/ghaction-github-labeleraccepts either. Keep one convention within a repo's file. - Renaming a label with
gh label create --forcedoes not rename — it creates a new label. Usegh label edit <old-name> --name <new-name>for renames, orfrom_name:in the sync tool's config format if it supports it.
FAQ
What does the labels-as-code skill do?
Manage a GitHub repository's labels as a version-controlled file and auto-label pull requests by changed path. Export current labels, diff them against a proposed .github/labels.yml, sync the difference (one-shot or via a scheduled workflow using one verified, SHA-pinned action), and wire path-based PR labeling with actions/labeler and .github/labeler.yml. Use when the user says "standardize labels", "sync labels", "auto-label PRs by path", "labels as code", or invokes /labels-as-code. Do NOT use for org-wide label policy across many repos — route that to /safe-settings, which reconciles labels (rename, exclude) from a central admin repo. Do NOT use for issue forms or templates — that is /oss-hygiene. Label deletions are never automatic; the skill asks for explicit authorization first.
How do I install labels-as-code?
Run npx skills add https://github.com/paulnsorensen/git-gouda --skill labels-as-code in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/labels-as-code/ (personal) or .claude/skills/labels-as-code/ (project).
Which AI agents can use labels-as-code?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is labels-as-code safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains labels-as-code?
It is published by paulnsorensen in paulnsorensen/git-gouda. It has 53 recorded installs.
More from paulnsorensen/git-gouda
safe-settings
paulnsorensen/git-gouda
Set up GitHub's safe-settings (a Probot-based GitHub App from the github org) for declarative, org-wide repository policy as code. Use when the user says "settings as code", "safe-settings", "manage repos declaratively", "centralize repo settings", "org-level branch protection", "scaffold an admin repo", "github settings app", or invokes /safe-settings on an org that wants to manage repo settings, branch protection, rulesets, labels, teams, environments, and collaborators from one admin repo. Scaffolds the admin-repo layout (settings.yml + suborgs/ + repos/), the GitHub App installation steps, and a scheduled full-sync GitHub Actions workflow. Distinct from /gh-bootstrap (one-shot gh api config of a single repo) — this skill is for org-scale settings as code that reconciles continuously. Not for per-task GitHub ops (PRs, issues, CI status) or local git work — those are out of this catalog's scope.
config-review-bot
paulnsorensen/git-gouda
Audit or configure CodeRabbit repository review policy from effective sources. Use for CodeRabbit setup, configuration review, path coverage, or a specific pull-request review audit. Trigger on "configure CodeRabbit", "review .coderabbit.yaml", "set up CodeRabbit", "audit CodeRabbit settings", or "is CodeRabbit covering X". Keep audits read-only by default and separate schema validity, rule quality, and completed-review evidence. Do not use it to run a CodeRabbit CLI review or autofix, or to fix review comments on a pull request.
gh-bootstrap
paulnsorensen/git-gouda
One-time GitHub repository configuration via the gh CLI: lock the default branch with PR and CI rules, optionally enable a supported merge queue, lock merging to squash-only with PR-title commit messages, scaffold automatically-generated release notes (.github/release.yml), and optionally add a tag-driven release workflow. Use when the user says "set up the repo", "configure the merge queue", "enable squash merging", "lock down main", "set up branch protection", "configure release notes", "scaffold releases", "set up release tagging", or invokes /gh-bootstrap on a fresh or loosely-configured GitHub repository. Idempotent — safe to re-run on already-configured repos to bring missing pieces in line. This skill covers one-time repo policy, not per-task GitHub operations, local git commands, or project task running.
prek
paulnsorensen/git-gouda
Onboard prek (Rust-powered pre-commit) into any project and suggest hooks tailored to the language/framework. Use when the user says "add prek", "set up pre-commit hooks", "configure prek", "what hooks should I use", or when you notice a project without a prek.toml that would benefit from pre-commit checks. Also trigger when the user wants to add new hooks to an existing prek.toml, audit their hook config, or migrate from pre-commit to prek. Covers Rust, Python, TypeScript/JavaScript, Go, Ruby, and Shell projects. Do NOT use for husky, lint-staged, or CI pipeline hook configuration — this skill is specifically for prek.
oss-hygiene
paulnsorensen/git-gouda
Bring an open-source GitHub repository up to community-standards and supply-chain hygiene baseline: scaffold the GitHub Community Standards files (README check, LICENSE, CODEOFCONDUCT, CONTRIBUTING, SECURITY, issue + PR templates), wire Dependabot version updates, the Dependency Review action, OpenSSF Scorecard, and CodeQL (when applicable), check Dependabot alerts and secret scanning, and add the OpenSSF Best Practices Badge link. Use when the user says "set up OSS hygiene", "make this repo open-source-ready", "add community health files", "wire dependabot", "add scorecard", "OSSF badge", "supply chain hardening", or invokes /oss-hygiene on a public repo. Idempotent — safe to re-run; diffs against templates and asks before overwriting. Distinct from /gh-bootstrap (merge-button + branch protection) and /safe-settings (org-scale settings as code): focuses on the contributor-facing and supply-chain surface, not merge or org policy. Run after /gh-bootstrap; before announcing the repo.
github-copilot-repo-instructions
paulnsorensen/git-gouda
Add, audit, or fix GitHub Copilot repository custom instructions — .github/copilot-instructions.md (repo-wide) and .github/instructions/.instructions.md (path-specific) — so Copilot Chat, Copilot code review, and the Copilot coding agent all pick up project-wide guidance. Also covers AGENTS.md, CLAUDE.md, and GEMINI.md as alternate agent instruction files. Use when the user says "add Copilot instructions", "set up copilot-instructions.md", "audit our Copilot config", "make Copilot follow our conventions", "configure Copilot code review", "add path-specific Copilot rules", "applyTo glob", "excludeAgent", "Copilot is ignoring our guidance", or invokes /github-copilot-repo-instructions. Do NOT use for personal (per-user) Copilot instructions; those are out of scope for this skill. For AGENTS.md authoring guidance beyond file layout, see the agents-md skill.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.