AgentSkillsCN

Gitlab

GitLab

SKILL.md

GitLab Integration Skill

This skill provides comprehensive GitLab integration for Claude Code, enabling seamless interaction with GitLab repositories, merge requests, branches, files, and CI/CD pipelines using the GitLab MCP server.

Prerequisites

  • GitLab MCP server configured in Claude Code
  • GitLab authentication set up through MCP (Personal Access Token or OAuth)
  • Git configured on your system

Configuration

This skill uses the GitLab MCP server for all GitLab API interactions. Ensure your GitLab MCP is properly configured with:

  • GitLab instance URL (e.g., https://gitlab.com or your self-hosted instance)
  • Authentication credentials (PAT or OAuth token)
  • Appropriate API scopes (api, read_repository, write_repository)

No additional configuration files are needed - the MCP handles all authentication and API communication.

Core Capabilities

1. Merge Request Management

  • Create MRs with AI-generated descriptions using mcp__gitlab__create_merge_request
  • List and filter MRs using mcp__gitlab__list_merge_requests
  • Get MR details using mcp__gitlab__get_merge_request
  • Add comments using mcp__gitlab__add_mr_comment
  • Checkout MR branches locally for testing
  • Merge MRs using mcp__gitlab__merge_merge_request
  • Update MR details using mcp__gitlab__update_merge_request

2. Branch Management

  • List branches using mcp__gitlab__list_branches
  • Create branches using mcp__gitlab__create_branch
  • Delete branches using mcp__gitlab__delete_branch
  • Checkout branches locally for development

3. File Operations

  • Get file contents using mcp__gitlab__get_file_content
  • Create files using mcp__gitlab__create_file
  • Update files using mcp__gitlab__update_file
  • Delete files using mcp__gitlab__delete_file
  • Create multi-file commits using mcp__gitlab__create_commit

4. Project Information

  • Get project details using mcp__gitlab__get_project
  • List user projects using mcp__gitlab__list_projects
  • List group projects using mcp__gitlab__list_group_projects
  • Check repository status with git commands

Usage

As a Skill

When invoked as a skill, I will:

  1. Understand the context: Check if we're in a git repository and identify the GitLab project
  2. Provide intelligent assistance: Offer suggestions based on current state
  3. Execute GitLab operations: Use the GitLab MCP server for all API interactions
  4. Generate quality content: Create well-structured MR descriptions, commit messages, etc.
  5. Combine MCP and Git: Use MCP for GitLab API operations and git commands for local operations

Available Commands

You can use these slash commands:

Merge Request Management:

  • /gitlab-list-mrs - List merge requests with filtering
  • /gitlab-create-mr - Create a new merge request
  • /gitlab-get-mr-commits - Get commits from an MR
  • /gitlab-post-mr-comment - Post a comment to an MR
  • /gitlab-checkout-mr - Checkout an MR branch locally

Branch Management:

  • /gitlab-list-branches - List branches in the project
  • /gitlab-create-branch - Create a new branch

Direct Invocation

You can also ask me directly:

  • "Create a GitLab MR for this feature"
  • "Show me open merge requests"
  • "Checkout the branch from MR !123"
  • "List all branches in this project"
  • "Create a new branch called feature/auth"

How I Work

When you use this skill, I will:

  1. Check Context: Determine current repository and branch using git commands
  2. Identify Project: Extract project information from git remote or use MCP to find the project
  3. Use GitLab MCP: Call GitLab MCP tools for all API operations
  4. Execute Git Commands: Run git operations for local repository management
  5. Generate Content: Create descriptions, summaries, and documentation using AI
  6. Provide Feedback: Show results and next steps with helpful links

GitLab MCP Tools

This skill uses the following GitLab MCP tools:

Project & Info:

  • mcp__gitlab__gitlab_info - Get GitLab connection info
  • mcp__gitlab__get_project - Get project details
  • mcp__gitlab__list_projects - List accessible projects

Merge Requests:

  • mcp__gitlab__list_merge_requests - List MRs with filtering
  • mcp__gitlab__get_merge_request - Get MR details
  • mcp__gitlab__create_merge_request - Create new MR
  • mcp__gitlab__update_merge_request - Update MR details
  • mcp__gitlab__merge_merge_request - Merge an MR
  • mcp__gitlab__add_mr_comment - Add comment to MR

Branches:

  • mcp__gitlab__list_branches - List branches
  • mcp__gitlab__create_branch - Create new branch
  • mcp__gitlab__delete_branch - Delete branch

Files:

  • mcp__gitlab__get_file_content - Get file content
  • mcp__gitlab__create_file - Create new file
  • mcp__gitlab__update_file - Update existing file
  • mcp__gitlab__delete_file - Delete file
  • mcp__gitlab__create_commit - Create multi-file commit

Security

  • Authentication handled securely by GitLab MCP server
  • Tokens never exposed in skill operations or logs
  • All API calls go through authenticated MCP connection
  • Git operations use standard git authentication

Examples

Example 1: Create MR

code
You: I've finished the authentication feature, create an MR
Me: I'll analyze your commits and create a merge request...
[Uses git log to analyze commits]
[Generates comprehensive MR description using AI]
[Uses mcp__gitlab__create_merge_request to create MR]
✓ Merge Request !123 created: https://gitlab.com/group/project/-/merge_requests/123

Example 2: List Open MRs

code
You: Show me open merge requests
Me: Fetching open merge requests...
[Uses mcp__gitlab__list_merge_requests with state=opened]
[Displays formatted list with MR !IID, title, author, status]

Found 5 open merge requests:
- !123: Add authentication feature (by alice)
- !122: Fix database connection pool (by bob)
...

Example 3: Checkout MR Branch

code
You: Checkout MR !123 for testing
Me: I'll checkout the MR branch locally...
[Uses mcp__gitlab__get_merge_request to get branch name]
[Fetches and checks out branch using git]
✓ Checked out branch 'feature/auth' from MR !123

Error Handling

  • Validates GitLab MCP connection before operations
  • Checks git repository state
  • Handles MCP tool errors gracefully
  • Provides helpful error messages with context
  • Falls back to alternative methods when possible

Extending

You can extend this skill by:

  • Creating additional slash commands in ~/.claude/commands/
  • Using additional GitLab MCP tools as they become available
  • Combining with other MCP servers (GitHub, Jira, etc.)
  • Creating custom workflows using multiple commands
  • Adding project-specific automation