name: clean-doc-examples description: Use when syncing or simplifying example code in docs/articles or README.md so embedded docs samples stay aligned with examples tests while removing compatibility noise from the published snippets.
Clean Doc Examples
Use this skill when the task is to refresh and simplify documentation code examples without changing the real test sources unless explicitly requested.
Task List
Create a plain Markdown checklist that AI Agent can follow:
- [ ] Inspect the affected docs, examples, and recent non-bot history
- [ ] Sync embedded docs samples with the current example tests when needed
- [ ] Simplify docs-only snippets for readability
- [ ] Run lightweight validation and summarize what changed
Workflow
- Inspect
docs/articles,README.md, and the matching files underexamples. - If the task mentions history or doc drift, inspect recent non-bot commits that touched
examplesor docs:git log --no-merges --author='^(?!.*(renovate|dependabot)).*$' --perl-regexp -- examples docs/articles README.md
- If a docs page embeds a live example block from
examples/..., sync the block to the current source test before simplifying it for docs-only readability. - Keep the real
examples/*.spec.tsfiles as source-of-truth tests. Do not rewrite them unless the user explicitly asks. - Apply readability cleanup only in docs snippets:
- remove compatibility-only casts such as
as neveroras any - remove
standalone: false - remove empty uniqueness-only methods such as
public someMarker() {} - remove
TODOcomments and Angular version guards from docs snippets - if
ViewChild,ViewChildren,ContentChild, orContentChildrenuse{}as the second argument, remove that empty argument - remove
const assertion: anyhelpers and usejasminedirectly - prefer direct Jasmine examples in visible code; keep Jest alternatives only as comments when helpful
- inline
@Injectable({ ... })config instead ofconst ...Args = [...]plus@Injectable(...args)
- remove compatibility-only casts such as
- Keep guide prose aligned with the simplified snippet if behavior changed materially.
- For docs-only changes, validate with search-based checks and
git diff --check. Skip wrapper tests unless the user specifically wants them or non-doc files changed.
Validation
- For docs-only changes:
- search for the targeted cleanup patterns to confirm they are gone
- run
git diff --check -- docs/articles README.md
Guardrails
- Do not edit real
examplestests just to make docs prettier unless the user explicitly asked to change the tests too. - Do not claim docs are synced until embedded example blocks or referenced snippets have been checked against
examples. - Prefer primary repo sources over memory:
examples,README.md,docs/articles, and recent human-authored git history. - If docs and executable behavior disagree, trust the current scripts/tests first and update the docs.
- For docs-only work, say explicitly in the final summary if wrapper tests were skipped.