Create Workspace
A skill for scaffolding structured, multi-repo development workspaces optimized for
parallel work by multiple agents and human developers.
Workspace Structure
{workspace-name}/
├── workspace.yaml # manifest: repos, worktrees, deps, metadata
├── CLAUDE.md # project-wide agent context and conventions
├── .gitignore # ignores sketch/ directory
├── .claude/
│ └── settings.json # permissions for coding agents
├── repositories/
│ └── {repoName}/
│ ├── main/ # regular clone at default branch (worktree parent)
│ └── worktrees/
│ └── {worktreeName}/ # git worktree checkouts
├── docs/ # cross-repo design docs, ADRs, specs
├── deps/
│ └── {depName}/ # full clones of dependency repos
├── tasks/ # task assignments and coordination
└── sketch/ # .gitignored agent scratch space
Workflows
1. Create a New Workspace
When the user asks to create a workspace, follow these steps:
Step 1: Gather information. Ask the user for:
- Workspace name (will be the root directory name)
- A short description of the project/task
- Where to create the workspace. Offer the current working directory as the default option, and let the user specify a different path. The workspace will be created as a subdirectory at the chosen location (i.e.,
{chosen-path}/{workspace-name}/
).
- Repositories to include (and which worktrees/branches to create). Accept any of these formats:
- HTTPS URL:
https://github.com/user/repo.git
- SSH URL:
git@github.com:user/repo.git
- GitHub shorthand: or
- Dependency repositories (if any), in the same formats above.
If the user provides a
file or its contents, parse it directly instead of asking.
Resolving repository references:
When the user provides a GitHub shorthand (
) instead of a full URL:
- Try CLI first: Run
gh repo view user/repo --json url -q .url
to get the HTTPS URL. This works if the user has installed and authenticated.
- Try GitHub MCP: If CLI is not available, use the GitHub MCP or tool to verify the repository exists and get its URL.
- Fallback — web search: If neither CLI nor GitHub MCP is available, use web search to find the repository URL, then ask the user to confirm before cloning.
Once resolved, clone using the full URL. Store the resolved URL in
.
Step 2: Create the directory structure.
bash
mkdir -p {path}/{workspace-name}/{repositories,docs,deps,tasks,sketch}
Where
is the location chosen in Step 1 (defaults to the current working directory).
Step 3: Generate the workspace.yaml manifest.
Use the template from
assets/workspace.yaml.template
as a reference. The manifest should
capture all repositories, their worktrees, and dependencies. Write it to
{workspace-name}/workspace.yaml
.
Step 4: Resolve and clone repositories.
First, resolve any GitHub shorthand references to full URLs (see "Resolving repository references" above).
Then, for each repository in the manifest:
bash
# Clone the repository into the main/ directory
git clone {resolved-url} {workspace-root}/repositories/{repoName}/main
# For each worktree, create a branch and worktree
cd {workspace-root}/repositories/{repoName}/main
git worktree add ../worktrees/{worktreeName} -b {branchName}
If the branch already exists on the remote, use checkout instead of
:
bash
git worktree add ../worktrees/{worktreeName} {branchName}
Important worktree notes:
- The clone is the worktree parent. Agents should avoid switching branches in .
- Each worktree is an independent working directory with its own HEAD, index, and working tree.
- Multiple agents can work on different worktrees of the same repo simultaneously without conflicts.
Step 5: Clone dependencies.
For each dependency in the manifest:
bash
# Full clone (not shallow — deps may contain bugs or ongoing work to analyze)
git clone {url} {workspace-name}/deps/{depName}
# If a specific ref is specified, check it out
cd {workspace-name}/deps/{depName}
git checkout {ref}
Step 6: Generate the CLAUDE.md.
Use the template from
assets/CLAUDE.md.template
as a starting point. Populate it with:
- The workspace description from the manifest
- The list of repositories with their purposes
- The list of worktrees and what each is for
- The list of dependencies
- Cross-repo relationships (ask the user if not obvious)
Step 7: Create the .gitignore.
Write a
at the workspace root:
Step 8: Set up agent permissions.
Create
at the workspace root using the template from
assets/settings.json.template
. This file configures permissions so that coding agents can perform common development tasks without requiring manual approval for every command, while still blocking dangerous operations.
bash
mkdir -p {workspace-name}/.claude
Copy the template as-is. The defaults are designed to be safe for multi-repo development:
- Allow (no prompt): Read-only tools, git read ops, git worktree management, build/test/lint commands for common package managers, file exploration, version checks.
- Ask (prompt once): Git write ops (commit, push, pull, merge, rebase), package installs, docker operations.
- Deny (always blocked): , , force pushes, , reading //, secrets, SSH keys, AWS credentials, PEM/key files.
Note:
and
files are intentionally
not blocked — agents need to read these to understand the environment variable setup.
This file is generated once. Users can edit it afterwards to add project-specific rules.
Step 9: Confirm completion. Summarize what was created:
- Number of repositories cloned
- Number of worktrees created
- Number of dependencies cloned
- Location of the workspace
2. Add a Repository to an Existing Workspace
When the user asks to add a repo to an existing workspace:
- Read the existing
- Clone the repo into
repositories/{repoName}/main/
- Create any requested worktrees
- Update with the new repository entry
- Update to include the new repository
3. Add a Worktree to an Existing Repository
When the user asks to add a worktree:
- Read to find the repository
- Create the worktree:
bash
cd {workspace}/repositories/{repoName}/main
git worktree add ../worktrees/{worktreeName} -b {branchName}
- Update with the new worktree entry
4. Add a Dependency
When the user asks to add a dependency:
- Clone the dependency into
- Optionally check out a specific ref
- Update
- Update
5. Show Workspace Status
When the user asks about workspace status:
- Read
- For each repository and worktree, run and
- Report: current branches, uncommitted changes, recent commits
6. Remove a Worktree
When the user asks to remove a worktree:
- Run from the main clone
- Update
Conventions
- Never modify the clone's branch — it anchors all worktrees. Document this in CLAUDE.md.
- Worktree names should match branch names when possible for clarity. If the branch has slashes (e.g., ), use a slugified name for the worktree directory (e.g., ).
- The directory is ephemeral — agents can write anything there. It is always gitignored.
- The directory is for coordination between agents and humans. Files here describe work items, assignments, and status.
- The directory is for durable design documentation that outlives any single task.
Error Handling
- If a fails, report the error and continue with remaining repos. Mark failed repos in the output.
- If a worktree branch already exists locally, use
git worktree add ../worktrees/{name} {branch}
without .
- If a worktree directory already exists, warn the user and skip unless they confirm overwriting.
- If already exists when creating a new workspace, ask before overwriting.