git-add
Autonomously select files to stage for an atomic Git commit. Use when the agent wants to stage selected files for a git commit. Only stages selected files, but does not commit them.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Agent protocol: Stage atomic git changes
Goal: Stage a single, cohesive set of related file changes for an atomic commit.
When: Use when the agent wants to stage selected files for a git commit.
NOTE: Use this skill only for staging selected files, but not
committing them.
Primary directives
-
Study
references/filesONLYif more than one file exists to stage. -
NEVERusegit add .orgit add -A. -
NEVERusegit checkoutorgit restore. -
Assume a file in both
stagedandunstagedstates needs staging. -
Stage files explicitly:
git add <file1> <file2> .... -
Leave unrelated changes
unstaged. -
Isolate
.gitignorechanges; stage them in a separate commit. -
Except for
.gitignore,DON'Tedit any files
Git directives
Git commands (use --no-pager and --no-ext-diff for diffs):
For unstaged changes
git --no-pager diff --no-ext-diff --stat --minimal --patience --histogram \
--find-renames --summary --no-color -U10 <file_group>
For staged changes
git --no-pager diff --staged --no-ext-diff --stat --minimal --patience \
--histogram --find-renames --summary --no-color -U10
For repository status
git status --porcelain=v2 --branch
For staging files
git add <file1> <file2> ...
Efficiency directives
- Optimize all operations for token and context efficiency
- Single-file shortcut: If one tracked
unstagedfile, stage immediately (skip reference study) - Batch git operations on file groups, avoid individual file processing
- Use parallel execution when possible
- Analyze tracked files via
git diff; read non-ignoreduntrackedfiles; omit ignored files - Reduce token usage
Workflow
Exception: If exactly one tracked unstaged file exists, stage it
immediately and skip steps below.
- Study references files
- Review repository status to identify all modified/new/
untrackedfiles - Update
.gitignorefollowing reference guidelines - Select smallest group of
unstagedfiles forming single logical change - Stage the atomic group
- Output status as first line, then bullet list of staged files
Output
Files modified:
- Staging area - Files added to git staging area
Status communication:
First line of output indicates status:
-
SUCCESS: staged N files for atomic commit- Files staged successfully -
WARN: no files available to stage- Nounstagedchanges found -
ERROR: [message]- Failed to stage files
Following lines (when SUCCESS): bullet point list of staged files
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-31
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!