updated 7d ago
You are helping a developer bootstrap a multi-repo development workspace from a domain (a bundled or external config of repos + context). This skill picks a location for the workspace, clones repos, distributes context files, and generates the workspace's root CLAUDE.md.
What can you do with Setup Environment?
name: setup-environment description: Set up or refresh a workspace — multi-repo from a domain (pick a location, clone repos, distribute context) or a single-repo self-workspace wrapping the current checkout argument-hint: "[]"
Set Up Workspace Environment
You are helping a developer bootstrap a multi-repo development workspace from a domain (a bundled or external config of repos + context). This skill picks a location for the workspace, clones repos, distributes context files, and generates the workspace's root CLAUDE.md.
Two modes exist. Multi-repo (domain): a user-chosen directory gets
dev-env.yaml, cloned repos under repos/, and distributed context.
Single-repo (self): the workspace root IS an existing repo checkout —
no domain, no cloning, and the plugin's only footprint is dev-env.yaml,
projects/, and .claude/settings.local.json. Step 0 picks the mode.
The plugin ships read-only at ${CLAUDE_PLUGIN_ROOT}. The workspace is a
separate, user-chosen directory. All setup.sh calls therefore pass
--workspace "$WS" explicitly — do not rely on the current directory, which
during this skill is the launch dir, not the chosen workspace.
To build a fully custom workspace from arbitrary repos (no bundled domain),
use /workspace:create-domain instead.
Step 0: Choose the Mode
If $ARGUMENTS is a git URL, skip this question — that is an external
domain (multi-repo path); go to Step 0a.
Check whether the launch directory is inside a git repository:
git rev-parse --show-toplevel 2>/dev/null
- If it is, and that repo root has no
dev-env.yamlyet, ask via AskUserQuestion:- "Wrap this repo (
<basename of repo root>) as a single-repo workspace" — set$WS= the repo root and jump to the Self-Repo Path. - "Multi-repo workspace from a domain" — continue with Step 0a.
- "Wrap this repo (
- If it is not a git repo (or the repo root already has a
dev-env.yaml), continue with Step 0a.
Step 0a: Choose the Workspace Location (multi-repo path)
Decide where the workspace will live and store it as $WS.
-
If
$ARGUMENTScontains an existing workspace path, use it. -
Otherwise, use AskUserQuestion to offer sensible locations, e.g.:
~/Workspace/<name>(Recommended)~/dev/<name>- the current directory
- Other (free-text path)
Ask the user for the workspace folder name if needed. Expand
~to the home directory.
Create it: mkdir -p "$WS" via Bash. (setup.sh init also creates a fresh
workspace, but creating it now lets later steps operate on a known path.)
If $ARGUMENTS is a git URL (starts with https://, git@, ssh://,
git://, or ends with .git): treat it as an external domain source and
skip Step 1 — use the URL directly in Step 2.
Step 0.5: Check for an Existing Domain (refresh path)
Check if $WS/dev-env.yaml already exists and contains a domain: block.
If it exists and contains a top-level self: block instead, this is a
single-repo self-workspace — tell the user it is already set up (there is
no domain to refresh; dev-env.yaml is edited directly) and stop.
If it does, read the source field and offer via AskUserQuestion:
- "Re-initialize (keep current domain)" — refresh from the recorded
source (run
refresh-domainin Step 2) - "Choose a different domain" — continue to Step 1
If $WS/dev-env.yaml does not exist, skip this step.
Step 1: Select Domain
If $ARGUMENTS is a git URL, skip this — use that URL as the domain
source and go to Step 2.
Otherwise, list available domains by running:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" --workspace "$WS" init
This prints bundled and workspace domains (each tagged with its source), each with a name and description. Present them via AskUserQuestion:
- One option per listed domain (name + description)
- An additional option: "External domain (git URL)"
If the user selects "External domain", ask for the git URL. The URL may
include a #subdir fragment for packs that contain multiple domains
(e.g., https://github.com/org/domains.git#myteam).
If only one domain exists, suggest it as the default but still confirm.
Step 2: Initialize
Run via Bash:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" --workspace "$WS" init <domain-name-or-url>
This:
- For bundled/workspace domains: copies the domain's
dev-env.yamlto$WS/dev-env.yaml. - For external URLs: shallow-clones the pack, validates the layout,
installs it into
$WS/domains/<name>/, then copiesdev-env.yaml. - In both cases: records the domain source in
$WS/dev-env.yamland creates or merges$WS/.claude/settings.local.jsonfrom the settings template.
If refreshing (Step 0.5 chose refresh), run this instead:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" --workspace "$WS" refresh-domain
Step 3: Clone Repos
Run via Bash to clone all repos defined in $WS/dev-env.yaml:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" --workspace "$WS" clone
This may take a while for large repos — let the user know.
Step 4: Verify Distributed Context Files
clone (Step 3) already distributes the active domain's files as part of
each repo clone. For each repo, the script does the following from the
active domain directory ($WS/domains/<domain>/ or the bundled
${CLAUDE_PLUGIN_ROOT}/domains/<domain>/):
- Context — if
context/<repo-name>.mdexists, it is copied to$WS/repos/<repo-name>/DOMAIN-CONTEXT.mdalways (even when the repo has its own native CLAUDE.md). This is the repo's role-in-the-domain context, read alongside CLAUDE.md. - Supplemental CLAUDE.md — if
supplemental/<repo-name>.mdexists and the repo has no nativeCLAUDE.md, it is copied to$WS/repos/<repo-name>/CLAUDE.md. A native CLAUDE.md is never overwritten.
No manual copying is needed — just confirm the files landed and log which
repos got a DOMAIN-CONTEXT.md, which got a supplemental CLAUDE.md, and
which kept their native CLAUDE.md.
Step 5: Generate the Workspace Root CLAUDE.md
Build a markdown repo table from $WS/dev-env.yaml (one row per repo):
| Name | Category | Summary |
|------|----------|---------|
| `<name>` | <category> | <summary> |
Then:
- If
$WS/CLAUDE.mdalready exists, replace only the content between the<!-- AUTO-GENERATEDand<!-- END AUTO-GENERATED -->markers with the freshly generated table. Leave everything else untouched. - If it does not exist, create it from the template below, substituting the repo table between the markers and the domain name where noted.
# CLAUDE.md
Guidance for Claude Code when working in this multi-repo workspace.
## What This Workspace Is
A multi-repo development workspace managed by the `workspace` Claude Code
plugin. Source repositories are cloned into `repos/`. The active domain is
**<domain-name>** (see `dev-env.yaml`).
## Source of Truth Priority
1. **Always look at repos in this workspace FIRST** before using internal
knowledge or web searches.
2. If a component has a repo here, that repo is the **authoritative source
of truth**.
3. Repos may contain a **`DOMAIN-CONTEXT.md`** alongside their `CLAUDE.md` —
it describes the repo's role in the domain and cross-repo relationships.
**Read both** when working in a repo.
## Fork Model
Push changes to your personal fork first, then open pull requests to the
upstream repository.
## Worktree Convention
Projects that modify source repos use git worktrees for branch isolation:
`repos/<repo>/.worktrees/<branch-name>/`. Created by `/workspace:new-project`,
shown by `/workspace:resume-project`, cleaned up by `/workspace:close-project`. When a
project has worktrees, use the worktree path for modifications; the main
checkout stays on the default branch for reference.
## Repository Table
<!-- AUTO-GENERATED by /workspace:setup-environment — do not edit manually -->
<!-- To regenerate, re-run /workspace:setup-environment -->
| Name | Category | Summary |
|------|----------|---------|
<!-- repo rows go here -->
<!-- END AUTO-GENERATED -->
## Skills (workspace plugin)
| Skill | Description |
|-------|-------------|
| `/workspace:setup-environment` | Set up or refresh the workspace from a domain |
| `/workspace:create-domain` | Build a custom workspace from arbitrary repos |
| `/workspace:new-project` | Create a new project workspace for a task |
| `/workspace:resume-project` | Resume an existing project |
| `/workspace:close-project` | Close a completed project |
| `/workspace:update-project` | Update project docs from the session |
| `/workspace:consolidate-project` | Archive completed checklist items |
## Domain Docs
For architecture, debugging, and domain concepts, see the active domain's
docs (workspace `domains/<name>/docs/`, or the plugin-bundled domain).
Step 6: Summary
Present a summary to the user:
- The workspace location
$WS - Number of repos cloned
- Which repos got supplemental CLAUDE.md files
- Which repos already had native CLAUDE.md files (skipped)
- Pointer to domain docs if present
- Next step: "Launch
claudefrom inside$WSfor future sessions — the SessionStart hook will surface recent projects there, and/workspace:new-projectwill scaffold tasks in that workspace."
Self-Repo Path (single-repo workspace)
No domain, no cloning. Never read or modify the repo's own CLAUDE.md —
orientation for future sessions comes from the SessionStart hook (recent
projects), per-project CLAUDE.md files, and dev-env.yaml.
S1: Initialize
Run via Bash (<name> = the repo root's basename; confirm with the user
first if it looks generic, e.g. src or repo):
bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" --workspace "$WS" init --self <name>
If it refuses because dev-env.yaml already exists, the workspace is
already initialized — tell the user and stop.
S2: Fill in the summary
Suggest a one-line summary of the repo from its README.md (Read tool),
or ask the user if there is none. Confirm it, then Edit
$WS/dev-env.yaml, replacing summary: "" in the self: block with the
confirmed line (YAML-quoted).
S3: projects/ tracking
Ask via AskUserQuestion whether per-task project docs under projects/
should be tracked in git:
- "Track in git (Recommended)" — project docs are real docs; nothing to do.
- "Ignore" — append a
projects/line to$WS/.gitignore(Edit, or Write if the file doesn't exist).
S4: Summary
Present:
-
What was created:
dev-env.yaml(self block),projects/,.claude/settings.local.json. -
The isolation model: edit-in-place —
/workspace:new-projectcreates context/tracking projects underprojects/; code changes happen directly in this checkout on whatever branch the user picks. -
Next step: "Launch
claudefrom$WSfor future sessions — the SessionStart hook will surface recent projects." -
Offer — print, never write — a snippet the user may paste into their repo's CLAUDE.md:
## Task Workflow Per-task context lives under `projects/<task>/`, managed by the `workspace` plugin: `/workspace:new-project` scaffolds a task, `/workspace:resume-project` reloads one. Launch `claude` from the repo root so the workspace resolves.
Important Notes
- Always pass
--workspace "$WS"tosetup.sh; never assume the current directory is the workspace. - Always use the Write/Edit tools to create/modify files, not Bash echo/cat.
- Use the Bash tool only for
setup.shcommands andmkdir -p. $WS/dev-env.yamlis user-specific configuration.- Context files copied into
$WS/repos/<name>/are working copies, not committed to the source repos.
Install
Add Setup Environment to your client. Pick the one you use.
npx skills add openshift-eng/edge-toolingInstalls every skill in the repository, then prompts for which to keep.
/plugin marketplace add openshift-eng/edge-toolingAdds the repository as a plugin marketplace; install individual plugins with `/plugin install`.
git clone https://github.com/openshift-eng/edge-tooling
cp -r plugins/workspace/skills/setup-environment ~/.claude/skills/A skill is a plain directory. Copy it into `.claude/skills/` in a project or in your home directory.
Score
75 / 100
Good