关于 Sharing Skills
这项技能指导贡献者将经过测试、适用范围广的技能从本地克隆提交到上游仓库,涵盖分支、提交、推送及使用 GitHub CLI 创建拉取请求。
主要功能
- 01同步上游仓库的流程
- 02创建功能分支
- 03技能提交与推送步骤
- 04使用 gh 创建拉取请求
适用场景
- 01贡献经过测试的通用技能
- 02提交技能更新以供审查
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ obra/ superpowers-skills --skill sharing-skills安装后在 Claude Code 中输入/sharing-skills确认已加载。
详细介绍
分享技能
概述
将本地分支中的技能贡献回上游仓库。
工作流: 分支 → 编辑/创建技能 → 提交 → 推送 → PR
何时分享
适合分享的情况:
- 技能适用范围广(并非特定于某个项目)
- 其他人也能受益的模式/技术
- 经过充分测试并有文档说明
- 遵循 skills/meta/writing-skills 指南
适合保留为个人技能的情况:
- 特定于某个项目或组织
- 仍处于实验阶段或不稳定
- 包含敏感信息
- 过于狭窄/小众,不适合一般用途
前提条件
- 已安装并完成身份验证的
ghCLI - 工作目录为
~/.config/superpowers/skills/(你的本地克隆) - 技能已通过测试(请参阅 skills/meta/writing-skills 了解 TDD 流程)
分享工作流
1. 确保你位于 Main 分支并已同步
cd ~/.config/superpowers/skills/
git checkout main
git pull upstream main
git push origin main # Push to your fork
2. 创建功能分支
# Branch name: add-skillname-skill
skill_name="your-skill-name"
git checkout -b "add-${skill_name}-skill"
3. 创建或编辑技能
# Work on your skill in skills/
# Create new skill or edit existing one
# Skill should be in skills/category/skill-name/SKILL.md
4. 提交更改
# Add and commit
git add skills/your-skill-name/
git commit -m "Add ${skill_name} skill
$(cat <<'EOF'
Brief description of what this skill does and why it's useful.
Tested with: [describe testing approach]
EOF
)"
5. 推送到你的 Fork
git push -u origin "add-${skill_name}-skill"
6. 创建拉取请求
# Create PR to upstream using gh CLI
gh pr create \
--repo upstream-org/upstream-repo \
--title "Add ${skill_name} skill" \
--body "$(cat <<'EOF'
## Summary
Brief description of the skill and what problem it solves.
## Testing
Describe how you tested this skill (pressure scenarios, baseline tests, etc.).
## Context
Any additional context about why this skill is needed and how it should be used.
EOF
)"
完整示例
以下是分享名为 "async-patterns" 的技能的完整示例:
# 1. Sync with upstream
cd ~/.config/superpowers/skills/
git checkout main
git pull upstream main
git push origin main
# 2. Create branch
git checkout -b "add-async-patterns-skill"
# 3. Create/edit the skill
# (Work on skills/async-patterns/SKILL.md)
# 4. Commit
git add skills/async-patterns/
git commit -m "Add async-patterns skill
Patterns for handling asynchronous operations in tests and application code.
Tested with: Multiple pressure scenarios testing agent compliance."
# 5. Push
git push -u origin "add-async-patterns-skill"
# 6. Create PR
gh pr create \
--repo upstream-org/upstream-repo \
--title "Add async-patterns skill" \
--body "## Summary
Patterns for handling asynchronous operations correctly in tests and application code.
## Testing
Tested with multiple application scenarios. Agents successfully apply patterns to new code.
## Context
Addresses common async pitfalls like race conditions, improper error handling, and timing issues."
PR 合并后
PR 合并后:
- 同步本地 Main 分支:
cd ~/.config/superpowers/skills/
git checkout main
git pull upstream main
git push origin main
- 删除功能分支:
git branch -d "add-${skill_name}-skill"
git push origin --delete "add-${skill_name}-skill"
故障排除
“gh: command not found”
- 安装 GitHub CLI:https://cli.github.com/
- 完成身份验证:
gh auth login
“Permission denied (publickey)”
- 检查 SSH 密钥:
gh auth status - 设置 SSH:https://docs.github.com/en/authentication
“Skill already exists”
- 你正在创建一个修改版本
- 考虑改用其他技能名称,或与该技能的维护者协调
PR 合并冲突
- 变基到最新的上游版本:
git fetch upstream && git rebase upstream/main - 解决冲突
- 强制推送:
git push -f origin your-branch
多技能贡献
请勿在一个 PR 中批量提交多个技能。
每个技能都应:
- 有自己的功能分支
- 有自己的 PR
- 可以独立审查
原因? 每个技能都可以独立审查、迭代和合并。
相关技能
- skills/meta/writing-skills - 如何创建经过充分测试的技能
评论
支持 Markdown