Git refactor hygiene
Skill gjbex/scientific-computing-skills/skills/git-refactor-hygiene
Codex plugin for scientific computing
npx -y skills add gjbex/scientific-computing-skills --skill git-refactor-hygieneAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when reorganizing, moving, renaming, staging, committing, or preparing pull requests in a Git worktree, especially to preserve rename history and keep branches, commits, and PRs single-purpose.
SKILL.md
4.6 KB, as published. Nobody here has run it
Git Refactor Hygiene
Workflow
- Check status first with
git status --short. - Fetch remote refs before branch or pull-request decisions when network
access is available, so comparisons use current
origin/*state rather than stale local tracking refs. - Before implementation starts, confirm the work is on a focused branch for
the requested concern. If it is still on the project's target branch, such
as
main,trunk, ordevelopment, update that intended base withgit pull --ff-onlyand create a short-lived topic branch from it unless the user explicitly wants to work in place. - Check the current branch and compare it with its base when practical before committing or preparing a pull request.
- For tracked files or directories, use
git mv <old> <new>rather than plainmv. - If a plain
mvalready happened, stage withgit add -A <paths>and verify Git reportsRrenames, not justDplusA. - Leave unrelated dirty or untracked files untouched unless the user explicitly asks otherwise.
- Stage by path or hunk so each commit represents one purpose.
- Verify with
git status --shortand, when needed,git diff --cached --summary.
Branch and Commit Scope
- Keep branches single-purpose: one bug fix, feature, refactor, documentation update, release chore, or validation change.
- Use the repository's documented pull-request target as the base branch. Some
projects use trunk-based development with PRs into
main; others usetrunk,development, or temporary release branches. Do not assumedevelopmentis universal. - A short-lived topic branch is the default for new implementation work, but a tiny mechanical release chore can be committed directly on an integration branch when the maintainer explicitly chooses that path and the diff is limited to the release metadata.
- Treat remote tracking branches as the source of truth for pull-request scope.
Before opening or updating a PR, check the commit list and diff against the
actual target branch, for example
git log --oneline origin/main..HEADorgit diff --stat origin/development...HEAD. - Keep commits atomic: each commit should explain one coherent reason for the changed files and should be revertible without taking unrelated work with it.
- Watch for scope drift while working. If the branch's diff starts to include a second concern, warn the user and propose either staying focused on the current concern or moving the new concern to a separate branch.
- Separate mechanical moves or generated refreshes from semantic edits when practical.
- If a change touches unrelated skill boundaries, build files, documentation, and release metadata at once, pause and explain whether those changes form one contract or should be split.
- Do not stage unrelated dirty files just because they are present in the worktree.
Warning Triggers
Before committing, pushing, opening a pull request, or summarizing a branch, warn the user when:
git status --shortshows unrelated modified or untracked files;- the branch diff mixes independent concerns that could be reviewed or reverted separately;
- the branch includes commits already intended for the target branch because it
was created from a local integration branch that was ahead of
origin/*; - a commit would combine file moves with substantial content changes;
- generated artifacts, caches, logs, or local environment files appear in the diff;
- the diff spans many directories or skill boundaries without a clear single purpose;
- the pull request would include cleanup, feature work, release metadata, and validation changes that are not part of the same repository contract.
When warning, name the files or themes causing the concern and suggest a split such as separate commits, a follow-up branch, or leaving unrelated files unstaged.
Notes
- Prefer one move-focused commit separate from content edits when practical.
- If files are edited during the move, Git may still detect renames after staging, but check explicitly.
- Keep persistent scratch notes either ignored intentionally or outside the repository; do not stage them by accident.
- Ignored caches such as
__pycache__/do not need to be removed for normal Git hygiene. Usegit status --short --ignoredorgit check-ignore -v <path>if you need to verify that generated files are safely ignored.