Prefill

From Chanw-research/claude-code-paper-writing · View interactive version

Prefill is an AI agent skill from the GitHub repository Chanw-research/claude-code-paper-writing. 用领域基础知识填充 wiki/foundations/,避免后续 /ingest 为教科书材料创建重复的 concept 页面

How to use this skill

Skill file

/prefill

将领域基础知识(奠基性方法、common practice、标准架构)作为终端页面沉淀到 wiki/foundations/。

Foundations 设计上单向:其他页面可以链接到 foundation,foundation 不写反向链接。

Trigger

手动:/prefill [domain] 或 /prefill --add "概念名"。

Inputs

Outputs

Wiki Interaction

读取

写入

Workflow

前置条件:当前目录包含 wiki/、tools/、.claude/。WIKI_ROOT=wiki/。

Step 1: 确定 domain

  1. 用户传入 domain → 直接使用。
  2. 否则若处于 --add 模式 → 默认 general,除非用户额外指定。
  3. 否则:读取 wiki/topics/*.md 的 frontmatter tags;若能识别出主导 domain 则用之,否则提示用户。

Step 2: 加载种子

对每个种子,若 wiki/foundations/{slug}.md 已存在则跳过(不覆盖、不警告)。

Step 3: 从 Wikipedia 拉取背景

对每个剩余种子调用 tools/fetch_wikipedia.py:

python3 tools/fetch_wikipedia.py summary "<title>"
python3 tools/fetch_wikipedia.py sections "<title>"
python3 tools/fetch_wikipedia.py section "<title>" --index <N>   # 拉取相关章节

Step 4: 组装 foundation 页面

按下方模板渲染。Wikipedia 来源的内容与 LLM 生成的内容需视觉上区分:纯 LLM 段落以 (LLM analysis) 标注。

---
title: "{title}"
slug: "{slug}"
domain: "{domain}"
status: mainstream         # 已被取代的方法填 historical
aliases: []                # 列出 LLM 有把握的常见别名
first_introduced: "{Wikipedia summary 中能提取的年份,否则留空}"
date_updated: "{今天}"
source_url: "{Wikipedia URL,404 时留空}"
---

## Definition
{Wikipedia summary 首段,或 LLM 提供的定义。}

## Intuition
{基于定义的通俗解释。}

## Formal notation
{从 Wikipedia 提取的公式/记号;若无则由 LLM 补充并标注 `(LLM analysis)`。}

## Key variants
{从 Wikipedia "Variants" / "Types" / "Architecture" 章节提炼的列表。}

## Known limitations
{Wikipedia + LLM 综合判断。}

## Open problems
{LLM analysis (LLM analysis)}

## Relevance to active research
{LLM analysis (LLM analysis)}

每页写入 wiki/foundations/{slug}.md。

Step 5: 刷新导航和日志

python3 tools/research_wiki.py rebuild-index wiki/
python3 tools/research_wiki.py log wiki/ "prefill | {N} foundations created for {domain}"

Step 6: 报告

打印分组摘要:

## Prefill Report — {date}

**Domain**: {domain}
**Created**: {N}  **Skipped (already present)**: {M}

### mainstream
- foundations/gradient-descent — Gradient Descent
- ...

### historical
- foundations/recurrent-neural-networks — Recurrent Neural Networks

提醒用户:后续 /ingest 会与这些 foundation 去重,遇到匹配概念时创建 [[foundation-slug]] 链接而非新建 concept 页面。

Constraints

Error Handling

Dependencies

工具(通过 Bash)

Catalog

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.