nesnilnehc/ai-cortex/deliver-feature
Claude Code and agent skill by nesnilnehc/ai-cortex
- community
Checking that the SKILL.md file is still in the repository.
From inside a linked worktree, deliver the current feature branch into main — merge with --no-ff, push, and optionally clean up the worktree, all without leaving CWD.
Install
npx vskill@latest install nesnilnehc/ai-cortex/deliver-featureSKILL.md
The same SKILL.md was published earlier as nesnilnehc/ai-cortex/deliver-feature.
Skill: Deliver Feature
Purpose
Land the current feature branch onto main from inside a linked worktree, with no directory switching. The main repo is driven through git -C <main-repo>, so the user stays in the feature worktree the whole way, until they explicitly choose to leave. It cuts out the round trip of "cd to the main repo → invoke the batch tool → pick only the branch just finished → cd back".
Core Objective
Primary goal: land the current worktree's feature branch onto main (through a --no-ff merge), push it to origin, and let the user decide whether to keep or remove that worktree — without ever leaving the worktree directory.
Success criteria (all of them must hold):
- ✅ Invocation context verified: CWD is inside a linked worktree (not the main repo), and the current branch is not the main branch
- ✅ Pre-flight passed: the current worktree has no uncommitted changes (
git status --porcelainis empty) - ✅ The merge runs in the main repo, not in the worktree:
pull/merge --no-ff/pushall go throughgit -C <main-repo>; CWD stays in the worktree for the whole merge - ✅ Push succeeded: the cleanup options are offered only once
git push origin <main-branch>returns 0 - ✅ The user controls cleanup: the user explicitly picks keep or remove (with optional branch deletion,
-donly); nothing is removed implicitly - ✅ Single-branch summary: report the merge commit hash, the push status, and the cleanup outcome
Acceptance test: once the skill finishes, git -C <main-repo> log --oneline <main-branch> shows exactly one new merge commit referencing that feature branch; git -C <main-repo> ls-remote origin <main-branch> agrees with local; and where the user chose removal, git worktree list no longer holds the source worktree.
Scope Boundaries
This skill owns:
- Verifying the invocation context (inside a linked worktree, not on the main branch)
- Determining the main branch (auto-detected; the user is asked only when it cannot be determined)
- Pre-flighting the current worktree (is the working tree clean)
- Locating the main repo path via
git worktree list --porcelain - Running pull →
--no-ffmerge → push against the main repo viagit -C - Handing over to the user on a conflict or a rejected push (nothing is resolved automatically)
- Optionally removing the worktree and deleting the feature branch (on the user's confirmation,
-donly) - The single-branch summary report
This skill does not own:
- Batch operations across several worktrees (use
integrate-branchesfrom the main branch of the main repo) - Committing uncommitted changes (use
commit-workfirst) - Rebasing or squashing before the merge
- Resolving merge conflicts (on a conflict it stops and prompts the user)
- Creating or managing pull requests
- Force-pushing to any branch
Handoff points:
- → `integrate-branches`: the user is on the main branch of the main repo and wants to land several worktrees in one go
- Stop and prompt the user: invoked in the main repo (not a worktree), or from a worktree sitting on the main branch
- On a merge conflict: stop, and direct the user to resolve it by hand in the main repo; the worktree is left alone
- On a rejected push: stop, and direct the user to undo the merge in the main repo (
git -C <main-repo> reset --hard HEAD~1, say), pull, and retry by hand
Use Cases
- A developer has just finished a feature in
/repos/myapp-api(a worktree on branchfeat/api-v2) and wants to land it on main without leaving the current directory - Delivering that single branch immediately after running
commit-workinside the worktree - An IDE or editor session is pinned to one worktree directory; the user wants to deliver the feature without interrupting that session
Behavior
Workflow (checklist)
Read the delivery examples if you need a command transcript for delivery and cleanup, or a worked example of stopping in the main worktree or on a merge conflict.
Step 1 — verify the invocation context
Deciding the context: in a linked worktree, git-dir != git-common-dir (the per-worktree .git/worktrees/<name> differs from the shared .git). Equivalently, <toplevel>/.git is a plain file (a gitlink) in a linked worktree, and a directory in the main repo.
- If
git rev-parse --git-direqualsgit rev-parse --git-common-dir(that is, CWD is the main repo rather than a linked worktree) → stop:
> "This skill must run inside a linked worktree, not in the main repo. Current location: <cwd>. To batch-merge several worktrees from the main repo, use integrate-branches."
- If the current branch equals the detected main branch (Step 2) → stop:
> "The current branch is <main-branch>. This skill delivers a feature branch into main; it does not merge main into itself. Switch to the feature branch in this worktree, or use integrate-branches from the main repo."
Record <feature-worktree> (= git rev-parse --show-toplevel) and <feature-branch> (= the current branch).
Step 2 — determine the main branch and locate the main repo
- The result is unambiguous (
HEAD branch: main, say) → use it directly. - The command fails or returns nothing → check for
origin/mainingit branch -r, thenorigin/master. - Still undetermined → ask the user:
> "The main branch could not be determined automatically. Enter the main branch name (main, master, develop, and so on):"
Record <main-branch>.
Locate the main repo from the worktree list:
Parse the porcelain output. The first record is the main repo (its worktree line gives the path). Record <main-repo>. Sanity check: <main-repo> != <feature-worktree>.
Step 3 — pre-flight: the current worktree must be clean
If the output is non-empty → stop:
"The current worktree<feature-worktree>has uncommitted changes. Commit them first (withcommit-work, say) and invoke again. Nothing is stashed automatically."
Step 4 — pull main, merge the feature branch, push (all through `git -C <main-repo>`)
CWD stays at `<feature-worktree>` for every command — the git -C flag drives the main repo operations without moving the user.
On a merge conflict → stop:
"Merging<feature-branch>into<main-branch>hit a conflict (main repo<main-repo>). Resolve the conflict by hand in the main repo, finish the merge, then rungit -C <main-repo> push origin <main-branch>. The worktree is untouched."
On a rejected push (not a fast-forward) → stop:
"The push after merging<feature-branch>was rejected. In<main-repo>, rungit reset --hard HEAD~1to undo the merge, thengit pull, merge again, and push by hand."
Once the push succeeds, capture <merge-commit-hash> with git -C <main-repo> rev-parse <main-branch>.
Step 5 — ask the user about cleanup
One prompt, three options:
"Delivery complete. What do you want done with worktree<feature-worktree>and branch<feature-branch>?[1] Keep the worktree (stay here, keep the branch)[2] Remove the worktree, keep the branch (cd back to the main repo)[3] Remove the worktree and delete the branch (git branch -d, the safe delete)Choose 1 / 2 / 3:"
For options 2 and 3, the skill prints a closing hint telling the user to cd to <main-repo> (the skill cannot change the user's shell CWD; it only runs git commands).
For options 2 and 3, run through git -C:
For option 3 only, after the worktree has been removed:
-d only — never -D. If -d fails (which should not happen after a successful --no-ff merge), report the error and stop the deletion (do not retry with -D).
Step 6 — summary report
Input & Output
Input requirements
| Input | Required | Notes | |
|---|---|---|---|
| Worktree context | Yes | CWD must be inside a linked worktree; invoked in the main repo, it stops | |
| Non-main branch | Yes | The current branch must not be <main-branch>; otherwise it stops | |
| Clean working tree | Yes | git status --porcelain must be empty; nothing is stashed automatically | |
| Cleanup choice | User input | One of three: keep / remove and keep the branch / remove and delete the branch | |
| Main branch name | Auto/ask | Detected from the remote; the user is asked when it cannot be determined | |
| Network access | Yes | pull and push to origin need the network |
Output contract
Produced (as side effects):
| Element | Notes | |
|---|---|---|
| Merge commit | Exactly one --no-ff merge commit on <main-branch> in the main repo | |
| Remote push | origin/<main-branch> updated once | |
| Worktree removal | Optional, the user's choice | |
| Branch deletion | Optional, the user's choice; git branch -d only | |
| Summary report | A single-branch table with the merge commit hash, the push status, the cleanup outcome, and where applicable the follow-up cd hint |
Restrictions
Hard Boundaries
- Changing CWD is forbidden — every main-repo operation goes through
git -C <main-repo>; the user's shell stays in the worktree - Force-pushing is forbidden (
--force,--force-with-lease) to any branch - Auto-stashing uncommitted changes is forbidden — stop and prompt the user
- Using `git branch -D` is forbidden —
-donly - Removing the worktree before both the merge and the push have succeeded is forbidden
- Carrying on in the main repo, or in a worktree on the main branch, is forbidden — stop and give the matching prompt
Skill Boundaries
- Batch-merging several worktrees: use
integrate-branchesfrom the main branch of the main repo - Committing pending changes: use
commit-workbefore invoking this skill - rebase / squash: use
git rebasedirectly before invoking this skill - Creating a PR: use the platform's own PR tooling; this skill merges into main directly
- Code review: use
review-diffbefore committing; this skill performs no code review
Anti-Patterns
Invocation context
✅ Run inside a linked worktree, on a branch that is not main ❌ Do not run in the main repo — that is integrate-branches's job; run from main and there is no current worktree to deliver
CWD discipline
✅ Use git -C <main-repo> for every main-repo operation; CWD stays in the worktree ❌ Do not cd <main-repo> midway through the skill — if the user removes the worktree afterwards, they expect to be left where they invoked it, until they pick option 2/3
Pre-flight order
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/deliver-feature/SKILL.md
Popularity
- Repository stars
- 7
- Repository forks
- 3
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. 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
[](https://verified-skill.com/skills/nesnilnehc/ai-cortex/deliver-feature)