Skip to content
Back to skills

Isolated Worktree Testing

ASecurity

Use when testing tracked local changes away from the source checkout. Capture before switching.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 21, 2026
ai-agentspythonrustnodetestinggitsecurity

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 21, 2026

npx -y skills add Rafaelrr5/agent-cortex --skill isolated-worktree-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Isolated Worktree Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Isolated Worktree Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rafaelrr5-isolated-worktree-testing/badge)](https://www.skillsdirectory.com/skills/rafaelrr5-isolated-worktree-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: isolated-worktree-testing
description: "Use when testing tracked local changes away from the source checkout. Capture before switching."
---

# Isolated worktree testing

Use a detached worktree to test a captured revision without switching the source
branch. Git worktrees share repository metadata: this is checkout isolation, not a
security sandbox. Untrusted commands need a separate security boundary.

## Supported snapshot

`python scripts/capture_worktree.py SOURCE TARGET` resolves source HEAD and captures
`git diff --binary HEAD` **in the source checkout before creating the worktree**.
This combines staged and unstaged tracked content relative to HEAD; it does not preserve
index staging distinctions. TARGET must not exist. No fetch, checkout, merge or push occurs.

The helper refuses untracked nonignored files and submodules before creating anything.
It does not silently omit new source files. If new files are required, stop and choose an
explicit reviewed snapshot method; do not stage files merely to evade this restriction.
Ignored files (including ignored new source files), local secrets and dependency installs
are not copied. Review ignore rules and expected file coverage first. Do not edit the
source concurrently: capture is not transactional. Compare source status before/after
and repeat if another writer changed the intended snapshot.

## Procedure

1. Review source status including ignored/untracked files, intended base and acceptance.
2. Capture using the helper. Record the printed base SHA and patch SHA-256.
3. Run project-specific tests in TARGET, with independent dependencies and disposable
   data. Disable implicit package publishing. A smoke check is not full-suite coverage.
4. Record commands, real exit codes, tested revision and failures. Apply/build failures
   leave the worktree available for inspection; a failed capture never means verified.
5. Inspect TARGET status. Remove only the exact disposable worktree, via
   `git -C SOURCE worktree remove TARGET`. Dirty trees require review and explicit
   cleanup authorization; never use blanket recursive deletion or automatic `--force`.

Never share `node_modules` by symlink or junction, and never delete dependencies in
an inherited linked directory. If a tool creates links/reparse points, stop and inspect
ownership and targets before cleanup. The helper performs no recursive cleanup.

Run tests: `python -B -m unittest discover -s tests -v`.
Tests create disposable local repositories under TMPDIR, with no remote or credentials.

## Provenance

Rewritten from the supplied `verification-workflow` source, whose metadata declares
MIT licensing and machine-generated authorship (no named human author). Source notices
must be retained by the distributor where required; this summary does not replace a
license grant. This version removes the stale post-switch diff and shared-dependency advice.

Files in this skill

  • SKILL.md2.8 KB
  • references/local-evidence.md753 B
  • scripts/capture_worktree.py1.4 KB
  • tests/test_capture.py2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.