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. Seed wiki/foundations/ with domain background knowledge so subsequent /ingest does not create duplicate concept pages for textbook material

How to use this skill

Skill file

/prefill

Sediments foundational background (seminal methods, common practice, standard architectures) into wiki/foundations/ as terminal pages.

Foundations are single-direction by design: other pages link to them, foundations write no reverse links.

Trigger

Manual: /prefill [domain] or /prefill --add "concept name".

Inputs

Outputs

Wiki Interaction

Reads

Writes

Workflow

Pre-conditions: working directory contains wiki/, tools/, .claude/. Set WIKI_ROOT=wiki/.

Step 1: Resolve domain

  1. If domain argument given → use it.
  2. Else if --add mode → domain is general unless the user specified one.
  3. Else: read all wiki/topics/*.md frontmatter tags; if a single dominant domain is detected, use it; otherwise ask the user.

Step 2: Load seeds

For each seed, check wiki/foundations/{slug}.md. If it already exists, skip (do not overwrite, do not warn).

Step 3: Fetch background from Wikipedia

For each remaining seed, call 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>   # for relevant sections

Step 4: Compose the foundation page

Render each seed into the template below. Distinguish Wikipedia-derived content from LLM-supplied content by appending (LLM analysis) to sections that have no Wikipedia source material.

---
title: "{title}"
slug: "{slug}"
domain: "{domain}"
status: mainstream         # or historical, if the seed is a superseded technique
aliases: []                # list any common aliases the LLM is confident about
first_introduced: "{year if present in Wikipedia summary, else empty}"
date_updated: "{today}"
source_url: "{wikipedia url, or empty if 404}"
---

## Definition
{First paragraph of Wikipedia summary, or LLM-supplied definition.}

## Intuition
{Plain-language explanation built on the definition.}

## Formal notation
{Math/notation extracted from Wikipedia, or LLM-supplied with `(LLM analysis)` tag.}

## Key variants
{Bulleted list distilled from Wikipedia "Variants"/"Types"/"Architecture" sections.}

## Known limitations
{From Wikipedia + LLM judgment.}

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

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

Write each file to wiki/foundations/{slug}.md.

Step 5: Refresh navigation and log

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

Step 6: Report

Print a grouped summary:

## 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

Remind the user that subsequent /ingest runs will dedup against these foundations and create wikilinks ([[foundation-slug]]) instead of new concept pages.

Constraints

Error Handling

Dependencies

Tools (via 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.