sk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsing the sk
CLI
sk使用sk
CLI
skskskills.lock.json./skills~/.cache/sk/reposskskills.lock.json./skills~/.cache/sk/reposWhen to reach for this skill
适用场景
- You need to install or upgrade a skill from the canonical skills repo ().
https://github.com/lambdamechanic/skills - You want to verify the working tree is clean (,
sk doctor --status).sk doctor --summary - You are preparing to sync edits back to the upstream skills repository ().
sk sync-back <install>
- 你需要从标准技能仓库()安装或升级技能。
https://github.com/lambdamechanic/skills - 你想要验证工作树是否干净(、
sk doctor --status)。sk doctor --summary - 你准备将本地编辑同步回上游技能仓库()。
sk sync-back <install>
Core workflow
核心工作流程
-
Refresh the cache (optional but fast):bash
target/debug/sk update -
Install or upgrade a skill (alias keeps folder names stable):bash
target/debug/sk install https://github.com/lambdamechanic/skills testing-patterns --alias testing target/debug/sk upgrade testing -
Audit local installs before landing work:bash
target/debug/sk doctor --status --json # detect dirty trees vs lockfile target/debug/sk doctor --summary --json # shows pending upgrades or cache drift -
Sync edits upstream after modifying a skill under:
./skills/<name>bashtarget/debug/sk sync-back <name> --message "Describe the change"Onceis configured,sk config set default_repo <repo>automatically targets that repo, usessk sync-back <name>for the skill-path, and generates<name>branches so the quickstartsk/sync/<name>/<timestamp>flag is the only required argument. Supply-m/--repoonly when you need to override the defaults.--skill-pathThis creates a temp branch in the cached repo, copies your edited skill directory, commits, and pushes. On successrunsskfor you: it auto-opens a PR, enables auto-merge when GitHub reports the branch is clean, and prints the PR URL (or a conflict warning) so you can follow up if automation gets blocked. If the GitHub CLI is missing or the repo isn’t reachable via GitHub, you’ll see a warning plus manual PR instructions and can runghyourself once available.gh pr createPR automation tips- Run once per machine to ensure the GitHub CLI is logged in;
gh auth statuswill reuse your credentials.sk - Missing prints a warning and falls back to a recursive copy before committing; install
rsyncto keep large skills fast.rsync - After the push, watch the terminal output:
- (or
Opened PR …) links to the branch that was just published.Reusing PR … - means GitHub will land it once checks pass; otherwise you’ll see
Auto-merge armed…with a link to fix conflicts manually.Auto-merge blocked… - appears when checks can’t be armed (e.g., required approvals disabled); click through and finish by hand.
Auto-merge skipped…
- When is missing or unauthenticated you’ll see “Skipping PR automation …”; install/auth and rerun
ghto finish the upload.sk sync-back - Automation currently uses GitHub’s standard strategy; if your repo enforces
--merge/--squash, turn off auto-merge in the UI and land it manually after review.--rebase - If your PR output says , run
enablePullRequestAutoMerge(or visit the repo’s Settings → General page) once to flip the toggle.gh repo edit <owner>/<repo> --enable-auto-merge
- Run
-
Publish a brand-new skill that doesn’t exist upstream yet:bash
target/debug/sk sync-back <name> \ --repo https://github.com/lambdamechanic/skills \ --skill-path <subdir> \ --message "Add <name> skill"Provide/--repoonly if you need something other than the configured defaults.--skill-pathclones that repo, branches from the default tip (or your customsk), copies your local folder, pushes, and rewrites--branchwith the exact commit SHA/digest so status checks stay clean. You will always see the temporary branch name in the CLI output, e.g.skills.lock.json, even though that branch is meant to be merged and deleted once the upstream PR lands.Pushed branch 'sk/sync/<name>/<timestamp>' …
-
刷新缓存(可选但速度很快):bash
target/debug/sk update -
安装或升级技能(别名可保持文件夹名称稳定):bash
target/debug/sk install https://github.com/lambdamechanic/skills testing-patterns --alias testing target/debug/sk upgrade testing -
在提交工作前审计本地安装:bash
target/debug/sk doctor --status --json # 检测工作树与lockfile是否不一致 target/debug/sk doctor --summary --json # 显示待升级项或缓存偏移 -
修改下的技能后同步到上游:
./skills/<name>bashtarget/debug/sk sync-back <name> --message "描述所做更改"配置后,sk config set default_repo <repo>会自动指向该仓库,使用sk sync-back <name>作为技能路径,并生成<name>分支,因此快速启动时仅需提供必填的sk/sync/<name>/<timestamp>参数即可。仅当需要覆盖默认设置时,才需指定-m/--repo。--skill-path此命令会在缓存仓库中创建一个临时分支,复制你编辑过的技能目录,提交并推送。成功后,会自动调用sk:它会自动打开一个PR,当GitHub报告分支干净时启用自动合并,并打印PR URL(或冲突警告),以便在自动化受阻时进行后续处理。如果缺少GitHub CLI或无法访问GitHub仓库,你会看到一条警告以及手动创建PR的说明,待条件满足后可自行运行gh。gh pr createPR自动化技巧- 每台机器上运行一次以确保GitHub CLI已登录;
gh auth status会复用你的凭据。sk - 若缺少,会打印警告并在提交前回退到递归复制;安装
rsync可提升大型技能的同步速度。rsync - 推送完成后,关注终端输出:
- (或
Opened PR …)链接到刚刚发布的分支。Reusing PR … - 表示GitHub会在检查通过后自动合并;否则你会看到
Auto-merge armed…及手动解决冲突的链接。Auto-merge blocked… - 出现在无法启用检查时(例如禁用了必需的审批);点击链接手动完成合并。
Auto-merge skipped…
- 若缺失或未认证,你会看到“跳过PR自动化 …”的提示;安装/认证后重新运行
gh即可完成上传。sk sync-back - 自动化目前使用GitHub标准的策略;若你的仓库强制使用
--merge/--squash,请在UI中关闭自动合并,审核后手动合并。--rebase - 若PR输出显示,请运行一次
enablePullRequestAutoMerge(或访问仓库的设置→常规页面)来开启该功能。gh repo edit <owner>/<repo> --enable-auto-merge
- 每台机器上运行一次
-
发布上游尚未存在的全新技能:bash
target/debug/sk sync-back <name> \ --repo https://github.com/lambdamechanic/skills \ --skill-path <subdir> \ --message "Add <name> skill"仅当需要覆盖配置的默认值时,才需提供/--repo。--skill-path会克隆该仓库,从默认分支(或你指定的sk)创建分支,复制本地文件夹,推送并使用确切的提交SHA/摘要重写--branch,确保状态检查保持正常。你总会在CLI输出中看到临时分支名称,例如skills.lock.json,尽管该分支在上游PR合并后会被删除。Pushed branch 'sk/sync/<name>/<timestamp>' …
Example: publishing sk
sk示例:发布sk
skbash
cd /path/to/sk-decisions
target/debug/sk sync-back sk \
--repo https://github.com/lambdamechanic/skills \
--skill-path sk \
--branch sk/add-sk-skill-doc \
--message "Add sk skill doc"What happens:
- prints both the temporary branch name and the upstream repo it pushed to, so you can follow up on GitHub immediately.
sk - The branch only needs to live long enough for you (or automation) to open a PR; the lockfile entry pins the pushed commit hash, so it’s safe to delete the branch once merged.
- gains a new entry for
skills.lock.jsonwith the push timestamp, digest, and commit ID; subsequentskruns stay green because the on-disk tree matches that digest.sk doctor --status
bash
cd /path/to/sk-decisions
target/debug/sk sync-back sk \
--repo https://github.com/lambdamechanic/skills \
--skill-path sk \
--branch sk/add-sk-skill-doc \
--message "Add sk skill doc"执行过程:
- 会打印临时分支名称和推送的上游仓库,以便你立即在GitHub上跟进。
sk - 该分支只需存在到你(或自动化)打开PR即可;lockfile条目会固定推送的提交哈希,因此合并后删除分支是安全的。
- 会新增一个
skills.lock.json的条目,包含推送时间戳、摘要和提交ID;后续运行sk会保持绿色,因为磁盘上的工作树与该摘要匹配。sk doctor --status
Guardrails
注意事项
- Always run /
bd updatesobd closematches any skill changes..beads/issues.jsonl - Never edit by hand. Let
skills.lock.json,sk install, orsk upgradeupdate it; commit the lockfile alongside the skill changes.sk remove - If reports
sk doctor --status, fix the local tree before runningdirtyorsk upgradeto avoid partial syncs.sk sync-back - skips skills with local edits and prints reminders to
sk upgrade --all; treat that as a temporary state and clean them up promptly so future upgrades stay automatic.sk sync-back <name> - When creating a new skill, always specify the upstream repo/path so can register it and refresh the lockfile automatically.
sk - Use (once implemented) to block local-only sources such as
sk precommitentries.file://
- 始终运行/
bd update,确保bd close与技能的任何更改保持一致。.beads/issues.jsonl - 切勿手动编辑。让
skills.lock.json、sk install或sk upgrade来更新它;提交技能更改时一并提交lockfile。sk remove - 若报告
sk doctor --status,请在运行dirty或sk upgrade前修复本地工作树,避免部分同步。sk sync-back - 会跳过有本地编辑的技能,并提醒运行
sk upgrade --all;将此视为临时状态并及时处理,以便未来的升级保持自动化。sk sync-back <name> - 创建新技能时,始终指定上游仓库/路径,以便能自动注册并刷新lockfile。
sk - 使用(待实现)来阻止本地源(如
sk precommit条目)。file://
Debug tips
调试技巧
- rebuilds missing installs or cache entries.
target/debug/sk doctor --apply - prints the absolute path of an installed skill and its cached repo clone.
target/debug/sk where <name> - Set to surface extra logging when diagnosing cache fetches or rsync failures.
SK_TRACE=1
- 可重建缺失的安装或缓存条目。
target/debug/sk doctor --apply - 会打印已安装技能的绝对路径及其缓存仓库克隆地址。
target/debug/sk where <name> - 设置可在诊断缓存获取或rsync失败时显示额外日志。
SK_TRACE=1