AgentSkillsCN

UseGit

本项目中的Git实践。当您需要提交代码、创建提交或执行Git操作时,可使用此功能。它有助于保持整洁的Git历史记录。

SKILL.md
--- frontmatter
name: UseGit
description: Git practices for this project. USE WHEN committing code OR creating commits OR git operations. Enforces clean git history.

UseGit

Enforces clean git practices and commit hygiene for this project.

Core Principles

One commit = one logical change.

Commit after each step, then STOP and wait for user.

Workflow Routing

WorkflowTriggerFile
PreCommitBefore running git commitWorkflows/PreCommit.md

Quick Reference

Git Command Rules

RuleCommand
File renamesgit mv (not mv)
File deletionsgit rm (not rm)
Run commands fromRepo root (use git rev-parse --show-toplevel)
Before stagingAlways run git status first
Staging vs committingSeparate git add and git commit commands

Commit Rules

  1. One logical change per commit - Don't bundle unrelated changes
  2. Commit after each step - Before starting next task
  3. Stop after committing - Wait for user to request next step
  4. Include plan updates - Step implementation + plan update = one commit

Examples

Example 1: After completing a feature step

code
[Implementation done, tests pass]
→ git status
→ git add [files]
→ git commit -m "feat: ..."
→ STOP and wait for user

Example 2: Renaming a file

code
→ git mv old-name.ts new-name.ts
→ git commit -m "refactor: rename ..."

Example 3: Multiple logical changes found

code
[About to commit, notice unrelated changes]
→ STOP
→ Use git add -p to stage only related changes
→ Commit each logical change separately

References