$npx -y skills add Lylll9436/Paper-Polish-Workflow-skill --skill ppw-literatureSearch academic literature via Semantic Scholar MCP, select papers interactively, and generate verified BibTeX entries. 文献检索与BibTeX生成,通过Semantic Scholar MCP。
| 1 | ## Purpose |
| 2 | |
| 3 | This Skill searches academic literature using the Semantic Scholar MCP, presents an interactive numbered result list (up to 10 papers), waits for the user to select a specific paper, then generates a verified BibTeX entry built exclusively from MCP-returned data. Before any workflow begins, a pre-flight probe confirms MCP availability — if unavailable, the Skill refuses immediately with setup instructions rather than proceeding with degraded capability. After the user selects a paper, a mandatory anti-hallucination verification prompt reminds the user to confirm the paper's actual relevance before committing the citation. This Skill does not write or rewrite paper content; it searches, selects, and generates citation entries only. |
| 4 | |
| 5 | ## Trigger |
| 6 | |
| 7 | **Activates when the user asks to:** |
| 8 | - Search or find academic papers on a topic |
| 9 | - Generate BibTeX or citation entries for a reference |
| 10 | - 帮我找文献、检索相关论文、帮我生成引用格式 |
| 11 | |
| 12 | **Example invocations:** |
| 13 | - "Find papers about urban heat island" / "帮我找关于城市热岛的文献" |
| 14 | - "Search literature for spatiotemporal analysis" / "检索时空分析相关文献" |
| 15 | - "Generate BibTeX for a citation" / "帮我生成BibTeX引用格式" |
| 16 | |
| 17 | ## Modes |
| 18 | |
| 19 | | Mode | Default | Behavior | |
| 20 | |------|---------|----------| |
| 21 | | `direct` | Yes | Single-shot search → result list → user selects → BibTeX generated; no iteration | |
| 22 | | `batch` | | Not supported — each search requires user selection in session | |
| 23 | |
| 24 | **Default mode:** `direct`. Search is single-shot: if results are unsatisfactory, user re-triggers the Skill with different keywords. |
| 25 | |
| 26 | ## References |
| 27 | |
| 28 | ### Required (always loaded) |
| 29 | |
| 30 | None. This is a search task — no expression pattern files needed. |
| 31 | |
| 32 | ### Leaf Hints |
| 33 | |
| 34 | None. |
| 35 | |
| 36 | > No reference files loaded. All paper metadata sourced from Semantic Scholar MCP at runtime. |
| 37 | |
| 38 | ## Ask Strategy |
| 39 | |
| 40 | The Skill collects search inputs conversationally. At most two questions: |
| 41 | |
| 42 | 1. **Search query** (required): the topic or keyword to search — ask only if not provided in the trigger message. |
| 43 | 2. **Result count** (optional): how many results to display. Default: 5. Maximum: 10. |
| 44 | |
| 45 | If the user provides the topic in the trigger message, skip question 1 and proceed immediately. |
| 46 | |
| 47 | ## Workflow |
| 48 | |
| 49 | ### Step 0: Workflow Memory Check |
| 50 | |
| 51 | - Read `.planning/workflow-memory.json`. If file missing or empty, skip to Step 1. |
| 52 | - Check if the last 1-2 log entries form a recognized pattern with `ppw:literature` that has appeared >= threshold times in the log. See `skill-conventions.md > Workflow Memory > Pattern Detection` for the full algorithm. |
| 53 | - If a pattern is found, present recommendation via AskUserQuestion: |
| 54 | - Question: "检测到常用流程:[pattern](已出现 N 次)。是否直接以 direct 模式运行 ppw:literature?" |
| 55 | - Options: "Yes, proceed" / "No, continue normally" |
| 56 | - If user accepts: set mode to `direct`, skip Ask Strategy questions. |
| 57 | - If user declines or AskUserQuestion unavailable: continue in normal mode. |
| 58 | |
| 59 | ### Step 1: MCP Pre-flight Check |
| 60 | |
| 61 | 1. Call `mcp__semantic-scholar__papers-search-basic` with `{"query": "test", "limit": 1}`. |
| 62 | 2. If the call succeeds: proceed to Step 2. |
| 63 | 3. If the call fails or tool is unavailable: **refuse immediately** with: |
| 64 | |
| 65 | > "Semantic Scholar MCP is not available. To use this Skill: |
| 66 | > 1. Open Claude Code Settings → MCP Servers |
| 67 | > 2. Add the Semantic Scholar server (server key: `semanticscholar`) |
| 68 | > 3. Restart Claude Code and retry" |
| 69 | |
| 70 | Do NOT proceed past this point if MCP is unavailable. |
| 71 | |
| 72 | ### Step 2: Collect Search Query |
| 73 | |
| 74 | 1. Extract the search topic from the trigger message if present. |
| 75 | 2. If topic not provided, ask: "What topic or keywords should I search for?" |
| 76 | 3. Confirm result count (default: 5). |
| 77 | - **Record workflow:** Append `{"skill": "ppw:literature", "ts": "<ISO timestamp>"}` to `.planning/workflow-memory.json`. Create file as `[]` if missing. Drop oldest entry if log length >= 50. |
| 78 | |
| 79 | ### Step 3: Execute Search and Build Result Cards |
| 80 | |
| 81 | 1. Call `mcp__semantic-scholar__papers-search-basic` with the user's query and result count. |
| 82 | 2. For each returned paper: if the abstract field is empty in the search result, call `mcp__semantic-scholar__get-paper-abstract` to fetch an abstract excerpt. |
| 83 | 3. Display numbered result cards in this exact format: |
| 84 | |
| 85 | ``` |
| 86 | **[1] Title of the Paper** |
| 87 | Authors: Smith, J.; Lee, K. · Year: 2023 · Citations: 142 |
| 88 | > "One sentence from abstract describing the core contribution..." |