MarketingClaw Refactor Docs
Overview
Use this skill when the user gives a target MarketingClaw docs page and asks to
rewrite, refactor, reorganize, split, shorten, or improve it.
This skill builds on marketingclaw-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.
Inputs
Required:
- A target docs page path, such as
docs/plugins/codex-harness.md.
Optional:
- Desired page type, such as topic page, guide, reference, or troubleshooting.
- Specific goals, such as shorter main page, move details to reference pages, or
align with current CLI behavior.
- Related source files, schemas, commands, tests, specs, or PRs.
If the target page is missing or ambiguous, ask one concise question before
editing. Otherwise, proceed.
Working Contract
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:
- Topic or guide pages cover the 80/20 path, decisions readers must make, safe
setup, smallest reliable verification, common failures, and links onward.
- Reference pages cover exhaustive fields, defaults, enums, limits, precedence
rules, API contracts, narrow internals, and rare debugging details.
- Troubleshooting pages start from observable symptoms and map to checks,
causes, and fixes.
Workflow
1. Load the doc standard
Read ../marketingclaw-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.
2. Classify the page
Before editing, decide the intended page type from marketingclaw-docs.
If the current page mixes page types, choose the main page type and plan where
the other material belongs:
- Move exhaustive contracts to an existing or new reference page.
- Move symptom-driven material to an existing or new troubleshooting page.
- Move narrow setup workflows to a guide when they interrupt the main path.
- Keep concise routing, decision, and safety details in the main page when
readers need them to complete the workflow.
3. Preserve and audit existing facts
Create a working inventory from the old page before rewriting. Include:
- Config fields, flags, commands, slash commands, env vars, defaults, enums,
nullable values, and constraints.
- Precedence rules, fallback behavior, caps, limits, rate limits, timeouts,
lifecycle states, queueing behavior, and compatibility rules.
- Auth, permission, approval, sandbox, safety, privacy, and destructive-action
behavior.
- Setup requirements, supported versions, dependencies, operating systems,
credentials, and account requirements.
- Error messages, troubleshooting symptoms, diagnostics, and recovery steps.
- Examples, expected output, command routing tables, and cross-links.
For each fact, choose one outcome:
- Keep it in the refactored target page.
- Move it to a specific existing page.
- Move it to a specific new page.
- Delete it because current source proves it is obsolete or out of scope.
Do not infer defaults, permissions, policy, timeout behavior, or safety posture
from names or intent. Verify them.
4. Find source of truth
Use the nearest authoritative source for each behavior-sensitive claim:
- Public schema, plugin manifest, generated config docs, or exported types for
config fields.
- CLI implementation, slash-command handlers, help text, and command tests for
commands and flags.
- Runtime source and tests for lifecycle, queueing, permission, fallback,
timeout, and provider behavior.
- Protocol docs, SDK facades, and contract tests for APIs and plugin surfaces.
- Existing docs only as secondary evidence unless the target is purely
conceptual.
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.
5. Plan moved material
When moving detail out of the target page, record the destination before
editing:
- Existing page: name the page and section.
- New page: choose the page type, slug, title, frontmatter summary,
doc-schema-version: 1, and read_when hints.
- Target page: keep a short summary and link from the point where readers need
the deeper detail.
Avoid duplicate truth. If the same contract appears in multiple places, choose
one canonical page and link to it.
6. Rewrite
Rewrite in this order:
- Make the first screen answer what the reader can do and why this page exists.
- Put the recommended path before alternatives.
- Keep only decision-making and common operational detail in the main flow.
- Move exhaustive tables and rare details to the planned reference pages.
- Preserve concise routing tables when they help readers choose commands,
config paths, harnesses, plugins, providers, or references.
- Add troubleshooting from observable symptoms, not internal guesses.
- Link related concepts, guides, references, diagnostics, and adjacent tools.
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.
7. Compare old and new
After editing, compare the old and new page:
- Confirm all behavior-sensitive facts were kept, moved, or intentionally
deleted with source-backed reason.
- Check that the main page still covers the 80/20 scenario end to end.
- Check that reference pages remain exhaustive for the scope they claim.
- Check that links from the target page reach moved details.
- Check that headings are stable, searchable, and action-oriented.
If the refactor deliberately removes relevant material, say where it went or why
it was removed in the final report.
8. Verify
Run the smallest reliable docs checks for the touched surface:
pnpm docs:list
git diff --check -- <touched-files>
- Targeted
pnpm exec oxfmt --check --threads=1 <touched-files>
pnpm docs:check-mdx
pnpm docs:check-links
pnpm docs:check-i18n-glossary when link text, navigation, labels, or glossary
surfaces changed
- Generated-doc checks when schemas, generated config docs, API docs, or
generated baselines are touched
Run 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.
Final Report
Report:
- What changed in the target page.
- What details moved and their destination pages.
- What source-of-truth checks backed behavior-sensitive claims.
- What validation ran and what failed for unrelated reasons.
Do not include a long rewrite diary. Lead with remaining risks only if there are
any.
1---2name: marketingclaw-refactor-docs3description: Refactor an existing MarketingClaw docs page with source-audited preservation, restructuring, and verification.4---56# MarketingClaw Refactor Docs78## Overview910Use this skill when the user gives a target MarketingClaw docs page and asks to11rewrite, refactor, reorganize, split, shorten, or improve it.1213This skill builds on `marketingclaw-docs`: use that skill for style, page types,14structure, examples, discoverability, and verification. This skill adds the15rewrite workflow needed to avoid losing accurate behavior during a major docs16refactor.1718## Inputs1920Required:2122- A target docs page path, such as `docs/plugins/codex-harness.md`.2324Optional:2526- Desired page type, such as topic page, guide, reference, or troubleshooting.27- Specific goals, such as shorter main page, move details to reference pages, or28 align with current CLI behavior.29- Related source files, schemas, commands, tests, specs, or PRs.3031If the target page is missing or ambiguous, ask one concise question before32editing. Otherwise, proceed.3334## Working Contract3536Refactor the target page to be more useful, concise, and comprehensive within37its stated scope.3839Do not treat a rewrite as permission to discard behavior facts. Preserve,40verify, move, or explicitly retire existing material. Incorrect docs are worse41than verbose docs.4243Prefer this split:4445- Topic or guide pages cover the 80/20 path, decisions readers must make, safe46 setup, smallest reliable verification, common failures, and links onward.47- Reference pages cover exhaustive fields, defaults, enums, limits, precedence48 rules, API contracts, narrow internals, and rare debugging details.49- Troubleshooting pages start from observable symptoms and map to checks,50 causes, and fixes.5152## Workflow5354### 1. Load the doc standard5556Read `../marketingclaw-docs/SKILL.md` first. Apply its page-type, style,57examples, navigation, and verification guidance throughout the refactor.5859Run `pnpm docs:list` when available, then read only the target page and the60likely entry points, references, or related pages needed for the refactor.6162### 2. Classify the page6364Before editing, decide the intended page type from `marketingclaw-docs`.6566If the current page mixes page types, choose the main page type and plan where67the other material belongs:6869- Move exhaustive contracts to an existing or new reference page.70- Move symptom-driven material to an existing or new troubleshooting page.71- Move narrow setup workflows to a guide when they interrupt the main path.72- Keep concise routing, decision, and safety details in the main page when73 readers need them to complete the workflow.7475### 3. Preserve and audit existing facts7677Create a working inventory from the old page before rewriting. Include:7879- Config fields, flags, commands, slash commands, env vars, defaults, enums,80 nullable values, and constraints.81- Precedence rules, fallback behavior, caps, limits, rate limits, timeouts,82 lifecycle states, queueing behavior, and compatibility rules.83- Auth, permission, approval, sandbox, safety, privacy, and destructive-action84 behavior.85- Setup requirements, supported versions, dependencies, operating systems,86 credentials, and account requirements.87- Error messages, troubleshooting symptoms, diagnostics, and recovery steps.88- Examples, expected output, command routing tables, and cross-links.8990For each fact, choose one outcome:9192- Keep it in the refactored target page.93- Move it to a specific existing page.94- Move it to a specific new page.95- Delete it because current source proves it is obsolete or out of scope.9697Do not infer defaults, permissions, policy, timeout behavior, or safety posture98from names or intent. Verify them.99100### 4. Find source of truth101102Use the nearest authoritative source for each behavior-sensitive claim:103104- Public schema, plugin manifest, generated config docs, or exported types for105 config fields.106- CLI implementation, slash-command handlers, help text, and command tests for107 commands and flags.108- Runtime source and tests for lifecycle, queueing, permission, fallback,109 timeout, and provider behavior.110- Protocol docs, SDK facades, and contract tests for APIs and plugin surfaces.111- Existing docs only as secondary evidence unless the target is purely112 conceptual.113114If a page promises a reference, compare its tables against the schema,115manifest, CLI help, generated docs, or exported types. Missing public fields,116defaults, precedence rules, caps, or side effects are correctness bugs.117118### 5. Plan moved material119120When moving detail out of the target page, record the destination before121editing:122123- Existing page: name the page and section.124- New page: choose the page type, slug, title, frontmatter summary,125 `doc-schema-version: 1`, and `read_when` hints.126- Target page: keep a short summary and link from the point where readers need127 the deeper detail.128129Avoid duplicate truth. If the same contract appears in multiple places, choose130one canonical page and link to it.131132### 6. Rewrite133134Rewrite in this order:1351361. Make the first screen answer what the reader can do and why this page exists.1372. Put the recommended path before alternatives.1383. Keep only decision-making and common operational detail in the main flow.1394. Move exhaustive tables and rare details to the planned reference pages.1405. Preserve concise routing tables when they help readers choose commands,141 config paths, harnesses, plugins, providers, or references.1426. Add troubleshooting from observable symptoms, not internal guesses.1437. Link related concepts, guides, references, diagnostics, and adjacent tools.144145Add `doc-schema-version: 1` to the YAML frontmatter of every docs page that the146refactor migrates, creates, or materially rewrites. Apply it only to docs page147files, not `docs.json`, glossary JSON, or other non-page metadata. If a148migrated page is generated, update the generator so regeneration preserves the149marker instead of hand-editing generated output.150151Do not leave placeholders such as "TODO", "TBD", or "see docs" unless the user152explicitly asks for a draft.153154### 7. Compare old and new155156After editing, compare the old and new page:157158- Confirm all behavior-sensitive facts were kept, moved, or intentionally159 deleted with source-backed reason.160- Check that the main page still covers the 80/20 scenario end to end.161- Check that reference pages remain exhaustive for the scope they claim.162- Check that links from the target page reach moved details.163- Check that headings are stable, searchable, and action-oriented.164165If the refactor deliberately removes relevant material, say where it went or why166it was removed in the final report.167168### 8. Verify169170Run the smallest reliable docs checks for the touched surface:171172- `pnpm docs:list`173- `git diff --check -- <touched-files>`174- Targeted `pnpm exec oxfmt --check --threads=1 <touched-files>`175- `pnpm docs:check-mdx`176- `pnpm docs:check-links`177- `pnpm docs:check-i18n-glossary` when link text, navigation, labels, or glossary178 surfaces changed179- Generated-doc checks when schemas, generated config docs, API docs, or180 generated baselines are touched181182Run commands and examples from the page whenever feasible. If you cannot verify183a behavior-sensitive claim, either remove the claim, mark the uncertainty in the184work-in-progress report, or ask for the missing source.185186## Final Report187188Report:189190- What changed in the target page.191- What details moved and their destination pages.192- What source-of-truth checks backed behavior-sensitive claims.193- What validation ran and what failed for unrelated reasons.194195Do not include a long rewrite diary. Lead with remaining risks only if there are196any.