Communitygithub.com

lguidolin/merge-gates-and-automation

CIの設定、pre-push フック、タスクランナーの導入や、マージ前に通過すべきゲートを決める際に使用します。権威あるチェックをローカルフックだけに置いたり、CIをスキップしたり、--no-verify で回避したり、マージのゲートとローカルで実行されるものの区別がつかない状態を防ぎます。

merge-gates-and-automation とは?

このスキルは、CI(継続的インテグレーション)とローカルフックの役割を明確に定義し、ソフトウェア開発における検証ゲートの設計と運用を支援します。主な原則は「CIを唯一の真実源(source of truth)とし、ローカルの pre-push フックは利便性のためのミラーに過ぎない」というものです。CIはブランチ保護ルールなどで迂回不可能なゲートとして機能し、マージ前にすべてのチェック(リンター、型チェック、テスト、セキュリティスキャンなど)が通過することを強制します。一方、ローカルフックはスピードと早期フィードバックのために存在し、`--no-verify` で明示的にバイパス可能です。また、チェックが増えてCIが遅くなった場合には、presubmit(高速サブセット、PRをブロック)とpostsubmit(フルスイート、マージ後、プロモーションをブロック)に階層化することを推奨します。コンテナイメージはCIでビルドし、コンテンツダイジェストで識別して provenance 証明書とともに公開するのが原則です。強制モード(enforced)とアドバイザリーモード(advisory)を宣言的に定め、ブランチ保護が利用できない環境でも規律を維持します。このスキルは、Claude Code, Cursor, Codex など任意のAIエージェントが読み取り、プロジェクトのCI/CD設定やフック構成を判断するための知識ベースとして機能します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/merge-gates-and-automation

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

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

ドキュメント

検証ゲートと自動化

概要

検証がどこに存在し、何によってそれが現実のものとなるか。CIが真実の源であり、ローカルフックは利便性のためのミラーです。 迂回不可能なゲートによって強制されないルールは「提案」に過ぎません(原則7)— そのため、プラットフォームがそのゲートを提供できない場合、プロジェクトは advisory モードを宣言し、ルールを意図的に保持します。自分が持っていない機械を想定することはありません。

ルール

  • 1つのタスクランナーが、すべての日常的操作への正規のエントリポイントである — test、build、dev、deploy は名前付きのレシピです。誰かの頭の中にだけ存在する手順は確実に実行されず、エージェントに引き継ぐこともできません。
  • CIは真実の源である — 権威があり、共有され、プラットフォームが許す限り迂回不可能である。 リンター、型チェック、契約チェック、テスト、セキュリティスキャン、コミット検証はすべてここで実行され、enforced モードではマージ前に通過しなければなりません。CIが言うことがすべてです。advisory モードでは同じチェックが実行され報告されますが、ゲートは規律であり、それは決してチェックを減らす理由にはなりません。
  • pre-push フックは presubmit ミラーであって、壁ではない。 同じ高速チェックをローカルで実行し、CIにプッシュする前におそらくパスするようにします。これは明示的にバイパス可能(--no-verify)であり、ツールチェーンがインストールされている場合にのみ実行されます。その役割はスピードと早期フィードバックであり、強制ではありません。フックは決してゲートにならず、プラットフォームが許可する場所でCIがゲートとなります。
  • チェックを削除するのではなく階層化してCIを高速に保つ。 フルスイートがすべてのPRで大きくなりすぎた場合、presubmit(高速サブセット、PRをブロック)とpostsubmit(フルスイート、マージ後、プロモーションをブロック)に分割します — 権威あるチェックをバイパス可能なフックに戻してはいけません。
  • コンテナイメージはCIでビルドし、コンテンツダイジェストで識別し、provenance 証明書とともに公開します。レジストリのレイヤーキャッシュやセルフホステッドランナーでコストを抑えましょう — ビルドをラップトップに移すことは絶対に避けてください。そこでは成果物の provenance を他者が検証できません。
  • 強制モードを宣言する。 enforced — CIがブランチ保護を介してマージをブロックします。CIが言うことがすべてです。advisory — CIは実行して報告し、ゲートは規律です。ブランチ保護が利用できない場合(無料プランのプライベートリポジトリなど)に該当します。Advisory は正当ですが、実際には持っていない強制を主張することは許されません。プロジェクトの最初の意思決定記録にモードを記載し、何があれば enforced に移行するかを明記してください。

名前付きの緊張関係

バイパス可能なローカル presubmit は高速だが強制不可能であり、権威あるCIは強制可能だが低速です。それぞれに異なる役割を与えることで解決します — フックは内部ループを最適化し、CIは正しさの記録を担います — そしてフックではなくCIがマージをブロックするものとします。

よくある理屈

言い訳現実
「pre-push フックがテストを実行するから、CIは最小限でいい」フックはバイパス可能でツールチェーンに依存します。真実の源にはなり得ません。CIはすべてを再実行しなければなりません。
「今回だけ --no-verify しよう」問題ありません — CIがまだキャッチするからです。だからこそ、フックではなくCIがゲートなのです。
「CIが遅いから、テストをフックに移そう」CIを階層化(presubmit/postsubmit)してください。権威あるチェックをバイパス可能なゲートに移してはいけません。
「CIのビルドが遅いから、イメージをローカルでビルドしよう」ラップトップでビルドされた成果物は、他者が検証できないprovenanceを持ちます。レイヤーキャッシュかセルフホステッドランナーでレイテンシを解決してください。
「ブランチ保護はお金がかかるから、ルールは適用されない」ルールは適用されます。強制の仕方が異なるだけです。advisory モードを宣言して規律を維持するか、リポジトリを公開にして保護を無料で手に入れてください。

レッドフラグ — 停止

  • 権威あるチェックがローカルフックにしか存在しない
  • CIがフックで実行したチェックを再実行しない
  • CIが赤の状態でマージが許可されている
  • CI以外の場所でビルドされたイメージ、またはダイジェストではなくタグでプロモートされたイメージ
  • ブランチ保護が存在しないのに、CIがマージをゲートしているかのように振る舞うプロジェクト

完全な根拠: 憲法第VIII条、engineering-constitution/references/engineering-constitution.md にバンドルされています。Deploy/k8s の詳細: cloud-delivery-aks。

Individual skills in this repo

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

lguidolin/change-hygiene-and-code-craft

Use when writing or refactoring code, structuring a commit or PR, or deciding whether to abstract duplication. Symptoms — mixing reorg with logic changes, a PR doing several things at once, a file growing large, the second copy of similar code, or unsure whether to DRY something up.

lguidolin/cloud-delivery-aks

Use when deploying to Kubernetes or Azure Kubernetes Service (AKS), configuring cloud secrets, setting up progressive rollout/canary, per-PR ephemeral environments, or k8s health probes. Keywords — Kubernetes, AKS, Key Vault, Argo Rollouts, Flagger, canary, blue-green, liveness, readiness, PodDisruptionBudget, HPA, rollback, GHCR.

lguidolin/commit-history-rewrite

Use when an existing repository has messy commit history that needs to conform to conventional commits before adopting release-please, or when intermediate WIP/fixup/merge commits need to be cleaned up.

lguidolin/conventional-commits-and-releases

Use when committing, writing a commit message, opening a PR that will be squash-merged, or configuring automated versioning/changelogs. Keywords — conventional commits, release-please, semver, feat/fix/chore, breaking change, changelog.

lguidolin/defense-in-depth-security

Use when handling untrusted input, secrets, authentication/authorization, or dependencies — or threat-modeling a new surface. Keywords — STRIDE, threat model, least privilege, secrets management, supply chain, dependency scanning, input validation, audit log, defense in depth.

lguidolin/designing-before-building

Use when starting a feature, fixing a non-trivial bug, or about to write implementation code — before any code exists. Symptoms you need this: "this is simple, I'll just code it", reaching for the editor before a design is approved, or an idea that hasn't been turned into a spec and plan.

lguidolin/engineering-constitution

Use when starting work in a project that follows the engineering constitution, orienting to its rules, or deciding which engineering practice applies to a task — spec writing, commits, testing, security, deploys, database, or UI work.

lguidolin/graphql-contract-testing

Use when writing a GraphQL query/mutation that the UI and a test will share, or building route/schema contract or smoke tests. Symptoms — copying a query into a test, a test asserting on query text, schema change that didn't break the UI build, or RLS/permission drift. Keywords — graphql-codegen, typed document, contract test, route smoke test.

lguidolin/init-repo-CI

Use when setting up a new repository with conventional commits, release-please, and CI automation, or when retrofitting an existing repository that lacks automated versioning and PR validation workflows.

lguidolin/interface-craft-and-accessibility

Use when building or styling UI — components, layouts, forms, design tokens — or making accessibility decisions. Keywords — a11y, WCAG, keyboard navigation, focus state, contrast, design system, minimalist UI, component reuse, ARIA, semantic HTML.

lguidolin/observability-and-slos

Use when adding logging, metrics, tracing, health checks, SLOs, or alerting — or when building a service surface that needs to be operable and debuggable. Keywords — structured logs, OpenTelemetry, correlation id, RED metrics, liveness, readiness, SLI, SLO, error budget, alerting.

lguidolin/performance-and-scale

Use when working on hot paths, list endpoints, pagination, data-access in loops, or public interfaces/schemas. Symptoms — unbounded queries, N+1 access, no latency budget, optimizing without measuring, or changing an interface many consumers depend on. Keywords — pagination, N+1, Hyrum's Law, performance budget, bundle size.

lguidolin/postgres-postgraphile-rls-and-sql

Use when writing PostgreSQL, PostGraphile config, Row-Level Security policies, SQL schema files, or working on the Browser→App→PostGraphile→Postgres data path. Keywords — RLS, SECURITY DEFINER, search_path, pgSettings, grants, roles, GraphQL depth limit, query cost, statement_timeout, SQL file organization.

lguidolin/recording-decisions

Use when a design or architecture decision has been made and needs to be captured — writing a decision record or ADR, updating a decision index, noting a deferred idea, or superseding a past decision. Keywords — ADR, decision record, rationale, rejected alternatives, dependency index.

lguidolin/resilience-and-deploy-safety

Use when planning a deploy, designing a rollback, or responding to an incident or writing a postmortem. Keywords — deploy safety, rollback, immutable artifact, progressive delivery, canary, blast radius, incident response, blameless postmortem, error budget.

lguidolin/ship-it

Use when the user wants to ship work — push, PR, archive decision records, merge, and clean up. Handles the full lifecycle from committing final changes through post-merge cleanup including converting specs/plans to compact decision records.

lguidolin/tests-as-a-control

Use when writing or modifying tests, when a test breaks during a refactor, or when testing permission/role rules. Symptoms — tempted to edit a test to make it pass, testing only the happy path, a deny-test that started passing, flaky tests, or unsure what to assert.

lguidolin/zero-downtime-migrations

Use when changing a database schema where data must survive the change — adding/removing/renaming columns, constraints, indexes, or backfilling. Symptoms — a destructive migration bundled with a code deploy, a NOT NULL column with a backfill, a table-locking UPDATE, or a rename. Keywords — expand/contract, parallel change, backfill, NOT VALID, CREATE INDEX CONCURRENTLY, graphile-migrate.

関連スキル