Purpose
This Skill syncs local .claude/skills/ and references/ from the upstream GitHub repository Lylll9436/Paper-Polish-Workflow-skill. It downloads the latest SKILL.md files and reference documents, compares them with local versions, and updates any changed files.
Trigger
Activates when the user asks to:
- Update or sync skills from the remote repo
- 更新或同步技能包
Example invocations:
- "update skills"
- "sync skills from GitHub"
- "更新技能"
Modes
| Mode |
Default |
Behavior |
direct |
Yes |
Fetch, compare, update, report — no intermediate confirmation |
interactive |
|
Show diff summary before applying each update |
Default mode: direct
Workflow
Step 0: Workflow Memory Check
- Read
.planning/workflow-memory.json. If file missing or empty, skip to Step 1.
- Check if the last 1-2 log entries form a recognized pattern with
ppw:update that has appeared >= threshold times in the log. See skill-conventions.md > Workflow Memory > Pattern Detection for the full algorithm.
- If a pattern is found, present recommendation via AskUserQuestion:
- Question: "检测到常用流程:[pattern](已出现 N 次)。是否直接以 direct 模式运行 ppw:update?"
- Options: "Yes, proceed" / "No, continue normally"
- If user accepts: set mode to
direct, skip Ask Strategy questions.
- If user declines or AskUserQuestion unavailable: continue in normal mode.
Step 1: Pre-flight Check
- Verify
gh CLI is available and authenticated: gh auth status
- Verify the upstream repo is accessible:
gh api repos/Lylll9436/Paper-Polish-Workflow-skill --jq '.full_name'
- If either check fails, report the error and stop.
- Record workflow: Append
{"skill": "ppw:update", "ts": "<ISO timestamp>"} to .planning/workflow-memory.json. Create file as [] if missing. Drop oldest entry if log length >= 50.
Step 2: Fetch Remote File Index
Step 3: Compare and Update Skills
For each remote skill directory:
- Fetch the remote
SKILL.md content:gh api repos/Lylll9436/Paper-Polish-Workflow-skill/contents/.claude/skills/{skill-name}/SKILL.md --jq '.content' | base64 -d
- Read the local
.claude/skills/{skill-name}/SKILL.md if it exists.
- Compare the two:
- If local file does not exist → NEW skill, create directory and write file.
- If content differs → UPDATED, overwrite local file.
- If content is identical → UNCHANGED, skip.
- Track results for the final report.
In interactive mode: Before applying each update, show a summary of changes and ask for confirmation.
Step 4: Compare and Update References
For each remote reference file:
- Fetch the remote file content via
gh api with base64 decode.
- Read the local
references/{filename} if it exists.
- Compare and apply the same NEW/UPDATED/UNCHANGED logic as Step 3.
- For subdirectories (e.g.,
references/journals/, references/expression-patterns/), recurse into each file.
Step 5: Output Report
Present a summary table:
## Skills Update Report
| Skill | Status |
|-------|--------|
| polish-skill | ✓ Updated |
| de-ai-skill | - Unchanged |
| new-skill | + New |
## References Update Report
| File | Status |
|------|--------|
| expression-patterns.md | ✓ Updated |
| skill-conventions.md | - Unchanged |
**Summary:** {updated_count} updated, {new_count} new, {unchanged_count} unchanged
Output Contract
| Output |
Format |
Condition |
| Update report |
Markdown table |
Always produced |
| File count summary |
Text |
Always reported |
Edge Cases
| Situation |
Handling |
gh CLI not installed or not authenticated |
Report error, suggest gh auth login |
| Remote repo not accessible |
Report network/permission error |
| Local skill has modifications not in remote |
Overwrite with remote (remote is source of truth) |
| New skill in remote not present locally |
Create directory and write SKILL.md |
| Remote skill deleted but exists locally |
Keep local (do not delete; report as "local-only") |
| Reference subdirectory doesn't exist locally |
Create it |
Fallbacks
| Scenario |
Fallback |
gh api rate limited |
Wait and retry once, then report error |
| Base64 decode fails |
Try gh api with Accept: application/vnd.github.raw header |
| Single file fetch fails |
Skip file, continue with remaining, report in summary |
Conventions: references/skill-conventions.md
1---2name: ppw-update3description: Sync local skills and references from the GitHub repo. Triggers on update skills, sync skills, 更新技能, 同步技能4---5
6## Purpose
7
8This Skill syncs local `.claude/skills/` and `references/` from the upstream GitHub repository [Lylll9436/Paper-Polish-Workflow-skill](https://github.com/Lylll9436/Paper-Polish-Workflow-skill). It downloads the latest SKILL.md files and reference documents, compares them with local versions, and updates any changed files.
9
10## Trigger
11
12**Activates when the user asks to:**
13- Update or sync skills from the remote repo
14- 更新或同步技能包
15
16**Example invocations:**
17- "update skills"
18- "sync skills from GitHub"
19- "更新技能"
20
21## Modes
22
23| Mode | Default | Behavior |
24|------|---------|----------|
25| `direct` | Yes | Fetch, compare, update, report — no intermediate confirmation |
26| `interactive` | | Show diff summary before applying each update |
27
28**Default mode:** `direct`
29
30## Workflow
31
32### Step 0: Workflow Memory Check
33
34- Read `.planning/workflow-memory.json`. If file missing or empty, skip to Step 1.
35- Check if the last 1-2 log entries form a recognized pattern with `ppw:update` that has appeared >= threshold times in the log. See `skill-conventions.md > Workflow Memory > Pattern Detection` for the full algorithm.
36- If a pattern is found, present recommendation via AskUserQuestion:
37 - Question: "检测到常用流程:[pattern](已出现 N 次)。是否直接以 direct 模式运行 ppw:update?"
38 - Options: "Yes, proceed" / "No, continue normally"
39- If user accepts: set mode to `direct`, skip Ask Strategy questions.
40- If user declines or AskUserQuestion unavailable: continue in normal mode.
41
42### Step 1: Pre-flight Check
43
44- Verify `gh` CLI is available and authenticated: `gh auth status`
45- Verify the upstream repo is accessible: `gh api repos/Lylll9436/Paper-Polish-Workflow-skill --jq '.full_name'`
46- If either check fails, report the error and stop.
47- **Record workflow:** Append `{"skill": "ppw:update", "ts": "<ISO timestamp>"}` to `.planning/workflow-memory.json`. Create file as `[]` if missing. Drop oldest entry if log length >= 50.
48
49### Step 2: Fetch Remote File Index
50
51- List all skill directories from the remote repo:
52 ```bash
53 gh api repos/Lylll9436/Paper-Polish-Workflow-skill/contents/.claude/skills --jq '.[].name'
54 ```
55- List all reference files from the remote repo:
56 ```bash
57 gh api repos/Lylll9436/Paper-Polish-Workflow-skill/contents/references --jq '.[] | .name + " " + .type'
58 ```
59- For reference subdirectories (type=dir), also list their contents recursively.
60
61### Step 3: Compare and Update Skills
62
63For each remote skill directory:
64
651. Fetch the remote `SKILL.md` content:
66 ```bash
67 gh api repos/Lylll9436/Paper-Polish-Workflow-skill/contents/.claude/skills/{skill-name}/SKILL.md --jq '.content' | base64 -d
68 ```
692. Read the local `.claude/skills/{skill-name}/SKILL.md` if it exists.
703. Compare the two:
71 - If local file does not exist → **NEW** skill, create directory and write file.
72 - If content differs → **UPDATED**, overwrite local file.
73 - If content is identical → **UNCHANGED**, skip.
744. Track results for the final report.
75
76**In `interactive` mode:** Before applying each update, show a summary of changes and ask for confirmation.
77
78### Step 4: Compare and Update References
79
80For each remote reference file:
81
821. Fetch the remote file content via `gh api` with base64 decode.
832. Read the local `references/{filename}` if it exists.
843. Compare and apply the same NEW/UPDATED/UNCHANGED logic as Step 3.
854. For subdirectories (e.g., `references/journals/`, `references/expression-patterns/`), recurse into each file.
86
87### Step 5: Output Report
88
89Present a summary table:
90
91```
92## Skills Update Report
93
94| Skill | Status |
95|-------|--------|
96| polish-skill | ✓ Updated |
97| de-ai-skill | - Unchanged |
98| new-skill | + New |
99
100## References Update Report
101
102| File | Status |
103|------|--------|
104| expression-patterns.md | ✓ Updated |
105| skill-conventions.md | - Unchanged |
106
107**Summary:** {updated_count} updated, {new_count} new, {unchanged_count} unchanged
108```
109
110## Output Contract
111
112| Output | Format | Condition |
113|--------|--------|-----------|
114| Update report | Markdown table | Always produced |
115| File count summary | Text | Always reported |
116
117## Edge Cases
118
119| Situation | Handling |
120|-----------|----------|
121| `gh` CLI not installed or not authenticated | Report error, suggest `gh auth login` |
122| Remote repo not accessible | Report network/permission error |
123| Local skill has modifications not in remote | Overwrite with remote (remote is source of truth) |
124| New skill in remote not present locally | Create directory and write SKILL.md |
125| Remote skill deleted but exists locally | Keep local (do not delete; report as "local-only") |
126| Reference subdirectory doesn't exist locally | Create it |
127
128## Fallbacks
129
130| Scenario | Fallback |
131|----------|----------|
132| `gh api` rate limited | Wait and retry once, then report error |
133| Base64 decode fails | Try `gh api` with `Accept: application/vnd.github.raw` header |
134| Single file fetch fails | Skip file, continue with remaining, report in summary |
135
136---
137
138*Conventions: [references/skill-conventions.md](../../references/skill-conventions.md)*