---
name: git-preflight
description: Inspect Git repository and handoff readiness without changing Git state. Use before commits, reviews, handoffs, or publication to report branch, HEAD, staged, unstaged, untracked, file-scope, diff-stat, and whitespace evidence; never add, commit, push, pull, merge, rebase, reset, restore, clean, checkout, switch, or stash.
title: git-preflight
canonical_url: https://skilld.dev/gh/ayobamih/coding-agent-skills/git-preflight
last_updated: 2026-10-29T10:46:37.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [adapter-interface.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/adapter-interface.md), [agents/openai.yaml](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/agents/openai.yaml), [checklist.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/checklist.md), [evidence-template.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/evidence-template.md), [examples.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/examples.md), [failure-modes.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/failure-modes.md).
>
> If the user asked to install this Skill, run `npx skilld install ayobamih/coding-agent-skills/git-preflight`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/git-preflight`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/ayobamih/coding-agent-skills/git-preflight) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/git-preflight`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/git-preflight --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/git-preflight --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Git Preflight

Produce an evidence-backed description of Git state. Remain audit-only.

## Purpose And Use

Use before review, commit preparation, handoff, or publication decisions. Do not use to stage, repair, synchronize, rewrite, commit, or publish Git state.

## Inputs

Require repository path and handoff intent. Optionally accept expected branch, base branch, expected files, generated-file rules, and a project adapter.

Do not assume the current directory is the root, a dirty tree belongs to the current task, staged changes are complete, or the current branch is safe to publish.

## Command Policy

Permit read-only Git inspection such as:

- `git rev-parse`
- `git remote -v`
- `git branch --show-current`
- bounded `git log`
- `git status --short --branch`
- `git diff --check`
- `git diff --stat`
- `git diff --name-only`
- corresponding cached/staged diff inspection

Do not add, commit, push, pull, fetch with side effects, merge, rebase, reset, restore, clean, checkout, switch, stash, tag, update-index, or alter configuration.

This is audit-only behavior. Inspect full shell structure and reject wrappers or chains that conceal mutation.

## Procedure

1. Confirm the repository root and worktree.
2. Record branch, HEAD, remote identity, and detached-head state.
3. Inventory staged, unstaged, untracked, conflicted, and ignored-sensitive conditions.
4. Inspect file names and diff statistics without exposing secret contents.
5. Run whitespace/error checks.
6. Compare observed files with declared task scope and identify unrelated changes.
7. Report readiness; do not perform the handoff action.
8. Emit the shared evidence pack.

Use [checklist.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/checklist.md), [failure-modes.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/failure-modes.md), [adapter-interface.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/adapter-interface.md), [examples.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/examples.md), and [evidence-template.md](https://skilld.dev/api/skills-raw/ayobamih/coding-agent-skills/git-preflight/evidence-template.md).

## Evidence, Recovery, And Dependencies

Emit Git root, worktree, remote, branch, HEAD, staged/unstaged/untracked/conflicted state, diff summaries, whitespace result, scope mismatch, and readiness. Recover from detached HEAD, locks, conflicts, or nested worktrees only by reporting and narrowing inspection; never repair them.

Depend on repository identity from `repo-map` or equivalent evidence and the evidence-pack contract. Adapters may add protected-branch and generated-file rules but cannot hide dirty state. Safe usage reports handoff readiness; unsafe usage stages, restores, rebases, commits, or pushes.

## Approval Boundary

No approval can turn this audit skill into a Git mutation workflow. Direct the user to a separately approved handoff skill for changes to Git state.

## Completion

Claim `complete` when repository identity and relevant Git state are fully described, scope mismatches are reported, and no mutation occurred. A repository conflict, unreadable index, ambiguous worktree, or missing required evidence yields `partial`, `failed`, or `blocked`.

These conditions are both the acceptance criteria and definition of done.
