home / skills / thebushidocollective / han / create-mr

This skill guides you to create a GitLab merge request by collecting project, branches, title, and description for a ready MR.

npx playbooks add skill thebushidocollective/han --skill create-mr

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

Files (1)
SKILL.md
2.4 KB
---
name: create-mr
description: Create a new merge request in a GitLab project
---

# Create GitLab Merge Request

## Name

gitlab:create-mr - Create a new merge request in a GitLab project

## Synopsis

```
/create-mr [arguments]
```

## Description

Create a new merge request in a GitLab project

## Implementation

Create a new merge request in a GitLab project with source and target branches.

## Usage

```
/create-mr
```

This command helps you create a merge request with all necessary details.

## What This Command Does

1. Asks for the project ID or path
2. Prompts for source branch name
3. Requests target branch name
4. Asks for MR title
5. Requests MR description (optional)
6. Creates the merge request using the GitLab MCP `create_merge_request` tool
7. Returns the MR number and URL

## Prerequisites

- GitLab MCP server must be installed and configured
- GitLab version 18.5 or later
- You must have Developer or higher role in the project
- Both source and target branches must exist
- OAuth authentication must be completed

## Example Interaction

```
User: /create-mr

Claude: I'll help you create a merge request. What's the project ID or path?

User: 456

Claude: What's the source branch name?

User: feature/user-authentication

Claude: What's the target branch name?

User: main

Claude: What should the merge request title be?

User: Add JWT-based user authentication

Claude: Please provide a description (optional, press Enter to skip):

User: This MR implements JWT-based authentication for the API:
- User login and registration endpoints
- Token generation and validation middleware
- Password hashing with bcrypt
- Unit tests for auth flows

Closes #42

Claude: Creating merge request in project 456...

āœ“ Merge request created successfully!
  !15 - Add JWT-based user authentication
  https://gitlab.com/your-org/project/-/merge_requests/15

  Status: Open
  Source: feature/user-authentication
  Target: main
```

## Tips

- Link related issues using `Closes #123` or `Fixes #123` in the description
- Use conventional commit prefixes in titles: `feat:`, `fix:`, `refactor:`
- Include a testing checklist in the description
- Add reviewers after creation if needed
- Set appropriate labels for categorization
- Consider creating a draft MR for work-in-progress

## Related Commands

- `/view-mr`: View merge request details and diffs
- `/review-mr`: Get a comprehensive review of a merge request
- `/create-issue`: Create an issue that this MR will resolve

Overview

This skill creates a new merge request in a GitLab project by collecting minimal inputs and calling the GitLab MCP create_merge_request tool. It guides you through project selection, source and target branches, title, and optional description, then returns the MR number and URL. The flow is optimized for quick, reproducible MR creation when branches already exist.

How this skill works

The skill prompts for project ID or path, source branch, target branch, MR title, and an optional description. It validates inputs and uses the GitLab MCP create_merge_request API to create the MR. On success it returns the merge request ID, URL, status, source and target branches, and a short confirmation message.

When to use it

  • You have completed work on a feature or fix and both source and target branches already exist.
  • You want a quick, guided way to open a merge request without switching to the GitLab web UI.
  • You need to include issue closing keywords (e.g., Closes #123) in the MR description.
  • You want to create a draft MR for work-in-progress or collect a testing checklist in the description.
  • You have Developer role or higher and OAuth authentication to the GitLab MCP is configured.

Best practices

  • Prepare the source branch and push all commits before running the command to avoid incomplete MRs.
  • Use clear, conventional commit-style MR titles (e.g., feat:, fix:, refactor:) for consistent changelogs.
  • Include issue-closing keywords (Closes/Fixes) and a short testing checklist in the description to speed review and automation.
  • Create draft MRs for incomplete work by prefixing the title or using draft flags where supported.
  • Add labels and reviewers after creation if your workflow requires specific assignees or CI triggers.

Example use cases

  • Open an MR to merge feature/user-authentication into main and include a testing checklist and issue reference.
  • Create a hotfix MR from release/1.2.0-hotfix into main with a concise title and description linking the related issue.
  • Create a draft MR for a refactor branch to gather early feedback while work continues.
  • Quickly open an MR from the CLI or chat assistant when you already know project path and branch names.

FAQ

What permissions are required to create an MR?

You must have Developer or higher role in the target project.

What prerequisites are needed before using this skill?

GitLab MCP must be configured, OAuth authentication completed, GitLab 18.5+ supported, and both source and target branches must exist.