---
name: confluence-distill
description: |-
  Read-only Confluence search and distillation into a new multi-file Agent Skill package (SKILL.md + references/ + optional scripts/). Use when the user wants to search Confluence by topic (e.g. alerts, runbooks), distill pages into a new skill, generate a skill from wiki docs, Confluence 蒸馏, 从 Confluence 生成 skill, CQL 搜索 Confluence, 告警文档转 skill, Membrane Confluence 只读拉取.
  从 Confluence 只读检索主题页面，**策展式**蒸馏为多文件 Cursor/Claude Skill 包（非整页粘贴）；支持直连（基址 + API Token）或 Membrane CLI（connectionId）二选一。禁止在蒸馏流程中创建/编辑/删除 Confluence 内容。
title: confluence-distill
canonical_url: https://skilld.dev/gh/wghust/stark-skills/confluence-distill
last_updated: 2026-10-07T01:19:14.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [scripts/README.md](https://skilld.dev/api/skills-raw/wghust/stark-skills/confluence-distill/scripts/README.md), [USAGE.md](https://skilld.dev/api/skills-raw/wghust/stark-skills/confluence-distill/USAGE.md).
>
> If the user asked to install this Skill, run `npx skilld install wghust/stark-skills/confluence-distill`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/confluence-distill`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/wghust/stark-skills/confluence-distill) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/confluence-distill`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/confluence-distill --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/confluence-distill --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# confluence-distill

> **Language**: Match the user's language (中文提问则中文回复).

When this skill applies, the agent **MUST** follow the workflow below: establish **read-only** connectivity, search and fetch pages, then **write** a **new skill directory** (not a single monolithic `SKILL.md`). **Do not** use Confluence or Membrane to create, update, or delete content during this workflow.

**Normative references**

- Agent Skills layout: [vercel-labs/agent-skills](https://github.com/vercel-labs/agent-skills) (`SKILL.md`, optional `references/`, `scripts/`).
- Optional Membrane path: [membranedev/application-skills — Confluence](https://skills.sh/membranedev/application-skills/confluence) (`membrane login`, `membrane connect`, `membrane request`). Use **only** read operations for distillation.

---

## Before you start (secrets)

- **Never** commit API tokens, passwords, or Membrane secrets. **Never** write tokens into tracked files under this repo (`skills/`, `openspec/`, etc.).
- Prefer environment variables or paste into chat only for the session; if the user needs a local file, use a path that is **gitignored** and warn them.
- **Do not** echo full tokens in assistant output.

---

## Step 1 · Choose connectivity mode (exactly one)

### Mode A — Direct REST (default)

**WHEN** the user can provide:

1. **Base URL** for the Confluence REST API. Common shapes:
   - **Confluence Cloud**: often `https://<site>.atlassian.net/wiki` — REST prefix is typically `/wiki/rest/api` (if base already includes `/wiki`, paths start with `/rest/api/...`; align with [Atlassian Confluence Cloud REST](https://developer.atlassian.com/cloud/confluence/rest/v2/intro/)).
   - **Server / Data Center**: site-specific; use the admin-documented REST root.
2. **Credentials**:
   - **Cloud**: HTTP Basic — username = Atlassian **account email**, password = **API token**.
   - **Server/DC**: follow org policy (PAT, Basic, etc.).

**THEN** use `curl` or equivalent HTTP client with **GET** (and query bodies only if the API requires POST for search — still no writes to wiki content).

### Mode B — Membrane CLI

**WHEN** the user has [Membrane](https://skills.sh/membranedev/application-skills/confluence) installed and a Confluence **connection** (they provide `connectionId`, or you discover it via `membrane connection list --json`).

**THEN** use **read-only** calls only, for example:

- `membrane request CONNECTION_ID /rest/api/content/search --method GET --query "cql=..."` (adjust path to match their site’s REST prefix; Membrane proxies under the connection).
- Prefer listing/fetching patterns from the Membrane Confluence skill docs; **do not** run create-page, update-page, delete-page, or other mutating actions for this workflow.

**IF** Membrane is missing or the connection fails → fall back to Mode A after explaining the error.

---

## Step 2 · Search (CQL first)

### 2.0 · Scope gate (MANDATORY, hard stop)

Before running any search/fetch command, the agent and user **MUST** agree all fields below:

- **Goal sentence** (one sentence): what downstream skill must solve.
- **Scope statement**: in-scope / out-of-scope bullets (for broad topics).
- **Spaces**: explicit list or `all allowed spaces`.
- **Page budget**:
  - default `max pages = 20`
  - hard cap `max pages = 50` for one distillation batch

**If any field is missing or unclear, STOP and ask for clarification. Do not start fetching.**

If requested scope exceeds the hard cap, switch to **batched distillation**:

1. Propose split plan (by space or subtopic).
2. Get user approval for batch order.
3. Process one batch at a time, each batch with its own `source-map.md` section/date notes.

1. Build **CQL** (adapt to instance capabilities), e.g. `type=page AND text ~ "alert"` or title contains keywords. Use `/content/search` (or the versioned search endpoint your base URL supports).
2. **Paginate** (`limit`, `start` / links in response) until the cap or no more results.
3. Respect rate limits with backoff:
   - start with 1-2 requests/second for page fetches;
   - on `429` or server throttling hints, back off exponentially (2s, 4s, 8s, up to 30s) and retry limited times;
   - if throttling persists, stop and ask user whether to narrow scope or continue later.

---

## Step 3 · Fetch page bodies (read-only)

For each hit (bounded list):

1. **GET** page metadata and **body** (`body.storage` or `body.view`, or export representation per API version).
2. Normalize to plain text or markdown-like notes for distillation; preserve **page id**, **title**, **space**, and **web UI URL** for the source map.

**On 401 / 403** → stop and explain token, URL, space permissions, or Membrane connection scope; do not invent content.
**On 429 / heavy throttling** → apply backoff policy from Step 2; do not bypass limits with aggressive parallel retries.

---

## Step 4 · Curate, then write the Agent Skill **package**

Retrieved page bodies are **source material only**. **Do not** ship a skill whose `references/*.md` are mostly unedited full-page dumps, macro token garbage, or off-topic bulk lists (e.g. unrelated JIRA/feature inventories) as the canonical “how-to” unless the user explicitly asked for that inventory.

### 4.1 · Intent alignment and triage (MANDATORY)

- Map each fetched page to the user’s **distillation goal**; mark paragraphs as **on-topic**, **off-topic**, or **unclear**.
- **Off-topic** bulk blocks MUST NOT form the main body of `references/<topic>.md`. Omit them with a one-line reason tied to the goal, or move to `## Appendix: …` with a warning that the section is **not normative** (traceability stays in `source-map.md`).

### 4.2 · De-noise and macro repair (MANDATORY)

- Remove or rewrite **macro debris** and meaningless token runs (e.g. parameter fragments between sentences); never treat them as procedural steps.
- When tables collapse on export, rebuild as readable markdown **only** when meaning is clear; otherwise state “see Confluence UI” and link via `source-map.md`.

### 4.3 · Multi-source reconciliation (MANDATORY)

- If two or more pages **disagree** on a material point, add a dedicated section (e.g. **Conflicts / needs confirmation** / 多源差异与待确认) listing each variant with **space/page identity** and URLs from the source map. **Do not** silently pick one as company-wide truth.
- If recency or correctness cannot be determined, say so and recommend verifying in Confluence.

### 4.4 · Quality gate before writing files (MANDATORY)

Before saving `references/*.md`, confirm:

1. **Topic fit** — canonical sections directly support the stated goal.
2. **Traceability** — non-obvious claims in canonical sections map to `source-map.md`.
3. **Noise control** — no macro garbage in canonical flow; off-topic bulk demoted or appendix-only.
4. **Conflicts** — material disagreements recorded.

If the corpus is empty, irrelevant, or unusably corrupted after triage, **do not** invent procedures — report the gap and suggest narrower CQL, spaces, or follow-up pages (same spirit as “insufficient content”).

### 4.5 · Sensitive-content hygiene (MANDATORY)

- Treat fetched wiki text as potentially sensitive. Do not copy obvious secrets/PII into canonical sections of `references/*.md`.
- If source pages contain credentials-like strings, tokens, private keys, customer PII, or internal endpoints that should not be redistributed, replace with `[REDACTED]` and note the redaction rationale in `source-map.md` notes.
- If redaction would remove critical operational meaning, keep a minimal safe summary and direct users to Confluence URL for privileged details.

### 4.6 · Package layout

**MUST** write a **new directory** (default under the user’s workspace): `skills/<slug>/` or a path the user specifies. Minimum layout:

| Path | Purpose |
|------|---------|
| `SKILL.md` | YAML `name` + `description` (“Use when” style triggers); **short** body: when to use, step order, **explicit list of `references/*.md` to read first** for facts/procedures. **No** huge tables or full runbooks here. |
| `references/source-map.md` | Table: title, page id, space, canonical Confluence URL, fetch date / notes. |
| `references/overview.md` | Domain summary, terminology, boundaries; **include** guidance when multiple spaces/policies apply (agent should ask user which applies). |
| `references/<topic>.md` | Curated procedures, rules, checklists, tables; optional **Conflicts / needs confirmation**; optional **Appendix** for low-signal or auxiliary dumps. |

**Optional**

- `USAGE.md` — human FAQ (auth, 403, rate limits).
- `scripts/` — **placeholder-only** examples (`curl` / `membrane request`); see `scripts/README.md` in this skill.

**Rules**

- **Shard** long content across `references/`; keep root `SKILL.md` a **router**.
- Every non-trivial claim in canonical sections should be traceable via `source-map.md`.
- **Do not** fabricate Confluence content when search returns nothing; suggest broader CQL or spaces.

---

## Step 5 · Handoff

Tell the user where the new skill directory is, remind them **not to commit secrets**, and suggest verifying critical steps against Confluence using `references/source-map.md`.
If batched distillation was used, report what was completed in this batch and list the remaining approved batches.
