.agents/skills/openclaw-refactor-docs/SKILL.md
Use this skill when the user gives a target OpenClaw docs page and asks to rewrite, refactor, reorganize, split, shorten, or improve it.
This skill builds on openclaw-docs: use that skill for style, page types,
structure, examples, discoverability, and verification. This skill adds the
rewrite workflow needed to avoid losing accurate behavior during a major docs
refactor.
Required:
docs/plugins/codex-harness.md.Optional:
If the target page is missing or ambiguous, ask one concise question before editing. Otherwise, proceed.
Refactor the target page to be more useful, concise, and comprehensive within its stated scope.
Do not treat a rewrite as permission to discard behavior facts. Preserve, verify, move, or explicitly retire existing material. Incorrect docs are worse than verbose docs.
Prefer this split:
Read ../openclaw-docs/SKILL.md first. Apply its page-type, style,
examples, navigation, and verification guidance throughout the refactor.
Run pnpm docs:list when available, then read only the target page and the
likely entry points, references, or related pages needed for the refactor.
Before editing, decide the intended page type from openclaw-docs.
If the current page mixes page types, choose the main page type and plan where the other material belongs:
Create a working inventory from the old page before rewriting. Include:
For each fact, choose one outcome:
Do not infer defaults, permissions, policy, timeout behavior, or safety posture from names or intent. Verify them.
Use the nearest authoritative source for each behavior-sensitive claim:
If a page promises a reference, compare its tables against the schema, manifest, CLI help, generated docs, or exported types. Missing public fields, defaults, precedence rules, caps, or side effects are correctness bugs.
When moving detail out of the target page, record the destination before editing:
doc-schema-version: 1, and read_when hints.Avoid duplicate truth. If the same contract appears in multiple places, choose one canonical page and link to it.
Rewrite in this order:
Add doc-schema-version: 1 to the YAML frontmatter of every docs page that the
refactor migrates, creates, or materially rewrites. Apply it only to docs page
files, not docs.json, glossary JSON, or other non-page metadata. If a
migrated page is generated, update the generator so regeneration preserves the
marker instead of hand-editing generated output.
Do not leave placeholders such as "TODO", "TBD", or "see docs" unless the user explicitly asks for a draft.
After editing, compare the old and new page:
If the refactor deliberately removes relevant material, say where it went or why it was removed in the final report.
Run the smallest reliable docs checks for the touched surface:
pnpm docs:listgit diff --check -- <touched-files>pnpm exec oxfmt --check --threads=1 <touched-files>pnpm docs:check-mdxpnpm docs:check-linkspnpm docs:check-i18n-glossary when link text, navigation, labels, or glossary
surfaces changedRun commands and examples from the page whenever feasible. If you cannot verify a behavior-sensitive claim, either remove the claim, mark the uncertainty in the work-in-progress report, or ask for the missing source.
Report:
Do not include a long rewrite diary. Lead with remaining risks only if there are any.