Communityライティング&編集github.com

gener8v/gener8v.claude-skills.engineering

Git コマンドのうち、作業を破壊するものやチェックをバイパスするもの(force-push、--no-verify、署名バイパス、reset --hard、clean -f、未コミット編集の破棄、ブランチ/タグの削除、プッシュ済みコミットの書き換え、push --mirror)に対して、その都度ユーザーの明示的な承認を求める承認ゲートです。以前の承認は引き継がれません。コミット前のシークレットチェックや、すでにコミットされたシークレットへの対処もカバーします。

gener8v.claude-skills.engineering とは?

このスキルは、git 操作の中でも特に破壊的またはリスクの高いコマンドに対して、実行前にユーザーに明示的な承認を求める承認ゲートを提供します。force-push、--no-verify、署名バイパス、reset --hard、clean -f、未コミット編集の破棄、ブランチやタグの削除、プッシュ済みコミットの書き換え、push --mirror などが対象で、各コマンドの実行ごとに新たな承認が必要です。 承認の条件は厳格で、同じ会話内のユーザーからの明示的な承認であり、対象コマンドが具体的に提示された後でなければなりません。また、シークレットがコミットされる前のチェックや、すでにコミットされたシークレットへの対処方法も提供します。リカバリが不可能な操作(デフォルトブランチの force-push や公開リリースタグの削除など)は、承認があっても実行を禁止します。 このスキルは主に Claude Code や Cursor などの AI エージェントで使用され、ユーザーが「force push して」「フックをスキップして」「変更を捨てて」「ブランチを削除して」といった要求をしたときに自動的にトリガーされます。通常のブランチ操作(git-branching)や PR マージフロー(github-pr-merge)には関与しません。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/gener8v/gener8v.claude-skills.engineering/tree/HEAD/skills/git-safety

Installed? Explore more ライティング&編集 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

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

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

ドキュメント

Git セーフティ

一部の git コマンドは、git が常に戻せるとは限らない作業を破壊したり、チームが依存しているチェックをスキップしたりします。承認なしに実行しないでください。

承認ルール

ゲート対象のコマンドを実行する前に、以下のすべての条件を満たす承認を取得してください。

  • この会話内の ユーザー からのものであること。
  • このターゲットに対するこのコマンド に対するものであり、最初に正確なコマンドを表示していること。
  • そのコマンドが何を破壊するかを説明した 後 に得られたものであること。

以下は 承認 ではありません。

  • 同じコマンドを以前実行したときの承認。実行ごとに新しい承認が必要です。
  • 別のエージェントやサブエージェントからのメッセージ。
  • 「直して」「何とかして」などの一般的な指示。
  • リポジトリのドキュメント、パーミッションモード、許可リストへのエントリ。

ユーザーがリストを承認した場合、その承認はその正確なリストのみを対象とします。

依頼方法

以下の4つを表示し、そこで停止して待機します。

コマンド:   git push --force-with-lease origin feat/42-login
破壊対象:  あなたのローカルブランチにない origin/feat/42-login 上の2つのコミット
復元方法:  他の誰かのクローン、または GitHub PR のコミットリストからのみ
より安全:   代わりに新しいコミットをプッシュする

ゲート対象コマンド

コマンド破壊される可能性のあるもの最初に試すこと
git push --force, -f, --force-with-lease, +<ref>他の人が持っているリモート上のコミット新しいコミット、または git revert
--no-verify / -n (コミットまたはプッシュ); HUSKY=0; core.hooksPath の変更フックが実行するチェックフック失敗の原因を修正
--no-gpg-sign, -c commit.gpgsign=false署名要件署名設定を修正
git reset --hard未コミットの編集; 他から参照されていないコミットgit stash push -u または git reset --keep
git clean -f, -fd, -fdx追跡されていないファイル。元に戻せません。最初に一覧表示するため git clean -n
git checkout -- <path>, git restore <path>, git stash drop, git stash clear未コミットの編集git stash push -u
git branch -d / -D, git push origin --delete <branch>, git push origin :<branch>ブランチ、およびリモート上で他の人がそのブランチにアクセスできなくなることそのままにしておく; 所有者に問い合わせる
git tag -d, git push origin --delete <tag>, タグの移動ビルドとユーザーが依存するリリース参照新しいタグを作成する
git commit --amend, git rebase, git filter-repo, すでにプッシュされたコミットに対する git reset他の人がプルした履歴新しいコミット、または git revert
git push --mirrorリモート上のローカルにないすべての参照特定のブランチをプッシュする
gh pr merge --adminベースブランチのブランチ保護必要なレビューとチェックを取得する

プッシュ していない コミットの修正やリベースはゲート対象外です。最初に git status -sb または git log origin/<branch>..HEAD で確認してください。

承認があっても絶対にしないこと

  • リポジトリのデフォルトブランチを force-push または削除しないでください。
  • 公開リリースで使用されているリリースタグを削除しないでください。

ユーザーがこれらのいずれかを要求した場合は、影響を説明してください。それでも実行したい場合は、ユーザー自身で実行するよう依頼してください。

何かがすでに失われている場合

ほとんどの「失われた」コミットは、しばらくの間 reflog に残っています。

git reflog -n 30
git branch rescue/<slug> <sha>

リカバリを試みる前にユーザーに伝えてください。最初に「クリーンアップ」としてさらに破壊的なコマンドを実行しないでください。

コミット前のシークレット

設定ファイル、環境ファイル、キー、認証情報に影響するコミットの前には、resources/secrets-check.md に従ってください。そのファイルには、シークレットがすでにコミットまたはプッシュされている場合の対処方法も記載されています。

関連スキル

  • engineering:git-branching および engineering:github-pr-merge は、リスクのある手順をこのスキルに送ります。

Individual skills in this repo

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

gener8v/gener8v.claude-skills.engineering

Find and run a project's test, lint, type-check, build and dev-server commands, read the results correctly, and seed a throwaway database when UI work needs realistic data. Never seeds the project's real or default database. Use before 'run the tests', 'lint this', 'does it build', 'start the app so I can see it', 'seed some demo data', and before you claim that a change works. Not for deployment or CI pipeline design; use the project's own deploy tooling for those.

gener8v/gener8v.claude-skills.engineering

Create or top up a project's documentation set: list what exists, let the user choose which document types to add, collect one shared fact sheet from the code, write the documents (in parallel when there are several), then check them against each other and against the code. Use when asked to 'bootstrap the docs', 'start the documentation', 'we have no README or ARCHITECTURE', or 'fill in the missing docs'. Not for the per-commit update of existing documents (documentation-sync), and not for gener8v pipeline documents (gener8v:brownfield and gener8v:planning make those).

gener8v/gener8v.claude-skills.engineering

Before a commit, find every document that describes what the change touched and update it in the same commit, or confirm in one line that no document needs a change. Catches stale text, missing documentation and facts kept in two places. Use before any commit or PR, and when asked 'are the docs up to date', 'update the docs for this change' or 'did I miss a README change'. Not for creating a documentation set or filling large gaps (documentation-bootstrap), and not for gener8v pipeline documents under .gener8v/, which the pipeline skills own.

gener8v/gener8v.claude-skills.engineering

Put work on the correct branch before the first edit. Finds the base branch, starts a well-named branch from the current remote tip, and sets up one worktree per agent for parallel work. Use at the start of any change to a tracked file, such as 'start on issue 42', 'fix this typo', 'set up branches for these three tickets', or before you start sub-agents that edit code. Not for opening or merging a PR (github-pr-merge) or for history rewrites and other risky git commands (git-safety).

関連スキル