rse/ase / plugin/skills/ase-repo-stage
ase-repo-stage
VerifiedStage only the part of the current Git working copy changes which belongs to a topic, to the last `CHANGELOG.md` entry, to the last turn, or to the entire session, by picking and, if necessary, splitting hunks, check that the staged state builds on its own, and optionally chain into ChangeLog updating and commit message crafting. Use when the user calls to "stage" only a part of the changes, like "the hunks related to" a topic or "the last turn".
@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md @${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md @${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
$ARGUMENTS
Procedure
Throughout the entire skill, you MUST NEVER modify the content of
any working copy file yourself: only the Git index is changed, the
working copy is only temporarily stashed and restored by STEP 4, and
only the chained ase-repo-changelog skill of STEP 5 may edit a file.
Whenever this skill stops early after STEP 1.5, first undo the
intent-to-add marks of all files of which carry no
staged content by running the corresponding command (taken exactly as
given) per file: git -C "<repo-root/>" reset -q -- "<file/>".
-
-
Set , with any leading and trailing whitespace stripped. If more than one of , , and is equal
true, only output the following and then immediately STOP: -
Determine the selection mode : set it to
entry,turn, orsessionif the corresponding option is equaltrue. Otherwise, infer it from : set it toturnif refers to the changes of the last (or previous) turn, tosessionif it refers to all changes of the current session, toentryif it refers to the last ChangeLog entry, and in all these cases strip the referring words from . Otherwise, set it totopic. An explicitly given option always overrides the inference, and a remaining non-empty always narrows the modesentry,turn, andsession.If is
topicand is empty, only output the following and then immediately STOP:Otherwise, set to a brief rendering of and (like
topic "<topic/>",last ChangeLog entry,last turn, orsession, narrowed to "<topic/>") and only output the following : -
Determine the repository root by running the corresponding command (taken exactly as given) and capturing its output into . If this command fails, only output the following and then immediately STOP:
git rev-parse --show-toplevel -
git -C "<repo-root/>" -c core.quotepath=off diff --cached --name-onlygit -C "<repo-root/>" -c core.quotepath=off diff --name-onlyIf a file occurs in both lists, its staged version exists nowhere else and would be lost by resetting the index, so only output the following and then immediately STOP, leaving everything untouched:
Otherwise, if the first list is not empty, unstage everything by running the corresponding command (taken exactly as given), which leaves the working copy untouched:
git -C "<repo-root/>" reset -qThe selection is staged on top of the current index content, which hence stays untouched. Do not output anything. -
Determine the untracked files by running the corresponding command (taken exactly as given), skipping every entry below the
.ase/directory, as it carries ASE's own state:git -C "<repo-root/>" -c core.quotepath=off ls-files --others --exclude-standardSet to the remaining files and mark each of them as intent-to-add by running the corresponding command (taken exactly as given), so its content shows up as an ordinary, splittable creation diff:
git -C "<repo-root/>" add -N -- "<file/>" -
Determine the diff details and the diff statistics of the working copy against the index by running the corresponding commands (taken exactly as given) and capturing their full outputs into and :
git -C "<repo-root/>" diff --binarygit -C "<repo-root/>" diff --numstat
-
-
-
Determine the selected changes -- the changed lines of which belong to the selection -- according to :
-
topic: the changes which semantically belong to . -
entry: the changes which realize the last ChangeLog entry, i.e. the entry added or modified by the uncommitted change of theCHANGELOG.mdfile in (if several, the one names, else the last one in file order), plus the lines of this entry itself. If adds or modifies no such entry, only output the following and then STOP: -
turnresp.session: the changes made by your own file-modifying tool calls (likeEditandWrite) of the last turn before this skill invocation resp. of the entire current session, as carried by the conversation context. If the context carries no such modifications which are still part of , only output the following and then STOP:
For the modes
entry,turn, andsession, a non-empty additionally narrows the selected changes to those which semantically belong to . -
-
Keep mutually dependent changes together: if a selected change only builds together with an unselected one (like a use and its import or declaration), select the latter, too, and mention it in its file summary of STEP 3.
-
Set , , and to the number of files, hunks, and partially selected hunks with selected changes. A binary file diff is never split, so it is either selected entirely or not at all.
-
-
-
Set to the value of the
TMPDIRenvironment variable if it is known in the current session context, and to/tmpotherwise. Do not output anything. -
Assemble from : keep the complete
diff --gitfile headers and the@@hunk headers of all files and hunks with selected changes, and drop all others. Keep an entirely selected hunk verbatim. Turn a partially selected hunk into a sub-hunk, exactly like an edited hunk ofgit add -p: keep its context lines and its selected+and-lines, turn every unselected-line into a context line by replacing its leading-by a space, and drop every unselected+line. Its@@header stays unchanged, as--recountfixes its counts.Besides these marker changes, stays byte-exact: you MUST NEVER re-wrap, re-indent, or re-encode a line, normalize or strip trailing whitespace, omit the trailing newline, or re-render any part of it as Markdown.
-
Use the
Writetool to write to the patch file<tmp-dir/>/ase-stage.patch, and apply it to the index only by running the corresponding command (taken exactly as given):git -C "<repo-root/>" apply --cached --recount --whitespace=nowarn "<tmp-dir/>/ase-stage.patch" -
Undo the intent-to-add mark of every file of without selected changes by running the corresponding command (taken exactly as given) per file, and then remove the patch file by running the corresponding command (taken exactly as given):
git -C "<repo-root/>" reset -q -- "<file/>"rm -f "<tmp-dir/>/ase-stage.patch" -
Only output the following , with one
○line per staged file and an ultra brief of its staged changes:
-
-
-
Determine the build command of the project: prefer the command the project-level AI guidance files (
AGENTS.md,CLAUDE.md, or similar) name for building, else derive it from the build configuration (like thebuildscript ofpackage.json, the default target of aMakefile, or the native build command of the language). Prefer a single top-level command which builds and type-checks the entire project. -
Set to the outcome of running on the staged state alone, determined by the first applicable case:
-
git -C "<repo-root/>" worktree add --detach "<check-dir/>" HEADgit -C "<repo-root/>" diff --cached --binary > "<tmp-dir/>/ase-stage-check.patch"git -C "<check-dir/>" apply --whitespace=nowarn "<tmp-dir/>/ase-stage-check.patch"Link every git-ignored dependency directory of the working copy (like each
node_modulesdirectory, found viafind "<repo-root/>" -name node_modules -type d -prune -not -path "*/.ase/*") into the same relative location of vialn -s "<dependency-dir/>" "<check-dir/>/<relative-dir/>", so runs without a fresh installation. Then run with as its working directory, and finally clean up by running the corresponding commands (taken exactly as given):git -C "<repo-root/>" worktree remove --force "<check-dir/>"rm -f "<tmp-dir/>/ase-stage-check.patch" -
git -C "<repo-root/>" rev-parse -q --verify refs/stashgit -C "<repo-root/>" stash push -q --keep-index --include-untracked -m "ase-repo-stage"git -C "<repo-root/>" rev-parse -q --verify refs/stashIf the stash was not created, only output the following and then immediately STOP, as the working copy stays untouched:
Otherwise, run with as its working directory, and then always -- also on a failed build -- restore the working copy by running the corresponding commands (taken exactly as given), where the reset is safe because the stash carries both the index and the working copy:
git -C "<repo-root/>" reset -q --hardgit -C "<repo-root/>" stash pop -q --indexIf the
git stash popcommand fails, only output the following and then immediately STOP:
-
-
-
-
Capture the same diff again into , and stage exactly the changes which carries beyond -- the entries just added or updated for the staged selection -- by assembling, writing, and applying them as in STEP 3.2 and 3.3.
-
-
Give the closing hints by expanding the following (which, depending on the configured , may each expand into nothing and hence emit no output at all):
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |