craft-ts-doc-update

Author and update craft-ts VitePress documentation with tested snippet regions.

3|Updated Jan 9, 2026
One-click install
npx skills add https://github.com/craft-ts/craft-ts --skill craft-ts-doc-update-craft-ts
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: craft-ts-doc-update
Source: https://github.com/craft-ts/craft-ts/tree/main/.cursor/skills/craft-ts-doc-update
Command: npx skills add https://github.com/craft-ts/craft-ts --skill craft-ts-doc-update-craft-ts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Keeping craft-ts documentation accurate is hard because Markdown code fences are invisible to CI, so examples silently rot when the public API changes. This Skill enforces a docs workflow where complete examples live in linted, Vitest-tested snippet specs and pages import them via named regions. ## Core Features & Use Cases - Page structure guidance: Defines where pages belong (Learn, Guide, Reference, Resources) and the required shape for each, including sidebar registration in the VitePress config. - Snippet extraction rules: Decides which examples get extracted into apps/docs/tests/snippets/ spec files with named #region markers and which stay inline (fragments, anti-examples, signatures). - API currency enforcement: Rewrites stale APIs (signal(), MaybeSignal, inject()) to current Craft patterns (state(), CraftServiceInput, yield*) before extraction. - Use Case: When adding a new Guide page for a craft-ts service, extract the complete craftService example into a spec file with a real it() assertion, reference it with <<< @/tests/snippets/...#region, and verify with npx nx test docs and npx nx lint docs. ## Quick Start Update the craft-ts guide page for services by extracting its complete example into a tested snippet region and running the docs test and lint targets.

Frequently Asked Questions about craft-ts-doc-update

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a tested code example to VitePress documentation?▼

Extract the complete example into a spec file under apps/docs/tests/snippets/ mirroring the page path, wrap it in named #region and #endregion markers, and reference it in Markdown with <<< @/tests/snippets/...#region. Then add a real it() assertion and run npx nx test docs.

When should a code example stay inline instead of being extracted to a snippet spec?▼

Keep examples inline when they are shell commands, signatures, 1-5 line fragments, anti-examples, ellipsis fragments, or use dependencies the docs app does not ship. Only complete, copy-pasteable craftComponent, craftService, or craftRoutes modules get extracted.

Why does VitePress show the entire spec file instead of just my example?▼

This happens when the #endregion marker lacks the region name. VitePress requires both #region name and #endregion name to match; a bare #endregion causes it to dump the whole file including the test harness.

Does Vitest typecheck the documentation snippet specs?▼

No, Vitest uses esbuild and does not typecheck, so wrong Input or CraftServiceInput arity can stay green. Protection comes from ESLint Craft rules via npx nx lint docs plus a real it() that instantiates the component or service.

What should I do when a docs example uses a deprecated craft-ts API?▼

Rewrite the example to the current API before extracting it, such as converting signal() to state() or MaybeSignal to CraftServiceInput. Do not leave stale APIs inline to hide them, since lint rules like prefer-craft-state will fail on extracted stale code.