当前位置: 首页 > Skill >

Git Factory

Git Factory

Git Factory

为每个编码任务配置并管理独立的 Git worktree,支持并行分支和清晰的 PR 工作流,避免合并冲突。

1.0.0 2026.11.24 588
获取Skill文件查看使用说明
作 者:陆川 许可证: 更新时间:2026.11.24
本文目录展开

# Git Factory — Worktree Isolation for Moths

Each moth gets its own branch, its own workspace, its own PR. No conflicts. No merge hell.

When to Use

  • Multi-moth coding tasks — parallel feature work on the same repo
  • Open-source PRs — isolated branch per contribution
  • Skill packaging — each skill gets its own worktree for clean commits
  • Any moth that writes code — default to worktree isolation

Quick Reference

Provision a worktree for a moth

# From the repo root
.skillsgit-factoryscriptsnew-worktree.ps1 -RepoPath . -TaskSlug "fix-login-bug"
# Returns: C:Usersspazclawd.worktreesfix-login-bug

Finish and submit PR

.skillsgit-factoryscriptsfinish-worktree.ps1 `
  -WorktreePath ".worktreesfix-login-bug" `
  -CommitMessage "moth(fix-login-bug): fix auth redirect loop" `
  -CreatePR -PRTitle "Fix login redirect bug" `
  -PRBody "Fixes the auth redirect loop on expired sessions"

List active worktrees

.skillsgit-factoryscriptslist-worktrees.ps1 -RepoPath .

Clean up stale worktrees (>7 days)

.skillsgit-factoryscriptscleanup-stale.ps1 -RepoPath . -MaxAgeDays 7

Moth Dispatch Integration

When spawning a coding moth, include the worktree in the task prompt:

Your working directory is: C:Usersspazclawd.worktrees<task-slug>
You are on branch: moth/<task-slug>
Base branch: master

Work ONLY in this directory. When finished:
1. Stage and commit your changes
2. Push your branch: git push -u origin moth/<task-slug>
3. Report what you built and any issues

Do NOT modify files outside your worktree.

Conventions

Item Convention
Worktree location <repo>/.worktrees/<task-slug>
Branch naming moth/<task-slug>
Commit prefix moth(<task-slug>): <description>
PR mode Draft by default
Stale threshold 7 days (configurable)
.worktrees/ Added to .gitignore automatically

How It Works

  1. new-worktree.ps1 creates a branch moth/<slug> and a worktree at .worktrees/<slug>
  2. Moth works in the isolated directory — full git repo, own branch, no conflicts
  3. finish-worktree.ps1 commits, pushes, optionally creates a draft PR, then removes the worktree
  4. cleanup-stale.ps1 runs periodically to remove abandoned worktrees

Limitations

  • Worktrees share the same .git directory — large repos may have lock contention on heavy git ops
  • Can't have two worktrees on the same branch
  • Windows file locking can prevent cleanup if processes have files open

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • When to Use
    • Quick Reference
      • Provision a worktree for a moth
      • Finish and submit PR
      • List active worktrees
      • Clean up stale worktrees (>7 days)
    • Moth Dispatch Integration
    • Conventions
    • How It Works
    • Limitations
  • 项目或源文件

相关 Skill

更多
Worktrunk Worktrunk Git worktree 管理器,用于并行 AI Agent 工作流。适用于需要管理多个工作目录进行并行开发、创建功能分支等场景。
Swarm Sprint Swarm Sprint 使用 git worktree 隔离实现并行多智能体编程冲刺。适用于在同一仓库中同时运行 2 个以上、涉及不同代码区域的编码任务。
Parallel Orchestrate Parallel Orchestrate 主编排技能,接收 gstack 实施计划,通过并行 Claude Code 子代理在隔离的 git worktree 中发布。位于...
Worktree Manager Worktree Manager 管理基于 Docker 的开发实例及 git worktree,处理应用容器生命周期、数据库种子数据和代理路由激活,需要 mysql‑manager 等依赖。
using-git-worktrees using-git-worktrees 在开始需要与当前工作区隔离的功能开发或执行实施计划之前使用——创建隔离的 git worktree,具备智能目录选择和安全验证。