How this skill is triggered — by the user, by Claude, or both
Slash command
/team-skills:sync-mainThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
每天开工前同步 main 分支:拉最新代码 → 报告变动 → 影响分析 → 重建环境 → 启动。只看不动,功能完成后再合并。
每天开工前同步 main 分支:拉最新代码 → 报告变动 → 影响分析 → 重建环境 → 启动。只看不动,功能完成后再合并。
团队架构参考: https://lucian-why.github.io/team-skills/team-architecture.html
Core principle: 先看别人干了什么,再决定怎么开工。不改你的分支,不 rebase,不 merge。
Announce at start: "I'm using the sync-main skill to sync with main and start dev environment."
git fetch origin main
BRANCH=$(git branch --show-current)
BEHIND=$(git rev-list HEAD..origin/main --count)
AHEAD=$(git rev-list origin/main..HEAD --count)
If behind is 0:
✅ 你的分支 feature/chat 已经是最新,领先 main 2 个 commit。
直接开工:docker-compose up
Skip to Step 4.
If behind > 0: Continue to Step 2.
# 获取 main 上的变动(自你分支分叉以来的 commit)
git log HEAD..origin/main --pretty=format:"%h|%an|%s" --no-merges
输出格式:
═══════════════════════════════════════
sync-main 报告
═══════════════════════════════════════
📍 你的分支 feature/chat 落后 main 5 个 commit
📝 main 变动:
abc1234 @张三 — feat: 新增学习路径推荐算法
└ shared/ai/model.ts, features/learning-path/service/recommend.ts
def5678 @李四 — fix: 登录页样式错位
└ features/auth/components/LoginForm.tsx
ghi9012 @王五 — chore: 升级 React 19
└ package.json, package-lock.json, Dockerfile
检查变动文件,分类标记影响级别:
# 检查 shared/ 有没有变动
git diff --name-only HEAD..origin/main | grep "^shared/"
# 检查依赖文件有没有变动
git diff --name-only HEAD..origin/main | grep -E "package\.json|Dockerfile|docker-compose"
输出影响分析:
⚠️ 影响分析:
🔴 shared/ai/ 有变动 → 你用到了 ai/ 的接口,注意兼容性
🔴 shared/frontend/ui/ 有变动 → 通用组件更新了
🔴 package.json 变了 → 需要 docker-compose build
🟡 Dockerfile 变了 → 建议 docker-compose build --no-cache
🟢 features/auth/ 改动 → 不影响你的 feature/chat
判断逻辑:
注意: 这里只是提醒你别人改了什么。你不需要现在合并或 rebase,功能完成后再用 pre-push 处理合并。
# 用 main 最新代码重建 Docker 镜像并启动
docker-compose up --build
输出:
🚀 用 main 最新代码启动环境...
前端: http://localhost:5173
后端: http://localhost:3000
✅ 环境就绪,浏览器打开确认一下。
为什么每次都 build? main 上可能有新提交,镜像需要更新。这一步保证你跑的是最新代码构建的环境,不是你本地旧镜像。
浏览器打开 http://localhost:5173,确认页面能正常加载。
如果有问题,检查 docker-compose logs 输出。
| 场景 | 执行 |
|---|---|
| 落后 0 commit | 跳过,直接 docker-compose up |
| 落后 + 无 shared/ 变动 | 看报告 → docker-compose up --build |
| 落后 + shared/ 变动 | 看报告 + 影响分析 → docker-compose up --build |
| 落后 + 依赖变动 | 看报告 → docker-compose up --build |
| 功能完成要合并 | 用 pre-push,不用 sync-main |
不检查就开工
在 sync-main 里做 rebase/merge
忽略 🔴 影响警告
Never:
Always:
Pairs with:
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub lucianwhy/team-skills --plugin team-skills