Git workflow automation for Rails projects with intelligent commit grouping and worktree management

version
1.5.1
GitHub stars
39

Install

/plugin install git-workflows@claude-code-in-avinyc

Run it inside Claude Code after adding the marketplace with /plugin marketplace add aviflombaum/claude-code-in-avinyc.

Contents

Discovered from source

Skills 2

Git Commit Assistant

Analyze git changes and create logical, well-structured commits using conventional commit format.

When to Use

  • User asks to commit changes
  • Multiple unrelated changes need separate commits
  • Changes need conventional commit formatting

Workflow

Step 1: Review Current State

Run git status to see all changes:

git status

Review both staged and unstaged changes. Identify modified, added, and deleted files.

Step 2: Analyze and Plan Commits

Group changes into logical commits based on:

  • Feature boundaries: Files that implement the same feature together
  • Type of change: Separate fixes from features from refactors
  • Scope: Group by component, module, or area of the codebase

Present the commit plan to the user before proceeding:

I see the following logical commits:
1. feat(auth): Add password reset - auth/reset.rb, auth/mailer.rb
2. fix(api): Handle null responses - api/client.rb
3. docs: Update README - README.md

Step 3: Execute Commits One by One

For each planned commit:

Stage specific files only:

git add <file1> <file2>

Verify staging:

git status

Create commit with conventional format:

git commit -m "<type>[scope]: <description>" -m "<body>"

Verify commit succeeded:

git status

Only proceed to the next commit after verifying the current one completed.

Conventional Commit Types

TypeDescription
featNew feature
fixBug fix
docsDocumentation only
styleFormatting, no code change
refactorCode change, no new feature or fix
perfPerformance improvement
testAdding or fixing tests
choreBuild process, auxiliary tools

Commit Message Format

<type>[optional scope]: <description>

[optional body]

[optional footer]
  • Description: Imperative mood, lowercase, no period ("add feature" not "Added feature.")
  • Body: Explain what and why, not how
  • Scope: Component or area affected (auth, api, db, ui)

Rules

  1. Never mix unrelated changes in a single commit
  2. Always verify staging before committing
  3. Always verify success after committing
  4. Explain the plan before executing
  5. Never use git add . or git add -A without explicit approval
  6. Never include "Generated with Claude Code" or Co-Authored-By footers

Example Session

$ git status
# Modified: auth/login.rb, auth/signup.rb, README.md, api/client.rb

Plan:
1. feat(auth): Improve login validation - auth/login.rb, auth/signup.rb
2. fix(api): Handle timeout errors - api/client.rb
3. docs: Add authentication guide - README.md

Executing commit 1...
$ git add auth/login.rb auth/signup.rb
$ git status  # verify only auth files staged
$ git commit -m "feat(auth): improve login validation" -m "Add email format check and rate limiting"
$ git status  # verify commit succeeded

Executing commit 2...
[continues...]

Git Worktree for Rails

Create isolated git worktrees for feature development with automatic Rails credential symlinking.

When to Use

  • Starting work on a new feature that needs isolation
  • Working on multiple features simultaneously
  • Need a clean environment without stashing changes

Worktree Location

Worktrees are created in a sibling directory to keep the project root clean:

parent/
  project/              # main repo
  project-worktrees/    # worktree container
    25-01-22-feature/   # individual worktree

The container directory is ../<project-name>-worktrees/ relative to the project root.

Branch Naming Convention

Format: YY-MM-DD-feature-description

Examples:

  • 25-01-22-add-password-reset
  • 25-01-22-fix-api-timeout
  • 25-01-22-refactor-auth-module

Workflow

Step 1: Get Feature Name

If no feature name provided, ask:

What feature are you working on? (e.g., "add password reset", "fix checkout bug")

Step 2: Create Worktree

# Get project info
PROJECT_ROOT=$(pwd)
PROJECT_NAME=$(basename "$PROJECT_ROOT")
WORKTREES_DIR="../${PROJECT_NAME}-worktrees"

# Format branch name: YY-MM-DD-feature-description
DATE=$(date +%y-%m-%d)
BRANCH_NAME="${DATE}-<feature-slug>"

# Create worktrees directory if needed
mkdir -p "$WORKTREES_DIR"

# Create worktree with new branch
git worktree add "$WORKTREES_DIR/$BRANCH_NAME" -b "$BRANCH_NAME"

Step 3: Symlink Rails Credentials

Rails credentials must be symlinked so the worktree can decrypt secrets:

WORKTREE_PATH="$WORKTREES_DIR/$BRANCH_NAME"

# master.key
ln -sf "$PROJECT_ROOT/config/master.key" "$WORKTREE_PATH/config/master.key"

# development.key (if exists)
if [ -f "$PROJECT_ROOT/config/credentials/development.key" ]; then
  mkdir -p "$WORKTREE_PATH/config/credentials"
  ln -sf "$PROJECT_ROOT/config/credentials/development.key" "$WORKTREE_PATH/config/credentials/development.key"
fi

# test.key (if exists)
if [ -f "$PROJECT_ROOT/config/credentials/test.key" ]; then
  mkdir -p "$WORKTREE_PATH/config/credentials"
  ln -sf "$PROJECT_ROOT/config/credentials/test.key" "$WORKTREE_PATH/config/credentials/test.key"
fi

Use full absolute paths for symlinks.

Step 4: Report Success

Worktree created:
  Branch: 25-01-22-add-password-reset
  Location: ../project-worktrees/25-01-22-add-password-reset

Rails credentials symlinked:
  - config/master.key
  - config/credentials/development.key
  - config/credentials/test.key

To start working:
  cd ../project-worktrees/25-01-22-add-password-reset

Managing Worktrees

List worktrees:

git worktree list

Remove worktree:

git worktree remove ../project-worktrees/25-01-22-feature-name

Prune stale worktrees:

git worktree prune

Example Session

User: create a worktree for adding stripe webhooks

Creating worktree...
  Project: vc-matcher-app
  Feature: adding stripe webhooks
  Branch: 25-01-22-add-stripe-webhooks

$ mkdir -p ../vc-matcher-app-worktrees
$ git worktree add ../vc-matcher-app-worktrees/25-01-22-add-stripe-webhooks -b 25-01-22-add-stripe-webhooks

Symlinking Rails credentials...
$ ln -sf /Users/avi/Development/code/project/config/master.key ../vc-matcher-app-worktrees/25-01-22-add-stripe-webhooks/config/master.key
[additional symlinks...]

Done! Worktree ready at:
  ../vc-matcher-app-worktrees/25-01-22-add-stripe-webhooks

Notes

  • Always use absolute paths for credential symlinks
  • The worktree shares git history with main repo
  • Commits in worktree are visible from main repo
  • Delete the branch separately after removing worktree if needed
  • Run bundle install in new worktree if Gemfile differs

Commands 2

Invoke the git-workflows:commit skill for: $ARGUMENTS

Invoke the git-workflows:worktree skill for: $ARGUMENTS

Sponsors

Details

Marketplace
aviflombaum/claude-code-in-avinyc
Source
plugins/git-workflows
Author
Avi Flombaum
Category
Community
License
MIT

More from aviflombaum/claude-code-in-avinyc

All 9