---
name: sf-vcs-hygiene
description: Apply repository-specific version-control hygiene in automatic workflows. Use before commit, push, safe-push, worktree sync, or interpreting Git/JJ rules.
user-invocable: false
model-invocable: true
side-effects: external
permission-profile: trusted
triggers:
  - build
  - verify
  - "*"
---

# SF VCS Hygiene

Use this skill before committing, pushing, or interpreting repository-specific VCS instructions.

## Rules

- Detect the current repository first. Do not infer VCS behavior from sibling repos.
- If the current repo has `.jj/`, treat it as JJ-backed and follow that repo's JJ instructions.
- If the current repo has `.git/` and no `.jj/`, treat it as plain Git.
- If the current repo has a repo-owned push wrapper, use that wrapper for pushes unless the user explicitly directs otherwise.
- Never apply another repo's wrapper or safe-push rule to the current repo.

## Push Selection

- JJ repo with repo wrapper: use the repo wrapper.
- JJ repo without wrapper: inspect repo docs before pushing.
- Git repo with repo wrapper: use the repo wrapper.
- Git repo without wrapper: normal Git push is appropriate.

## Safety

Before mutating VCS state, check `git status --short --branch` or the repo's JJ equivalent. Preserve unrelated user changes.
