github-create-label
GitHub Create Label Skill
Create GitHub issue labels using the best available tool with automatic tool selection.
When to Use This Skill
Use this skill when you need to:
- Create a new label in the current repository
- Create multiple labels with specific names, descriptions, and colors
- Use the best available tool (MCP Server, CLI, or REST API) automatically
- Define labels before creating issues or assigning them
Quick Start
Create a Single Label
Input: "Create a label called 'bug' with description 'Something isn't working' and color d73a4a"
Process:
- Detects available tools (MCP Server → CLI → REST API)
- Uses the first available tool
- Creates the label with provided parameters
- Returns success confirmation
Create Multiple Labels
Input: "Create these labels: bug (red #d73a4a), enhancement (cyan #a2eeef), documentation (blue #0075ca)"
Process:
- Parses label definitions
- Creates each label using available tool
- Returns list of created labels or errors
Tool Selection Workflow
The skill attempts label creation in this precedence order:
1. GitHub MCP Server
Best for: Integrated Claude workflows When available: Claude with GitHub tools enabled Advantages: Native integration, no external tools needed
2. GitHub CLI (gh)
Best for: Local development, interactive workflows
When available: gh command installed and authenticated
Command: gh label create --name --description --color
Requirements:
ghcommand installed- Authenticated via
gh auth login
3. GitHub REST API
Best for: CI/CD, automation, programmatic access
When available: GITHUB_TOKEN or GH_TOKEN environment variable set
Endpoint: POST /repos/{owner}/{repo}/labels
Requirements:
GITHUB_TOKENorGH_TOKENenvironment variable- Token must have
reposcope
Label Parameters
Required
- name (string): Label name
- Max 50 characters
- Examples: "bug", "enhancement", "documentation"
Optional
-
description (string): Label description
- Max 100 characters
- Examples: "Something isn't working"
- Default: empty string
-
color (string): Hex color code
- 6 characters without # prefix
- Examples: "d73a4a" (red), "a2eeef" (cyan), "0075ca" (blue)
- Default: random color assigned by GitHub
Common Label Patterns
Bug Tracking
bug: d73a4a (red)
"Something isn't working"
help wanted: 008672 (dark green)
"Extra attention is needed"
Feature Management
enhancement: a2eeef (cyan)
"New feature or request"
good first issue: 7057ff (purple)
"Good for newcomers"
Documentation & Questions
documentation: 0075ca (blue)
"Improvements or additions to documentation"
question: cc317c (purple)
"Further information is requested"
Maintenance
wontfix: ffffff (white)
"This will not be worked on"
invalid: e4e669 (yellow)
"This doesn't seem right"
Configuration
Environment Variables
# GitHub CLI authentication (handled by gh auth login)
# No manual setup needed
# REST API authentication
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
# or
export GH_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
Repository Detection
The skill automatically detects:
- Repository owner and name from git remote URL
- Current directory as repository root (can be overridden)
Common Scenarios
Scenario 1: Create Standard Labels for New Repository
User Input: "Set up standard labels for bug tracking and feature management"
Process:
- Creates "bug" label (red)
- Creates "enhancement" label (cyan)
- Creates "documentation" label (blue)
- Creates "help wanted" label (dark green)
- Returns confirmation
Scenario 2: Create Custom Label
User Input: "Create a label for security issues with color ff0000"
Process:
- Parses label: name="security", color="ff0000"
- Uses available tool to create
- Returns confirmation
Scenario 3: Tool Fallback
User Input: Create label (gh CLI not installed)
Process:
- Detects gh not available
- Checks for GITHUB_TOKEN
- Uses REST API if available
- Returns error if no tools available
Scenario 4: Batch Label Creation
User Input: Create labels from a list
Process:
- Iterates through label definitions
- Creates each label using available tool
- Tracks successes and failures
- Returns summary report
Reference
For detailed information about:
- GitHub API and CLI commands: See api_reference.md
- Label color suggestions and examples
- Error handling and troubleshooting
Error Handling
The skill handles these common errors gracefully:
| Error | Solution |
|---|---|
| "gh: not found" | Install GitHub CLI from https://cli.github.com |
| "Not authenticated" | Run gh auth login to authenticate |
| "GITHUB_TOKEN not set" | Set GITHUB_TOKEN environment variable |
| "Repository not found" | Verify git remote is configured correctly |
| "Label already exists" | Use different name or update existing label |
| "Invalid color format" | Use 6-character hex code (e.g., d73a4a) |
| "Name too long" | Keep label name under 50 characters |
Integration Example
When using this skill in Claude tasks:
I need to set up labels for this repository.
Create these labels:
- bug (red, "Something isn't working")
- enhancement (cyan, "New feature or request")
- documentation (blue, "Documentation improvements")
- help wanted (dark green, "Extra attention needed")
The skill will:
- Check for available tools in order of precedence
- Create each label using the best available tool
- Return confirmation for each created label
- Report any errors that occur
Best Practices
- Consistency: Use consistent naming across projects (lowercase, hyphens for spaces)
- Documentation: Always include descriptions for clarity
- Colors: Use colors to create visual patterns (red for bugs, green for help, blue for docs)
- Batch Creation: Create all needed labels upfront during project setup
- Naming Conventions: Follow repository guidelines for label naming