skills/ks-skill-orchestrator-subagent-context-and-git-state/SKILL.md
Use when: (1) building a skill/command that orchestrates other skills by spawning subagents, (2) a delegated sub-skill reads git working-tree state (e.g. `git branch --show-current`) instead of taking it as an argument, (3) a sub-skill is supposed to "reflect on this session" / capture session learnings (like revise-claude-md) but runs in a subagent, (4) base branch ends up wrong or a session-reflection step sees an empty/trivial context. Keywords: orchestrator, subagent isolated context, git branch --show-current, base branch checkout, revise-claude-md, this session.
npx skillsauth add arinhubcom/arinhub ks-skill-orchestrator-subagent-context-and-git-stateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When a skill orchestrates other skills by launching one subagent per phase, two non-obvious assumptions silently break. Both come from the same root: a subagent is an isolated context with its own conversation, and many skills read ambient state (git working tree) rather than their arguments.
ah-workflow) that runs phase skills in
sequence via subagents.Many skills compute their base/context from the working tree, e.g.
BASE_BRANCH=$(git branch --show-current). Passing a "base branch" string in the subagent prompt has
no effect — the skill ignores it and uses whatever branch is checked out.
Fix: set up the working-tree state before launching the subagent. For a base branch, the
orchestrator must git checkout <base-branch> (and git pull if it tracks a remote) first, so the
sub-skill's git branch --show-current returns the intended base. Always read the sub-skill's actual
Step 0 to learn which state it derives vs. which it accepts as an argument.
Skills like revise-claude-md operate on "this session" (the conversation history). Run inside a
subagent, they reflect on the subagent's own isolated context — which only contains "I invoked one
skill" — not the orchestrator's full run. The captured learnings are therefore empty or trivial.
Fix: invoke session-reflection skills in the main orchestrator session, not as a subagent. Make this an explicit exception in the per-phase loop.
ah-* (non-pipeline) steps may not auto-commitPipeline skills often run an internal committer subagent. A general command like revise-claude-md
does not, and if it runs after the PR is already created, its file edits land uncommitted and outside
the PR. Handle such steps explicitly: present the diff and ask whether to commit + push onto the PR
branch.
| Symptom | Root cause | Fix |
| ------- | ---------- | --- |
| Base branch wrong in spec.md / new branch cut from wrong base | sub-skill uses git branch --show-current, ignores passed arg | git checkout <base> before launching that phase |
| Session-learnings step produces empty/trivial output | reflection skill ran in isolated subagent context | run it in the main session |
| CLAUDE.md / doc edits left uncommitted, not in PR | non-pipeline step has no internal committer; runs post-PR | commit + push explicitly, or run before PR creation |
spec.md (or equivalent) records the intended base branch and
that the reflection step's output references the whole pipeline, not just "invoked a skill".Discovered while building ah-workflow (arinhub-dev-skills): ah-create-tasks derives base branch
from git branch --show-current, and claude-md-management:revise-claude-md reflects on the current
session. See also [[ks-merge-dropped-feature-stale-base]] for related git-base hazards.
development
Run the full ArinHub feature-development pipeline end-to-end with the "ah" prefix. Use for "ah workflow", "ah run workflow", "ah full workflow", a GitHub issue URL to take from issue to PR, or any request to run the whole ah pipeline at once. Takes a feature description + issue number + base branch, OR a GitHub issue URL (resolved via references/resolve-gh-issue.md). Sequentially launches subagents: ah-create-prd-adr -> ah-create-tasks -> ah-implement-tasks -> optional ah-check-qa verification -> ah-finalize-code (creates the PR), anchored with /goal and guarded by retry + escalation.
testing
Verify that a PR or local changes fully implement requirements from a linked GitHub issue, with the "ah" prefix. Use for "ah verify requirements coverage", "ah verify requirements coverage issue 42", "ah verify requirements coverage PR 123", or both ("PR 123, issue 42").
development
Submit a completed code review with line-specific comments and suggestions to a GitHub PR, with the "ah" prefix. Use for "ah submit code review 123".
development
Review code with the "ah" prefix. Use for "ah review code", "ah review code 123", "ah review", "ah code review", "ah review my changes", or "ah review this PR" (even without "code"). Reviews correctness, maintainability, and adherence to project standards for local branch changes or remote Pull Requests (by ID or URL).