Communitygithub.com

lguidolin/resilience-and-deploy-safety

デプロイ計画、ロールバック設計、インシデント対応、またはポストモーテム作成時に使用します。キーワード — デプロイ安全性、ロールバック、イミュータブルアーティファクト、プログレッシブデリバリー、カナリア、ブラスト半径、インシデント対応、非難なきポストモーテム、エラーバジェット。

resilience-and-deploy-safety とは?

このスキルは、システム障害は避けられないという前提に立ち、「小さく失敗し、素早く回復し、毎回学習する」という文化と実践を提供します。主にコンテナベースのアプリケーションにおいて、イミュータブルアーティファクトのダイジェストによるプロモーション、プログレッシブなロールアウト、展開/収縮パターンによるインフラとアプリケーションの独立したロールバック可能性を重視します。デプロイ前のチェックリスト、非難なきポストモーテム(事後分析)、エラーバジェットによる優先順位付けなど、具体的なプロセスも定義されています。このスキルは、自身の信頼性向上を目指すすべての開発者やAIエージェントユーザーにとって価値があり、特にCI/CDパイプラインやクラウドネイティブ環境(Kubernetesなど)で効果を発揮します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/lguidolin/agent-skills/tree/main/skills/resilience-and-deploy-safety

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

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

ドキュメント

レジリエンスとデプロイ安全性

概要

物事は壊れます。取るべき姿勢は「すべての障害を防ぐ」ではなく、小さく失敗し、素早く回復し、毎回学習することです。信頼性とは障害がないことではなく、障害が発生したときのブラスト半径を制限し、回復時間を短くすることです。

デプロイ安全性 – すべてのデプロイは元に戻せ、段階的に公開する

  • アーティファクトはイミュータブルであり、再ビルドではなくプロモーションされる。 CIで一度だけビルドされた単一のイメージは、そのコンテンツダイジェストで識別され、プレビュー→ステージング→本番と変更されることなく移動します。環境ごとに再ビルドすることは、テストしたことのないものをデプロイすることを意味します。
  • タグは可変ポインタであり、ダイジェストが識別子である。 タグは上書きされ、気付かれずに別の場所を指す可能性があります。コンテンツダイジェストはそれができません。各環境は検証したダイジェストを記録し、本番環境は下位環境で検証されたダイジェストのみを実行します。つまり、「テストしたまさにそのもの」という性質は、誰かが覚えておくべき規律ではなく、パイプラインが強制するプロパティになります。
  • 本番環境へのデプロイには、人間の判断が必要である。 これは、単独メンテナにとっては、職務分掌ではなく、意図的な一時停止と監査記録を意味します。どちらであるかを明確に述べ、過大評価しないでください。
  • 実行中のバージョンはデプロイ時に注入され、イメージに焼き付けられてはならない。 ビルド引数として焼き付けられたバージョンは、リリースを刻印するために再ビルドを強制し、その再ビルドこそがプロモーションが回避しようとしているものです。
  • インフラが独自のリポジトリにある場合、展開/収縮(expand/contract)パターンで調整する。 インフラはまず展開(追加的、後方互換)し、アプリケーションは後のデプロイで新しい機能を利用し、そしてインフラは収縮するのは、古い形状に依存する動作中のアーティファクトがなくなった場合のみです。これはスキーマ変更と同じ規律です(zero-downtime-migrationsを参照)。不変条件:まだ稼働していないインフラ変更を必要とするアプリケーションアーティファクトを決して出荷しないこと。 これを守れば、各リポジトリは独立して元に戻せるようになり、両者の歩調が合わない場合にロールバックを扱いやすくします。
  • ロールバックできる場合にのみ、前方へのロールアウトを行う。 リスクのある変更を出荷する前に、ロールバックパスが存在し、テストされています。「どうやってこれを元に戻すのか?」という問いは、インシデント発生時ではなく、計画時に答えられます。
  • ロールバックとは、以前に正常だったダイジェストを再デプロイすることである。 そのダイジェストはレジストリにまだ存在し、イミュータブルなので、ロールバックは逆方向へのプロモーションです。決して再ビルドではなく、「当時のまま」の再ビルドでもありません。
  • 段階的な公開。 新しいバージョンは徐々にユーザーに届けられます(ヘルスゲート付きロールアウト、サポートされている場合はカナリア)。そのため、悪いリリースが被害を与えるのは一部のユーザーに留まり、全員ではありません。
  • スキーマ変更はコードデプロイから切り離され、展開/収縮に従います(zero-downtime-migrationsを参照)。デプロイは、同時に破壊的なマイグレーションを必要としてはいけません。
  • デプロイ準備完了チェックリストが本番環境へのゲートとなる: 可観測性が整っていること、ロールバックが検証されていること、マイグレーションが展開安全であること、SLOが守られていること。

インシデント対応 – 障害は学習へのインプット

  • 重要度で分類し、比例した対応を行う。適切な人材を招集するための既知の経路を持つこと。
  • すべてのユーザーに影響するインシデントに対して、非難なきポストモーテムを作成する。 タイムラインの記述、原因(システム的なものであり、個人的なものではない)、具体的なアクションアイテムを含みます。問うべきは「このシステムの何がこれを引き起こしたのか」であり、「誰がミスをしたのか」ではありません。
  • アクションアイテムは追跡され、忘れられない – それらは将来の検討事項ドキュメント(recording-decisionsを参照)に流れ込み、実際の作業となります。
  • エラーバジェットが優先順位を決める。 信頼性が消費された場合、予算が回復するまで信頼性に関する作業が機能開発よりも優先されます。

クイックリファレンス

リスクのあるデプロイ前に確認すること
アーティファクトCIで一度だけビルドされ、ダイジェストでプロモーションされ、ステージングで検証したものと同じであること
ゲート本番環境前に記録された人間の判断があること
ロールバックパスが存在し、テストされていること
公開範囲段階的/カナリアであり、一斉ではないこと
スキーマ展開安全であり、コードデプロイから切り離されていること
可観測性問題が発生しているかどうかを確認できるか

これを適用するタイミング

ローカル/プレローンチのプロジェクトでもこれらのルールを今すぐ記述し、最初の実際のユーザーが現れた時点で有効にします。プロパティ(一度ビルドし、テストしたものをプロモーションし、本番前に判断し、ロールバック可能であること)は移植可能ですが、メカニズムはそうではありません。コンテナホストではダイジェストによるプロモーションは意味がありますが、静的サイトではほぼ無意味です。また、マネージドプラットフォームはプレビュー環境とインスタントロールバックを無料で提供するかもしれません。プロジェクトのデリバリースキル内でメカニズムを指定してください。プロパティはここに残します。メカニズムのスタック(k8sのプローブ、カナリア、PRごとの環境):cloud-delivery-aks。

完全な根拠:憲法第XII条、engineering-constitution/references/engineering-constitution.mdに同梱されています。

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/merge-gates-and-automation

Use when setting up or changing CI, pre-push hooks, or a task runner, or deciding what must pass before merge. Symptoms — tempted to put authoritative checks only in a local hook, skip CI, bypass with --no-verify, or unsure what gates a merge vs. runs locally.

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/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.

関連スキル