@lylll9436/paper-polish-workflow-skill 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/ppw-abstract/SKILL.md +239 -0
- package/.claude/skills/ppw-caption/SKILL.md +284 -0
- package/.claude/skills/ppw-cover-letter/SKILL.md +230 -0
- package/.claude/skills/ppw-de-ai/SKILL.md +299 -0
- package/.claude/skills/ppw-experiment/SKILL.md +290 -0
- package/.claude/skills/ppw-literature/SKILL.md +237 -0
- package/.claude/skills/ppw-logic/SKILL.md +316 -0
- package/.claude/skills/ppw-polish/SKILL.md +265 -0
- package/.claude/skills/ppw-repo-to-paper/SKILL.md +460 -0
- package/.claude/skills/ppw-reviewer-simulation/SKILL.md +284 -0
- package/.claude/skills/ppw-team/SKILL.md +242 -0
- package/.claude/skills/ppw-translation/SKILL.md +264 -0
- package/.claude/skills/ppw-update/SKILL.md +156 -0
- package/.claude/skills/ppw-visualization/SKILL.md +250 -0
- package/CHANGELOG.md +53 -0
- package/CONTRIBUTING.md +106 -0
- package/CONTRIBUTING_CN.md +106 -0
- package/LICENSE +21 -0
- package/README.md +313 -0
- package/examples/abstract-polishing-session.md +263 -0
- package/package.json +38 -0
- package/paper-polish-workflow/SKILL.md +160 -0
- package/references/anti-ai-patterns/sentence-patterns.md +33 -0
- package/references/anti-ai-patterns/transitions-and-tone.md +32 -0
- package/references/anti-ai-patterns/vocabulary.md +36 -0
- package/references/anti-ai-patterns.md +56 -0
- package/references/bilingual-output.md +95 -0
- package/references/body-generation-rules.md +121 -0
- package/references/expression-patterns/conclusions-and-claims.md +41 -0
- package/references/expression-patterns/geography-domain.md +50 -0
- package/references/expression-patterns/introduction-and-gap.md +41 -0
- package/references/expression-patterns/methods-and-data.md +41 -0
- package/references/expression-patterns/results-and-discussion.md +41 -0
- package/references/expression-patterns.md +67 -0
- package/references/journals/ceus.md +121 -0
- package/references/repo-patterns.md +96 -0
- package/references/skill-conventions.md +273 -0
- package/references/skill-skeleton.md +169 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ppw:abstract
|
|
3
|
+
description: >-
|
|
4
|
+
Generate or optimize academic paper abstracts using the 5-sentence Farquhar formula.
|
|
5
|
+
Supports generate-from-scratch and restructure-existing paths. Produces labeled output
|
|
6
|
+
for formula verification plus a clean version for clipboard use.
|
|
7
|
+
摘要生成与优化,支持从原始材料生成或改写现有摘要。
|
|
8
|
+
triggers:
|
|
9
|
+
primary_intent: generate or optimize academic paper abstract
|
|
10
|
+
examples:
|
|
11
|
+
- "Write an abstract for my paper"
|
|
12
|
+
- "帮我写摘要"
|
|
13
|
+
- "Optimize my existing abstract"
|
|
14
|
+
- "改写我的摘要,符合五句话公式"
|
|
15
|
+
- "Generate a submission-ready abstract for CEUS"
|
|
16
|
+
- "帮我生成一个投稿摘要"
|
|
17
|
+
- "Restructure my abstract using the Farquhar formula"
|
|
18
|
+
- "优化摘要让它更符合学术规范"
|
|
19
|
+
tools:
|
|
20
|
+
- Read
|
|
21
|
+
- Write
|
|
22
|
+
- Structured Interaction
|
|
23
|
+
references:
|
|
24
|
+
required:
|
|
25
|
+
- references/expression-patterns.md
|
|
26
|
+
- references/bilingual-output.md
|
|
27
|
+
leaf_hints:
|
|
28
|
+
- references/expression-patterns/introduction-and-gap.md
|
|
29
|
+
- references/expression-patterns/results-and-discussion.md
|
|
30
|
+
- references/expression-patterns/conclusions-and-claims.md
|
|
31
|
+
- references/expression-patterns/methods-and-data.md
|
|
32
|
+
input_modes:
|
|
33
|
+
- file
|
|
34
|
+
- pasted_text
|
|
35
|
+
output_contract:
|
|
36
|
+
- labeled_abstract
|
|
37
|
+
- clean_abstract
|
|
38
|
+
- bilingual_abstract
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Purpose
|
|
42
|
+
|
|
43
|
+
This Skill generates or optimizes academic paper abstracts using the locked 5-sentence Farquhar formula: [1: Contribution], [2: Difficulty], [3: Method], [4: Evidence], [5: Key Result]. It operates on two mutually exclusive paths — generate a new abstract from raw materials (paper sections, bullet points, or a brief description), or restructure an existing abstract to comply with the formula. Both paths produce labeled output first so users can verify formula compliance sentence by sentence, followed by a clean plain-paragraph version ready for clipboard use. When a target journal is specified, journal-specific style conventions are applied.
|
|
44
|
+
|
|
45
|
+
## Trigger
|
|
46
|
+
|
|
47
|
+
**Activates when the user asks to:**
|
|
48
|
+
- Write, generate, or create an abstract from paper content
|
|
49
|
+
- Optimize, restructure, or rewrite an existing abstract
|
|
50
|
+
- 写摘要、生成摘要、改写摘要、优化摘要
|
|
51
|
+
|
|
52
|
+
**Example invocations:**
|
|
53
|
+
- "Write an abstract for my paper" / "帮我写摘要"
|
|
54
|
+
- "Optimize my existing abstract" / "改写我的摘要"
|
|
55
|
+
- "Restructure this abstract using the 5-sentence formula"
|
|
56
|
+
- "Generate a CEUS-ready abstract from my introduction and results"
|
|
57
|
+
|
|
58
|
+
## Modes
|
|
59
|
+
|
|
60
|
+
| Mode | Default | Behavior |
|
|
61
|
+
|------|---------|----------|
|
|
62
|
+
| `direct` | Yes | Single-pass abstract output using the 5-sentence formula |
|
|
63
|
+
| `batch` | | Not supported — abstract requires full paper context |
|
|
64
|
+
|
|
65
|
+
**Default mode:** `direct`. User provides content and receives labeled + clean abstract in one pass.
|
|
66
|
+
|
|
67
|
+
**Path selection (within direct mode):**
|
|
68
|
+
- Input reads like a formed abstract → restructure path
|
|
69
|
+
- Input is raw content (sections, bullets, "my paper is about...") → generate path
|
|
70
|
+
- Ambiguous → ask before proceeding
|
|
71
|
+
|
|
72
|
+
## References
|
|
73
|
+
|
|
74
|
+
### Required (always loaded)
|
|
75
|
+
|
|
76
|
+
| File | Purpose |
|
|
77
|
+
|------|---------|
|
|
78
|
+
| `references/expression-patterns.md` | Academic expression patterns overview |
|
|
79
|
+
|
|
80
|
+
### Leaf Hints (loaded when needed)
|
|
81
|
+
|
|
82
|
+
| File | When to Load |
|
|
83
|
+
|------|--------------|
|
|
84
|
+
| `references/expression-patterns/introduction-and-gap.md` | Contribution and gap framing (sentences 1-2) |
|
|
85
|
+
| `references/expression-patterns/conclusions-and-claims.md` | Calibrated claim language (sentences 1 and 5) |
|
|
86
|
+
| `references/expression-patterns/methods-and-data.md` | Method description (sentence 3, when weak) |
|
|
87
|
+
| `references/expression-patterns/results-and-discussion.md` | Evidence and result framing (sentences 4-5) |
|
|
88
|
+
|
|
89
|
+
### Journal Template (conditional)
|
|
90
|
+
|
|
91
|
+
- When user specifies a target journal, load `references/journals/[journal].md`.
|
|
92
|
+
- If template missing, **refuse**: "Journal template for [X] not found. Available: CEUS."
|
|
93
|
+
- If no journal specified, ask once; if declined, apply general academic style.
|
|
94
|
+
|
|
95
|
+
## Ask Strategy
|
|
96
|
+
|
|
97
|
+
**Before starting, ask about:**
|
|
98
|
+
1. Path: does the user have an existing abstract to restructure, or raw content to generate from? (skip if clear from input)
|
|
99
|
+
2. Target journal if not specified (ask once; if declined, use general academic style)
|
|
100
|
+
3. Word limit if known (typically 150-300 words; ask once)
|
|
101
|
+
|
|
102
|
+
**Path inference:**
|
|
103
|
+
- User pastes text that reads like an abstract → restructure path
|
|
104
|
+
- User provides sections, bullets, or "my paper is about..." → generate path
|
|
105
|
+
- Ambiguous → ask: "Do you have an existing abstract to restructure, or shall I generate one from your materials?"
|
|
106
|
+
|
|
107
|
+
**Rules:**
|
|
108
|
+
- Never ask more than 2 questions before starting.
|
|
109
|
+
- Skip path question if inference is clear from input.
|
|
110
|
+
- In `direct` mode with sufficient context, proceed without pre-questions.
|
|
111
|
+
|
|
112
|
+
## Workflow
|
|
113
|
+
|
|
114
|
+
### Step 0: Workflow Memory Check
|
|
115
|
+
|
|
116
|
+
- Read `.planning/workflow-memory.json`. If file missing or empty, skip to Step 1.
|
|
117
|
+
- Check if the last 1-2 log entries form a recognized pattern with `ppw:abstract` that has appeared >= threshold times in the log. See `skill-conventions.md > Workflow Memory > Pattern Detection` for the full algorithm.
|
|
118
|
+
- If a pattern is found, present recommendation via AskUserQuestion:
|
|
119
|
+
- Question: "检测到常用流程:[pattern](已出现 N 次)。是否直接以 direct 模式运行 ppw:abstract?"
|
|
120
|
+
- Options: "Yes, proceed" / "No, continue normally"
|
|
121
|
+
- If user accepts: set mode to `direct`, skip Ask Strategy questions.
|
|
122
|
+
- If user declines or AskUserQuestion unavailable: continue in normal mode.
|
|
123
|
+
|
|
124
|
+
### Step 1: Collect Context
|
|
125
|
+
|
|
126
|
+
- Load `references/expression-patterns.md` overview.
|
|
127
|
+
- If journal specified, load `references/journals/[journal].md`. If missing, refuse with: "Journal template for [X] not found. Available: CEUS."
|
|
128
|
+
- Read user input: file via Read tool, or pasted text from conversation.
|
|
129
|
+
- Determine path: restructure if input reads like a formed abstract; generate if raw materials. Ask if ambiguous.
|
|
130
|
+
- **Opt-out check:** Scan the user's trigger prompt for any of these phrases (case-insensitive, exact phrase match): `english only`, `no bilingual`, `only english`, `不要中文`. Store result as `bilingual_mode` (true/false). This flag governs Step 3 output below.
|
|
131
|
+
- **Record workflow:** Append `{"skill": "ppw:abstract", "ts": "<ISO timestamp>"}` to `.planning/workflow-memory.json`. Create file as `[]` if missing. Drop oldest entry if log length >= 50.
|
|
132
|
+
|
|
133
|
+
### Step 2a: Generate Path (raw content provided)
|
|
134
|
+
|
|
135
|
+
- Load `references/expression-patterns/introduction-and-gap.md` for contribution and gap framing.
|
|
136
|
+
- Load `references/expression-patterns/conclusions-and-claims.md` for calibrated claim language.
|
|
137
|
+
- Load `references/expression-patterns/methods-and-data.md` if the user's method description is weak.
|
|
138
|
+
- Synthesize sentence 1 (contribution): start with "We introduce / propose / demonstrate / show..."
|
|
139
|
+
- Synthesize sentence 2 (difficulty): why this problem is hard or why it matters.
|
|
140
|
+
- Synthesize sentence 3 (method): how the problem is solved, with key technical terminology.
|
|
141
|
+
- Load `references/expression-patterns/results-and-discussion.md` for sentences 4-5.
|
|
142
|
+
- Synthesize sentence 4 (evidence): what was measured, on what benchmark or dataset.
|
|
143
|
+
- Synthesize sentence 5 (key result): the most important number or qualitative outcome.
|
|
144
|
+
|
|
145
|
+
### Step 2b: Restructure Path (existing abstract provided)
|
|
146
|
+
|
|
147
|
+
- Load the same leaf hints as the generate path.
|
|
148
|
+
- Map each existing sentence to one of the 5 formula positions.
|
|
149
|
+
- Rewrite each sentence to tighten formula compliance while preserving the user's content.
|
|
150
|
+
- **Internal audit:** After restructuring, verify all 5 positions are filled.
|
|
151
|
+
- Flag any missing position with `[MISSING: position-name]` — never silently drop content.
|
|
152
|
+
|
|
153
|
+
### Step 3: Output
|
|
154
|
+
|
|
155
|
+
- Present the labeled version first (formula positions explicit, see Output Contract).
|
|
156
|
+
- Present the clean version (plain paragraph, no labels) separated by `---`.
|
|
157
|
+
- If the user wants to save: offer to write to a file using the Write tool.
|
|
158
|
+
- If word limit was specified, report word count; warn if over limit.
|
|
159
|
+
- **Bilingual display:** If `bilingual_mode` is true: after presenting the labeled version and after presenting the clean version, append a `> **[Chinese]** ...` blockquote for each sentence of the abstract. Use a header: "**双语对照 / Bilingual Comparison:**" before the blockquotes. Format:
|
|
160
|
+
|
|
161
|
+
> **[Chinese]** [1: 贡献] ...
|
|
162
|
+
> **[Chinese]** [2: 难度] ...
|
|
163
|
+
> **[Chinese]** [3: 方法] ...
|
|
164
|
+
> **[Chinese]** [4: 证据] ...
|
|
165
|
+
> **[Chinese]** [5: 关键结果] ...
|
|
166
|
+
|
|
167
|
+
Each blockquote corresponds to one Farquhar formula sentence. Label prefixes in Chinese are for readability only -- the clean version Chinese follows the plain paragraph structure without labels.
|
|
168
|
+
- If `bilingual_mode` is false (opt-out detected): skip bilingual display entirely.
|
|
169
|
+
- Optionally recommend the Polish Skill for further expression refinement.
|
|
170
|
+
|
|
171
|
+
## Output Contract
|
|
172
|
+
|
|
173
|
+
| Output | Format | Condition |
|
|
174
|
+
|--------|--------|-----------|
|
|
175
|
+
| `labeled_abstract` | Labeled 5-sentence block with `[N: Position]` markers | Always |
|
|
176
|
+
| `clean_abstract` | Plain paragraph with no labels, separated by `---` | Always |
|
|
177
|
+
| Word count | Integer | When user specified a word limit |
|
|
178
|
+
| `bilingual_abstract` | `> **[Chinese]** ...` blockquotes in session (one per sentence) | When bilingual_mode is true (default). Skipped when opt-out detected. |
|
|
179
|
+
|
|
180
|
+
**Exact labeled format:**
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
[1: Contribution] We propose...
|
|
184
|
+
[2: Difficulty] Despite growing interest in X, existing approaches fail to...
|
|
185
|
+
[3: Method] We address this by...
|
|
186
|
+
[4: Evidence] Evaluated on N datasets...
|
|
187
|
+
[5: Key Result] Our approach achieves...
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
Clean version:
|
|
191
|
+
We propose... Despite growing interest in X, existing approaches fail to... We address this by... Evaluated on N datasets... Our approach achieves...
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Edge Cases
|
|
195
|
+
|
|
196
|
+
| Situation | Handling |
|
|
197
|
+
|-----------|----------|
|
|
198
|
+
| Input is ambiguous (not clearly raw content or existing abstract) | Ask before proceeding: "Do you have an existing abstract to restructure, or shall I generate one?" |
|
|
199
|
+
| Existing abstract has fewer than 5 sentences | Run restructure path; flag missing positions with `[MISSING: ...]` |
|
|
200
|
+
| User specifies word limit | Count words in output; warn if over limit with exact count |
|
|
201
|
+
| Journal specified but template missing | Refuse: "Journal template for [X] not found. Available: CEUS." |
|
|
202
|
+
| Formula position cannot be filled from available content | Flag with `[MISSING: difficulty statement]`; do not invent content |
|
|
203
|
+
| User provides only a title or one-sentence summary | Ask for more content before proceeding |
|
|
204
|
+
|
|
205
|
+
## Fallbacks
|
|
206
|
+
|
|
207
|
+
| Scenario | Fallback |
|
|
208
|
+
|----------|----------|
|
|
209
|
+
| Structured Interaction unavailable | Ask 1-2 plain-text questions (path + journal) |
|
|
210
|
+
| Expression pattern leaf missing | Proceed with general academic register; warn user |
|
|
211
|
+
| Journal template missing (no journal specified) | Ask once; if declined, use general academic style |
|
|
212
|
+
| Write tool fails | Present output in conversation instead |
|
|
213
|
+
|
|
214
|
+
## Examples
|
|
215
|
+
|
|
216
|
+
**Invocation:** "Help me restructure my abstract to follow the 5-sentence formula."
|
|
217
|
+
|
|
218
|
+
User pastes: "In this paper we study urban mobility patterns using GPS data. We find that mobility is highly predictable. We propose a model called MobNet. It outperforms existing approaches by 12% on the next-location prediction task."
|
|
219
|
+
|
|
220
|
+
**Output:**
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
[1: Contribution] We propose MobNet, a model for predicting urban mobility using GPS data.
|
|
224
|
+
[2: Difficulty] Despite the prevalence of GPS data, existing mobility models fail to capture [MISSING: difficulty statement — why prediction is hard or why existing approaches fall short].
|
|
225
|
+
[3: Method] MobNet addresses this by [MISSING: method description — how MobNet works].
|
|
226
|
+
[4: Evidence] Evaluated on a next-location prediction task using GPS traces from urban environments.
|
|
227
|
+
[5: Key Result] MobNet outperforms existing approaches by 12% on next-location prediction.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
Clean version:
|
|
231
|
+
We propose MobNet, a model for predicting urban mobility using GPS data. [MISSING: difficulty statement]. MobNet addresses this by [MISSING: method description]. Evaluated on a next-location prediction task using GPS traces from urban environments. MobNet outperforms existing approaches by 12% on next-location prediction.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Two formula positions are flagged as missing. Please provide: (1) why mobility prediction is hard or what existing approaches fail to do, and (2) a brief description of how MobNet works.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
*Skill: abstract-skill*
|
|
239
|
+
*Conventions: references/skill-conventions.md*
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ppw:caption
|
|
3
|
+
description: >-
|
|
4
|
+
Generate or optimize figure/table captions for academic papers.
|
|
5
|
+
Geography-aware: study area, CRS notation, data source.
|
|
6
|
+
Writes output to .tex file. 图表标题生成与优化。
|
|
7
|
+
triggers:
|
|
8
|
+
primary_intent: generate or optimize figure/table caption
|
|
9
|
+
examples:
|
|
10
|
+
- "Write a caption for my figure"
|
|
11
|
+
- "帮我写图表标题"
|
|
12
|
+
- "Optimize this table caption"
|
|
13
|
+
- "优化我的图表说明"
|
|
14
|
+
- "Generate a CEUS-ready figure caption"
|
|
15
|
+
- "帮我生成符合期刊要求的图题"
|
|
16
|
+
tools:
|
|
17
|
+
- Read
|
|
18
|
+
- Write
|
|
19
|
+
- Structured Interaction
|
|
20
|
+
references:
|
|
21
|
+
required:
|
|
22
|
+
- references/expression-patterns.md
|
|
23
|
+
leaf_hints:
|
|
24
|
+
- references/expression-patterns/geography-domain.md
|
|
25
|
+
input_modes:
|
|
26
|
+
- file
|
|
27
|
+
- pasted_text
|
|
28
|
+
output_contract:
|
|
29
|
+
- caption_latex
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Purpose
|
|
33
|
+
|
|
34
|
+
This Skill generates or optimizes LaTeX figure and table captions for academic papers. For spatial figures (maps, GIS outputs, aerial photos), the Skill proactively collects study area, data source, and CRS metadata using a geography-aware Ask Strategy. For non-spatial figures and tables, geography questions are skipped entirely. Output is written directly to the user's `.tex` file at the correct `\caption{}` location using the Read-before-Write pattern. When a target journal is specified, caption length and style are adapted to the journal template.
|
|
35
|
+
|
|
36
|
+
## Core Prompt
|
|
37
|
+
|
|
38
|
+
> Source: [awesome-ai-research-writing](https://github.com/Leey21/awesome-ai-research-writing) — 生成图的标题 + 生成表的标题
|
|
39
|
+
|
|
40
|
+
**图标题 Prompt:**
|
|
41
|
+
|
|
42
|
+
````markdown
|
|
43
|
+
# Role
|
|
44
|
+
你是一位经验丰富的学术编辑,擅长撰写精准、规范的论文插图标题。
|
|
45
|
+
|
|
46
|
+
# Task
|
|
47
|
+
请将我提供的【中文描述】转化为符合顶级会议规范的【英文图标题】。
|
|
48
|
+
|
|
49
|
+
# Constraints
|
|
50
|
+
1. 格式规范:
|
|
51
|
+
- 如果翻译结果是名词性短语:请使用 Title Case 格式,即所有实词的首字母大写,末尾不加句号。
|
|
52
|
+
- 如果翻译结果是完整句子:请使用 Sentence case 格式,即仅第一个单词的首字母大写,其余小写(专有名词除外),末尾必须加句号。
|
|
53
|
+
|
|
54
|
+
2. 写作风格:
|
|
55
|
+
- 极简原则:去除 The figure shows 或 This diagram illustrates 这类冗余开头,直接描述图表内容(例如直接以 Architecture, Performance comparison, Visualization 开头)。
|
|
56
|
+
- 去 AI 味:尽量避免使用复杂的生僻词,保持用词平实准确。
|
|
57
|
+
|
|
58
|
+
3. 输出格式:
|
|
59
|
+
- 只输出翻译后的英文标题文本。
|
|
60
|
+
- 不要包含 Figure 1: 这样的前缀,只输出内容本身。
|
|
61
|
+
- 必须对特殊字符进行转义(例如:`%`、`_`、`&`)。
|
|
62
|
+
- 保持数学公式原样(保留 `$` 符号)。
|
|
63
|
+
````
|
|
64
|
+
|
|
65
|
+
**表标题 Prompt:**
|
|
66
|
+
|
|
67
|
+
````markdown
|
|
68
|
+
# Role
|
|
69
|
+
你是一位经验丰富的学术编辑,擅长撰写精准、规范的论文表格标题。
|
|
70
|
+
|
|
71
|
+
# Task
|
|
72
|
+
请将我提供的【中文描述】转化为符合顶级会议规范的【英文表标题】。
|
|
73
|
+
|
|
74
|
+
# Constraints
|
|
75
|
+
1. 格式规范:
|
|
76
|
+
- 如果翻译结果是名词性短语:请使用 Title Case 格式,即所有实词的首字母大写,末尾不加句号。
|
|
77
|
+
- 如果翻译结果是完整句子:请使用 Sentence case 格式,即仅第一个单词的首字母大写,其余小写(专有名词除外),末尾必须加句号。
|
|
78
|
+
|
|
79
|
+
2. 写作风格:
|
|
80
|
+
- 常用句式:对于表格,推荐使用 Comparison with, Ablation study on, Results on 等标准学术表达。
|
|
81
|
+
- 去 AI 味:尽量避免使用 showcase, depict 等词,直接使用 show, compare, present。
|
|
82
|
+
|
|
83
|
+
3. 输出格式:
|
|
84
|
+
- 只输出翻译后的英文标题文本。
|
|
85
|
+
- 不要包含 Table 1: 这样的前缀,只输出内容本身。
|
|
86
|
+
- 必须对特殊字符进行转义(例如:`%`、`_`、`&`)。
|
|
87
|
+
- 保持数学公式原样(保留 `$` 符号)。
|
|
88
|
+
````
|
|
89
|
+
|
|
90
|
+
## Trigger
|
|
91
|
+
|
|
92
|
+
**Activates when the user asks to:**
|
|
93
|
+
- Write, generate, or create a caption for a figure or table
|
|
94
|
+
- Optimize, improve, or rewrite an existing weak caption
|
|
95
|
+
- 写图题、生成图表说明、优化标题、改写图表描述
|
|
96
|
+
|
|
97
|
+
**Example invocations:**
|
|
98
|
+
- "Write a caption for my figure" / "帮我写图表标题"
|
|
99
|
+
- "Optimize this table caption" / "优化我的图表说明"
|
|
100
|
+
- "Generate a CEUS-ready figure caption" / "帮我生成符合期刊要求的图题"
|
|
101
|
+
- "Improve the caption for my map figure"
|
|
102
|
+
- "帮我生成符合CEUS要求的图题"
|
|
103
|
+
|
|
104
|
+
## Modes
|
|
105
|
+
|
|
106
|
+
| Mode | Default | Behavior |
|
|
107
|
+
|------|---------|----------|
|
|
108
|
+
| `direct` | Yes | Single-pass caption output after Ask Strategy questions |
|
|
109
|
+
| `batch` | | Not supported — each caption requires its own figure/table context |
|
|
110
|
+
|
|
111
|
+
**Default mode:** `direct`. User provides figure/table context and receives a complete LaTeX caption in one pass.
|
|
112
|
+
|
|
113
|
+
**Path selection (within direct mode):**
|
|
114
|
+
- User provides an existing caption to improve → Optimize path
|
|
115
|
+
- User provides content description only → Generate path
|
|
116
|
+
- Ambiguous → ask: "Do you have an existing caption to improve, or shall I generate one from your description?"
|
|
117
|
+
|
|
118
|
+
## References
|
|
119
|
+
|
|
120
|
+
### Required (always loaded)
|
|
121
|
+
|
|
122
|
+
| File | Purpose |
|
|
123
|
+
|------|---------|
|
|
124
|
+
| `references/expression-patterns.md` | Academic expression patterns overview — always loaded as entrypoint |
|
|
125
|
+
|
|
126
|
+
### Leaf Hints (loaded conditionally)
|
|
127
|
+
|
|
128
|
+
| File | When to Load |
|
|
129
|
+
|------|--------------|
|
|
130
|
+
| `references/expression-patterns/geography-domain.md` | When figure type is spatial (map, photo, GIS output); provides study area framing, spatial description patterns, planning language |
|
|
131
|
+
|
|
132
|
+
### Journal Template (conditional)
|
|
133
|
+
|
|
134
|
+
- When user specifies a target journal, load `references/journals/[journal].md`.
|
|
135
|
+
- If template missing, **refuse**: "Journal template for [X] not found. Available: CEUS."
|
|
136
|
+
- If no journal specified, ask once; if declined, use general academic style.
|
|
137
|
+
|
|
138
|
+
## Ask Strategy
|
|
139
|
+
|
|
140
|
+
**Before starting, collect:**
|
|
141
|
+
|
|
142
|
+
1. **Figure or table type** (always required — determines whether spatial questions apply):
|
|
143
|
+
map / chart / diagram / photo / data table?
|
|
144
|
+
|
|
145
|
+
2. **Target journal** if not specified (ask once; if declined, use general academic style)
|
|
146
|
+
|
|
147
|
+
3. **If figure type is spatial (map, photo, GIS output):**
|
|
148
|
+
- Study area / city name (e.g., "Beijing Chaoyang District")
|
|
149
|
+
- Data source brief (e.g., "OpenStreetMap 2023", "Landsat-8 imagery")
|
|
150
|
+
- CRS (ask only if user knows it; skip if uncertain — do not press)
|
|
151
|
+
- Key legend items (ask only if map or chart has a visible legend)
|
|
152
|
+
|
|
153
|
+
4. **If figure type is non-spatial (bar chart, line chart, schematic, data table):**
|
|
154
|
+
Skip all geography questions. Ask only for data source if not mentioned.
|
|
155
|
+
|
|
156
|
+
**Rules:**
|
|
157
|
+
- Never ask more than 3 questions before proceeding
|
|
158
|
+
- Missing spatial metadata (CRS, legend): skip the clause gracefully — do NOT insert `[MISSING: ...]` stubs in caption output
|
|
159
|
+
- If `.tex` file has multiple `\caption{}` commands: ask which `\label{}` (e.g., `\label{fig:study_area}`) is the target before writing
|
|
160
|
+
- In `direct` mode with sufficient context already provided, proceed without pre-questions
|
|
161
|
+
|
|
162
|
+
## Workflow
|
|
163
|
+
|
|
164
|
+
### Step 0: Workflow Memory Check
|
|
165
|
+
|
|
166
|
+
- Read `.planning/workflow-memory.json`. If file missing or empty, skip to Step 1.
|
|
167
|
+
- Check if the last 1-2 log entries form a recognized pattern with `ppw:caption` that has appeared >= threshold times in the log. See `skill-conventions.md > Workflow Memory > Pattern Detection` for the full algorithm.
|
|
168
|
+
- If a pattern is found, present recommendation via AskUserQuestion:
|
|
169
|
+
- Question: "检测到常用流程:[pattern](已出现 N 次)。是否直接以 direct 模式运行 ppw:caption?"
|
|
170
|
+
- Options: "Yes, proceed" / "No, continue normally"
|
|
171
|
+
- If user accepts: set mode to `direct`, skip Ask Strategy questions.
|
|
172
|
+
- If user declines or AskUserQuestion unavailable: continue in normal mode.
|
|
173
|
+
|
|
174
|
+
### Step 1: Collect Context
|
|
175
|
+
|
|
176
|
+
- Load `references/expression-patterns.md` overview.
|
|
177
|
+
- If journal specified, load `references/journals/[journal].md`. If missing, refuse: "Journal template for [X] not found. Available: CEUS."
|
|
178
|
+
- Read user input: if file provided, use Read tool; otherwise accept pasted text description.
|
|
179
|
+
- Run Ask Strategy questions to fill any gaps not already answered by input.
|
|
180
|
+
- Determine path: if user provides an existing caption to improve → Optimize path; if user provides content description only → Generate path; ask if ambiguous.
|
|
181
|
+
- **Record workflow:** Append `{"skill": "ppw:caption", "ts": "<ISO timestamp>"}` to `.planning/workflow-memory.json`. Create file as `[]` if missing. Drop oldest entry if log length >= 50.
|
|
182
|
+
|
|
183
|
+
### Step 2a: Generate Path (new caption from content description)
|
|
184
|
+
|
|
185
|
+
- **Follow the Core Prompt constraints above** (figure or table prompt as applicable) as the primary instruction set for caption generation.
|
|
186
|
+
|
|
187
|
+
- If figure type is spatial: load `references/expression-patterns/geography-domain.md`.
|
|
188
|
+
- Apply figure vs. table branching logic:
|
|
189
|
+
|
|
190
|
+
| Type | Caption Focus |
|
|
191
|
+
|------|--------------|
|
|
192
|
+
| Map | Spatial extent, CRS (if provided), data source, scale bar mention |
|
|
193
|
+
| Chart / Diagram | Variables described, trend or comparison purpose, data source |
|
|
194
|
+
| Photo | Subject, location (if provided), data source or photographer credit |
|
|
195
|
+
| Table | Row/column semantics, statistical context, units, data source |
|
|
196
|
+
|
|
197
|
+
- Compose caption using locked three-part LaTeX format:
|
|
198
|
+
`\caption{[Subject / study area]. [Key content description]. [Data source statement].}`
|
|
199
|
+
- Adapt length and style to journal template if loaded.
|
|
200
|
+
|
|
201
|
+
### Step 2b: Optimize Path (improve existing weak caption)
|
|
202
|
+
|
|
203
|
+
- If figure type is spatial: load `references/expression-patterns/geography-domain.md`.
|
|
204
|
+
- Review existing caption for: completeness (subject/content/source), spatial metadata gaps, terminology precision, journal length compliance.
|
|
205
|
+
- Rewrite using the same branching logic and three-part format as the Generate path.
|
|
206
|
+
- Do not introduce `[MISSING: ...]` placeholders; generate from available content.
|
|
207
|
+
|
|
208
|
+
### Step 3: Write to File
|
|
209
|
+
|
|
210
|
+
- Read the target `.tex` file (required before Write — locate `\caption{}` or `\caption[]{}` insertion point).
|
|
211
|
+
- If multiple `\caption{}` commands exist in the file: apply Ask Strategy rule to confirm target `\label{}` before writing.
|
|
212
|
+
- Replace existing `\caption{}` content (or insert if empty) at the identified location.
|
|
213
|
+
- Write updated file.
|
|
214
|
+
- If Write tool fails: present final caption in conversation with instructions to paste at `\caption{}` location.
|
|
215
|
+
|
|
216
|
+
## Output Contract
|
|
217
|
+
|
|
218
|
+
| Output | Format | Condition |
|
|
219
|
+
|--------|--------|-----------|
|
|
220
|
+
| `caption_latex` | LaTeX `\caption{...}` string written to `.tex` file | Always — file input and Write succeeds |
|
|
221
|
+
| `caption_latex` | LaTeX `\caption{...}` string in conversation | Fallback — Write fails, or pasted text input |
|
|
222
|
+
|
|
223
|
+
**LaTeX caption format examples:**
|
|
224
|
+
|
|
225
|
+
Figure (spatial):
|
|
226
|
+
```latex
|
|
227
|
+
\caption{Distribution of urban green space in Shenzhen Nanshan District. Data derived from OpenStreetMap 2023. Projected in WGS 84 / UTM Zone 50N.}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Figure (non-spatial):
|
|
231
|
+
```latex
|
|
232
|
+
\caption{Comparison of model accuracy across three benchmark datasets. All values are F1 scores. Data from the COCO 2017 validation set.}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Table:
|
|
236
|
+
```latex
|
|
237
|
+
\caption{Descriptive statistics of land use change by category, 2010--2020. All areas reported in km\textsuperscript{2}. Data from the Third National Land Survey.}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Edge Cases
|
|
241
|
+
|
|
242
|
+
| Situation | Handling |
|
|
243
|
+
|-----------|----------|
|
|
244
|
+
| Journal specified but template not found | Refuse: "Journal template for [X] not found. Available: CEUS." |
|
|
245
|
+
| Figure type is spatial but no study area or data source provided | Generate from available content; skip missing clauses; do NOT use `[MISSING: ...]` |
|
|
246
|
+
| `.tex` file has multiple `\caption{}` commands | Ask which `\label{}` is the target before writing |
|
|
247
|
+
| User provides both existing caption and content description | Default to Optimize path; confirm if ambiguous |
|
|
248
|
+
| Figure type unclear ("my figure") | Ask type before any branching logic |
|
|
249
|
+
| Input is only a file path with no description | Read the file; ask for clarification if content is ambiguous |
|
|
250
|
+
| Non-standard caption format in journal template | Journal template overrides default three-part format rules |
|
|
251
|
+
| User declines to provide CRS | Skip CRS clause entirely; do not leave placeholder |
|
|
252
|
+
|
|
253
|
+
## Fallbacks
|
|
254
|
+
|
|
255
|
+
| Scenario | Fallback |
|
|
256
|
+
|----------|----------|
|
|
257
|
+
| Structured Interaction unavailable | Ask 1-3 plain-text questions (figure type, journal, study area if spatial) |
|
|
258
|
+
| `geography-domain.md` leaf missing | Proceed with general spatial description; warn user of reduced quality |
|
|
259
|
+
| Journal template missing (no journal specified) | Ask once; if declined, use general academic style |
|
|
260
|
+
| Write tool fails | Present caption in conversation; advise user to paste at `\caption{}` location |
|
|
261
|
+
| `.tex` file not found or unreadable | Present caption in conversation |
|
|
262
|
+
|
|
263
|
+
## Examples
|
|
264
|
+
|
|
265
|
+
**Invocation:** "Write a caption for my map figure showing urban heat island distribution in Guangzhou."
|
|
266
|
+
|
|
267
|
+
**Ask Strategy exchange:**
|
|
268
|
+
- Type: map (spatial → geography questions apply)
|
|
269
|
+
- Study area: Guangzhou
|
|
270
|
+
- Data source: Landsat-8 imagery, 2022
|
|
271
|
+
- CRS: user does not know → skipped
|
|
272
|
+
- Journal: CEUS
|
|
273
|
+
|
|
274
|
+
**Generated caption (after loading CEUS template and geography-domain.md):**
|
|
275
|
+
```latex
|
|
276
|
+
\caption{Spatial distribution of urban heat island intensity in Guangzhou. Land surface temperature derived from Landsat-8 imagery (2022). City boundary data from the National Geomatics Center of China.}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Write step:** Skill reads `paper.tex`, locates `\caption{}` at `\label{fig:uhi}`, replaces content, writes file.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
*Skill: caption-skill*
|
|
284
|
+
*Conventions: references/skill-conventions.md*
|