# Docs branch off feature branch smuggles code

> Docs branch off feature branch smuggles code is an open-source agent skill for developer tools. Catches docs PRs that accidentally carry a parent feature branch's code. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code
- **Repository:** https://github.com/wan-huiyan/agent-traffic-control
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** docs-branch-off-feature-branch-smuggles-code
- **Collection:** https://github.com/wan-huiyan/agent-traffic-control
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill guards against a git mistake that happens when a documentation follow-up branch is cut from a feature branch instead of origin/main. The docs pull request then quietly includes the feature's source, Dockerfile and tests under a docs title. The skill describes three situations where this happens and how each differs, including a case where a peer hands over a branch name and head SHA without describing the commits beneath it.

The workflow gives the agent a pre-merge diagnostic: list changed files outside the docs folder, compare the commit range against origin/main, and check the merge-base. It then walks through recovery, either rebasing the docs commits onto origin/main with --force-with-lease or, when the feature is already merged, recreating a clean branch and copying only the docs files across. It also lists prevention habits such as creating branches with an explicit origin/main base or using a dedicated worktree.

The skill is written as a markdown guide with shell commands and relies on git and the GitHub CLI (gh). It contains no scripts of its own and expects a repository with an origin remote and access to open and close pull requests.

## When your agent uses it

> Catch the bug class where a "docs follow-up" PR silently ships the parent feature's code under a `docs(sN):` title because the docs branch was created from the current working branch (a feature branch), not from `origin/main`. Use when: (1) you just opened a PR titled `docs(...)` or `chore(...)` after wrapping up a feature session, (2) `gh pr diff <N> --name-only` shows files OUTSIDE `docs/` (source code, Dockerfile, tests, generated artefacts), (3) `git log origin/main..HEAD` shows TWO+ commits where you only authored one or two docs commits, (4) the surprise commit author/message is from your own earlier feature work on the parent branch, (5) the PR body claims "docs-only" but the actual diff carries code. Trigger surface: end-of-session handoff workflows that `git checkout -b docs/sN-handoff` from inside a feature worktree that's still on `feat/sN-feature`. Squash-merging such a PR auto-promotes the feature code under a "docs" title — bypassing the planned merge-and-deploy gate for the feature PR, and sile

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code)
- [License: MIT](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code)

## Features

- **Pre-merge diff check:** Shell commands that list changed files outside docs/ and compare the branch range against origin/main before merging.
- **Rebase recovery steps:** A git rebase --onto procedure that drops smuggled feature commits from a docs branch and force-pushes safely.
- **Clean branch alternative:** A path for when the feature is already merged: close the conflicting PR and copy only the docs files onto a fresh branch.
- **Branch base prevention:** Habits such as explicit origin/main base and dedicated docs worktrees that prevent the wrong base at creation time.
- **Peer-branch caution:** Guidance to verify a briefed branch's commits before opening a PR for stacked work someone else created.

## Good for

- Check whether a docs PR contains code files before squash-merging it
- Rebase a handoff docs branch so it only carries the docs commits
- Recreate a clean docs branch after the feature PR has already merged
- Set up a worktree from origin/main for writing session documentation

## Install

### Claude Code

This skill ships in the `agent-traffic-control` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-control
```

Or copy only this skill to `~/.claude/skills/docs-branch-off-feature-branch-smuggles-code`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/docs-branch-off-feature-branch-smuggles-code &&
cp -R "$tmp/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code" ~/.claude/skills/docs-branch-off-feature-branch-smuggles-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/docs-branch-off-feature-branch-smuggles-code` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/docs-branch-off-feature-branch-smuggles-code` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/docs-branch-off-feature-branch-smuggles-code &&
cp -R "$tmp/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code" ~/.agents/skills/docs-branch-off-feature-branch-smuggles-code &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/docs-branch-off-feature-branch-smuggles-code` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/docs-branch-off-feature-branch-smuggles-code` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/docs-branch-off-feature-branch-smuggles-code &&
cp -R "$tmp/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code" ~/.cursor/skills/docs-branch-off-feature-branch-smuggles-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/docs-branch-off-feature-branch-smuggles-code` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code
```

Or copy the folder to `~/.gemini/skills/docs-branch-off-feature-branch-smuggles-code` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/docs-branch-off-feature-branch-smuggles-code`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/docs-branch-off-feature-branch-smuggles-code &&
cp -R "$tmp/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code" ~/.copilot/skills/docs-branch-off-feature-branch-smuggles-code &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/docs-branch-off-feature-branch-smuggles-code` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git
```

Then copy `agent-traffic-control/plugins/agent-traffic-control/skills/docs-branch-off-feature-branch-smuggles-code` into your agent's skills folder as `docs-branch-off-feature-branch-smuggles-code`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Docs branch off feature branch smuggles code trigger?

It is meant for cases where a docs(...) or chore(...) PR is opened after a feature session and the diff shows files outside docs/, or the commit range includes more commits than the docs author wrote.

### What does the recovery change in the repository?

The rebase variant rewrites the docs branch onto origin/main and force-pushes it with --force-with-lease. The clean-branch variant closes the conflicting PR and opens a new one from a fresh branch.

### Does Docs branch off feature branch smuggles code need any tools installed?

The commands use git and the GitHub CLI (gh). The skill itself has no scripts or bundled files.

### How do I install Docs branch off feature branch smuggles code in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/docs-branch-off-feature-branch-smuggles-code to use it in all your projects, or to .claude/skills/docs-branch-off-feature-branch-smuggles-code in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.

### Does Docs branch off feature branch smuggles code run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Docs branch off feature branch smuggles code?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Docs branch off feature branch smuggles code?

The closest alternatives to Docs branch off feature branch smuggles code are Git merge, Make PR easy to review, Git workflow, Check a stale branch is not undoing newer main work and Merge PR.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Git merge](https://ai-powered.com/skills/git-merge): Git merge is an open-source agent skill for developer tools.
- [Make PR easy to review](https://ai-powered.com/skills/make-pr-easy-to-review): Make PR easy to review is an open-source agent skill for developer tools.
- [Git workflow](https://ai-powered.com/skills/git-workflow-aws-solutions): Git workflow is an open-source agent skill for developer tools.
- [Check a stale branch is not undoing newer main work](https://ai-powered.com/skills/check-a-stale-branch-is-not-undoing-newer-main-work): Check a stale branch is not undoing newer main work is an open-source agent skill for developer tools.
- [Merge PR](https://ai-powered.com/skills/merge-pr): Merge PR is an open-source agent skill for developer tools.
- [Gh PR merge worktree checkout trap](https://ai-powered.com/skills/gh-pr-merge-worktree-checkout-trap): Gh PR merge worktree checkout trap is an open-source agent skill for developer tools.
- [Git post merge cleanup](https://ai-powered.com/skills/git-post-merge-cleanup): Git post merge cleanup is an open-source agent skill for developer tools.
- [Gha PR merge ref shows upstream changes](https://ai-powered.com/skills/gha-pr-merge-ref-shows-upstream-changes): Gha PR merge ref shows upstream changes is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/docs-branch-off-feature-branch-smuggles-code
