技能上游公关
- 作者仓库星标 282
- 许可证 MIT
- 作者仓库 asm
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 94 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @luongnv89 · MIT
- 上下文用量评级
- 中等消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
`gh repo fork --clone --remote`在您的帐户下创建分叉,将其克隆到本地,将`origin`设置为您的分叉,将`upstream`设置为原始存储库。在继续之前先用`git remote -v` 进行验证。创建一个专门的分支来进行改进:
如果用户给出了`path`,请使用它。否则:如果有多个匹配且没有给出`path`,则列出候选者并要求用户选择。永远不要猜测——错误的公关比延迟的公关更糟糕。将 `SKILL_PATH` 设置为包含所选 SKILL.md 的目录(不是文件本身) - `asm eval` 采用一个目录。
该技能不会重新实现改进循环。按照`skills/skill-auto-improver/SKILL.md`中的工作流程,以`$SKILL_PATH`为目标:该技能的第0阶段:捕获`.asm-improver/baseline.json`第1阶段:`asm eval --fix`第2-4阶段:85/8楼层的逐类别循环第5阶段:`.asm-improver/report.md`
读取自动改进器生成的两个文件: `.asm-improver/baseline.json` — 之前的快照 最新的 `.asm-improver/iter-N.json` — 后的快照 两者的提取:`overallScore`、`grade`
阅读`references/pr-template.md`并填写。该模板强调友好、建议式的语气。关键部分: 发生了什么变化 - 一句话摘要 之前/之后指标 - 包含总体分数、成绩和所有 7 个类别的表格 触及的文件 - 列出`$SKILL_PATH` 下的每个修改路径 进行的迭代 - 来自自动改进循环的 N 次(共 8 次)
在别人的仓库上创建 PR 是公开的并且很难逆转。在推送任何内容之前,请向用户显示: PR 标题 完整的 PR 正文(呈现的降价) 确切的差异 (`git diff upstream/<default-branch>`) 您将要运行的命令
批准后:切勿推送至`upstream`。切勿使用 `--no-verify` 或其他 hook-skip 标志。如果`gh pr create`失败,停止并报告——不要循环重试。打印`gh pr create`返回的PR URL,以便用户可以打开它。
# Skill Upstream PR
You are contributing quality improvements to someone else's open-source skill. The workflow is: fork → clone → improve via `skill-auto-improver` → push to fork → open a friendly suggestion PR upstream. You do not own the target repo. Every step assumes you are a polite contributor, not a maintainer.
## Repo Sync Before Edits (mandatory)
Before any modification to the cloned fork, pull the latest from the fork's tracked branch:
```bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"
```
If the working tree is dirty: stash, sync, pop. If `origin` is missing or conflicts occur: stop and ask the user. A stale fork that PRs yesterday's tree is worse than no PR.
## When to Use
- User shares a GitHub URL to a public skill repo and asks to "improve", "level up", or "contribute to" it
- User says "open a PR to this skill" or "suggest improvements upstream"
- The target skill scores below 85/8 on `asm eval` and the user wants the upstream author to benefit
Do **not** trigger for: editing a local skill with no upstream, authoring a brand-new skill, publishing to the ASM registry, or bulk-improving many repos in one pass. One skill → one PR.
## Prerequisites
Verify each before cloning anything. Stop and tell the user if any fails.
- `asm` on PATH (`command -v asm`)
- `gh` on PATH and authenticated (`gh auth status`)
- `git` on PATH
- Network access to GitHub
- Write access to your own GitHub account (for the fork)
## Input
The user provides a GitHub reference to a skill. Accept any of:
- `https://github.com/owner/repo`
- `https://github.com/owner/repo/tree/<branch>/<path/to/skill>`
- `github:owner/repo[#ref][:path]`
Normalize to `owner`, `repo`, optional `ref`, optional `path`. If `path` is not given and the repo has multiple `SKILL.md` files, ask the user which one.
## Workflow
Execute phases in order. Do not skip or reorder.
### Phase 0 — Fork and clone
```bash
cd "$(mktemp -d)"
gh repo fork "$OWNER/$REPO" --clone --remote
cd "$REPO"
# If a ref was provided:
git checkout "$REF"
```
`gh repo fork --clone --remote` creates the fork under your account, clones it locally, sets `origin` to your fork and `upstream` to the original repo. Verify with `git remote -v` before continuing.
Create a dedicated branch for the improvement:
```bash
git checkout -b "skill-upstream-pr/improve-$(date +%Y%m%d-%H%M%S)"
```
### Phase 1 — Locate the target SKILL.md
If the user gave a `path`, use it. Otherwise:
```bash
find . -maxdepth 5 -name "SKILL.md" -type f
```
If more than one match and no `path` was given, list the candidates and ask the user to pick. Never guess — a wrong PR is worse than a delayed one.
Set `SKILL_PATH` to the **directory** containing the chosen SKILL.md (not the file itself) — `asm eval` takes a directory.
### Phase 2 — Delegate to skill-auto-improver
This skill does not reimplement the improvement loop. Follow the workflow in `skills/skill-auto-improver/SKILL.md` with `$SKILL_PATH` as the target:
1. Phase 0 of that skill: capture `.asm-improver/baseline.json`
2. Phase 1: `asm eval --fix`
3. Phases 2-4: category-by-category loop with the 85/8 floor
4. Phase 5: `.asm-improver/report.md`
If the baseline already passes 85/8, stop and tell the user — no PR needed for a skill that already meets the floor. Offer to find a different skill or a different target.
### Phase 3 — Harvest metrics for the PR
Read two files produced by the auto-improver:
- `.asm-improver/baseline.json` — the before snapshot
- The latest `.asm-improver/iter-N.json` — the after snapshot
Extract for both:
- `overallScore`, `grade`
- Every `categories[].score` (7 categories)
- `topSuggestions` summary (for context, not quoted verbatim)
Compute deltas. If the overall score did not improve by at least 3 points **or** no category moved from below 8 to at least 8, stop and tell the user — the change isn't meaningful enough to justify a PR. Offer the auto-improver report as feedback they can share informally instead.
### Phase 4 — Build the PR body
Read `references/pr-template.md` and fill it in. The template enforces friendly, suggestion-style tone. Key sections:
- **What changed** — one-sentence summary
- **Before/after metrics** — table with overallScore, grade, and all 7 categories
- **Files touched** — list every modified path under `$SKILL_PATH`
- **Iterations taken** — N of 8 from the auto-improver loop
- **How to verify** — the `asm eval` command the maintainer can run locally
Tone rules (read `references/tone-guide.md`):
- Lead with "Hi — noticed X, wanted to share Y"
- Frame as a suggestion, not a fix: "happy to adjust if the direction doesn't fit"
- Never imply the maintainer did something wrong
- Thank them for open-sourcing the skill
- Close with "no obligation to merge — totally fine to close if this isn't the right direction"
### Phase 5 — Last-mile confirmation (mandatory)
Opening a PR on someone else's repo is public and hard to reverse. Before pushing anything, show the user:
1. The PR title
2. The full PR body (rendered markdown)
3. The exact diff (`git diff upstream/<default-branch>`)
4. The commands you are about to run
Ask the user to confirm. If they want edits, apply them and re-preview. Do not push until the user says "go" or equivalent.
### Phase 6 — Push and open the PR
After approval:
```bash
# Commit the changes
git add -A
git commit -m "$(cat <<'EOF'
improve SKILL.md: clarify triggers, add acceptance criteria, fix frontmatter
Suggested via skill-upstream-pr. See PR body for before/after metrics.
EOF
)"
# Push to the fork
git push -u origin "$(git rev-parse --abbrev-ref HEAD)"
# Open the PR upstream
gh pr create \
--repo "$OWNER/$REPO" \
--title "$PR_TITLE" \
--body-file .asm-improver/pr-body.md
```
Never push to `upstream`. Never use `--no-verify` or other hook-skip flags. If `gh pr create` fails, stop and report — do not retry in a loop.
Print the PR URL returned by `gh pr create` so the user can open it.
## Step Completion Reports (mandatory)
Emit a compact status block after each phase:
```
◆ Phase N — [phase name] ([N of 6])
··································································
[check 1]: √ pass
[check 2]: √ pass (note if relevant)
[check 3]: × fail — [reason]
Criteria: √ M/K met
______________________________
Result: PASS | FAIL | PARTIAL
```
Checks per phase:
- **Phase 0** — `Fork created`, `Clone succeeded`, `Branch created`, `Remotes correct`
- **Phase 1** — `SKILL.md located`, `Path unambiguous`
- **Phase 2** — `Baseline captured`, `Auto-improver ran`, `Final score >= 85`, `All categories >= 8`
- **Phase 3** — `Before/after delta >= 3 points OR category promoted`
- **Phase 4** — `PR body rendered`, `Tone checks passed`
- **Phase 5** — `User approved`
- **Phase 6** — `Push succeeded`, `PR opened`, `URL printed`
## Acceptance Criteria
- Fork + clone done via `gh repo fork --clone --remote` — never a direct clone of upstream
- Dedicated feature branch created before any edits
- `skill-auto-improver` workflow run on the target; baseline + final JSON captured under `.asm-improver/`
- Overall score improved by ≥ 3 points, OR at least one category moved from below 8 to ≥ 8
- PR body built from `references/pr-template.md` with the full before/after table
- User explicitly approved the PR preview before push
- `git push` targets `origin` (the fork), never `upstream`
- `gh pr create --repo $OWNER/$REPO` used — the PR targets the upstream repo
- PR URL printed to the user at the end
### Expected output
- A new branch on the user's fork of `$OWNER/$REPO`
- A public PR on `$OWNER/$REPO` with a before/after metrics table and friendly tone
- A local `.asm-improver/` directory with baseline, iterations, report, and `pr-body.md`
## Edge Cases
- **Skill already passes 85/8** — stop at Phase 2; do not open a PR for a skill that already meets the floor
- **Improvement too small** (< 3 point overall delta AND no category promoted) — stop at Phase 3; offer the auto-improver report as informal feedback instead
- **Multiple SKILL.md files in the repo** — ask the user which one; never batch
- **Fork already exists from a prior run** — `gh repo fork --clone --remote` reuses it; rebase on upstream's default branch before editing
- **Upstream force-pushed or rewrote history** — stop and ask the user; do not force-push the fork to "catch up"
- **`asm eval --fix` writes changes you disagree with** — revert `SKILL.md.bak` and do targeted edits only; don't ship the auto-fix if it harms the skill
- **Maintainer has a CONTRIBUTING.md or PR template** — read it before Phase 4 and align the PR body with their conventions; their template wins over ours
## References
- `references/pr-template.md` — PR title + body template with before/after table
- `references/tone-guide.md` — wording patterns for friendly, suggestion-style contributions
- `skills/skill-auto-improver/SKILL.md` — the improvement loop this skill delegates to
- `asm eval --help` — flag reference for the evaluator
按说明文件中的顺序排列。
编辑前同步仓库(强制)
何时使用
先决条件
输入
工作流程
文件/命令 -> skill-auto-improver · origin · asm eval · asm · command -v asm · gh auth status · git · https://github.com/owner/repo
内容校验值 -> 15e53b9f1038
当前原文的自动摘译,尚未人工审校。
编辑前同步仓库(强制)
在对克隆的分叉进行任何修改之前,请从分叉的跟踪分支中提取最新内容:如果工作树脏:存储、同步、弹出。如果
origin丢失或发生冲突:停止并询问用户。一个陈旧的叉子,对昨天的树进行 PR 比没有 PR 更糟糕。何时使用
用户将 GitHub URL 共享到公共技能存储库,并要求“改进”、“升级”或“做出贡献” 用户说“针对该技能打开 PR”或“建议上游改进” 目标技能在
asm eval上的得分低于 85/8,并且用户希望上游作者受益 不要触发以下情况:编辑没有上游的本地技能、创作全新技能、发布到 ASM 注册表或批量改进多项技能一次性回购。一项技能→一项公关。先决条件
在克隆任何东西之前验证每一个。如果有任何失败,请停止并告诉用户。
asm在 PATH 上 (command -v asm)gh在 PATH 上并经过身份验证 (gh auth status)git在 PATH 网络访问 GitHub输入
用户提供技能的 GitHub 参考。接受以下任意一项:
https://github.com/owner/repohttps://github.com/owner/repo/tree/<branch>/<path/to/skill>github:owner/repo[#ref][:path]标准化为owner、repo、可选ref、可选path。如果未给出path并且存储库有多个SKILL.md文件,请询问用户是哪一个。工作流程
按顺序执行阶段。不要跳过或重新排序。