From spindev-core
Wraps up a working session cleanly so a following /clear loses nothing important — syncs docs, prunes and updates memory, reconciles TODOs, runs local quality gates, writes a session summary, and (when appropriate) creates a PR with auto-merge + squash. Use this skill whenever the user invokes /end-session or says phrases like "get ready to clear context", "wrap up this session", "prep for /clear", "we're done for now", "let's wrap up", or otherwise signals the session is ending. This skill is itself the explicit permission to create a PR and enable auto-merge when session context clearly indicates feature work is complete.
How this skill is triggered — by the user, by Claude, or both
Slash command
/spindev-core:end-sessionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Wraps up a working session so a following `/clear` loses nothing important. Think of it as the checklist you would want to run every time you are done for the day or about to reset context mid-thread.
Wraps up a working session so a following /clear loses nothing important. Think of it as the checklist you would want to run every time you are done for the day or about to reset context mid-thread.
Announce at the start: "Running /end-session to wrap up this session."
/end-session (slash command)Optional arguments the user may include at invocation:
merge / no-merge — force or skip the PR stepwait / no-wait — override CI wait behaviorInvoking /end-session grants permission to:
CLAUDE.md, memory files, project docs, TODO files, and SESSION-SUMMARIES.md in this turnIt does not authorize:
reset --hard, branch -D, stash drop, clean -fd) — always askmain, staging, or prod in protected mode/clear itself — that is the user's next actionThe wrap-up steps depend on the project's phase. Detect at the start.
| Mode | Signals | PR behavior |
|---|---|---|
| Bringup | main is the only branch, commits go straight to main, no PR history, often no remote yet | Commit + push to main, no PR |
| Protected | Feature branches exist, history shows squash merges / PRs, main has protection rules or a clear convention | PR from feature branch, squash + auto-merge |
Record the detected mode as a breadcrumb under a ## Project Mode heading in CLAUDE.md. If a bringup breadcrumb exists but the repo now shows feature branches or PR history, remove the breadcrumb and treat as protected from now on. The breadcrumb prevents re-detection on every session.
There should always be a CLAUDE.md. If one does not exist, create it before writing the breadcrumb. Ask the user for anything you genuinely cannot infer (project purpose, stack, notable conventions). A minimal CLAUDE.md with scope + mode is a fine starting point.
Walk through these steps in order. Announce the current step as you go. Skip steps that clearly do not apply and say so. For a large session, consider using a task list so interruptions are recoverable.
git status, current branch, remotegit log <upstream>..HEAD to see un-pushed workgit worktree list — detect whether we are in a worktree vs the main checkout, and note the path of the root (main) worktreedocs/superpowers/plans/ or equivalentCLAUDE.md, SESSION-SUMMARIES.md, and any memory system (e.g., MEMORY.md) existIf there is no git repository at all and the project looks code-shaped, offer to git init. If the user declines, continue with the docs/memory/TODO steps anyway — a CLAUDE.md still helps.
Detect bringup vs protected. Write or remove the breadcrumb in CLAUDE.md as needed.
Create it if missing. If present, check it still reflects the repo — new top-level directories, changed stack, new sub-CLAUDE.md references the root should point at.
List staged, unstaged, and untracked changes. Ask the user what to do with each group:
discard)Before any commit or push, scan staged content for anything that looks like credentials (.env, tokens, API keys, private keys, cookie jars, session files). Flag scratch/debug files (.scratch, tmp_*, debug_*, notebook checkpoints) that should not land in a commit. Do not auto-remove — surface and ask.
For untracked files that clearly belong in .gitignore (build artifacts, caches, node_modules, __pycache__, IDE files, OS junk), propose additions. Ask on ambiguous cases. Update .gitignore before the PR so the diff stays clean. This is one of the most common sources of noise in PRs and it is cheap to prevent.
Update:
CLAUDE.md and every CLAUDE.md it referencesCLAUDE.md, module READMEs that enumerate files)docs/superpowers/plans/ — mark completed steps, close finished plansIf a new doc would genuinely help (a new subsystem with no README, a migration guide, an API note), propose it with a suggested path and purpose. Create only after the user confirms.
docs/CLAUDE-TODO.md)If the environment has a persistent memory system (e.g., MEMORY.md with linked memory files), read it and for each entry:
When a learning is more of a durable project rule than personal context, write it in CLAUDE.md instead of (or in addition to) memory.
Append an entry to SESSION-SUMMARIES.md at the repo root. Create the file if missing and add a one-line reference to it from CLAUDE.md (e.g., "Session history: see SESSION-SUMMARIES.md").
Entry format — aim for balance, not a wall of text:
## YYYY-MM-DD — <branch-name>
- 3-5 bullets of what shipped or moved forward
- Follow-ups, blockers, or partially-complete work
- New TODOs spawned (note origin — which decision or discussion)
- Anything future-you should know before touching this area again
Keep it scannable. A future session should be able to read one entry and pick up work without re-reading the whole conversation.
Run locally, even if CI also runs them:
pytest, npm test, cargo test, etc.)tsc --noEmit, mypy, svelte-check, etc.)Discovery: Do not rely solely on CLAUDE.md for the list of commands. Also check the CI workflow files (.github/workflows/*.yml, .gitlab-ci.yml, Makefile, package.json scripts) for quality gates that may not be documented. If you find a gate in CI that is not in CLAUDE.md, run it and add it to the Testing section of CLAUDE.md so future sessions do not repeat this gap.
If any gate fails, stop and report. Do not proceed to review offers or PR.
If the session's changes are substantial — roughly hundreds of lines changed, 10+ files touched, or context clearly indicates a major feature or refactor — offer to run any of:
/codex:review/codex:adversarial-review/simplifyFor small bugfixes or trivial changes, skip the offer — it is noise. Use judgment; when in doubt, offer.
Squash merges on main leave local commits orphaned: same content, different SHA, so git log looks like you still need to push work that is already merged. This has repeatedly caused confusion. Always reconcile before creating the PR:
git fetch origingit log origin/main..HEAD shows only genuinely new commitsmain, inspect the content, not just the SHA — squash merges change SHAs but preserve file contentDo not skip this step. A PR opened without syncing will mislead both us and reviewers.
Bringup mode: commit to main, push, stop at the pre-clear report.
Protected mode, work complete — context clearly indicates the feature is done, or the user said so at invocation:
Protected mode, work not complete — multi-session feature in progress:
When uncertain whether work is complete, ask. Do not create a PR on a guess.
After enabling auto-merge:
If the session was run inside a git worktree, the desired end state depends on whether the work is done.
Work complete and PR merged (or about to auto-merge):
cd <root-worktree-path>git checkout main && git pullgit worktree remove <worktree-path> (use --force only after asking, e.g., if the worktree has untracked files you've already reviewed)mainWork complete, fire-and-forget auto-merge (long CI):
Work not complete (multi-session feature):
Project-specific worktree setup (e.g., symlinks, data directories) does not need special handling here — git worktree remove handles the git side, and any project-specific cleanup is the project's responsibility.
Final message back to the user before they run /clear. A short checklist:
main? preserved at <path> for continued work? cleanup deferred until CI lands?)If you made any self-updates to this skill during the session, mention them here.
Always pause and confirm before:
git reset --hard, git clean -fd, git branch -D, git push --forcegit stash drop, git rm on untracked or uncommitted filesOne authorization does not carry across operations — re-ask each time.
If during execution you notice:
This skill is served from a read-only plugin cache (~/.claude/plugins/cache/spindev-core@spinlockdevelopment/<version>/). Edits there do not persist and do not propagate. To actually apply the fix, edit the authoritative copy at plugins/spindev-core/skills/end-session/SKILL.md in a clone of spinlockdevelopment/dev-setup, commit (bringup: straight to main; protected: feature branch + PR), and push. Consumers pick it up on their next /plugin marketplace update. The idea is that this skill gets sharper every time it runs.
superpowers:finishing-a-development-branch covers a simpler 4-option flow (merge locally / push+PR / keep as-is / discard) with no docs or memory work. This skill is the superset for end-of-session wrap-up. Do not invoke both in the same run — they will fight over the PR decision.
main accumulates squash commits from feature branches.npx claudepluginhub spinlockdevelopment/dev-setup --plugin spindev-coreGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.