Skip to content

Commit 3a2aa4d

Browse files
committed
feat: enhance implementation process details in SKILL.md
1 parent fca39ba commit 3a2aa4d

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

skills/workspace-guide/SKILL.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,42 @@ compatibility: Requires git. Template scripts are in Node.js but the approach wo
66
license: CC0 1.0
77
metadata:
88
author: Paleo
9-
version: "0.12.0"
9+
version: "0.12.1"
1010
repository: https://github.com/paleo/skills
1111
---
1212

1313
# Implementing Worktree-Based Concurrent Local Environments
1414

15-
This skill helps you implement a system for running multiple local development environments simultaneously using git worktrees. It is meant to be adapted to any repository, regardless of tech stack or database engine.
15+
Implement a system for running multiple local dev environments side by side via git worktrees. Adapt it to any repository, regardless of tech stack or database engine.
1616

1717
**Node consumers** install the `@paleo/workspace` package and write two custom scripts that build a config object and call `runWorkspace(config)` / `runDevServer(config)`. The package owns the kernel — slot/dev-server registries, port math, branch lifecycle, process-group control, log polling, CLI parsing. Consumers supply project-specific callbacks (`finalizeWorktree`, `printSummary`, optional `purgeInfrastructure`, optional `devServerScript`) plus a `configFiles` list with patch functions, and resolve their own dev-limit ladder.
1818

1919
**Non-Node consumers** reimplement the system from this design doc; the rationale sections below are self-contained.
2020

21-
The `assets/` directory contains reference scripts ([workspace.mjs](assets/workspace.mjs), [dev-server.mjs](assets/dev-server.mjs)) — thin wrappers around the package — plus a template for [agent documentation](assets/workspace.md). The scripts are annotated with `ADAPT` comments to highlight what needs changing.
21+
The `assets/` directory contains reference scripts ([workspace.mjs](assets/workspace.mjs), [dev-server.mjs](assets/dev-server.mjs)) — thin wrappers around the package — plus a template for [agent documentation](assets/workspace.md). The scripts carry `ADAPT` comments and long explanatory blocks — scaffolding to guide _you_, not part of the deliverable. Strip them from the scripts you generate; keep only the rare comment explaining a non-obvious, project-specific choice (e.g. why a file is copied). Aim for lean wrappers.
22+
23+
## Implementation Process
24+
25+
Apply the skill in this order. The per-project decisions live in the [checklist](#checklist-for-adapting-to-a-new-repository); this section is the sequence and its guardrails.
26+
27+
1. **Require a clean working tree.** Run `git status` first. If it is not clean, stop and ask the developer to commit or stash. Testing the CLI commits scaffolding and creates/removes worktrees and branches — safe and reviewable only from a clean baseline.
28+
29+
2. **Investigate.** Read the rest of this document, then inspect the repo to answer every checklist item: current ports and config files, shared vs per-worktree gitignored directories, database provisioning, package manager, and the dev-server's ready / fatal log markers. Note what needs migrating (scattered ports, a config file not yet gitignored, a colliding dev-script name, etc.).
30+
31+
3. **Present findings and plan, then get approval.** Summarize what you found and exactly what you intend to do — base port and port scheme, the shared / per-worktree split, config files to patch, database-provisioning strategy, dev-server command (and any rename), and migrations. **Do not change anything until the developer agrees.**
32+
33+
4. **Implement.** Work through the checklist: install the package, write the two lean scripts, add the npm scripts, migrate ports / config, update `.gitignore`, write the agent docs.
34+
35+
5. **Commit once, then test.** Make a **single commit** with all the scaffolding — a prerequisite for testing, not a wrap-up. `workspace setup <branch> -c` builds the linked worktree from the committed `HEAD`, so the scripts and `package.json` changes must be committed to exist there; the commit also gives the clean tree `workspace remove` expects. Then exercise the CLI end to end:
36+
- bootstrap the main worktree (`workspace setup`);
37+
- create a throwaway workspace (`workspace setup <test-branch> -c`);
38+
- start / stop dev servers (`dev up`, `dev list`, `dev down` / `down --all`);
39+
- `workspace list` and `status`;
40+
- remove the throwaway workspace (`workspace remove <test-branch>`), then delete the test branch you created — your own artifact, the one case where deleting a branch is expected.
41+
42+
6. **Fix by amending, then re-test.** When a test surfaces a problem, fix it, fold it into the same commit with `git commit --amend`, and re-run the affected tests. Keep the whole effort as one commit. A common find: a gitignored credential file (e.g. `.npmrc`, a private-registry token) not propagated to new worktrees, so `npm install` fails there — add it to `configFiles` (verbatim copy, usually `optional: true`).
43+
44+
7. **Never push.** Leave the final, amended commit for the developer to review and push.
2245

2346
## The Problem
2447

@@ -370,10 +393,21 @@ The agents need to know:
370393
- [ ] **Decide on fatal log markers for `dev-server`** (or leave the array empty). Substrings that mean "unrecoverable startup failure" let the script fail fast instead of waiting for the timeout.
371394
- [ ] **Bootstrap the main worktree's config files manually once** (from `.example` files), since sibling worktrees inherit from the main worktree.
372395
- [ ] **Install `@paleo/workspace`** as a dev-dependency (Node consumers).
373-
- [ ] **Write `workspace`** using [assets/workspace.mjs](assets/workspace.mjs) as a starting point. Search for `ADAPT` comments.
374-
- [ ] **Write `dev-server`** using [assets/dev-server.mjs](assets/dev-server.mjs) as a starting point. Same approach.
396+
- [ ] **Write `workspace`** using [assets/workspace.mjs](assets/workspace.mjs) as a starting point. Search for `ADAPT` comments — then strip them (and the other scaffolding comments) from your final script.
397+
- [ ] **Write `dev-server`** using [assets/dev-server.mjs](assets/dev-server.mjs) as a starting point. Same approach: adapt, then leave a lean script.
375398
- [ ] **Add npm scripts** (or Makefile targets, etc.): `workspace` and a single `dev` (don't reuse the app's own dev script name).
376399
- [ ] **Set the dev-server cap** by passing `devLimit` to `runDevServer` (default `5`).
377400
- [ ] **Update `.gitignore`** to ignore your shared and per-worktree directory (e.g. `.local-wt/`).
378401
- [ ] **Write agent documentation** if applicable (see [assets/workspace.md](assets/workspace.md)).
379402
- [ ] **Update your main instruction file** (`AGENTS.md` / `CLAUDE.md`) with a pointer to the agent documentation and any conventions (branch naming, commit messages) the agent needs to follow.
403+
404+
## Removing This Guide Skill
405+
406+
Once the workspace system is implemented, committed, and tested, this guide has done its job — it is not needed for day-to-day work. As the very last step, give the developer the command to uninstall it (assuming it was installed with the [`skills` CLI](https://github.com/vercel-labs/skills)):
407+
408+
```sh
409+
npx skills remove workspace-guide --yes
410+
411+
# prune the entry in skills-lock.json
412+
node --input-type=module -e 'import {readFileSync as r,writeFileSync as w} from "node:fs";const f="skills-lock.json",j=JSON.parse(r(f));delete j.skills["workspace-guide"];w(f,JSON.stringify(j,null,2)+"\n")'
413+
```

0 commit comments

Comments
 (0)