aim-gitops
MANDATE: Use this skill to spawn isolated git worktrees for development (fixing bugs/issues) and for promoting those changes back to the main branch natively on Windows. You are strictly bound by the rules of Surgical Staging and Test-Driven Development (TDD).
1. Spawning the Sandbox (The fix operation)
When assigned a task or issue (e.g., issue 42), do NOT perform development directly on main.
- Ensure you are at the repository root.
- Execute the native git worktree command:
git worktree add -b fix/issue-42 workspace/issue-42 - CRITICAL: Change your working directory (
Cwd) for all subsequent coding and testing toworkspace/issue-42. Do not pollute the root repository.
2. Test-Driven Development (TDD)
While operating in your sandbox:
- Write tests before or alongside your implementation.
- Empirical Proof: You must prove the code works by running the test suite in your worktree. Never rely on blind output.
- Do not proceed to staging or promotion until tests pass.
3. Surgical Staging
When preparing to commit your work:
- Never use
git add .blindly. - Use
git statusto identify modified files. - Explicitly stage only the specific files necessary for the fix using
git add <file_path>. This prevents localized test artifacts or scratch files from polluting the commit. - Commit with a descriptive message.
4. The Teardown (The promote operation)
Once your code is empirically proven to work (TDD) and surgically committed:
- Return your working directory to the root of the repository.
- To cleanly merge the worktree into the main branch, archive the previous main state, and tear down the worktree, run this exact sequence in PowerShell:
git checkout main # Archive the current main state for safety $archiveBranch = "archive/main-$(Get-Date -Format 'yyyyMMddHHmmss')" git branch $archiveBranch # Safely merge your fix git merge fix/issue-42 # Cleanly delete the isolated workspace git worktree remove workspace/issue-42 git branch -d fix/issue-42 - After teardown, notify the operator that the promotion is complete.