Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .claude-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# agent-cli-dev Plugin for Claude Code

This plugin teaches Claude Code how to spawn parallel AI coding agents in isolated git worktrees using `agent-cli dev`.

## What It Does

The plugin provides a skill that enables Claude Code to:

- Create isolated git worktrees for parallel development
- Spawn AI coding agents (Claude, Codex, Gemini, Aider) in separate terminal tabs
- Manage multiple features/tasks simultaneously without branch conflicts
- Automatically set up project dependencies in new worktrees

## Installation

### Install agent-cli

```bash
# Using uv (recommended)
uv tool install agent-cli

# Or run directly without installing
uvx agent-cli dev new my-feature --agent --prompt "..."
```

### Install the Claude Code plugin

```bash
# From the marketplace
claude plugin marketplace add basnijholt/agent-cli

# Then install
claude plugin install agent-cli@agent-cli-dev
```

## Usage

Once installed, Claude Code can automatically use this skill when you ask to:

- "Work on multiple features in parallel"
- "Spawn agents for auth, payments, and notifications"
- "Create a worktree for this bug fix"
- "Delegate this task to a separate agent"

## Key Commands

```bash
# Create worktree with AI agent
agent-cli dev new my-feature --agent --prompt "Implement the login page"

# Use prompt file for longer tasks
agent-cli dev new my-feature --agent --prompt-file task.md

# Check status of all worktrees
agent-cli dev status

# Clean up merged worktrees
agent-cli dev clean --merged
```

## Documentation

Full documentation: [docs/commands/dev.md](https://github.com/basnijholt/agent-cli/blob/main/docs/commands/dev.md)
8 changes: 8 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"source": "./.claude-plugin",
"repository": "https://github.com/basnijholt/agent-cli",
"homepage": "https://github.com/basnijholt/agent-cli",
"documentation": "https://github.com/basnijholt/agent-cli/blob/main/docs/commands/dev.md",
"keywords": ["git", "worktree", "parallel", "agents", "development", "claude", "ai"],
"license": "MIT"
}
7 changes: 7 additions & 0 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "agent-cli-dev",
"version": "1.0.0",
"author": "basnijholt",
"description": "Spawn parallel AI coding agents in isolated git worktrees. Creates isolated development environments with automatic project setup, letting you work on multiple features simultaneously with different AI agents (Claude, Codex, Gemini, Aider).",
"skills": ["./skills/agent-cli-dev"]
}
136 changes: 136 additions & 0 deletions .claude-plugin/skills/agent-cli-dev/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
name: agent-cli-dev
description: Spawns AI coding agents in isolated git worktrees. Use when the user asks to spawn or launch an agent, delegate a task to a separate agent, work in a separate worktree, or parallelize development across features.
---

# Parallel Development with agent-cli dev

This skill teaches you how to spawn parallel AI coding agents in isolated git worktrees using the `agent-cli dev` command.

## Installation

If `agent-cli` is not available, install it first:

```bash
# Install globally
uv tool install agent-cli

# Or run directly without installing
uvx agent-cli dev new <branch-name> --agent --prompt "..."
```

## When to spawn parallel agents

Spawn separate agents when:
- Multiple independent features/tasks can be worked on in parallel
- Tasks benefit from isolation (separate branches, no conflicts)
- Large refactoring that can be split by module/component
- Test-driven development (one agent for tests, one for implementation)

Do NOT spawn when:
- Tasks are small and sequential
- Tasks have tight dependencies requiring constant coordination
- The overhead of context switching exceeds the benefit

## Core command

For short prompts:
```bash
agent-cli dev new <branch-name> --agent --prompt "Fix the login bug"
```

For longer prompts (recommended for multi-line or complex instructions):
```bash
agent-cli dev new <branch-name> --agent --prompt-file path/to/prompt.md
```

This creates:
1. A new git worktree with its own branch
2. Runs project setup (installs dependencies)
3. Saves your prompt to `.claude/TASK.md` in the worktree (for reference)
4. Opens a new terminal tab with an AI coding agent
5. Passes your prompt to the agent

**Important**: Use `--prompt-file` for prompts longer than a single line. The `--prompt` option passes text through the shell, which can cause issues with special characters (exclamation marks, dollar signs, backticks, quotes) in ZSH and other shells. Using `--prompt-file` avoids all shell quoting issues.

## Writing effective prompts for spawned agents

Spawned agents work in isolation, so prompts must be **self-contained**. Include:

1. **Clear task description**: What to implement/fix/refactor
2. **Relevant context**: File locations, patterns to follow, constraints
3. **Report request**: Ask the agent to write conclusions to `.claude/REPORT.md`

### Using --prompt-file (recommended)

For any prompt longer than a single sentence:

1. Write the prompt to a temporary file (e.g., `.claude/spawn-prompt.md`)
2. Use `--prompt-file` to pass it to the agent
3. The file can be deleted after spawning

Example workflow:
```bash
# 1. Write prompt to file (Claude does this with the Write tool)
# 2. Spawn agent with the file
agent-cli dev new my-feature --agent --prompt-file .claude/spawn-prompt.md
# 3. Optionally clean up
rm .claude/spawn-prompt.md
```

### Prompt template

```
<Task description>

Context:
- <Key file locations>
- <Patterns to follow>
- <Constraints or requirements>

When complete, write a summary to .claude/REPORT.md including:
- What you implemented/changed
- Key decisions you made
- Any questions or concerns for review
```

## Checking spawned agent results

After spawning, you can check progress:

```bash
# List all worktrees and their status
agent-cli dev status

# Read an agent's report
agent-cli dev run <branch-name> cat .claude/REPORT.md

# Open the worktree in your editor
agent-cli dev editor <branch-name>
```

## Example: Multi-feature implementation

If asked to implement auth, payments, and notifications:

```bash
# Spawn three parallel agents
agent-cli dev new auth-feature --agent --prompt "Implement JWT authentication..."
agent-cli dev new payment-integration --agent --prompt "Add Stripe payment processing..."
agent-cli dev new email-notifications --agent --prompt "Implement email notification system..."
```

Each agent works independently in its own branch. Results can be reviewed and merged separately.

## Key options

| Option | Description |
|--------|-------------|
| `--agent` / `-a` | Start AI coding agent after creation |
| `--prompt` / `-p` | Initial prompt for the agent (short prompts only) |
| `--prompt-file` / `-P` | Read prompt from file (recommended for longer prompts) |
| `--from` / `-f` | Base branch (default: origin/main) |
| `--with-agent` | Specific agent: claude, aider, codex, gemini |
| `--agent-args` | Extra arguments for the agent |

@examples.md
Loading