What Two Agent Skills Found in a Real Repository
I turned my worktree isolation method into two agent skills and ran them on a client project. One found a collision; the other rebuilt it and caught a bug.
In One Checkout per Job I described giving every job its own Git worktree, with mise handing each one its own ports, database, vhost and key prefix. I ended with a gap. The demo repository was a one-off. I built it by prompting an agent with what I knew and wanted, and real repositories aren’t that tidy.
I’d built the same pattern in three projects by then, and each one refined how I do it. What I wanted was a repeatable process, for my next project and for my colleagues at work. So the method is now two agent skills in my skills repository: one that sets the workflow up in a repository, and one that keeps it honest as the code changes.
They’re my first attempt at making skills of my own. To be clear about who did what: an agent wrote both skills, from my prompting. I brought the problem, what I’d learned from those projects, and the decisions about what the skills should and shouldn’t do.
This post is what happened when I ran them on a real client project.
A real repository isn’t the demo
The demo has one frontend, one API and a handful of shared services. I knew every port and every connection string because I’d chosen them and walked the agent through each one.
The client project, which I can’t name, is three application repositories: an API, a web admin app and a mobile app. They sit on Postgres, Directus and Azurite, with several third-party services around them. None of them is a monorepo, and none of them on its own is the product.
Its local setup was a fourth repository, a mise-based coordinator that drives the other three. That was AI-guided too, built the same way as the demo, from what I knew and wanted at the time. Directus couldn’t be separated logically within one instance, so we gave each named environment its own Docker stack: Postgres, Directus and Azurite containers, and its own block of ports. That’s a separate container per environment applied to the whole stack rather than only to Directus, which keeps each environment simple to reason about.
A setup like that has two problems, and they need different tools.
- Setting it up. Someone has to find every application and every piece of mutable state, then decide how each is isolated. Miss one and two worktrees share it.
- Keeping it true. The setup describes the repository at one commit. Next week someone adds a worker with a fixed port, or a new blob container, and nothing complains. Every test still passes, because the tests only know about what the setup knew about.
The second one worries me more. A passing run on a stale setup looks exactly like proof of isolation.
Two skills, one for each problem
The split into two skills isn’t mine. Credit goes to Lauren Tan and her /create-verification-skill in pstack. That skill studies a repository and generates a project-local skill that drives the real app the way a user would, then runs it end to end once before handing it over. A companion, /maintain-verification-skill, keeps it honest as the app changes. I asked for the same shape: work things out from the repository rather than asking, prove the result before calling it done, and pair the create skill with one that maintains it.
create-mise-worktree-setup: discover, decide, prove
The create skill starts from the repository, not a template. It builds two catalogues from the code: the runnable applications, and every dependency they touch. It goes looking for the places state hides, such as connection strings, fixed localhost ports, storage clients, auth callback URLs, Docker volumes and every environment-variable read. Existing scripts and docs count as hints, not as proof that the inventory is complete.
Every mutable dependency then gets one explicit isolation decision, from cheapest to most expensive:
- Shared, because it’s stateless or read-only.
- Shared service, with a per-worktree prefix or resource name.
- Shared service, with a separate database, schema or account.
- A separate process per worktree.
- A separate container or Compose project per worktree.
- Not isolatable locally, with a written rule for working around it.
One Postgres with a database per worktree beats a Postgres per worktree, so the skill has to justify anything at level 5, including the memory, disk and start-up time it adds to every worktree.
The skill also pins down details an agent would otherwise guess at. For example, worktree identity comes from Git metadata rather than the branch name, because branches get renamed and ports and database names should stay stable. Identity turns out to be the heart of Run 1.
Tests aren’t enough on their own, so the skill finishes with a two-worktree proof in a disposable clone. It creates two linked worktrees, starts the normal application set in both, and checks that isolated resources really are separate and shared ones really are shared. Then it stops one, confirms nothing from it is still running, and tears the clone down. The real checkout never changes.
Last, it writes a sync record into the repository: the commit the catalogues describe, the commit the proof passed against, the searches that would find a new dependency, and the known limitations.
maintain-mise-worktree-setup: drift versus leaks
The maintain skill starts from that record. It diffs everything since the sync commit, not just the files the catalogues mention, because drift usually arrives as a new file. Every area then gets an outcome, and the distinction between two of them is the point of the skill:
- Updated means the setup had drifted from the code. The catalogue, config or tasks now describe the new code.
- Leak means the setup describes the code correctly, and two worktrees can still collide or share state. A new service on a fixed port is a leak. So is a database name that isn’t derived from the worktree.
It updates from the code, not from the test result, because a green run isn’t evidence the catalogue is right.
That’s the design: create writes the record, and maintain reads it. This post didn’t follow that route, as it turned out.
Run 1: adopting the coordinator
The coordinator had no sync record. In that case the maintain skill adopts the setup: it describes what the setup actually does, ranks the gaps by risk and records which ones a test guards, without changing any code.
The run took about five and a half minutes. It ran the existing tests before touching anything (68 passed, one opt-in Docker test skipped), scanned the application repositories for configuration the coordinator didn’t override, and probed the port and name generators with awkward inputs: long names, names that sanitise to the same string, and port slots that overlap the main environment’s. It wrote a catalogue and a sync record, reran the tests and committed. It didn’t run the proof, so the sync commit stays not set.
Most of the catalogue came back fine. The applications, the migration tools, the databases and the emulators were all isolated within one checkout of the coordinator. What it found was more interesting.
The biggest one: two checkouts of the coordinator collide. An environment’s identity came only from its name, with nothing to say which checkout it belonged to. So main in two checkouts, such as a worktree of the coordinator next to the primary, used the same Docker project and database. Worse, if both created an environment with the same name, setting up the second would run compose down --volumes and delete the first one’s data. That’s the case the coordinator wasn’t built for, and the one a worktree-per-job workflow creates.
Two smaller leaks, and none of the three is guarded by a test:
- A few port slots reuse ports the main environment needs. It only bites when
mainis stopped while one of those slots is handed out, and only after 33 environments exist. Unlikely, but now written down. - Names that differ only in case collide. On macOS,
Feature-Xandfeature-xshare a state file and a workspace folder.
Drift, where the setup no longer matched the code:
- A Docker Compose template the coordinator copies over an application repository’s own Compose file had fallen behind it, and quietly undid a configuration change made in the application repository.
- The setup’s default for the AI chat model still named a model the application had since moved away from, and the local value overrides the application’s own setting.
It also listed the third-party services that can’t be isolated locally, each with a safe way to use them, and the items from the skill’s newer spec that the setup lacked.
Then came the recommendation: don’t run the create skill on it. Its model of one repository with linked worktrees doesn’t fit a coordinator plus three application repositories. It recommended fixing four problems directly instead: the two-checkout collision, the stale Compose template, the stale model default, and creating an environment over an existing name, which silently overwrites it and deletes its Docker data the next time it starts. I didn’t know about any of them, and I haven’t fixed any yet.
Run 2: rebuilding it as a home repo
The maintain skill’s advice was to fix those four problems in the coordinator, and that’s a fair route. I chose a different one.
As a consultant, I don’t always get to choose how a client’s code is split. Here it was already several independent repositories, and a home repo is one way to work across many repositories without merging them into a monorepo. So if I set this up again today, I wouldn’t build a coordinator. I’d use the home repo pattern: one repository that holds the skills, the agent instructions and the shared docs, with pointers to the application repositories. I’d clone those inside it and have Git ignore them, which the pattern allows. It suits this kind of project: several independent repositories that share one domain.
I expected the create skill to fit it, too. The home repo owns the mise tasks and the isolation, because together the repositories are the client’s environment and product. Each repository on its own is only an isolated part of that bigger product, so for this project it’s the wrong place for the setup to live.
So I tried it. I asked an agent to create a home repo for the three application repositories, leaving the old coordinator repository untouched, and then run /create-mise-worktree-setup on it.
The skill made the home checkout the unit of isolation. Each worktree of the home repo is one complete environment. Creating one with wt switch --create my-feature runs a hook that generates the worktree’s mise.local.toml from the primary’s without prompting, creates a matching worktree on my-feature in each application repository, and installs packages. Removing it refuses if any of those child worktrees has uncommitted changes. Otherwise it deletes that environment’s containers and volumes, its child worktrees, and any child branches it created that have no commits. A task acts on whichever checkout you run it in.
It ported everything from the coordinator except the named environments, including the Directus bootstrap, the CMS seed import, migrations, and the build and release helpers. It ended with 82 orchestration tests.
Does that fix what Run 1 found? Partly, by design. The named environments behind the two-checkout collision are gone, because each checkout is now the environment, and with them the risk of creating one over an existing name. Port slots are now checked against the ones that would reuse the primary’s ports. But I haven’t checked whether the stale Compose template and the stale model default came across with everything else. That’s the first job for the next maintain run.
For isolation, the agent recommended a cheaper design, with one shared Postgres holding a database per worktree, one shared Azurite with a blob container per worktree, and only Directus separate. I chose a full Docker stack per checkout again, because a full set is easier to reason about than some services shared and some separate. The catalogue records that reason. It costs more per worktree, and it goes against the skill’s own preference for the cheapest isolation. The skill lets me make that call, as long as the reason is written down.
The proof found a real bug
The two-worktree proof ran in a throwaway clone. Both worktrees got different ports, Compose projects and secrets. A table and a blob container created in one didn’t appear in the other. The admin app and the mobile bundler ran in both at once. Stopping one left no processes behind, and the other kept serving.
Then it removed one worktree, and the child branches it had created were still there. The cleanup step deleted the local state folder, including the record of which child branches it had created, before the step that removes them ran. So that step had nothing to work from. All 80 tests had passed. The agent changed the cleanup step to keep that record, committed, and reran a trimmed proof that confirmed the branches were gone.
The run took about 27 minutes from my prompt to its handover, including three questions it asked me about layout, scope and isolation, and three proof runs: one cut short to fix a repeated prefix in the Compose project names, a full run, and a trimmed rerun after the bug fix.
Where it bent the rules
Not everything could run. The machine had no .NET SDK, and the schema tool comes from a private package feed that needs credentials. So the API, the migrations and the Directus schema were never proven, and to start the admin and mobile apps the agent marked both proof checkouts as already prepared.
The skill says to leave the sync commit not set when the proof can’t run in full. The agent recorded the fix commit as the sync commit anyway and listed the blocked steps in the record. When it reported against the skill’s handover list, it said so and offered to change it back. I kept it set. The blocked steps are in the record, so the next maintain run can see what was never proven.
What making my first skills taught me
- Split one job into two skills. The maintain run found what had quietly gone wrong in a setup nobody was watching. The create run built its replacement. Neither job would have fitted inside the other.
- The proof is the part that earns its keep. Every test passed, and the setup still left child branches behind on removal. Only running two real worktrees side by side, then removing one, showed it.
- A good skill can tell you not to use it. The maintain run didn’t just list problems. It said the create skill didn’t fit the coordinator. I chose to try a home repo, and the create skill fitted that well.
- The agent follows the skill with judgement, so make the judgement visible. The create run bent the sync commit rule, and the bend ended up in the record where the next run can find it. A rule an agent can bend needs a place where the bending gets written down.
- The agent writes, I decide. An agent wrote both skills and did both runs. My part was the decisions: answering its questions about layout, scope and isolation, choosing a full Docker stack per checkout over a cheaper mix, and keeping the sync commit set. The skills don’t remove those calls. They make sure each one is asked, and recorded.
Honest gaps
- The proof needs a working local environment. Without Docker, the right SDKs or package credentials, parts of it stay blocked, as the API and migrations did on the create run.
- Some gaps need application changes. The maintain skill only edits the workflow. When the fix belongs in application code, such as a connection string hard-coded to the primary’s database, it reports the leak and the change instead of making it.
- The handoff is untested. I haven’t yet run the maintain skill against a record the create skill wrote. The next change to the home repo will be that test.
- It’s opinionated. It assumes mise as the front door. If your repository runs on something else, the ideas carry over but the skills won’t.
A one-off setup worked for a demo. For a real project, the hard part was never producing the setup. It was finding everything that needed isolating, and noticing when that list stopped being true. One skill does the first job, the other does the second, and the sync record between them is meant to tell the second one where to look.
Try them
Both skills are manual only, so an agent won’t decide to run them on its own. They change a repository’s development workflow, and I want to choose when that happens. Install them with the skills CLI, which asks which skills and agents you want:
npx skills add gertjvr/skills
Or install both across every project:
npx skills add gertjvr/skills --skill create-mise-worktree-setup maintain-mise-worktree-setup -g
To install this exact version, pin the release tag:
npx skills add gertjvr/[email protected]
Then run /create-mise-worktree-setup or /maintain-mise-worktree-setup. You’ll want mise installed, and Worktrunk if you want the hooks to run for you. Nothing about the isolation depends on Worktrunk, though.
The create skill targets an ordinary repository with linked worktrees. You don’t need a home repo for that. A home repo is just one way to work across several repositories when a monorepo isn’t an option.
Expect a high-risk warning, for now
When you install them, the skills CLI shows a security assessment from three partners. Gen rates both skills safe and Socket finds no alerts, but Snyk rates both high risk. Part of that is by design: the skills modify your existing app’s development setup. They write mise tasks and Worktrunk hooks, generate local config, and create and clean up Compose services and databases. Snyk flags that as modifying system services, and I don’t expect a wording change to remove it, because it’s what the skills are for. The skills themselves run destructive commands only in the disposable proof clone or after you confirm them. The removal hook they generate deletes a worktree’s containers and volumes when you remove that worktree, which is its job.
The high rating is a stored audit of the first commit. That audit also flagged loose wording about secrets and the commit messages the maintain skill reads, and an agent fixed both at my direction. A scan of the current skills with Snyk Agent Scan finds only the by-design issue, rated low. Until skills.sh re-audits the repository, installs will keep showing the old rating. The README has the details and the command to scan them yourself.
Comments
Join the conversation on Bluesky.