jpskill.com
🛠️ 開発・MCP コミュニティ

quality-commit

変更をステージングし、コードチェックや脆弱性スキャン、レビューを経てコミットまで、品質基準を満たすための作業を標準化された流れで実行するSkill。

📜 元の英語説明(参考)

Stage, lint, scan, review, and commit changes with full quality gates in a single standardized flow.

🇯🇵 日本人クリエイター向け解説

一言でいうと

変更をステージングし、コードチェックや脆弱性スキャン、レビューを経てコミットまで、品質基準を満たすための作業を標準化された流れで実行するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o quality-commit.zip https://jpskill.com/download/9179.zip && unzip -o quality-commit.zip && rm quality-commit.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9179.zip -OutFile "$d\quality-commit.zip"; Expand-Archive "$d\quality-commit.zip" -DestinationPath $d -Force; ri "$d\quality-commit.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して quality-commit.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → quality-commit フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Quality Commit

ステージングされた変更に対して、すべての品質ゲート(lint、typecheck、Semgrep、CodeRabbit、テスト)を実行し、コミットします。これは、プリコミットフックの摩擦を頻繁に引き起こす手動による複数ステップのプロセスを置き換えるものです。

手順

1. スコープの決定

どのワークスペースにステージングされた変更があるかを特定します。

cd "$CLAUDE_PROJECT_DIR"
STAGED=$(git diff --cached --name-only --diff-filter=ACMR)

ステージングされたファイルを以下のように分類します。

  • frontend: apps/frontend/src/**/*.{ts,svelte,js}
  • api: apps/api/src/**/*.ts
  • shared: packages/shared/src/**/*.ts

ファイルがステージングされていない場合は、警告を出力して終了します。

2. ステージングされたファイルの Lint

ステージングされたファイルがある各ワークスペースに対して以下を実行します。

  • frontend: cd apps/frontend && npx eslint <staged-files>
  • api: cd apps/api && npx eslint <staged-files> (eslint が設定されている場合)
  • shared: cd packages/shared && npx eslint <staged-files> (eslint が設定されている場合)

失敗した場合: 具体的なエラーを出力します。コミットに進まないでください。最初に問題を修正してください。

3. 型チェック

影響を受けるワークスペースに対してのみ型チェックを実行します。

  • frontend: cd apps/frontend && npx svelte-check --tsconfig ./tsconfig.json --threshold error
    • 注: テストファイルに既存の11個のエラーがベースラインとして知られています — これらは無視してください。
  • api: cd apps/api && npx tsc --noEmit
  • shared: cd packages/shared && npx tsc --noEmit

失敗した場合: エラーを出力します。進まないでください。

4. Semgrep セキュリティスキャン

重要: Semgrep は、複数のファイル引数が与えられるとクラッシュします(1.146.0–1.151.0+ の Invalid_argument: invalid path バグ)。常にファイルを1つずつスキャンしてください。

SEMGREP_FINDINGS=""
for f in <staged-files>; do
  RESULT=$(semgrep scan --config auto --json "$f" 2>/dev/null) || true
  SEMGREP_FINDINGS="$SEMGREP_FINDINGS$RESULT"
done
  • 各ファイルからの JSON 出力を解析し、ファイル:行とルール ID を持つ結果を集約します。
  • 重大/高の検出結果の場合: コミットをブロックし、検出結果を表示します。
  • 中/低の検出結果の場合: 警告を表示しますが、続行を許可します(可視性のために出力します)。
  • semgrep がインストールされていない場合は、警告とともにスキップします。

5. CodeRabbit レビュー (オプション)

$ARGUMENTS--review または --full が含まれている場合:

coderabbit review --plain -t uncommitted 2>&1
  • 出力を解析し、重大度(Critical、Suggestions、Positive)でグループ化します。
  • 重大な検出結果の場合: コミットをブロックし、詳細を表示します。
  • coderabbit CLI がインストールされていない場合は、警告とともにスキップします。

6. 関連するテストの実行

ステージングされた .ts/.svelte ファイルごとに、同じ場所に配置された .test.ts を探します。

# 例: src/lib/server/auth/rbac.ts → src/lib/server/auth/rbac.test.ts
# 例: src/routes/chat.ts → src/routes/chat.test.ts

検出されたテストファイルを npx vitest run <test-files> --reporter=verbose で実行します。

失敗した場合: 失敗したテストを出力します。進まないでください。

7. コミット

すべてのゲートがパスした場合:

  1. ステージングされた差分をもう一度確認します。

  2. プロジェクトの慣例に従ってコミットメッセージを作成します。

    type(scope): description
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  3. HEREDOC を使用してコミットメッセージを作成します。

Types: featfixrefactortestdocschore Scopes: securityphaseX.Yapifrontenddatabaseauthworkflows

8. プッシュ ( --push の場合のみ)

$ARGUMENTS--push が含まれている場合:

  1. 最後のコミットからのファイルに対して semgrep を実行します(一度に1つのファイル — 複数ファイルに関するステップ4の注意を参照してください)。

    COMMITTED_FILES=$(git diff --name-only HEAD~1 -- '*.ts' '*.svelte' '*.js')
    SEMGREP_FINDINGS=""
    for f in $COMMITTED_FILES; do
      RESULT=$(semgrep scan --config auto --json "$f" 2>/dev/null) || true
      SEMGREP_FINDINGS="$SEMGREP_FINDINGS$RESULT"
    done
    • 重大/高の検出結果の場合: プッシュを中止し、検出結果を出力します。コミットはそのまま残ります。
    • 中/低の検出結果の場合: 警告を表示しますが、続行します。
    • semgrep がインストールされていない場合は、警告とともにスキップします。
  2. ブランチとアップストリームを決定します。

    BRANCH=$(git rev-parse --abbrev-ref HEAD)
    UPSTREAM=$(git rev-parse --abbrev-ref @{u} 2>/dev/null || echo "")
  3. プッシュ:

    • アップストリームが存在する場合: git push
    • アップストリームが存在しない場合: git push -u origin $BRANCH
    • --dry-run も設定されている場合: "would push to origin/$BRANCH" と出力し、実際のプッシュをスキップします。
  4. プッシュに失敗した場合: エラーを報告します。コミットはそのまま残ります — 取り消そうとしないでください。

--push が渡されない場合は、このステップを完全にスキップします。

9. サマリー

サマリーテーブルを出力します。

| Gate        | Status | Details                    |
|-------------|--------|----------------------------|
| Lint        | PASS   | 5 files, 0 errors          |
| TypeCheck   | PASS   | api + frontend             |
| Semgrep     | PASS   | 0 findings                 |
| CodeRabbit  | SKIP   | (use --review to enable)   |
| Tests       | PASS   | 3 test files, 12 tests     |
| Commit      | DONE   | abc1234                    |
| Push        | PASS   | pushed to origin/feature-x |

プッシュが要求されていない場合は、以下を表示します。

| Push        | SKIP   | (use --push to enable)     |

引数

  • $ARGUMENTS: オプションのフラグ:
    • --review または --full: CodeRabbit レビューを含めます(遅くなります、〜30秒)。
    • --dry-run: すべてのゲートを実行しますが、実際のコミット(およびプッシュ)をスキップします。
    • --push: コミットが成功した後、コミットされたファイルに対して semgrep を実行し、リモートにプッシュします。
    • --message "custom message": 自動生成されたメッセージの代わりに、カスタムコミットメッセージを使用します。
    • 空の場合: lint + typecheck + semgrep + tests + commit を実行します(CodeRabbit をスキップし、プッシュをスキップします)。

エラーからの回復

いずれかのゲートが失敗した場合:

  1. 具体的なエラーを明確に出力します。
  2. ターゲットを絞った修正を提案します。
  3. 自動修正と再試行を試みないでください — ユーザー(またはエージェント)に最初に修正させてから、/quality-commit を再実行してください。

  • /quality-commit — 標準フロー: lint、typecheck、semgrep、tests、commit
  • /quality-commit --review — CodeRabbit レビューを含むフルフロー
  • /quality-commit --dry-run — すべてを検証しますが、コミットまたはプッシュは行いません。
  • /quality-commit --push — 標準フロー + コミット後のプッシュ

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Quality Commit

Run all quality gates (lint, typecheck, Semgrep, CodeRabbit, tests) on staged changes, then commit. This replaces the manual multi-step process that frequently causes pre-commit hook friction.

Steps

1. Determine Scope

Identify which workspace(s) have staged changes:

cd "$CLAUDE_PROJECT_DIR"
STAGED=$(git diff --cached --name-only --diff-filter=ACMR)

Categorize staged files into:

  • frontend: apps/frontend/src/**/*.{ts,svelte,js}
  • api: apps/api/src/**/*.ts
  • shared: packages/shared/src/**/*.ts

If no files are staged, print a warning and exit.

2. Lint Staged Files

For each workspace with staged files:

  • frontend: cd apps/frontend && npx eslint <staged-files>
  • api: cd apps/api && npx eslint <staged-files> (if eslint is configured)
  • shared: cd packages/shared && npx eslint <staged-files> (if eslint is configured)

On failure: Print the specific errors. Do NOT proceed to commit. Fix the issues first.

3. Type Check

Run type checks only on affected workspaces:

  • frontend: cd apps/frontend && npx svelte-check --tsconfig ./tsconfig.json --threshold error
    • Note: 11 pre-existing errors in test files are known baseline — ignore those.
  • api: cd apps/api && npx tsc --noEmit
  • shared: cd packages/shared && npx tsc --noEmit

On failure: Print errors. Do NOT proceed.

4. Semgrep Security Scan

Important: Semgrep crashes when given multiple file arguments (Invalid_argument: invalid path bug in 1.146.0–1.151.0+). Always scan files one at a time:

SEMGREP_FINDINGS=""
for f in <staged-files>; do
  RESULT=$(semgrep scan --config auto --json "$f" 2>/dev/null) || true
  SEMGREP_FINDINGS="$SEMGREP_FINDINGS$RESULT"
done
  • Parse JSON output from each file and aggregate findings with file:line and rule ID.
  • On critical/high findings: Block the commit and show the findings.
  • On medium/low findings: Warn but allow proceeding (print them for visibility).
  • If semgrep is not installed, skip with a warning.

5. CodeRabbit Review (Optional)

If $ARGUMENTS contains --review or --full:

coderabbit review --plain -t uncommitted 2>&1
  • Parse output and group by severity (Critical, Suggestions, Positive).
  • On critical findings: Block the commit and show details.
  • If coderabbit CLI is not installed, skip with a warning.

6. Run Related Tests

For each staged .ts/.svelte file, look for a colocated .test.ts:

# Example: src/lib/server/auth/rbac.ts → src/lib/server/auth/rbac.test.ts
# Example: src/routes/chat.ts → src/routes/chat.test.ts

Run discovered test files with npx vitest run <test-files> --reporter=verbose.

On failure: Print failing tests. Do NOT proceed.

7. Commit

If all gates pass:

  1. Review the staged diff one more time.

  2. Draft a commit message following the project convention:

    type(scope): description
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  3. Create the commit using a HEREDOC for the message.

Types: feat, fix, refactor, test, docs, chore Scopes: security, phaseX.Y, api, frontend, database, auth, workflows

8. Push (only with --push)

If $ARGUMENTS contains --push:

  1. Run semgrep on files from the last commit (one file at a time — see Step 4 note on multi-file bug):

    COMMITTED_FILES=$(git diff --name-only HEAD~1 -- '*.ts' '*.svelte' '*.js')
    SEMGREP_FINDINGS=""
    for f in $COMMITTED_FILES; do
      RESULT=$(semgrep scan --config auto --json "$f" 2>/dev/null) || true
      SEMGREP_FINDINGS="$SEMGREP_FINDINGS$RESULT"
    done
    • On critical/high findings: Abort push, print findings. The commit stays intact.
    • On medium/low findings: Warn but continue.
    • If semgrep is not installed, skip with a warning.
  2. Determine branch and upstream:

    BRANCH=$(git rev-parse --abbrev-ref HEAD)
    UPSTREAM=$(git rev-parse --abbrev-ref @{u} 2>/dev/null || echo "")
  3. Push:

    • If upstream exists: git push
    • If no upstream: git push -u origin $BRANCH
    • If --dry-run is also set: Print "would push to origin/$BRANCH" and skip the actual push.
  4. On push failure: Report the error. The commit remains intact — do NOT attempt to undo it.

If --push is not passed, skip this step entirely.

9. Summary

Print a summary table:

| Gate        | Status | Details                    |
|-------------|--------|----------------------------|
| Lint        | PASS   | 5 files, 0 errors          |
| TypeCheck   | PASS   | api + frontend             |
| Semgrep     | PASS   | 0 findings                 |
| CodeRabbit  | SKIP   | (use --review to enable)   |
| Tests       | PASS   | 3 test files, 12 tests     |
| Commit      | DONE   | abc1234                    |
| Push        | PASS   | pushed to origin/feature-x |

When push is not requested, show:

| Push        | SKIP   | (use --push to enable)     |

Arguments

  • $ARGUMENTS: Optional flags:
    • --review or --full: Include CodeRabbit review (slower, ~30s)
    • --dry-run: Run all gates but skip the actual commit (and push)
    • --push: After successful commit, run semgrep on committed files and push to remote
    • --message "custom message": Use a custom commit message instead of auto-generating one
    • If empty: Run lint + typecheck + semgrep + tests + commit (skip CodeRabbit, skip push)

Error Recovery

If any gate fails:

  1. Print the specific errors clearly
  2. Suggest targeted fixes
  3. Do NOT attempt to auto-fix and retry — let the user (or agent) fix first, then re-run /quality-commit

Examples

  • /quality-commit — Standard flow: lint, typecheck, semgrep, tests, commit
  • /quality-commit --review — Full flow with CodeRabbit review included
  • /quality-commit --dry-run — Validate everything but don't commit or push
  • /quality-commit --push — Standard flow + push after commit
  • /quality-commit --review --push — Full flow with CodeRabbit + push
  • /quality-commit --push --dry-run — Run all gates, print "would push", skip actual commit and push
  • /quality-commit --message "fix(security): add IPv6 SSRF checks" — Custom commit message