deploy-command-discipline
Skill0 starsChanged 3 months agoApache-2.0View on GitHub
複数段階のビルド/デプロイパイプライン(例: アプリビルド→アダプタ変換→プラットフォームデプロイ)を持つプロジェクトでデプロイを実行する時に使う。個別コマンドを手で組み立てて途中の段階を省略し、古いビルド成果物をデプロイしてしまう事故を防ぐ。cloudflare-deploy-guard(課金・セキュリティのGO/NO-GO判定)とは独立した、実行手順そのものの規律。
In this repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/go-skills-knowledge-pack/AGENTS.mdAGENTS.md
- .agents/skills/rust-skills-knowledge-pack/AGENTS.mdAGENTS.md
- .agents/skills/typescript-skills-knowledge-pack/AGENTS.mdAGENTS.md
- .claude/skills/go-skills-knowledge-pack/AGENTS.mdAGENTS.md
- .claude/skills/rust-skills-knowledge-pack/AGENTS.mdAGENTS.md
- .claude/skills/typescript-skills-knowledge-pack/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/00-general.mdcCursor rule
- .cursor/rules/revharness-critical.mdcCursor rule
- .cursor/rules/revharness-detailed.mdcCursor rule
- auto-orchestratorSkill
- baseline-protectionSkill
- client-distribution-readinessSkill
- cloudflare-deploy-guardSkill
- codex-app-server-guardSkill
- codex-app-server-product-integrationSkill
- codex-callerSkill
- context-compactorSkill
- cursor-callerSkill
- delegated-development-disciplineSkill
- design-principlesSkill
- development-constitutionSkill
- development-junk-cleanupSkill
- go-skills-knowledge-packSkill
- harness-official-docs-updateSkill
- naming-normalization-guardSkill
- orchestrator-bootstrapSkill
- payload-cms-deploy-guardSkill
- production-function-implementerSkill
- research-handoffSkill
- rev-harness-lifecycleSkill
- review-workflowSkill
- root-cause-first-disciplineSkill
- rust-skills-knowledge-packSkill
- scope-guardSkill
- self-growth-proposal-triageSkill
- shared-client-wrapper-safetySkill
- slice-designerSkill
- staff-code-reviewerSkill
- structured-mentorSkill
- supabase-deploy-guardSkill
- system-plannerSkill
- typescript-skills-knowledge-packSkill
- auto-orchestratorSkill
- baseline-protectionSkill
- client-distribution-readinessSkill
- cloudflare-deploy-guardSkill
- codex-app-server-guardSkill
- codex-app-server-product-integrationSkill
- codex-callerSkill
- context-compactorSkill
- cursor-callerSkill
- delegated-development-disciplineSkill
- deploy-command-disciplineSkill
- design-principlesSkill
- development-constitutionSkill
- development-junk-cleanupSkill
- go-skills-knowledge-packSkill
- harness-official-docs-updateSkill
- The first 60 shown.
The file
Files
Deploy Command Discipline
多段階のビルド/デプロイパイプラインを持つプロジェクト(例: Next.js → OpenNext adapter → Cloudflare Workers/Wrangler、あるいは類似の「フレームワークビルド→プラットフォームアダプタ→プラットフォームCLIデプロイ」という3段以上の構成)では、各段階を手動で個別に実行しようとすると、途中の段階を省略したまま最終段階だけを実行してしまう事故が起きる。このスキルは、そのような事故を「定義済みの一括コマンドを常に使う」という運用で防ぐ。
絶対ルール
- プロジェクトに定義済みの一括デプロイコマンド(
package.jsonのscripts、Makefile、justfile等)が存在する場合、デプロイは必ずそのコマンド経由で実行する。 個別の下位コマンド(例:wrangler deploy、docker push単体)を直接組み立てて実行しない。 - 一括コマンドが存在しない、または不完全だと判明した場合は、まず一括コマンドを整備してから使う。 「今回だけ手動で」を繰り返すと、次回以降も同じ事故が再発する。
- デプロイ前に、一括コマンドが実際にどの段階を含んでいるかを一度確認する。 特に「ビルド成果物を生成する段階」と「その成果物をアップロードする段階」が分離しているパイプラインでは、後者だけを実行すると前者の古い成果物がそのままデプロイされる。
- デプロイ後は必ず実測で検証する。 実際に配信されているレスポンス(ヘッダー、バージョン文字列、機能の挙動)を
curlやブラウザで確認し、「デプロイコマンドが成功終了した」ことと「意図した変更が実際に反映されている」ことを区別する。前者は後者を保証しない(古い成果物でもデプロイコマンド自体は正常終了する)。
起動条件
- Next.js/OpenNext/Cloudflare Workers、Docker build→push→deploy、Terraform plan→apply、その他「複数の独立したCLIコマンドを順番に実行する必要があるデプロイフロー」を持つプロジェクトでデプロイしようとしている時。
- 「ビルドとデプロイは別コマンドだが、今回はビルドは前にやったはずだからデプロイだけ実行すればいい」と考えている時(この判断こそが典型的な事故の入口)。
- デプロイ後の実測確認で、意図した変更が反映されていないように見える時(キャッシュの影響と区別する前に、まず「正しいビルド成果物がデプロイされたか」を疑う)。
具体的な見分け方
デプロイ対象のプロジェクトで、以下を確認する。
# package.jsonにdeploy系スクリプトが定義されているか確認する
grep -A3 '"deploy"' package.json
# 一括スクリプトが複数コマンドを&&で連結しているか(=手動で個別に打つと
# 順序や段階を省略しうる構成になっているか)を確認する一括スクリプトが "deploy": "<build-command> && <deploy-command>" のように複数コマンドを連結している場合、それは「この2つは常にセットで実行されるべき」という設計上の宣言である。片方だけを手で実行することは、この宣言に反する。
デプロイ後の実測検証
一括コマンドを使った場合でも、デプロイ後は必ず実測で確認する。
# 本番/デプロイ先に対して実際にHTTPレスポンスを取得し、
# 意図した変更(新しいヘッダー、新しいバージョン文字列等)が
# 実際に含まれているかを確認する
curl -I https://<production-host>/
# CDN/エッジキャッシュがある場合、キャッシュヘッダー(cache-control, age等)を
# 確認し、古いキャッシュを見ている可能性を排除してから結論を出す。
# 一度で古い結果が返っても即断せず、複数回・時間を置いて再確認する。必須アウトプット
デプロイを実施した際は、以下を明示する。
使用したコマンド: <一括コマンドか個別コマンドか、個別の場合はその理由>
パイプライン段階: <このプロジェクトのデプロイが何段階で構成されるか>
デプロイ後実測: <curl等での確認結果、意図した変更が反映されていることの確認>
キャッシュの影響確認: <CDN/エッジキャッシュがある場合、古い結果を見ていないことの確認>ケーススタディ: opennextjs-cloudflare build 省略による古いビルド成果物のデプロイ
- 状況: Next.js + OpenNext + Cloudflare Workers構成のアプリで、
next.config.tsにCSPヘッダーを追加する変更を行った後、wrangler deployを直接実行した。 - 事故: このプロジェクトの正しいデプロイ手順は「
opennextjs-cloudflare build(Next.jsのビルド成果物をCloudflare Workers用に変換し.open-next/worker.jsを生成する)→wrangler deploy(生成済みの.open-next/worker.jsをアップロードする)」の2段階だったが、opennextjs-cloudflare buildの再実行を省略してwrangler deployだけを実行した。wrangler deploy自体は正常終了し、エラーは一切出なかった。 - 発覚: デプロイ後、本番URLに対して
curl -IでCSPヘッダーを実測確認したところ、新しく追加したはずのconnect-srcのorigin(tiles.openfreemap.org)が含まれていなかった。これは、.open-next/worker.jsがCSP追加前のnext.config.tsから生成された古い成果物のままだったため。 - 修正:
opennextjs-cloudflare buildを実行して.open-next/worker.jsを再生成してからwrangler deployを再実行し、curl -Iで正しいヘッダーが反映されていることを確認した。確認の過程で、CDN(Cloudflareのエッジキャッシュ、cache-control: s-maxage=31536000)の影響で一瞬古い結果が返ることもあったため、複数回確認して正しく更新されていることを最終確認した。 - 根本原因:
package.jsonには"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy"という、まさにこの2段階を連結した一括コマンドが既に定義されていたにもかかわらず、それを使わずwrangler deployという下位コマンドを個別に手動実行したこと。 - 教訓: 定義済みの一括デプロイコマンドが存在する場合は常にそれを使う。「ビルドは前にやったはずだから今回はデプロイだけでいい」という判断は、ビルド成果物と設定ファイルの同期を人間の記憶に依存させることになり、構造的に事故りやすい。デプロイコマンドの正常終了は「意図した変更が反映された」ことを保証しないため、デプロイ後は必ず実測で確認する。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

