7.5 KiB
7.5 KiB
id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
| id | title | category | status | source_trust_level | verification_status | created_at | updated_at | tags | tech_stack | applied_in | aliases | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| productivity-pr-template | PR Template — 좋은 description / 자동화 | Coding | draft | B | conceptual | 2026-05-09 | 2026-05-09 |
|
|
|
PR Template
좋은 PR = 빠른 review + 미래 reference. What / Why / Test plan 3가지 + checkbox + screenshot. GitHub
.github/PULL_REQUEST_TEMPLATE.md.
📖 핵심 개념
- What: 변경 내용.
- Why: 동기 (issue link).
- How: 구현 핵심 (필요 시).
- Test plan: 어떻게 검증.
💻 코드 패턴
기본 template
<!-- .github/PULL_REQUEST_TEMPLATE.md -->
## What
<!-- 짧게 — 무엇을 변경 -->
## Why
<!-- 왜 — 어떤 issue / 요구 -->
Closes #
## How
<!-- 핵심 구현 결정 — 필요 시 -->
## Screenshots
<!-- UI 변경 시 before/after -->
## Test plan
- [ ] Unit tests pass
- [ ] Manual test: ...
- [ ] Edge case: ...
## Migration / rollback
<!-- DB / config 변경 시 -->
## Checklist
- [ ] Tests added/updated
- [ ] Docs updated
- [ ] Feature flag added (if behind flag)
- [ ] No PII in logs
- [ ] No breaking change OR migration guide
Multi-template (PR type 별)
.github/PULL_REQUEST_TEMPLATE/
├── feature.md
├── bugfix.md
├── chore.md
└── docs.md
# URL 으로 select
github.com/org/repo/compare/main...feature?template=feature.md
Bug fix template
## Bug
<!-- 무엇이 잘못 -->
## Root cause
<!-- 왜 발생 -->
## Fix
<!-- 어떻게 해결 -->
## Repro
1. ...
2. ...
## Verification
- [ ] Before: shows bug
- [ ] After: works correctly
- [ ] Regression test added
Fixes #
Feature template
## Feature
<!-- 무엇 -->
## User story
As a <user>, I want <action>, so that <benefit>.
Spec: <link>
Issue: #
## Implementation notes
- ...
## Test plan
- [ ] Happy path
- [ ] Error cases
- [ ] Edge cases
- [ ] A11y
## Demo
[video / screenshot]
## Feature flag
- Flag: `flag-name`
- Default: off
- Rollout plan: ...
## Rollback
1. Disable flag
2. ...
Migration template
## Migration
<!-- 무엇 변경 -->
## Online safety
- [ ] No long lock
- [ ] Concurrent index (if applicable)
- [ ] Backwards-compatible deploy order
## Rollback
1. Disable new code path
2. Migrate data back: ...
## Deploy plan
1. Deploy migration
2. Verify
3. Deploy app code
4. Monitor
5. Cleanup (after N days)
## Risks
- ...
Conventional commits
feat: 새 feature
fix: bug fix
chore: misc (build, deps)
docs: docs
style: formatting (no logic)
refactor: 코드 정리 (no behavior)
perf: 성능
test: test
ci: CI 변경
build: build system
Scope: feat(api): ..., fix(ui): ...
Breaking: feat!: ... 또는 BREAKING CHANGE: footer
git commit -m "feat(orders): add cursor pagination
Closes #123"
Commitlint
// commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [
'feat', 'fix', 'chore', 'docs', 'style', 'refactor', 'perf', 'test', 'ci', 'build',
]],
},
};
Husky commit-msg hook
# .husky/commit-msg
npx --no -- commitlint --edit $1
→ 잘못된 commit message = block.
Semantic-release (자동 versioning)
# .releaserc
branches: [main]
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- '@semantic-release/changelog'
- '@semantic-release/npm'
- '@semantic-release/github'
feat: → minor bump (1.2.0)
fix: → patch (1.1.1)
feat!: 또는 BREAKING CHANGE: → major (2.0.0)
chore / docs: → no release
→ Commit history → version + changelog 자동.
Auto-merge / auto-rebase
# .github/auto-merge.yml (mergify, kodiak)
queue_rules:
- name: default
conditions:
- check-success=ci
- "#approved-reviews-by>=1"
- label=auto-merge
→ Approve + label = 자동 merge.
PR labels
- type:bug, type:feature, type:chore
- priority:high, priority:low
- status:wip, status:ready, status:blocked
- size:xs, size:s, size:m, size:l, size:xl
→ Filter / sort / report.
PR title 형식
✅ feat(orders): add cursor pagination
✅ fix(auth): handle null token
❌ "Update stuff"
❌ "Fixes"
Linked issue (자동 close)
Closes #123
Fixes #456
Resolves #789
→ PR merge → issue 자동 close.
Preview environment
# Vercel / Netlify auto-deploy preview
# PR 마다 unique URL
# Reviewer 가 직접 test
Dependabot PR
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule: { interval: weekly }
labels: [dependencies, auto-merge]
# Security patches 자동
- package-ecosystem: npm
directory: /
schedule: { interval: daily }
open-pull-requests-limit: 0
allow:
- dependency-type: direct
insecure-external-code-execution: deny
Stale PR cleanup
# .github/workflows/stale.yml
on:
schedule: [{ cron: '0 0 * * *' }]
jobs:
stale:
steps:
- uses: actions/stale@v9
with:
days-before-stale: 14
days-before-close: 7
stale-pr-message: "This PR is stale. It will be closed in 7 days."
Dangerous patterns
// danger.js — PR check
import { danger, fail, warn, message } from 'danger';
if (danger.git.modified_files.includes('package.json') && !danger.git.modified_files.includes('CHANGELOG.md')) {
warn('You changed package.json but not CHANGELOG.md');
}
if (danger.github.pr.body.length < 50) {
fail('Please provide a meaningful PR description');
}
if (danger.github.pr.title.length > 70) {
warn('PR title is long — consider shortening');
}
CHANGELOG (auto)
# semantic-release 가 자동
# 또는 git-cliff / standard-version
# CHANGELOG
## [1.5.0] - 2026-05-09
### Features
- orders: add cursor pagination (#123)
### Bug Fixes
- auth: handle null token (#456)
### Breaking Changes
- API: removed deprecated /v1/users endpoint
PR review 자동 (AI)
# .github/workflows/coderabbit.yml
- uses: coderabbit/ai-pr-reviewer@v2
→ AI 가 first review.
Squash vs merge commit vs rebase
Squash: PR 의 모든 commit → 1 commit (clean history).
Merge commit: PR 의 모든 commit + merge commit (full history).
Rebase: PR commit 들을 main 에 fast-forward (linear).
→ 보통 Squash (default GitHub).
큰 stack PR = rebase merge.
🤔 의사결정 기준
| 상황 | 추천 |
|---|---|
| 작은 팀 / 시작 | Simple template |
| 큰 / 복잡 | Multi template + danger |
| Open source | Detailed checklist |
| Internal | Lightweight |
| Strict process | Required CI + reviewers |
| Mobile / native | + screenshot / device test |
❌ 안티패턴
- Description 빈약 ("fix"): reviewer 추측.
- Template 안 따름: skip.
- Test plan 없음: 깨짐 risk.
- Conventional commit 강제 안 함: changelog 깨짐.
- Auto-merge + low review: 깨짐.
- PR 제목 generic: changelog 깨짐.
- Stale PR 무한: context loss.
🤖 LLM 활용 힌트
- What / Why / Test plan 3종 항상.
- Conventional commits + semantic-release.
- Multi-template (feature / bugfix / migration).
- Auto AI review + 인간 review.