the9ball/.dotfiles/git-stage-lines

Claude Code and agent skill by the9ball/.dotfiles

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Safely stage only selected working-tree Git changes by line range or diff hunk, without changing the working tree or discarding existing staged changes. Use for requests such as `この変更だけstageして`, `42〜57行目だけgit addして`, `変更1と3だけstageして`, `commit A用の変更だけstageして`, or `git add -p相当を非対話的にやって`.

Install

npx vskill@latest install the9ball/.dotfiles/git-stage-lines

SKILL.md

The same SKILL.md was published earlier as the9ball/.dotfiles/git-stage-lines.

Git Stage Lines

Use bin/git-stage-lines.mjs with Node.js 20 or newer. It creates and checks a patch, then applies it only to the index.

Procedure

  1. Inspect git status --short, git diff -- <path>, and

git diff --cached -- <path>.

  1. For change numbers, run --list -- <path>, retain the fingerprint printed

to stderr, and pass it with --fingerprint. --changes requires the exact fingerprint from the preceding --list.

  1. Run --dry-run before applying when the list shows an unexpected deletion

count, a replacement hunk, or another non-obvious selection.

  1. Apply the selection, then verify git diff --cached -- <path> and the

remaining unstaged diff. A mismatch is failure.

Examples:

node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --list -- src/foo.ts node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" -- src/foo.ts 42-57 node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --dry-run -- src/foo.ts 42-57 node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --changes 1,3 --fingerprint HASH -- src/foo.ts

Use the --changes example for deletion-only hunks; it is their only selection path.

Rules

  • Preserve existing staged changes and never rewrite the working tree.
  • Put the path after --; do not pass an ambiguous request or infer nearby changes.
  • Select complete text hunks only. L uses new-side lines and D uses old-side lines. Deletion-only hunks (no added lines) require --changes. Replacement hunks can be selected by a line range containing all their new-side changed lines, or by --changes; both sides, for example L20/D20-80 (+1/-61), are staged as one unit. If a line range also overlaps a deletion-only hunk's old-side coordinates, use --changes to select the intended hunks explicitly.
  • Normalize overlapping or adjacent line ranges by merging them; do not add lines outside their union.
  • Reject unsupported renames, copies, binary files, symlinks, submodules,

mode-only changes, conflicts, malformed hunks, and failed verification.

  • Exit codes: 0 success, 1 internal error, 2 fix the request, 3 unsupported target/runtime, 4 safety check failure or changed state, 5 Git failure.

Implementation: bin/git-stage-lines.mjs. Tests: tests/git-stage-lines.test.mjs.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/the9ball/.dotfiles/git-stage-lines/badge)](https://verified-skill.com/skills/the9ball/.dotfiles/git-stage-lines)

Something wrong with this skill or its page? Tell us.