Agent skill
mr-generator
Generates intelligent GitLab merge request descriptions from git commits with automatic categorization and Jira integration
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/mr-generator
SKILL.md
Features
- Automatic commit analysis: Analyzes git commits since diverging from main branch
- Smart categorization: Categorizes commits with appropriate emojis (๐, โจ, ๐, ๐, ๐ฅ, ๐, etc.)
- Jira integration: Supports Jira ticket numbers and can fetch descriptions
- Template-based: Uses your team's MR template format
- GitLab integration: Can create MRs directly using
glabCLI - Interactive preview: Shows MR preview before creation with edit capabilities
Installation
-
Ensure you have the required dependencies:
bash# GitLab CLI pip install glab # Or follow installation instructions at https://gitlab.com/gitlab-org/cli -
Make sure the script is executable:
bashchmod +x scripts/mr_generator.py
Usage
Basic usage (outputs to terminal):
python3 scripts/mr_generator.py
With Jira ticket:
python3 scripts/mr_generator.py --jira PROJ-123
Create MR directly:
python3 scripts/mr_generator.py --create --jira PROJ-123
The tool will:
- Generate the MR description
- Ask for Jira ticket title if not found
- Show a preview for confirmation
- Create the MR with title format:
RD-[ticket] [title]
Save to file:
python3 scripts/mr_generator.py --output mr_description.md
Create MR with custom title:
python3 scripts/mr_generator.py --create --title "Custom MR Title" --jira PROJ-123
MR Template
The tool uses this template format:
Closes #X or Relates to [link to backlog]
## What's new
- ๐ Init of a new component
- โจ [New feature](url)
- ๐ [Bug fixed](url)
- ๐ [Glitch fixed](url)
- ๐ฅ [P1 bug fixed](url)
- ๐ Something is deployed
- ...
## BTW
Something relevant fixed along the way (tech debt, doc).
## SCREENSHOTS
Screenshots of the app with your fix/new feature on.
## Requirements & Dependencies
- Required software (ex. Docker, Node)?
- Critical new dependency (ex. framework)
## Testing
Run the following commands
cd ... make help make tests
Commit Categorization
The tool automatically categorizes commits based on message content:
- ๐ Init:
init,initial,start - โจ Feature:
feat,feature,add - ๐ Bug:
fix,bug,patch - ๐ฅ P1 Bug:
p1,critical(with bug keywords) - ๐ Style/UI:
style,ui,glitch - ๐ Deploy:
deploy,release - ๐ง Refactor:
refactor,tech debt,cleanup - ๐ Docs:
docs,documentation - ๐งช Tests:
test,tests - ๐ Changes: Default for other commits
Configuration
Jira Integration
Currently, Jira integration is manual (you provide the ticket number). Future versions could include:
- Automatic Jira API integration
- Ticket description fetching
- Status synchronization
Custom Template
To customize the MR template, modify the template variable in the MRGenerator.__init__ method in scripts/mr_generator.py.
Examples
Example 1: Generate MR for a feature branch
# On your feature branch
python3 scripts/mr_generator.py --jira PROJ-456 --create
Output:
โ
MR created successfully!
https://gitlab.com/cnty-ai/continuity/-/merge_requests/789
Example 2: Generate description without creating MR
python3 scripts/mr_generator.py --jira PROJ-789 --output description.md
Troubleshooting
Common Issues
-
"Not in a git repository"
- Make sure you're in a git repository
- Check that you have a remote named
originormain
-
"glab command not found"
- Install GitLab CLI: https://gitlab.com/gitlab-org/cli
- Authenticate:
glab auth login
-
"Could not find main branch"
- Ensure you have a
mainororigin/mainbranch - The tool tries both
mainandorigin/main
- Ensure you have a
Debug Mode
Add debug output by setting environment variable:
DEBUG=1 python3 scripts/mr_generator.py
Contributing
To extend this tool:
- Add new commit categories: Update the
categorize_commitmethod inmr_generator.py - Customize template: Modify the
templatevariable inMRGenerator.__init__ - Add new integrations: Extend the Jira integration or add other ticket systems
- Improve categorization: Enhance the commit analysis logic
License
This skill is part of the OpenCode project and follows the same license terms.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?