home / skills / laurigates / claude-plugins / github-labels

github-labels skill

/git-plugin/skills/github-labels

This skill helps you discover, assign, and manage GitHub labels on PRs and issues using gh CLI to improve workflow clarity.

npx playbooks add skill laurigates/claude-plugins --skill github-labels

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.8 KB
---
model: haiku
created: 2025-12-16
modified: 2026-02-06
reviewed: 2025-12-16
name: github-labels
description: |
  Discover and apply labels to GitHub PRs and issues using the gh CLI. Use when
  you need to list available labels, add or remove labels on pull requests or issues,
  or create new labels for a repository.
allowed-tools: Bash, Read, Grep, Glob
---

# GitHub Labels

Reference for discovering and applying labels to GitHub PRs and issues.

## Discovering Available Labels

```bash
# List all labels with details
gh label list --json name,description,color --limit 50

# Search for specific labels
gh label list --search "bug"

# Output as simple list
gh label list --json name -q '.[].name'
```

## Adding Labels to PRs

```bash
# Single label
gh pr create --label "bug"

# Multiple labels (repeat flag)
gh pr create --label "bug" --label "priority:high"

# Comma-separated
gh pr create --label "bug,priority:high"

# Add to existing PR
gh pr edit 123 --add-label "ready-for-review"
```

## Adding Labels to Issues

```bash
# Create with labels
gh issue create --label "bug,needs-triage"

# Add to existing issue
gh issue edit 123 --add-label "in-progress"

# Remove label
gh issue edit 123 --remove-label "needs-triage"
```

## Common Label Categories

| Category | Examples |
|----------|----------|
| Type | `bug`, `feature`, `enhancement`, `documentation`, `chore` |
| Priority | `priority:critical`, `priority:high`, `priority:medium`, `priority:low` |
| Status | `needs-triage`, `in-progress`, `blocked`, `ready-for-review` |
| Area | `frontend`, `backend`, `infrastructure`, `testing`, `ci-cd` |

## Label Inheritance Pattern

When creating a PR from an issue:
1. Read issue labels via `gh issue view N --json labels`
2. Apply same labels to PR: `gh pr create --label "label1,label2"`

This maintains traceability and consistent categorization.

Overview

This skill automates discovery and application of GitHub labels using the gh CLI. It helps list available labels, add or remove labels on pull requests and issues, and create consistent labels for a repository. Use it to standardize categorization and maintain traceability between issues and PRs.

How this skill works

The skill runs gh CLI commands to list labels, query label details, and edit issues or pull requests. It can read labels from an issue and apply the same set to a new PR, add or remove individual labels on existing objects, and output label names for scripting. Commands include gh label list, gh issue edit/view, and gh pr create/edit.

When to use it

  • You need to see all repository labels and their metadata.
  • You want to add or remove labels on a new or existing PR/issue via scriptable commands.
  • You are creating PRs from issues and want to inherit labels for traceability.
  • You need a quick search for labels matching a term (e.g., bug).
  • You want to create or standardize label sets across contributions.

Best practices

  • List labels with --json name,description,color to get full metadata before applying changes.
  • Search labels with gh label list --search to avoid creating duplicates.
  • When creating PRs from issues, read issue labels (gh issue view --json labels) and pass them to gh pr create to preserve context.
  • Prefer repeated --label flags or comma-separated lists consistently across scripts.
  • Remove labels explicitly with --remove-label to avoid accidental overwrites.

Example use cases

  • List up to 50 labels with details: gh label list --json name,description,color --limit 50.
  • Create a PR and assign multiple labels: gh pr create --label "bug" --label "priority:high".
  • Add a label to an existing issue: gh issue edit 123 --add-label "in-progress".
  • Create an issue with labels: gh issue create --label "bug,needs-triage".
  • Copy labels from an issue to a PR: gh issue view N --json labels and then gh pr create --label "label1,label2".

FAQ

Can I search labels by keyword?

Yes. Use gh label list --search "keyword" to filter labels containing the term.

How do I copy labels from an issue to a PR?

Read the issue labels with gh issue view N --json labels, extract names, and pass them to gh pr create --label "label1,label2".