一键导入
stage
Use when you need to stage only the changes made by the current agent in a shared working tree where other agents may have edited the same files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when you need to stage only the changes made by the current agent in a shared working tree where other agents may have edited the same files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when the user wants existing uncommitted repository changes analyzed, split into logical atomic commits, staged, and committed without prescribing the grouping.
Use when the user wants to humanize text, rewrite text to sound natural and human, remove AI artifacts or padding, make text clear/direct/conversational, or provides source text along with "humanize", "make this sound like a person wrote it", "revise for voice", etc.
Use when editing the global or personal AGENTS.md (or CLAUDE.md) that lives in the dotfiles repo and is symlinked for availability across agents. Distinguish from any project-local AGENTS.md in a repository root.
Use when creating or adding a personal skill that must live only in the dotfiles repo and be symlinked into agent skill directories for availability across tools.
基于 SOC 职业分类
| name | stage |
| description | Use when you need to stage only the changes made by the current agent in a shared working tree where other agents may have edited the same files. |
| argument-hint | optional task description for commit context |
| compatibility | Requires git |
When the user asks you to stage changes — especially when other agents have been editing the same files in parallel — follow this process to stage only your own changes.
Use when you need to commit a clean set of changes from only the current agent's work in a session where multiple agents may have touched overlapping files. This ensures atomic, bisectable commits.
git status --porcelain --untracked-files=no and git diff --stat.git add <path>.git apply --cached.git diff --cached --stat.See detailed steps below for mixed files and verification.
git add -A, git add ., git add -u, or any broad add that could pull in another agent's work.git status --porcelain --untracked-files=no
git diff --name-only
git diff --stat
These tell you the full picture without flooding context. Use them first.
You (the agent) know which files you touched because the edits happened via your tools in this conversation (search_replace, write, terminal edits, etc.).
Cross-reference the list from step 1 with your recent actions.
git add path/to/file.tsNew files you introduced count as exclusive (add them explicitly).
For every file that is not 100% yours:
a. Export a compact, zero-context diff for easy parsing:
GIT_PAGER=cat git diff --no-color --unified=0 -- "the/file.ts" > "/tmp/diff-$(echo the/file.ts | tr / _).patch"
b. Read the diff using the most efficient available method:
read_file tool on the /tmp/...patch file.run_terminal_command with cat /tmp/....patch | head -200 (repeat with offset if huge).c. Locate the @@ ... @@ hunks that contain your edits. Match literal strings, function names, or the exact replacements you performed.
d. Two ways to produce the filtered patch for staging:
Option A — Reconstruct (simple when few hunks): Write only the header + the hunks you want using a heredoc:
cat > /tmp/my-changes.patch << 'PATCHEOF'
diff --git a/apps/elvent-shop/src/foo.ts b/apps/elvent-shop/src/foo.ts
--- a/apps/elvent-shop/src/foo.ts
+++ b/apps/elvent-shop/src/foo.ts
@@ -42,6 +42,9 @@ export function bar() {
+ // your added lines here
+ doTheThing();
PATCHEOF
Option B — Edit in place (often more precise, leverages your edit tool):
search_replace tool (or several calls) directly on the /tmp/xxx.patch file to delete the hunks and context that do not belong to you.diff --git, ---, +++, index) intact.This is efficient because you are using the same precise edit capability you used on source code.
You can combine hunks from one file (or even multiple files if you concatenate properly) into the final patch that gets applied.
e. Apply just that patch to the index (staging area). This leaves the working tree untouched:
git apply --cached /tmp/my-changes.patch
f. Verify only your part moved to staged:
git diff --cached -- "the/file.ts"
git diff -- "the/file.ts" # should show the other agent's remaining hunks
Repeat for every shared file. You can accumulate many small patches or one combined patch.
git add path/you/own.ts path/you/own-too/ new-file-you-created.ts
git diff --cached --stat
git diff --cached --name-only
# Only when the stat is small and you are sure:
git diff --cached
If anything from another agent appears here, unstage and repeat the hunk selection.
Unstage mistakes without touching the working tree:
git reset HEAD -- path/to/file.ts
With all the changes that are currently on disk (yours + any other agents' uncommitted edits):
bun fix (format + type check across the monorepo)bun run testbun run build, turbo build, or app-specific checks.Fix anything that is in scope for your task.
This satisfies "the change to be complete in the sense that it compiles now, with all the current changes being on disk."
If you want to be extra rigorous that your commit alone does not introduce breakage (when other parallel changes are not present):
git stash push --keep-index -m "other-agents-inflight"
# At this point index == your staged changes only
bun fix && bun run test
git stash pop
If the stashed test fails, your change has an undeclared dependency on another agent's edit. Re-scope the tasks.
Once the index contains exactly your changes:
cmc (or git-commit-with-ai)git commit -m "feat(area): concise description of the atomic change"The AI commit helper reads git diff --cached, so it will only see your precise work.
git diff of the whole tree. Use --stat and name lists.-U0 (no context) when exporting patches for shared files — keeps token usage low.git diff --no-color -U0 -- "file" | grep -n -B2 -A5 "UniqueStringYouAdded"
git add file on a shared file.bun fix on the full dirty tree.# Inspect
git status --porcelain --untracked-files=no
git diff --stat
git diff --name-only
# Compact diff for one file
GIT_PAGER=cat git diff --no-color -U0 -- path/file.ts
# Safe whole-file stage (exclusive only)
git add path/file.ts
# Selective stage via patch
git apply --cached /tmp/selected-hunks.patch
# Inspect result
git diff --cached --stat
git diff --cached
# Fix a bad stage (working tree stays the same)
git reset HEAD -- path/file.ts
Follow the steps above to produce clean, bisect-safe per-agent Git commits.