agentleFS
5hirish5hirish/duct/.agents/skills/feature/SKILL.md

feature

Skill8 starsChanged 7 days agoMITView on GitHub

Start a new branch safely from main. Handles uncommitted changes, stashing, unfinished merges, and branch naming conventions automatically.

  • Deletes or force-pushes

71 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use bug, bugfix and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • paulocsbSkill

    bug

    Investigation playbook for fixing a bug. Walks through 5 phases: reproduce → isolate → root cause → propose fix → validate. Forces concrete reasoning with code reads, log inspection, and git blame instead of pattern-matching guesses. Use for any non-trivial defect.

    Also in 8 projects that use this

  • team-attentionSkill

    bugfix

    Root cause based one-shot bug fix. debugger diagnosis → requirements.md generation → /execute. /bugfix "error description" Full investigation pipeline: debugger + gap-analyzer + standard verify. QA suggestion after successful fix.

    Also in 7 projects that use this

  • codebycoreySkill

    adopt

    Adopt an existing plan from conversation context into delta-spec format. Use when importing a plan, adopting planning that already happened, capturing plan mode output, or bringing in prior design work.

    Also in 4 projects that use this

  • Google CloudSkill

    fix

    Plan a remediation strategy after a test failure.

    Also in 10 projects that use this

  • marylinSkill

    recover

    Recover work from a crashed or interrupted session. Use when Claude crashed mid-task, after an unexpected exit, when you see 'stale sessions detected', or when you lost context and need to figure out what was happening.

    Also in 3 projects that use this

  • aegiswizardSkill

    context

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 65 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If no argument was provided, ask the user:

    line 14
  2. Distinctive:

    Run these commands to understand current state:

    line 19
  3. Distinctive:

    Remove special characters (keep letters, numbers, hyphens)

    line 72
  4. Distinctive:

    If branch has unpushed commits: Do NOT offer to delete.

    line 111
  5. Very specific:

    If branch is fully pushed (or remote doesn't exist): Ask user "You're currently on {previous-branch}.

    line 112
  6. Very specific:

    If deleted: "Created {prefix}/{branch-name} from latest main.

    line 127
  7. Very specific:

    If preserved (unpushed): "Created {prefix}/{branch-name} from latest main.

    line 128
  8. Very specific:

    If preserved (user choice): "Created {prefix}/{branch-name} from latest main.

    line 129
  9. Distinctive:

    If changes were stashed in Step 3:

    line 143
  10. Distinctive:

    If stash pop fails due to conflicts:

    line 149

“Common” is measured: kept by at least 6 in 10 of the 65 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Start New Branch

Safely creates a new branch from main, handling all edge cases automatically. Uses proper branch naming conventions based on the type of work.

Step 1: Get Work Description

If no argument was provided, ask the user:

  • "What are you working on? (e.g., 'add user authentication', 'fix login bug', 'update docs')"

Step 2: Check Git State

Run these commands to understand current state:

git status
git branch --show-current
git fetch origin main
git rev-list --count origin/main..HEAD 2>/dev/null || echo "0"

Check for:

  1. Unfinished merge: Look for "You have unmerged paths" or check if .git/MERGE_HEAD exists
  2. Unfinished rebase: Check if .git/rebase-merge or .git/rebase-apply exists
  3. Uncommitted changes: Look for "Changes not staged" or "Changes to be committed"
  4. Current branch name
  5. Commits ahead of origin/main (the count from rev-list)

Step 3: Handle Edge Cases (All Automatic)

If unfinished merge detected:

git merge --abort

Tell user: "Aborted unfinished merge to start fresh."

If unfinished rebase detected:

git rebase --abort

Tell user: "Aborted unfinished rebase to start fresh."

If uncommitted changes exist:

git stash push -m "WIP: before {prefix}/{branch-name}"

Remember to restore these at the end. Tell user: "Stashed your uncommitted changes."

Step 4: Determine Branch Type and Generate Name

First, determine the branch type based on keywords in the description:

KeywordsBranch Prefix
fix, bug, issue, error, broken, crash, patchbugfix/
hotfix, urgent, critical, emergencyhotfix/
docs, documentation, readme, commentdocs/
refactor, cleanup, restructure, reorganizerefactor/
test, testing, spec, coveragetest/
chore, config, ci, build, dependency, depschore/
(default - new functionality)feat/

Then convert the description to a branch name:

  • Lowercase everything
  • Replace spaces with hyphens
  • Remove special characters (keep letters, numbers, hyphens)
  • Apply the appropriate prefix

Examples:

  • "add user authentication" → feat/add-user-authentication
  • "fix the login bug" → bugfix/fix-the-login-bug
  • "hotfix payment crash" → hotfix/payment-crash
  • "update API docs" → docs/update-api-docs
  • "refactor database layer" → refactor/database-layer
  • "add unit tests for auth" → test/add-unit-tests-for-auth
  • "update CI pipeline" → chore/update-ci-pipeline

Step 5: Create Branch Based on Situation

Situation A: On main with commits ahead of origin/main

This means user accidentally committed to main. Move those commits to the new branch:

# Create branch from current HEAD (keeps the commits)
git checkout -b {prefix}/{branch-name}

# Now reset main back to origin/main so it's clean
git checkout main
git reset --hard origin/main

# Switch back to the feature branch
git checkout {prefix}/{branch-name}

Tell user: "Moved your commits from main to {prefix}/{branch-name}. Main is now clean."

Situation B: On a different branch (not main)

First, check if the previous branch has unpushed commits:

git log origin/{previous-branch}..HEAD --oneline 2>/dev/null | wc -l
  • If branch has unpushed commits: Do NOT offer to delete. Inform user the branch is preserved.
  • If branch is fully pushed (or remote doesn't exist): Ask user "You're currently on {previous-branch}. Do you want to delete this branch after switching? (y/n)"
# Switch to main and pull latest
git checkout main
git pull origin main

# Create the new branch
git checkout -b {prefix}/{branch-name}

# If user chose to delete AND branch had no unpushed commits
git branch -D {previous-branch}

Tell user:

  • If deleted: "Created {prefix}/{branch-name} from latest main. Deleted {previous-branch}."
  • If preserved (unpushed): "Created {prefix}/{branch-name} from latest main. Preserved {previous-branch} (has unpushed commits)."
  • If preserved (user choice): "Created {prefix}/{branch-name} from latest main. (You were on {previous-branch})."

Situation C: On main, clean and up-to-date

git checkout main
git pull origin main
git checkout -b {prefix}/{branch-name}

Tell user: "Created {prefix}/{branch-name} from latest main."

Step 6: Restore Stashed Changes

If changes were stashed in Step 3:

git stash pop

Tell user: "Restored your uncommitted changes."

If stash pop fails due to conflicts:

git stash show -p

Tell user: "Your stashed changes had conflicts. Run git stash show -p to see them, then git stash drop after manually applying."

Step 7: Confirm Success

Run and display:

git status
git log --oneline -3

Summary for user:

  • Created branch {prefix}/{branch-name}
  • [If applicable] Moved commits from main
  • [If applicable] Restored uncommitted changes
  • [If applicable] Aborted unfinished merge/rebase
  • Ready to start working!

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.