Imported from majiayu000/claude-skill-registry (
skills/development/ase-code-dissect/SKILL.md). Install upstream withnpx skills add majiayu000/claude-skill-registry --skill ase-code-dissect. Copyright stays with the author.
@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md @${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md @${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md
$ARGUMENTS
@${CLAUDE_SKILL_DIR}/../../meta/ase-common-dissect.md
Procedure
-
-
Determine the dissection hint: set , with any leading and trailing whitespace stripped. Additionally, inherit the always existing from the current context, as it names the worktrees and branches of all derived parts.
-
Determine the repository root by running the corresponding command (taken exactly as given) and capturing its output into :
git rev-parse --show-toplevel -
Determine the diff details and the diff statistics by running the corresponding commands (taken exactly as given) and capturing their full outputs into and :
git diff --cached --numstat HEADgit diffgit diff --numstat -
git -C "<repo-root/>" ls-files --others --exclude-standardSkip every listed entry below the
.ase/directory -- it carries ASE's own state and the worktrees created by this very skill, and hence is never part of the user's change set.Then, for every remaining listed file, capture its creation diff by running the corresponding command (taken exactly as given) and append its output to :
git -C "<repo-root/>" diff --no-index --binary /dev/null "<file/>"This command intentionally exits with a non-zero status, because the two compared paths differ; treat this exit status as success, not as an error. Judge the outcome by the output instead: a run which emits no diff on standard output but an
error:orfatal:message (e.g. the entry is a nested Git repository, whichgit ls-filesreports as a directory) is a real failure -- append nothing for that entry and only output the following , then continue with the next file:
-
-
-
Derive the parts of the epic:
<expand name="dissect-derive" arg1="ase-code-dissect" arg2="" arg3=""
the individual hunks of the captured , weighted by the line counts of and -- for the folded-in untracked files, which carry no entry -- by their own diff line counts
Additionally, try to keep all hunks of one file in the same part, and split a file's hunks across parts only when they are genuinely unrelated -- this keeps the per-part patches applicable.
A single hunk is atomic here, so rule 3's splitting permission does not apply to it: you MUST NOT break a hunk into sub-hunks, because this would require re-computing its
@@header and hence destroy the byte-exactness the per-part depends on. -
Report the parts:
-
-
-
Determine the existing worktrees and existing branches by running the corresponding commands (taken exactly as given) and capturing their outputs:
git worktree list --porcelaingit branch --list -
Set to all of for which either a worktree directory
<repo-root/>/.ase/worktree/<part-id/>or a branch<part-id/>already exists. -
Directly after this , and before stopping, give the corrective hint by expanding the following (which, depending on the configured , may expand into nothing and hence emit no output at all):
-
git worktree remove --force "<repo-root/>/.ase/worktree/<part-id/>"git worktree prunegit branch -D <part-id/>
-
-
You MUST NEVER mutate the original working copy in this step: do not modify, stage, stash, revert, or commit anything outside of the freshly created worktrees.
-
Set to the value of the
TMPDIRenvironment variable if it is known in the current session context, and to/tmpotherwise. Do not output anything. -
For every part in , in their derived order:
-
Assemble from the verbatim subset of assigned to this part: keep the complete
diff --gitfile headers and the complete@@hunk headers of the assigned hunks, and change nothing inside them.The captured is byte-exact input and stays byte-exact, too, because
git applyrejects even the smallest deviation. You MUST therefore NEVER re-wrap a line, re-indent a line, normalize or strip trailing whitespace, drop the leading context/+/-marker column, re-encode a character, or omit the trailing newline -- and you MUST NEVER re-render any part of the diff as Markdown, so no bullet marker and no inline code span is ever introduced into . -
Use the
Writetool to write to the patch file<tmp-dir/>/ase-dissect-<part-id/>.patch. -
Create the worktree by running the corresponding command (taken exactly as given), which creates the directory and -- named after its last path component -- the branch from
HEAD. The.asedirectory is usually git-ignored, so the worktree itself never shows up as a change:git worktree add "<repo-root/>/.ase/worktree/<part-id/>" -
Apply the patch inside the freshly created worktree by running the corresponding command (taken exactly as given):
git -C "<repo-root/>/.ase/worktree/<part-id/>" apply --whitespace=nowarn "<tmp-dir/>/ase-dissect-<part-id/>.patch" -
The existing
CHANGELOG.mdis changed, never replaced: you MUST use theReadtool to read it and theEdittool to insert the single new entry in place, and you MUST NEVER use theWritetool on it, as this would drop the entire remaining change history. -
Leave the worktree uncommitted: do not run
git addand do not rungit commit, so the user keeps full control over the final commit of every part. -
Only output the following :
-
-
Clean up the temporary patch files by running the corresponding command (taken exactly as given) once per of the successfully materialized , and silently ignore the failure of an individual command when the corresponding patch file does not exist:
rm -f "<tmp-dir/>/ase-dissect-<part-id/>.patch"The patch file of a successful part is a pure intermediate: it was already consumed by
git applyand its content is fully preserved in the worktree, so it is removed. The patch file of a part whose worktree or patch failed is kept instead, because it is that part's only materialization and would otherwise be lost. Do not output anything.
-
-
-
Finally, 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):
-