| name | create-mr |
| description | Create a merge request (or pull request) with change-type analysis and project MR/PR template adherence. Use when the user asks to create an MR/PR, says "MR ๋ง๋ค์ด์ค", "create-mr", "$create-mr", or "PR ์์ฑํด์ค". Do not use for amending existing MRs, reviewing code, or committing changes.
|
Create MR
Create a properly typed, template-adherent merge request or pull request.
Workflow
0. Pre-flight Check
Run all checks in parallel before proceeding. If any check fails, report the
specific blocker and stop.
git branch --show-current
git diff --cached --stat
git status --porcelain
git log @{upstream}..HEAD --oneline 2>/dev/null
| Check | Blocker action |
|---|
| On main/master | Ask user to create a feature branch first |
| No commits ahead of upstream | Nothing to create an MR for โ stop |
| Uncommitted changes exist | Warn user; ask whether to continue or commit first |
Detect the platform once and reuse throughout:
.gitlab-ci.yml exists or remote URL contains gitlab โ GitLab (glab)
- Otherwise โ GitHub (
gh)
Verify CLI authentication before proceeding:
glab auth status 2>&1
gh auth status 2>&1
If auth fails, report the exact error and stop โ do not attempt MR creation without auth.
Determine <base> branch: check upstream tracking branch, or fall back to main/master.
1. Classify MR Type
Analyze the diff to determine the primary change type before writing anything.
git log <base>...HEAD --oneline
git diff <base>...HEAD --stat
git diff <base>...HEAD
| Type | Signal |
|---|
| feature | New user-facing functionality |
| fix | Bug correction |
| refactor | Code restructure, no behavior change |
| chore | Tooling, config, deps, CI/CD |
| docs | Documentation only |
| perf | Performance improvement |
| test | Test addition/modification only |
| hotfix | Urgent production fix |
If multiple types, choose the dominant one and note secondary concerns in the body.
2. Find and Apply MR Template (MANDATORY)
Never skip this step. Always search for templates before writing the MR body.
- Search these paths in the target repo:
.gitlab/merge_request_templates/
.github/PULL_REQUEST_TEMPLATE/
.github/PULL_REQUEST_TEMPLATE.md
.github/pull_request_template.md
docs/mr_templates/
- Also run a glob search:
**/*{merge_request,pull_request,PULL_REQUEST,mr_template}*
- If multiple templates exist, pick the one matching the MR type (e.g.
feature.md for features).
- Template found โ read it, fill every section. Mark inapplicable sections "N/A" with reason.
- No template found โ use the fallback below and inform the user.
3. Gather Context
git branch --show-current
git rev-parse --abbrev-ref @{upstream} 2>/dev/null
git status
Warn the user if unstaged changes or untracked files exist.
4. UI ๋ณ๊ฒฝ ์ Before/After ์คํฌ๋ฆฐ์ท
If the diff touches UI code (components, styles, layouts, templates, CSS, HTML), capture
Before/After screenshots and attach them to the MR body.
Detect UI changes:
git diff <base>...HEAD --name-only | grep -iE '\.(tsx|jsx|vue|svelte|html|css|scss|sass|less|styled)\b'
ํ๊ฒฝ ํ์ธ ํ ๋ถ๊ธฐ:
npx playwright --version ์ฑ๊ณต and dev server ๊ธฐ๋ ๊ฐ๋ฅ โ Playwright๋ก ์คํฌ๋ฆฐ์ท ์ดฌ์:
git worktree add /tmp/mr-before <base>
npx playwright screenshot --wait-for-timeout=3000 <target-url> /tmp/mr-before-screenshot.png
git worktree remove /tmp/mr-before
npx playwright screenshot --wait-for-timeout=3000 <target-url> /tmp/mr-after-screenshot.png
- Playwright ๋ฏธ์ค์น ๋๋ dev server ๊ธฐ๋ ๋ถ๊ฐ โ ์คํฌ๋ฆฐ์ท์ ๊ฑด๋๋ฐ๊ณ MR ๋ณธ๋ฌธ์ Before/After ์น์
์ ๋ค์์ ๊ธฐ์ฌ:
> โ ๏ธ Playwright ๋ฏธ์ค์น ๋๋ dev server ๊ธฐ๋ ๋ถ๊ฐ๋ก ์๋ ์คํฌ๋ฆฐ์ท์ ์๋ตํฉ๋๋ค.
> ์๋์ผ๋ก ์คํฌ๋ฆฐ์ท์ ์ถ๊ฐํด ์ฃผ์ธ์.
์คํฌ๋ฆฐ์ท ์ดฌ์ ์คํจ๊ฐ MR ์์ฑ ์์ฒด๋ฅผ ๋ง์ง ์๋๋ค.
5. Find Related Issue
๋ฐ๋์ ๊ด๋ จ ์ด์๋ฅผ ๊ฒ์ํด์ ์ฐพ๋๋ค. ๋ธ๋์น๋ช
์ถ์ธก์ ์์กดํ์ง ์๋๋ค.
5-1. ์ด์ ๋ฒํธ ํํธ ์์ง
git branch --show-current
git log <base>...HEAD --oneline
5-2. ์ด์ ๊ฒ์
ํ๋ซํผ์ ๋ง๋ CLI๋ก ์ด์๋ฅผ ์ง์ ๊ฒ์ํ๋ค.
GitLab:
glab issue list --search "<ํค์๋>" --per-page 10
glab issue view <๋ฒํธ>
glab issue list --assignee=@me --per-page 10
GitHub:
gh issue list --search "<ํค์๋>" --limit 10
gh issue view <๋ฒํธ>
gh issue list --assignee=@me --limit 10
5-3. ์ด์ ๋งค์นญ ๋ฐ ์ฝ์
- ๊ฒ์ ๊ฒฐ๊ณผ์์ MR ๋ณ๊ฒฝ ๋ด์ฉ๊ณผ ๊ฐ์ฅ ๊ด๋ จ ์๋ ์ด์๋ฅผ ์ ํํ๋ค.
- ๋งค์นญ๋ ์ด์๊ฐ ์์ผ๋ฉด MR ๋ณธ๋ฌธ์ Related Issues ์น์
์
Closes #๋ฒํธ๋ฅผ ์ฝ์
ํ๋ค.
- ํ๋ณด๊ฐ ์ฌ๋ฌ ๊ฐ์ด๋ฉด ์ฌ์ฉ์์๊ฒ ์ด๋ค ์ด์๋ฅผ ์ฐ๊ฒฐํ ์ง ํ์ธํ๋ค.
- ๊ด๋ จ ์ด์๋ฅผ ์ฐพ์ง ๋ชปํ๋ฉด Related Issues ์น์
์ "None found"๋ฅผ ๊ธฐ์ฌํ๊ณ MR ์์ฑ์ ๊ณ์ ์งํํ๋ค. ์ด์ ๋ฏธ๋ฐ๊ฒฌ์ด MR ์์ฑ์ ๋ง์ง ์๋๋ค.
6. Preview and Confirm
MR์ ์ค์ ๋ก ์์ฑํ๊ธฐ ์ ์ ์๋ ๊ณ ์ ํ์์ผ๋ก ์ฌ์ฉ์์๊ฒ ๋ณด์ฌ์ฃผ๊ณ ํ์ธ์ ๋ฐ๋๋ค.
์ฝ๋๋ธ๋ก์ด ์๋ ๋งํฌ๋ค์ด ํ
์ด๋ธ๊ณผ ๋ณธ๋ฌธ ๋ธ๋ก์ผ๋ก ํ์ํ์ฌ ๊ฐ๋
์ฑ์ ํ๋ณดํ๋ค.
## MR Preview
| ํญ๋ชฉ | ๊ฐ |
|------|-----|
| **Title** | <type>(<scope>): <description> |
| **Type** | feature / fix / refactor / ... |
| **Source** | <ํ์ฌ ๋ธ๋์น> |
| **Target** | <base ๋ธ๋์น> |
| **Related Issue** | Closes #๋ฒํธ ๋๋ None found |
| **Commits** | <์ปค๋ฐ ์>๊ฐ |
### Body
<MR ๋ณธ๋ฌธ ์ ์ฒด โ ๋งํฌ๋ค์ด ๋ ๋๋ง ์ํ๋ก>
์ฌ์ฉ์๊ฐ ์์ ์ ์์ฒญํ๋ฉด ํด๋น ๋ถ๋ถ๋ง ๋ฐ์ํ ๋ค ๋ค์ ํ๋ฆฌ๋ทฐ๋ฅผ ๋ณด์ฌ์ค๋ค. "ํ์ธ", "LGTM", "ใ
ใ
", "์งํํด" ๋ฑ ๊ธ์ ์๋ต์ ๋ฐ์ ๋ค์๋ง ๋ค์ ๋จ๊ณ๋ก ์งํํ๋ค.
7. Create the MR
- Push the branch if needed:
git push -u origin <branch>.
- Create with composed title and body using the detected platform CLI. HEREDOC์ผ๋ก body๋ฅผ ์ ๋ฌํ์ฌ ์์์ ๋ณด์กดํ๋ค:
glab mr create --title "<title>" --description "$(cat <<'EOF'
<body>
EOF
)" --target-branch <base>
gh pr create --title "<title>" --body "$(cat <<'EOF'
<body>
EOF
)"
- CLI ์ถ๋ ฅ์์ MR/PR URL์ ํ์ฑํ๋ค.
- URL์ ํด๋ฆญ ๊ฐ๋ฅํ ๋งํฌ๋ค์ด ๋งํฌ๋ก ์ฌ์ฉ์์๊ฒ ๋ฐํํ๋ค:
[MR !๋ฒํธ](URL) ๋๋ [PR #๋ฒํธ](URL).
- CLI๊ฐ ์๋ฌ๋ฅผ ๋ฐํํ๋ฉด ์๋ฌ ๋ฉ์์ง๋ฅผ ๊ทธ๋๋ก ๋ณด์ฌ์ฃผ๊ณ , ํํ ์์ธ(๊ถํ ๋ถ์กฑ, ์ค๋ณต MR, ํ๊ฒ ๋ธ๋์น ๋ฏธ์กด์ฌ)์ ์๋ดํ๋ค.
MR Title
Format: <type>(<scope>): <Korean description> โ under 70 chars, no emoji.
Examples:
feat(auth): ์์
๋ก๊ทธ์ธ ์ฐ๋ ์ถ๊ฐ
fix(api): ํ์ด์ง๋ค์ด์
์คํ์
๊ณ์ฐ ์ค๋ฅ ์์
refactor(core): ์๋ฌ ํธ๋ค๋ง ๊ตฌ์กฐ ๋จ์ํ
Fallback Template
Use when no project template is found:
## Summary
<!-- what and why, 1-3 bullets -->
## Type
<!-- feature | fix | refactor | chore | docs | perf | test | hotfix -->
## Changes
<!-- key changes, bulleted -->
## Before / After
<!-- UI ๋ณ๊ฒฝ ์ ์คํฌ๋ฆฐ์ท. UI ๋ณ๊ฒฝ ์์ผ๋ฉด "N/A" -->
| Before | After |
|--------|-------|
| ![before]() | ![after]() |
## Related Issues
<!-- Closes #์ด์๋ฒํธ ํ์. ์ฌ๋ฌ ์ด์๋ฉด ๊ฐ๊ฐ Closes ๋ถ์ธ๋ค. ์์ผ๋ฉด "None found" -->
## Test Plan
<!-- how these changes were tested -->
## Checklist
- [ ] Self-review completed
- [ ] Tests added/updated
- [ ] Documentation updated (if applicable)
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Hard Rules
- Never skip template search โ always run the search, even when you assume none exists.
- Never leave template sections empty โ fill every section or mark "N/A" with reason.
- Show MR type classification to the user before creating.
- Preview the complete MR and confirm with the user before pushing or creating.
- MR titles in Korean (except the type prefix).
- No emoji in titles.
- ์คํฌ๋ฆฐ์ท ์คํจ๋ ๋ธ๋กํนํ์ง ์๋๋ค โ Playwright ๋ถ์ฌ ๋๋ dev server ๊ธฐ๋ ๋ถ๊ฐ ์ ์๋ด ๋ฌธ๊ตฌ๋ฅผ ๋จ๊ธฐ๊ณ MR ์์ฑ์ ๊ณ์ ์งํํ๋ค.
- ์ด์ ๊ฒ์์ ์ํํ๋, ๋ฏธ๋ฐ๊ฒฌ ์ ๊ณ์ ์งํํ๋ค โ
glab issue list --search ๋๋ gh issue list --search๋ก ๊ด๋ จ ์ด์๋ฅผ ์ง์ ๊ฒ์ํ๊ณ , ์ฐพ์ผ๋ฉด Closes #์ด์๋ฒํธ๋ฅผ ํฌํจํ๋ค. ๊ฒ์ํด๋ ๋ชป ์ฐพ์ผ๋ฉด "None found"๋ฅผ ๊ธฐ์ฌํ๊ณ MR ์์ฑ์ ์งํํ๋ค.
- CLI ์ธ์ฆ ์คํจ ์ ์ฆ์ ์ค๋จํ๋ค โ auth ์๋ฌ๋ฅผ ์ฌ์ฉ์์๊ฒ ๋ณด๊ณ ํ๊ณ
glab auth login ๋๋ gh auth login ์คํ์ ์๋ดํ๋ค.
- MR ์์ฑ ํ ๋ฐ๋์ URL์ ๋ฐํํ๋ค โ ํด๋ฆญ ๊ฐ๋ฅํ ๋งํฌ๋ค์ด ๋งํฌ ํํ๋ก, ๋ฒํธ์ URL์ ๋ชจ๋ ํฌํจํ๋ค.