Label Issue Skill
Automatically classify and label GitHub issues based on repository-specific labeling instructions.
Overview
This skill analyzes GitHub issue content (title, body, comments) and applies appropriate labels based on labeling rules defined in the target repository's .github/label-instructions.md file.
Workflow
- •Input: Receive issue URL or issue number with repository (owner/repo)
- •Fetch labeling instructions: Read
.github/label-instructions.mdfrom the repository - •Fetch issue: Get issue details (title, body, existing labels)
- •Analyze issue: Match issue content against labeling rules
- •Determine labels: Select appropriate labels based on:
- •Keyword matching
- •Issue type detection (bug, feature, question, etc.)
- •Priority assessment
- •Area/component identification
- •Apply labels: Use Python script to add labels via GitHub API
- •Report: Confirm labels applied with reasoning
Reading Labeling Instructions
Fetch .github/label-instructions.md from the target repository using GitHub MCP tools. The file should define:
- •Available labels: List of valid labels with descriptions
- •Labeling rules: Criteria for when to apply each label
- •Keywords mapping: Keywords that trigger specific labels
For template format, see references/label_instructions_template.md.
If .github/label-instructions.md is not found:
- •Fetch the list of labels defined in the target repository using
github/list_labels - •Create a brief summary of available labels based on their names and descriptions
- •Use the summary to determine which labels best match the issue content
Issue Analysis
Analyze issue content to determine appropriate labels by:
- •Type Detection: Match issue keywords against label names/descriptions
- •Priority Assessment: Identify severity indicators in the issue
- •Area Detection: Match issue content against area-specific labels
Applying Labels
Run the bundled Python script to add labels:
# Install dependency pip install requests # Add labels to an issue python scripts/label_issue.py <owner> <repo> <issue_number> <labels> # Example: add bug and priority:high labels python scripts/label_issue.py microsoft vscode 123 "bug,priority:high" # Example: add multiple area labels python scripts/label_issue.py microsoft vscode 123 "bug,area:ui,area:api"
The script scripts/label_issue.py handles the GitHub API call.
Example Commands
- •"Label issue #123 in microsoft/vscode"
- •"What labels should this issue have? https://github.com/owner/repo/issues/456"
- •"Classify and label issue #789"
- •"Add appropriate labels to this bug report"
Output
Report the labeling decision with:
- •Labels applied: List of labels added
- •Reasoning: Why each label was chosen
- •Type: "Detected as bug (keywords: 'not working', 'error')"
- •Priority: "High priority (affects core functionality)"
- •Area: "Matched 'ui' area (keywords: button, dialog)"
- •Existing labels: Labels already on the issue (not modified)
Example Output
✅ Labels added to issue #123: bug, priority:high, area:ui
**Reasoning:**
- **bug**: Issue describes broken functionality ("button not working")
- **priority:high**: Core feature affected, no workaround mentioned
- **area:ui**: UI-related keywords detected (button, click, display)
**Existing labels:** needs-triage (unchanged)
Configuration
The skill requires:
- •GITHUB_ACCESS_TOKEN or GITHUB_PAT environment variable with
reposcope - •label-instructions.md in target repository (optional but recommended)
Fallback Behavior
If labeling instructions are not found:
- •Use default type detection rules
- •Skip priority and area labels
- •Report that default rules were used