---
name: cangjie-skill
description: Convert a knowledge source into a coherent set of executable AI skills. Use when the user asks to 拆书, 蒸馏一本书, 把某本书/文档/网页/网站做成 skill, turn a book into skills, distill a URL or website into skills, or extract reusable frameworks, principles, checklists, methods, or operating rules from files, pasted text, URLs, or all readable pages on a website. Supports source files (PDF/EPUB/TXT/Markdown/HTML), pasted content, single webpages, and same-site readable page collections. Do not use for simple summaries, book reviews, news briefs, or role-playing as an author.
---

# cangjie-skill

## Purpose

Turn a source of durable knowledge into agent-usable skills.

The source can be:
- A content file: PDF, EPUB, TXT, Markdown, HTML, or pasted text.
- A single URL: one readable webpage or article.
- A website: all readable same-site pages that can be reached from a starting URL.

The output is not a summary. The output is a skill pack: atomic skills with clear triggers, execution steps, boundaries, examples, tests, and an audit trail.

## First Principles

1. Preserve the source before interpreting it.
2. Extract only reusable methods: frameworks, principles, checklists, decision rules, operating procedures, diagnostic questions, and failure patterns.
3. Make every generated skill usable by an arbitrary future agent with no private context.
4. Keep source-faithful and evolved versions separate.
5. Reject vague wisdom. A unit becomes a skill only if it changes action in a real situation.
6. Keep enough evidence for audit, but avoid stuffing generated skills with long quotations.

## Before Work

Confirm or infer these items:

- **Source**: file path, pasted text, URL, or website start URL.
- **Source scope**:
  - `file`: read the provided file only.
  - `url`: read the provided webpage only.
  - `site`: collect readable same-site pages from the start URL.
- **Title, author/owner, and publication year** if available.
- **Output location**. Default to `books/<source-slug>/`.
- **Mode**:
  - `faithful`: only source-grounded skills.
  - `evolution`: faithful skills plus separate `SKILL.evolution.md` files with current-context updates.

If the source itself is missing or inaccessible, stop and ask for it. Do not distill from memory.

## Source Acquisition

### Files Or Pasted Text

Read the content with the best available local tool. Preserve a normalized copy or extraction log under `source/`.

### Single URL

Fetch the page, extract the readable main text, record the canonical URL, page title, fetch date, and any extraction limits. Save it under `source/pages/`.

### Website

Collect readable same-site pages from the start URL.

Use `scripts/collect_readable_pages.py` when a simple crawler is enough:

```bash
python scripts/collect_readable_pages.py "https://example.com" --scope site --max-pages 80 --out books/example/source
```

Crawler rules:
- Stay on the same host unless the user explicitly expands scope.
- Prefer canonical, article, documentation, guide, help, blog, and knowledge pages.
- Skip login walls, search results, tag archives, binary files, calendars, tracking URLs, and near-duplicate pages.
- Record skipped URLs and reasons.
- Do not bypass paywalls, access controls, robots restrictions, or authentication boundaries.

If a browser, search, or site-specific API is more appropriate, use it and keep the same output contract: readable text files plus a manifest.

## Resource Map

Read these files only when needed:

- `00-overview.md`: RIA-TV++ pipeline overview.
- `01-stage0-adler.md`: whole-source understanding and optional external scan.
- `02-stage1-parallel-extract.md`: parallel extraction plan.
- `03-stage1.5-triple-verify.md`: validation gate for candidate units.
- `04-stage2-ria-plus.md`: generated skill structure.
- `05-stage3-zettelkasten.md`: links between generated skills.
- `06-stage4-pressure-test.md`: prompt tests.
- `07-stage2.5-evolution.md`: evolution-mode additions.
- `framework-extractor.md`, `principle-extractor.md`, `case-extractor.md`, `counter-example-extractor.md`, `glossary-extractor.md`: extraction prompts.
- `BOOK_OVERVIEW.md.template`, `INDEX.md.template`, `SKILL.md.template`, `SKILL.evolution.md.template`, `test-prompts.json.template`: output templates.

## Output Structure

```text
books/<source-slug>/
  source/
    manifest.json
    pages/
    skipped.json
  BOOK_OVERVIEW.md
  INDEX.md
  candidates/
  rejected/
  <skill-slug-1>/
    SKILL.md
    SKILL.evolution.md
    test-prompts.json
  <skill-slug-2>/
    ...
```

Omit `SKILL.evolution.md` unless evolution mode is enabled.

## Workflow

### 0. Normalize Source

Create a source corpus before analysis.

- For a book or document, preserve chapter or section boundaries.
- For a URL, preserve page title, URL, and text.
- For a website, build a manifest with every included page and skipped page.
- Deduplicate repeated navigation, footer, cookie text, ads, and boilerplate.

### 1. Understand The Whole Source

Use `01-stage0-adler.md`.

Produce `BOOK_OVERVIEW.md` with:
- Source identity and scope.
- Structure and major sections.
- Core question the source answers.
- Key terms in the source's own meaning.
- Method candidates and where they appear.
- Limits, blind spots, or dated assumptions.

For websites, treat the site as a corpus: infer its information architecture, recurring concepts, official terminology, and page clusters.

### 2. Extract Candidate Units

Use the five extractor files. Use subagents when available; otherwise do five independent passes yourself.

Extract:
- Frameworks and models.
- Principles and rules.
- Cases and worked examples.
- Counterexamples and failure modes.
- Terms and distinctions.

Write raw findings to `candidates/` with source locations.

### 3. Verify Candidates

Use `03-stage1.5-triple-verify.md`.

A candidate passes only when:
- It is grounded in the source.
- It can guide a future action or decision.
- It is specific enough that a generic agent would not already know it.
- It has clear boundaries.

Write rejected candidates and reasons to `rejected/`.

### 4. Build Atomic Skills

For each passed unit, create one skill folder.

Each generated `SKILL.md` must include:
- A precise frontmatter `description` that says when to use it.
- Source evidence with short quotations or paraphrases.
- The method in plain operational steps.
- Real trigger situations.
- Boundaries and misuse warnings.
- Related skills when relevant.

Use `04-stage2-ria-plus.md` and `SKILL.md.template`.

### 5. Add Evolution Only When Requested

If evolution mode is enabled:
- Keep `SKILL.md` source-faithful.
- Put current-context changes in `SKILL.evolution.md`.
- Mark facts, inferences, and recommendations separately.
- For current facts, verify with reliable sources when they may have changed.

Use `07-stage2.5-evolution.md`.

### 6. Link The Pack

Use `05-stage3-zettelkasten.md`.

Create `INDEX.md` with:
- Skill list by theme.
- When to use each skill.
- Suggested learning order.
- A relationship map.
- Source coverage notes.

### 7. Test

Use `06-stage4-pressure-test.md`.

Each generated skill needs `test-prompts.json` with:
- Prompts that should trigger the skill.
- Prompts that should not trigger it.
- Ambiguous boundary prompts.
- Evolution-sensitive prompts when evolution mode is enabled.

Run at least a basic validation pass: frontmatter, trigger clarity, boundary clarity, and source traceability.

## Quality Bar

Do not ship a generated skill pack unless:

- The source corpus is recorded.
- Every generated skill has a clear trigger and usable execution steps.
- Every generated skill is source-grounded.
- Rejected material is preserved with reasons.
- Website inputs include a page manifest and skipped-page notes.
- Tests include positive, negative, and boundary prompts.
- A future agent can use the pack without asking what the original conversation meant.

## Communication

Report progress between stages. For long sources or websites, first show the inferred source scope and wait for confirmation only when the scope is ambiguous or expensive to collect.

When finished, summarize:
- What source was processed.
- How many pages or files were included.
- How many skills were produced.
- Where the output was written.
- What could not be read, if anything.
