Get the FREE Ultimate OpenClaw Setup Guide →

create-clone

npx machina-cli add skill YoniChechik/claude-code-config/create-clone --openclaw
Files (1)
SKILL.md
1.8 KB

Creates a git clone for isolated feature development. Handles both new features and existing remote branches.

Feature description from user input

"$ARGUMENTS"

Feature Description Validation

  • If empty or missing: "Error: Feature description is required. Please provide a detailed description."

Process

Step 1: Parse Feature Description

  • Decide on feature name based on description
  • Convert feature name to kebab-case for branch naming

Step 2: Check for Existing Remote Branch

git fetch --prune
git branch -r | grep "$FEATURE_NAME" || true
  • If a matching remote branch exists → Existing branch mode
  • If no match → New branch mode

Step 3: Create Git Clone

ORIGINAL_REPO_DIR=$(pwd)
REPO_URL=$(git config --get remote.origin.url)
mkdir -p _clones

New branch mode:

git clone -b main "$REPO_URL" _clones/$FEATURE_NAME
cd _clones/$FEATURE_NAME
git checkout -b $FEATURE_NAME
git push -u origin $FEATURE_NAME

Existing branch mode:

git clone -b $FEATURE_NAME "$REPO_URL" _clones/$FEATURE_NAME
cd _clones/$FEATURE_NAME

Step 4: Sync with Main

Run the sync skill to commit and push.

Step 5: Symlink Environment Files

bash ~/.claude/skills/create-clone/symlink_env_files.sh "$ORIGINAL_REPO_DIR" "_clones/$FEATURE_NAME"

Step 6: Setup Environment

bash ~/.claude/skills/create-clone/setup_project_env.sh

Step 7: Notify User

Tell user:

  • The clone has been created at _clones/$FEATURE_NAME
  • The branch $FEATURE_NAME is tracking remote

Step 8: Change to Feature Directory

Change to the feature clone directory.

FROM NOW ALL NEW WORK SHOULD ONLY BE DONE IN THIS FEATURE DIR

Source

git clone https://github.com/YoniChechik/claude-code-config/blob/main/skills/create-clone/SKILL.mdView on GitHub

Overview

Creates an isolated git clone for feature development. It supports both new features and existing remote branches by cloning into _clones/FEATURE_NAME, deriving a kebab-case branch name from the description, and configuring tracking and environment setup.

How This Skill Works

The skill parses the feature description to derive a kebab-case feature name, then checks for a matching remote branch. It clones into _clones/FEATURE_NAME, selecting New branch mode or Existing branch mode based on remote branch presence, and creates or checks out the feature branch with proper upstream tracking. Finally it runs a sync with main, symlinks environment files, sets up the project environment, notifies the user, and switches into the feature directory.

When to Use It

  • Starting a new feature that should be isolated from main development
  • Working on an existing remote feature branch
  • Creating a per feature environment to test changes without touching main
  • Collaborating with teammates using a separate feature clone for reviews
  • When you want a clean switch between features without impacting the main repo

Quick Start

  1. Step 1: Parse the feature description to derive a kebab-case feature name
  2. Step 2: Run git fetch --prune and check for a remote branch named FEATURE_NAME to choose New vs Existing mode
  3. Step 3: Clone into _clones/FEATURE_NAME and set up the feature directory, creating or checking out the branch as needed

Best Practices

  • Ensure the feature description is descriptive to derive a meaningful kebab-case name
  • Always run git fetch --prune before checking remote branches
  • Store all work in _clones/FEATURE_NAME to keep features isolated
  • Sync with main before heavy work to minimize merge conflicts
  • Verify the feature branch tracks remote after setup and you are in the feature directory

Example Use Cases

  • Feature: add-login-flow clones to _clones/add-login-flow and creates branch add-login-flow
  • Feature: refactor-dashboard-navigation clones to _clones/refactor-dashboard-navigation and creates branch refactor-dashboard-navigation
  • Feature: improve-cache-mechanism clones to _clones/improve-cache-mechanism
  • Feature: fix-search-bug clones to _clones/fix-search-bug and tracks remote
  • Feature: integrate-notifications-webhook clones to _clones/integrate-notifications-webhook

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers