nesnilnehc/ai-cortex/deliver-feature

Claude Code and agent skill by nesnilnehc/ai-cortex

Trust tier 3
  • community
Source check pending

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-feature

SKILL.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):

  1. ✅ Invocation context verified: CWD is inside a linked worktree (not the main repo), and the current branch is not the main branch
  2. ✅ Pre-flight passed: the current worktree has no uncommitted changes (git status --porcelain is empty)
  3. ✅ The merge runs in the main repo, not in the worktree: pull / merge --no-ff / push all go through git -C <main-repo>; CWD stays in the worktree for the whole merge
  4. ✅ Push succeeded: the cleanup options are offered only once git push origin <main-branch> returns 0
  5. ✅ The user controls cleanup: the user explicitly picks keep or remove (with optional branch deletion, -d only); nothing is removed implicitly
  6. ✅ 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-ff merge → push against the main repo via git -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, -d only)
  • The single-branch summary report

This skill does not own:

  • Batch operations across several worktrees (use integrate-branches from the main branch of the main repo)
  • Committing uncommitted changes (use commit-work first)
  • 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 branch feat/api-v2) and wants to land it on main without leaving the current directory
  • Delivering that single branch immediately after running commit-work inside 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

bash
git rev-parse --git-dir # main repo: <root>/.git ; linked worktree: <main-root>/.git/worktrees/<name>
git rev-parse --git-common-dir # same value in both contexts: <main-root>/.git
git rev-parse --abbrev-ref HEAD # current branch
git rev-parse --show-toplevel # current worktree root (the repo root CWD sits in)

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-dir equals git 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

bash
git remote show origin | grep 'HEAD branch'
  • The result is unambiguous (HEAD branch: main, say) → use it directly.
  • The command fails or returns nothing → check for origin/main in git branch -r, then origin/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:

bash
git worktree list --porcelain

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

bash
git status --porcelain

If the output is non-empty → stop:

"The current worktree <feature-worktree> has uncommitted changes. Commit them first (with commit-work, say) and invoke again. Nothing is stashed automatically."

Step 4 — pull main, merge the feature branch, push (all through `git -C <main-repo>`)

bash
git -C <main-repo> checkout <main-branch>
git -C <main-repo> pull origin <main-branch>
git -C <main-repo> merge --no-ff <feature-branch> -m "Merge branch '<feature-branch>' into <main-branch>"
git -C <main-repo> push origin <main-branch>

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 run git -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>, run git reset --hard HEAD~1 to undo the merge, then git 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:

bash
git -C <main-repo> worktree remove <feature-worktree>

For option 3 only, after the worktree has been removed:

bash
git -C <main-repo> branch -d <feature-branch>

-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

yaml
deliver-feature summary
──────────────────────────────────────────────────────────────────────────
Feature branch: feat/api-v2
Worktree: /repos/myapp-api
Main repo: /repos/myapp
Main branch: main
Merge commit: a1b2c3d (--no-ff)
Push: ✓
Worktree: removed | kept
Branch: deleted | kept
──────────────────────────────────────────────────────────────────────────
Next: cd /repos/myapp (shown only when the worktree was removed)

Input & Output

Input requirements
InputRequiredNotes
Worktree contextYesCWD must be inside a linked worktree; invoked in the main repo, it stops
Non-main branchYesThe current branch must not be <main-branch>; otherwise it stops
Clean working treeYesgit status --porcelain must be empty; nothing is stashed automatically
Cleanup choiceUser inputOne of three: keep / remove and keep the branch / remove and delete the branch
Main branch nameAuto/askDetected from the remote; the user is asked when it cannot be determined
Network accessYespull and push to origin need the network
Output contract

Produced (as side effects):

ElementNotes
Merge commitExactly one --no-ff merge commit on <main-branch> in the main repo
Remote pushorigin/<main-branch> updated once
Worktree removalOptional, the user's choice
Branch deletionOptional, the user's choice; git branch -d only
Summary reportA 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 — -d only
  • 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-branches from the main branch of the main repo
  • Committing pending changes: use commit-work before invoking this skill
  • rebase / squash: use git rebase directly before invoking this skill
  • Creating a PR: use the platform's own PR tooling; this skill merges into main directly
  • Code review: use review-diff before 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/nesnilnehc/ai-cortex/deliver-feature/badge)](https://verified-skill.com/skills/nesnilnehc/ai-cortex/deliver-feature)

Something wrong with this skill or its page? Tell us.