sample/harness/next-js-pages/skills/git-pr/SKILL.md
Generate PR description and automatically create pull request on GitHub
npx skillsauth add sc30gsw/claude-code-customes git-prInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate a PR description and open a draft pull request on GitHub. Adds a two-track scoring system (Review Attention + Simplicity) with Greptile-style confidence tags, and produces styled Mermaid diagrams reviewers can read at a glance.
All analysis runs through CLI tools (git, gh, rg, ctx7) — no MCP servers required.
/git:pr [options]
| Option | Description | Example |
| ----------------- | ---------------------------------------------------------- | ------------------------- |
| (default) | Generate PR description and create PR | /git:pr |
| -p | Push current branch and create PR | /git:pr -p |
| -u | Update existing PR description only | /git:pr -u |
| --no-score | Skip both Review Attention and Simplicity scoring | /git:pr --no-score |
| --no-simplicity | Skip only the Cleanup Burden score (keep Review Attention) | /git:pr --no-simplicity |
| --no-mermaid | Skip Mermaid diagram generation | /git:pr --no-mermaid |
Do not try to do everything in /git:pr. Coordinate with two built-in skills:
| Skill | Responsibility | Relation to /git:pr |
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| /code-review | Review changed code for reuse, quality, efficiency, then fix | Run before /git:pr on big changes — lowers Simplicity / Complexity / Influence scores |
| /git:pr (this) | Generate description, Mermaid, scores → gh pr create --draft | Touches no code — metadata only |
| /review | Per-line review of an existing PR | Run after /git:pr on High / Critical PRs as a self-check before requesting reviewers |
/review's job/code-review's job/code-reviewUse plain CLI tools. Prefer the most specific tool for the job.
# Files changed in the current branch vs the base
git diff --name-status $(git merge-base HEAD origin/main)..HEAD
# Per-file +/- LOC
git diff --numstat $(git merge-base HEAD origin/main)..HEAD
# Commits on this branch
git log --oneline $(git merge-base HEAD origin/main)..HEAD
# Detect migration / auth / env-touching files
git diff --name-only $(git merge-base HEAD origin/main)..HEAD \
| grep -E '(migration|migrate|auth|middleware|\.env|secrets)'
For -u (update), use gh:
gh pr view --json number,title,body,baseRefName,headRefName
gh pr edit --body-file pr-body.md
gh pr create --draft --title "<title>" --body-file pr-body.md
# Find a symbol definition
rg -n --no-heading 'function\s+hashToken\b|const\s+hashToken\b|hashToken\s*=' .
# Find all references to a symbol (proxy for "find referencing symbols")
rg -n --no-heading '\bhashToken\b' .
# Count call sites
rg -c '\bhashToken\b' . | awk -F: '{sum+=$2} END {print sum}'
# Detect duplicate blocks: list candidates by signature
rg -n --no-heading 'function parseJWT|const parseJWT|parseJWT\s*=' .
# Common code-smell patterns
rg -n 'for\s*\(.*\)\s*\{[^}]*await' . # await-in-loop
rg -n '\.map\([^)]*\)\.filter\(' . # map().filter() chain
rg -n 'new\s+[A-Z][A-Za-z0-9_]*\(' . # direct `new` (DI smell)
/find-docs skill)# Step 1: resolve library id
ctx7 library nextjs "How to set up app router with middleware"
# Step 2: query docs with the resolved id
ctx7 docs /vercel/next.js "How to add authentication middleware to app router"
Do not invoke more than 3 ctx7 calls per PR generation. See the /find-docs skill for full rules, version pinning, and authentication.
Companion chain:
/code-review(pre) →/git:pr(this) →/review(post). For large changes, run/code-reviewfirst so scores drop and reviewers have less to wade through.
git diff --name-status + git diff --numstat + git log --oneline (base = origin/main or repo default branch).github/pull_request_template.mdrg to detect duplicates, dead code, NIH, inefficient patterns
## 📊 Review Attention Score and ## 🧹 Cleanup Burden/code-review and /review suggestions based on thresholdsctx7 (resolve library → query docs); max 3 callsclassDef palette + legend subgraph + shape semantics are mandatorygh pr create --draft --title <title> --body-file <pr-body.md>-pgit push -u origin "$(git rev-parse --abbrev-ref HEAD)"-ugh pr edit --body-file pr-body.mdctx7 for documentation URLs (see /find-docs for usage rules)--no-mermaid)--no-score)Signal quality: ✅ N confirmed · 🤔 M inferred · ❓ K speculativeclassDef block and a Legend subgraphWeighted average of three axes (0–100). Tells reviewers how carefully to read.
| Axis | Weight | Evaluates |
| ---------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| Risk (blast radius on failure) | 0.45 | DB migration, auth/authz, payment, breaking API change, prod config, .env/secrets, deletion |
| Influence (spread) | 0.35 | files changed, LOC, directories crossed, call sites, shared modules (packages/, lib/, core/) |
| Complexity (cognitive load) | 0.20 | concurrency/async, new algorithms, commit granularity, unrelated changes mixed in |
auth/, middleware/, RLS, JWT): +25.env.example / secrets-related: +20shared/, lib/, core/, packages/*/): +20rg -c '\bSYMBOL\b'): +15Promise.all, channels, goroutines, async chains): +20/code-review perspective — how much polish remains before merge. Independent 0–100 score; never folded into Total.
Reading the score: 0 = nothing to clean up (great), 100 = major cleanup recommended. A score of 10 means the code is clean, not that it failed.
| Lens | Looks at |
| ---------- | -------------------------------------------------------- |
| Reuse | Existing utilities ignored (NIH), reinvented helpers |
| Quality | Duplicated blocks, dead code, naming drift, magic values |
| Efficiency | N+1, await-in-loop, redundant .map().filter() chains |
| Design | Over-abstraction, tight coupling, hard-to-test code |
rg finds same name or near-identical signature elsewhere): +20new, no DI): +10Compute Simplicity mechanically with
rgwherever possible (duplicate symbols, dead imports, await-in-loop). Do not score on impression alone.
Every contributing-factor row in the score tables must carry a Confidence tag, so reviewers can separate signal from noise at a glance.
| Tag | Basis | Multiplier | Example |
| ------------------ | ------------------------------------------------------------------- | ---------- | ------------------------------------------------------- |
| ✅ Confirmed | Mechanically verifiable (diff, file presence, rg exact match) | ×1.0 | "migration file migrations/0042_*.sql exists in diff" |
| 🤔 Likely | Pattern match / naming convention / static-analysis level inference | ×0.7 | "for...await pattern → probably an N+1" |
| ❓ Speculative | LLM judgment only; depends on runtime/design intent | ×0.4 | "looks like premature abstraction" |
Output rule: every factor row starts with its tag (✅ DB migration added (+30))
Summary: each scoring section ends with a Signal quality block that lists each item by confidence tier:
Signal quality(シグナル品質):
- ✅ confirmed(確認済み): migration ファイル追加, auth middleware 変更, lib/auth.ts 変更 (23 call sites)
- 🤔 inferred(推定): refactor が feature と混在 (commit 粒度から推測)
- ❓ speculative(推測): なし
Rules:
なしconfirmed(確認済み), inferred(推定), speculative(推測)Warning: if ❓ share exceeds 40%, append ⚠️ 推測ベースの要因が多め — スコアは参考値として扱ってください
Direction: For both scores, a higher number = more work needed — not a grade.
- Review Attention 80 → reviewers must focus hard (risky PR)
- Review Attention 10 → reviewers can skim (safe PR)
- Simplicity 80 → lots of cleanup possible before merge
- Simplicity 10 → code is already clean, nothing to do
| Score | Review Attention | Simplicity | Badge | | ------ | -------------------- | ------------------ | ----- | | 0–34 | Low ↓ light focus | Clean ↓ no cleanup | 🟢 | | 35–64 | Medium | Some cleanup | 🟡 | | 65–84 | High ↑ close reading | Needs cleanup | 🔴 | | 85–100 | Critical ↑ all hands | Heavy cleanup | 🚨 |
| Condition | Output |
| ---------------------------------- | -------------------------------------------------------------------------------------------------- |
| Cleanup Burden ≥ 50 | > 💡 Run /code-review (Cleanup Burden {score} = {level}): {top reasons} — easy wins before merge |
| Total ≥ 65 | > 💡 Run /review (Review Attention {score} = {level}): self-review before assigning reviewers |
| Total < 35 AND Cleanup Burden < 30 | (suppress — already a clean, low-risk PR) |
> 🔍 **Review Attention: 🔴 High** (78 risk pts · higher = needs more focus) — DB migration + auth middleware rewrite, 14 files touched
> 🧹 **Cleanup Burden: 🔴 High** (75 cleanup pts · higher = more to fix) — hashToken() reinvented + parseJWT duplicated 3x
Rules for the badge line:
(N risk pts · higher = needs more focus) for Review Attention so the direction is unambiguous.(N cleanup pts · higher = more to fix) for Simplicity — never write it as "X/100" because low scores look like a failing grade when they are actually good (low = clean).🟢 Low (8 cleanup pts · higher = more to fix) correctly signals "almost nothing to clean up".## 📊 Review Attention Score
**Total: 🔴 High** (78 risk pts — higher = reviewers need to focus more)
Weighted average of Risk + Influence + Complexity. Does NOT include Simplicity.
| Axis | Axis score | Contributing factors (Confidence) |
| ---------- | ---------- | ------------------------------------------------------------------------------------------------------ |
| Risk | 85 pts | ✅ DB migration added (+30) / ✅ auth middleware rewrite (+25) / ✅ `.env.example` updated (+20) |
| Influence | 72 pts | ✅ 14 files / 612 LOC / ✅ shared `lib/auth.ts` modified (23 call sites via `rg`) |
| Complexity | 68 pts | ✅ new Promise.all concurrency / 🤔 refactor mixed into the feature (inferred from commit granularity) |
Signal quality(シグナル品質):
- ✅ confirmed(確認済み): DB migration ファイル追加, auth middleware 書き換え, `.env.example` 更新, 14 files / 612 LOC, shared `lib/auth.ts` 変更 (23 call sites)
- 🤔 inferred(推定): refactor が feature と混在 (commit 粒度から推測)
- ❓ speculative(推測): なし
### For reviewers
- Verify the rollback plan for `migrations/0042_*.sql`
- Confirm the `lib/auth.ts` signature change is matched by every one of the 23 call sites
- E2E: log in → refresh session → log out on a real environment
---
## 🧹 Cleanup Burden (separate, not in Total)
**🔴 High** (75 cleanup pts — higher = more to clean up)
`/code-review` perspective. 0 = nothing to do, 100 = heavy cleanup recommended.
| Lens | Contribution | Where (Confidence) |
| --------------------- | ------------ | ------------------------------------------------------------------------------------------------------- |
| Reuse | +20 | ✅ reinvents existing `hashToken()` from `lib/utils/hash.ts` (`src/auth/token.ts:42`, `rg` exact match) |
| Quality (duplication) | +15 | ✅ `parseJWT` duplicated across `api/signin.ts`, `api/refresh.ts`, `middleware/auth.ts` |
| Efficiency | +14 (×0.7) | 🤔 `await` inside `for` loop at `services/user-sync.ts:18` — convert to `Promise.all` |
| Quality (magic value) | +10 | ✅ `86400` (= 1 day) hardcoded in 2 places |
| Quality (dead code) | +10 | ✅ 2 unused imports |
| Design | +6 (×0.4) | ❓ generic type params on `AuthService` may be overkill |
Signal quality(シグナル品質):
- ✅ confirmed(確認済み): `hashToken()` 再発明 (rg 完全一致), `parseJWT` 3箇所重複, `86400` ハードコード 2箇所, 未使用 import 2件
- 🤔 inferred(推定): `for` ループ内 `await` (N+1 パターンから推測)
- ❓ speculative(推測): `AuthService` の generic 型パラメータが過剰かも
(Speculative 比率 17% — 警告なし)
> 💡 Next actions
>
> - Run `/code-review` (Cleanup Burden 75 = High): the duplicates and reinvention above can be cleaned up before merge
> - Run `/review` (Review Attention 78 = High): self-review before assigning reviewers
Reviewers must be able to tell what's new / modified / removed / external from color and shape alone in under a second. Generate that every time.
| Purpose | classDef name | fill | stroke | color |
| ------------------- | ------------- | --------- | --------- | --------- |
| Added | added | #dcfce7 | #16a34a | #14532d |
| Modified | modified | #fef3c7 | #d97706 | #78350f |
| Removed | removed | #fee2e2 | #dc2626 | #7f1d1d |
| External dependency | external | #dbeafe | #2563eb | #1e3a8a |
| Datastore | datastore | #ede9fe | #7c3aed | #4c1d95 |
| Highlight | highlight | #fce7f3 | #db2777 | #831843 |
Use stroke-width:2px to make borders pop. Text color stays dark so it stays readable in dark mode.
| Shape | Syntax | Meaning |
| ------------------------- | ----------------- | --------------------- |
| Rectangle [...] | process / service | generic component |
| Stadium ([...]) | endpoint / entry | API route, page |
| Cylinder [(...)] | datastore | DB, cache, queue |
| Rhombus {...} | branch / guard | guard, middleware |
| Hexagon {{...}} | external system | 3rd-party API |
| Double circle (((...))) | event | webhook, cron trigger |
Group nodes into Frontend / API / Domain / Datastore / External subgraphs to minimize visual scanning.
flowchart LR
subgraph Legend [" Legend "]
direction LR
L1[Added]:::added
L2[Modified]:::modified
L3[Removed]:::removed
L4[External]:::external
L5[(Datastore)]:::datastore
end
classDef added fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
classDef modified fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#78350f
classDef removed fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#7f1d1d
classDef external fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a8a
classDef datastore fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#4c1d95
flowchart TB
classDef added fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
classDef modified fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#78350f
classDef external fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a8a
classDef datastore fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#4c1d95
subgraph Frontend
Page([/login page]):::modified
end
subgraph API
Route([POST /api/auth/signin]):::added
MW{authMiddleware}:::modified
end
subgraph Domain
Svc[AuthService]:::added
end
subgraph Datastore
DB[(users table)]:::modified
end
subgraph External
IdP{{IdP / OAuth}}:::external
end
Page -->|credentials| Route
Route --> MW
MW -->|valid| Svc
Svc -->|verify| IdP
Svc -->|upsert| DB
sequenceDiagram does not honor classDef. Append an emoji marker to each participant label — 🟢 (added) / 🟡 (modified) / 🔴 (removed) / 🔵 (external) — and use Note over X: 🟢 new where extra emphasis helps.
tools
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
testing
# sdd-workflow — Workflow Status Dashboard ## Slash Command ``` /sdd-workflow [slug] ``` ## Purpose Read-only meta skill. Displays the current state of the SDD workflow — which phases are complete, which is next, and any blockers. Does NOT modify any files. --- ## This Skill is Read-Only `sdd-workflow` never writes to or modifies any file. It only reads spec files and git history to report status. There is no approval gate for this skill. --- ## Usage: Specific Feature ``` /sdd-workflo
content-media
# sdd-tasks **Slash command**: `/sdd-tasks <slug>` **Purpose**: Generate `tasks.md` (TASK-001..N) and `progress.md` from `requirements.md` and `design.md`. --- ## Prerequisites - `.claude/specs/<slug>/requirements.md` must exist - `.claude/specs/<slug>/design.md` must exist (run `/sdd-design` first) --- ## Steps ### 1. Read spec inputs ``` .claude/specs/<slug>/requirements.md .claude/specs/<slug>/design.md ``` Extract: - Every REQ-XXX ID with its acceptance criteria - Every design sect
development
# sdd-review — Post-Implementation Code Review ## Slash Command ``` /sdd-review <slug> ``` ## Purpose Run code review and security review on all changes introduced by the feature branch. Append structured findings to `review.md`. Does NOT auto-apply fixes — only proposes them. --- ## Prerequisites - `sdd-impl` has completed: all tasks in `progress.md` are `done` (or at least one is `done`; partial reviews are allowed). - The feature branch must have at least one commit ahead of `main`. -