Communitygithub.com

delivery-gate

Claude Codeが「完了」と宣言する前に品質チェックが合格するまでブロックするStopフックです。正当化パターン、古い学習ログ、ディスク容量不足を検出します。

delivery-gate とは?

delivery-gateは、Claude Codeのセッション終了時に機械的な品質ゲートを設ける**Stopフック**です。このスキルは、AI推論に頼らず、ファイルのタイムスタンプ、ディスク使用量、トランスクリプトの正規表現パターンといった**決定論的なチェック**のみを使用します。学習ライブラリの更新有無(mtime)、ディスク空き容量、および「テストは後で」「既存のバグ」といった正当化パターンを検出します。ディスクが深刻な状態(15GB未満)、3つ以上の学習ライブラリが未更新、または複雑なタスク(3回以上の編集)において成長ログが未更新の場合、セッションをブロック(exit 2)します。このスキルは、Claude Codeのビルド・テストなどのコード品質チェックを補完し、学習のキャプチャやセッション衛生を機械的に強制します。`self-audit`(出力品質チェック)と組み合わせて多層防御を構成します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/delivery-gate

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Delivery Gate — Claude Code用機械的品質ゲート

Claude Codeがセッションを終了する前に、決定論的チェック(ファイルの変更タイムスタンプ、ディスク使用量、トランスクリプトテキストの正規表現パターン)のみを使用して3つの項目を確認するStopフックです。AI推論は使用しません。

これは(self-auditのような)推論ゲートとは異なります。delivery-gateは機械的に検証可能な事実をチェックし、self-auditは4つの推論次元にわたる出力品質をチェックします。これらは多層防御を形成します。

  • delivery-gate: 「学習ライブラリは今日更新されたか?ディスク容量は安全か?」
  • self-audit: 「ファイルの内容は正しく、完全で、正直か?」

これはCIパイプラインゲートと同じパターンです。自己申告のステータスを信頼するのではなく、機械可読な事実を検証する自動化された決定論的チェックです。

チェック内容

チェック仕組み結果
正当化パターントランスクリプト末尾の正規表現警告のみ(ブロックしない)
古い学習ライブラリ5つの設定可能なパスのmtime一部古い場合は警告、3つ以上古い、または複雑タスクで成長ログが古い場合はブロック
ディスク容量 < 50GBshutil.disk_usage警告
ディスク容量 < 15GBshutil.disk_usageブロック(exit 2)

正当化検出は、「テストは後回し」「既存のバグ」などのパターンについて警告します。これらは思考が途中で打ち切られた可能性を示す表面信号です。正規表現によるヒューリスティックは誤検出の可能性があるため、単独ではブロックしません。ブロック条件は、ディスククリティカル、3つ以上の学習ライブラリが古い、またはgrowth-logが特に古い場合(すべて複雑タスクで3回以上の編集が必要)です。

なぜ必要か

Claude Codeの組み込みチェックはコード品質(ビルド→型→lint→テスト)をカバーします。しかし、別の障害モードがあります。エージェントが動作するコードを生成しながら、セッションの衛生状態がおろそかになっている場合です。学習が記録されず、ショートカットが正当化され、ディスクが知らないうちに不足しています。

何度も「そのまま出荷して忘れる」セッションを繰り返すと、人間は成長しません。このフックは習慣を強制します。複雑なタスク→学習ライブラリに触れる必要がある。

インストール

cp quality-gate.py ~/.claude/scripts/

~/.claude/settings.jsonに以下を追加:

{
  "hooks": {
    "Stop": [{
      "hooks": [{
        "type": "command",
        "command": "python3 ~/.claude/scripts/quality-gate.py",
        "timeout": 5000
      }]
    }]
  }
}

学習ライブラリ

プロジェクトのメモリディレクトリに以下のファイルを作成します。フックは少なくとも1つが本日更新されたかを確認します。

memory/
├── growth-log/          # 日々の学習エントリ(ディレクトリ)
├── decisions/log.md     # 決定ログ
├── output-index.md      # セッション出力のインデックス
├── ratings-tracker.md   # スキル評価の経時記録
└── tooling_capabilities.md  # 既知のツール一覧

LIBS辞書を編集して、自身のファイル構造に合わせてカスタマイズしてください。

設定

quality-gate.pyを編集:

変数デフォルト目的
RATIONALIZE4パターン正当化検出のための正規表現パターン
LIBS5ライブラリ本日の更新を確認するファイル/ディレクトリ
COMPLEX_THRESHOLD3複雑と分類する編集/書き込み呼び出し数
DISK_WARN_GB50この値以下で警告
DISK_CRIT_GB15この値以下でブロック

例

単純なセッション — 許可:

edit_count=1 (< 3, 複雑ではない) → exit 0

複雑タスク、学習が記録された — 許可:

edit_count=5 (複雑) → LIBSをチェック → growth-logが本日更新 → exit 0

複雑タスク、学習なし — ブロック:

edit_count=4 (複雑) → LIBSをチェック → 5つすべて古い → exit 2
stderr: "Blocked: complex task completed but no learning captured today."

ディスク容量不足 — ブロック:

disk_free=12GB < 15GB クリティカル → exit 2
stderr: "Blocked: disk space at 12GB (threshold: 15GB)."

制限事項

このフックは学習ライブラリに触れる習慣を強制するものであり、記録された内容の品質を強制するものではありません。output-index.mdが更新されていてもgrowth-logがスキップされた場合、フックは通過します(5つのライブラリ中1つに触れたため)。これは設計上の意図です。機械的ゲートは機械可読な事実をチェックします。内容品質の検証には、self-auditと組み合わせて使用してください。

互換性

  • Python 3.8+(from __future__ import annotationsを使用)
  • クロスプラットフォーム: Windows、macOS、Linux
  • stdlib以外の依存関係ゼロ

品質

このコードは4ラウンドの自動コードレビュー(CodeRabbit + Greptile)を経て、9件の実際のバグが発見・修正されました。

関連項目

  • self-audit — 推論品質ゲート(完全性/一貫性/根拠性/正直性)
  • verification-loop — コード品質チェック(ビルド/型/lint/テスト)
  • gateguard — ツール使用前の安全ゲート

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

関連スキル