Token导航 LogoToken导航

Agent Skill · 待分类

git-staging(git 暂存)

git-staging 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

git-staging 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 9,348。

总安装 245周安装 10GitHub Stars 10下载 78核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git-staging(git 暂存)
来源仓库:https://github.com/aspiers/ai-config
仓库路径:skills/git-staging
安装命令:
npx skills add https://github.com/aspiers/ai-config --skill git-staging
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/aspiers/ai-config --skill git-staging

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库和原始 README 核验具体用法和功能细节。

安装通过 npx skills add 命令从指定 GitHub 仓库获取,适用于 Codex、Claude、Cursor、Gemini CLI。建议确认权限范围、维护状态及是否触发联网、命令执行或文件读写。

来源仓库内路径:skills/git-staging

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/aspiers/ai-config --skill git-staging;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

git-staging 怎么安装?

在终端执行 npx skills add https://github.com/aspiers/ai-config --skill git-staging。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

git-staging 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

git-staging 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

git-staging 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

git-staging 用的人多吗?

公开数据是累计安装 245 次,近一周安装 10 次,下载 78 次,GitHub 10 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

git-staging 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
git-staging

git 暂存 · 本页

24510只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Non-interactive Git Staging

When to use this skill

Use this skill when you need to:

  • Stage only specific hunks from a file (not the entire file)
  • Stage only specific lines within a hunk
  • Avoid interactive git commands (git add -p, git add -i, etc.)
  • Programmatically control exactly what gets staged

Step 1: Assess the changes

Before choosing a staging method, determine what changes exist:

git status                    # See which files have changes
git diff --no-ext-diff        # See all unstaged changes
git diff --cached --no-ext-diff  # See already-staged changes

Decision tree:

  • If only ONE file has changes and you want ALL of them staged → use git add <file>
  • If ONE file has multiple unrelated hunks and you want only SOME → use Method 2 or 3
  • If MULTIPLE files need staging → stage per-file with git add for each, or selectively with patch method

Why not use git add -p?

Interactive git commands require a TTY and human input. AI agents cannot reliably fake interactive sessions - attempts using echo "y" or yes are fragile and often fail. Instead, construct patches programmatically and apply them directly to the index.

Core technique

The key insight is that git apply --cached applies a patch directly to the staging area (index) without modifying the working tree. This lets you stage precise changes non-interactively.

Temporary files

All temporary patch files should be written to tmp/ within the repository (not /tmp) to avoid permission prompts. Ensure the directory exists first:

mkdir -p tmp

Methods

Method 1: Stage entire file

When you want to stage all changes in a file:

git add <file>

Method 2: Stage specific hunks via patch

When you need to stage only certain hunks from a file:

  1. Generate the full diff for the file: git diff <file> > tmp/full.patch
  2. Edit the patch to keep only the hunks you want to stage (use the Edit tool or create a new file with only the desired hunks)
  3. Apply the edited patch to the index: git apply --cached tmp/selected.patch

Method 3: Stage specific lines within a hunk

When you need to stage only certain lines within a hunk, you must carefully edit the patch to maintain validity:

  1. Generate the diff: git diff <file> > tmp/full.patch
  2. Edit the patch, following these rules for the hunk you're modifying:

- Keep the @@ hunk header but adjust the line counts - To exclude an added line (+): remove the entire line from the patch - To exclude a removed line (-): change - to a space (`) to make it context - Adjust the line counts in the @@ -X,Y +X,Z @@` header to match

  1. Apply: git apply --cached tmp/selected.patch

Patch format reference

A unified diff patch has this structure:

diff --git a/file.txt b/file.txt
index abc123..def456 100644
--- a/file.txt
+++ b/file.txt
@@ -10,6 +10,8 @@ optional context label
 context line (unchanged)
-removed line
+added line
 context line (unchanged)

Hunk header format

@@ -START,COUNT +START,COUNT @@

  • First pair: original file (lines being removed or used as context)
  • Second pair: new file (lines being added or used as context)
  • COUNT = number of lines in that side of the hunk (context + changes)

Line prefixes

  • `` (space): context line (unchanged, appears in both versions)
  • -: line only in original (will be removed)
  • +: line only in new version (will be added)

Example: Staging only the second hunk

Given a file with two hunks of changes:

# Generate full diff
git diff --no-ext-diff myfile.py > tmp/full.patch

The patch might look like:

diff --git a/myfile.py b/myfile.py
index abc123..def456 100644
--- a/myfile.py
+++ b/myfile.py
@@ -5,6 +5,7 @@ import os
 def foo():
     pass
+    # Added comment in first hunk

 def bar():
@@ -20,6 +21,7 @@ def bar():
 def baz():
     pass
+    # Added comment in second hunk

To stage only the second hunk, create a new patch with just that hunk:

diff --git a/myfile.py b/myfile.py
index abc123..def456 100644
--- a/myfile.py
+++ b/myfile.py
@@ -20,6 +21,7 @@ def bar():
 def baz():
     pass
+    # Added comment in second hunk

Then apply:

git apply --cached tmp/second-hunk.patch

Example: Excluding specific added lines

If you have a hunk with multiple additions but only want to stage some:

Original hunk:

@@ -10,4 +10,7 @@
 existing line
+line I want to stage
+line I do NOT want to stage
+another line I want to stage
 more context

Edit to exclude the unwanted line (remove it entirely and adjust count):

@@ -10,4 +10,6 @@
 existing line
+line I want to stage
+another line I want to stage
 more context

Note: The +10,7 became +10,6 because we removed one added line.

Verification

After applying, verify what was staged:

git diff --cached          # Show staged changes
git diff                   # Show unstaged changes (should include excluded hunks)
git status                 # Overview of staged/unstaged state

Common pitfalls

  1. Invalid line counts: If the @@ header counts don't match the actual lines in the hunk, git apply will fail. Always recount after editing.
  2. Missing newline at EOF: Patches are sensitive to trailing newlines. Watch for \ No newline at end of file markers.
  3. Whitespace corruption: Ensure context lines start with a space, not an empty prefix. Some editors strip trailing spaces.
  4. Index mismatch: The index abc123..def456 line is optional for git apply --cached. If you have issues, try removing it.

Troubleshooting

If git apply --cached fails:

  1. Test the patch first without --cached: git apply --check tmp/selected.patch
  2. Use verbose mode to see what's happening: git apply --cached -v tmp/selected.patch
  3. Common error messages:

- "patch does not apply": Line counts are wrong or context doesn't match - "patch fragment without header": Missing the diff --git or ---/+++ lines

平台分布

Codex

33.27%
按下载量换算26

Claude

32.65%
按下载量换算25

Cursor

18.24%
按下载量换算14

Gemini CLI

8.81%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills