SuperAPI AI Directory

git-init

Coding & development

View repository

Updated 10-15 21:48

About this skill

Git Status Discovery and Adoption

When to Use and When Not to Use

This skill is not intended to replace CodeGuard quality, platform protection, or deployment acceptance. It can be installed on its own; when the GitFlow plugin is absent, use read-only Git observation and rule-by-rule verification. It does not depend on adjacent skill files or assume the host automatically loads other skills.

Prerequisites and Authorization

  • Git is available and the project directory is clear. First confirm the real root of the parent repository and the project instructions; preserve user modifications.
  • Existing conventions take precedence; no Git, no conventions, detached, shallow history, and unknown provenance must be explicitly reported.
  • Read-only observation and preview may be executed; Git initialization, branch creation/switching, committing, pushing, integration, cleanup, installing Hooks, and rule activation are executed within the scope of the user's existing authorization.
  • Project Rules and Evidence is a self-contained reference for this skill;authoritative directory is used for model and provenance verification.

Execution Steps

Step 1

Run this skill's read-only script to confirm the real root of the parent repository, HEAD, and the Git/common/worktree directories; do not judge by whether .git is a directory.

Step 2

No Git: inject the context "the current project is not managed by Git", ask whether to initialize or not to enable it for now, and do not execute git init. If not enabled for now, remember the session decision.

Step 3

When the plugin has PLUGIN_DATA, remember the decision via context --choice defer --apply; it is not authorization for future Git initialization. Rediscover when the state changes.

Step 4

Empty history: may recommend the team classic-gitflow default, preview the convention files and local snapshot first; authorize the initial commit and branch creation separately.

Step 5

Existing history: read the existing conventions; after explicitly selecting a profile or existing JSON, adopt it, without rewriting names, remotes, history, or user modifications.

Step 6

Before initialization, list the expected .gitflow/ files, Git localization configuration, and local exclusions; shared definitions are convenient for versioning,.gitflow/state/ stores local state that is not committed, and local mode is explicitly not propagated with clone.

Step 7

Only after explicit authorization, run initialize-git/apply; rediscover, verify that no fake initial commit was made; read the missing long-term roles, perform a read-only audit, then reconcile per separate authorization. Idempotently reuse existing effective conventions; do not replace them with init.

Standalone Tool and Plugin Paths

First locate this skill's scripts/inspect_repository.py, and read the status per the commands in the contract . Python 3.11+ standard library, read-only and does not initialize. The actual command uses the directory where the current skill resides; the mounted example is:

python3 /mnt/skills/user/git-init/scripts/inspect_repository.py /absolute/project

When the GitFlow plugin is available, invoke the command corresponding to its actual path; see operation examples. Do not treat a CLI name that is not installed as an existing command.

Verification and Output

For plugin init examples, see references/action.md. Without the plugin, first have the user review a preview plan for git init, execute per actual authorization, and never pretend activation has been established.

Output must distinguish: facts, rule sources, recommendations, user authorization, and unverified items. After write operations, check the current refs/HEAD/status; plans and previews are not evidence of completion. Security boundaries: do not leak credentials, do not upload the worktree; do not expose credentials, entire worktree contents, or sensitive remote URLs in logs.

Positive Example

A subdirectory is under the parent repository's main: bind to the parent repository and output the current rules; for an independent empty directory, if the user chooses not to enable it for now, continue to retain this context.

Counterexamples

Run git init in each subdirectory, or interpret "could consider Git" as authorization to already initialize and create branches.

Gotchas (situations prone to misjudgment)

  • .git When it is a file, it may still be a valid work tree; query Git/common-dir first.
  • A branch pattern match does not prove the source is correct; manually created but undocumented should be listed separately as unknown.
  • Remote tracking and protection configuration text cannot prove that the live remote has actually implemented it.
  • Do not pre-create fake long-term refs for a new project's empty history; the initial commit must have an explicit bootstrap plan.
  • For definition changes, recheck the activated revision first; passing quality checks does not exempt branch rules.
  • Do not blindly replay steps that have already completed just because of a timeout with no response; check Git status and operation logs first.

Exception handling

Missing/drifted/corrupted rules, unidentified identity, interrupted operations, or insufficient source evidence: stop the related write actions, report unverified and the specific information needed, and continue with read-only work that can be completed independently. Clear naming/flow violations: deny and provide a preservation-oriented remediation direction. Git unavailable or network failure: do not auto-install, and do not treat failure as success. Preserve the real scene for conflicts and handle them according to the recovery steps.

Optional handoff

When other responsibilities are needed, invoke by name and do not assume that skill is installed. For example, workflow selection can be handed off to git-workflow;Install: npx skills add full-stack-skills/git-skills --skill git-workflow. Any handoff must not expand user authorization.