hook-docs

Writes trilingual Astro MDX documentation pages for React hooks and regenerates the hook registry.

1.0k|141|Updated Sep 18, 2022
One-click install
npx skills add https://github.com/childrentime/reactuse --skill hook-docs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-docs
Source: https://github.com/childrentime/reactuse/tree/main/.claude/skills/hook-docs
Command: npx skills add https://github.com/childrentime/reactuse --skill hook-docs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing documentation for a new ReactUse hook requires creating three locale-specific MDX files (English, Simplified Chinese, Traditional Chinese) that follow a strict content schema, live-demo convention, and category-based routing, plus regenerating the hook registry — a repetitive, error-prone manual process.

Core Features & Use Cases

  • Trilingual MDX Generation: Produces matching English, zh-Hans, and zh-Hant documentation files in the correct packages/website-astro content folders, with proper frontmatter (title, description, sidebar_label).
  • Live Demo Convention: Embeds an inline tsx live code block for an editable demo and preserves the %%API%% placeholder that the build replaces with the generated API table.
  • Registry Regeneration: Runs scripts/generate-hook-registry.sh to rebuild scripts/hook-registry.json so blog and doc links resolve with the correct category and lowercase URL.
  • Use Case: After implementing a new useX hook, ask the assistant to document it — it creates all three locale files under the right category folder (browser, effect, element, state, integrations) and updates the registry.

Quick Start

Ask the assistant to document the new useX hook following the ReactUse docs convention and regenerate the hook registry.

Frequently Asked Questions about hook-docs

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

FAQPage Schema
How do I document a new React hook in the ReactUse website?

Create one MDX file per locale under packages/website-astro/src/content/docs, docs-zh-hans, and docs-zh-hant, inside a category folder such as browser or state. Include frontmatter with title and description, an inline tsx live demo, and the %%API%% placeholder, then run scripts/generate-hook-registry.sh.

How do I add a live editable demo to Astro MDX documentation?

Use a fenced code block with the tsx live language tag and write the demo component inline in the MDX file. The site renders it as an editable live example; it is not imported from the hook's source code.

Does the ReactUse docs site need a sidebar or routes config?

No. The sidebar and routes are built automatically from file paths in the content folders. The folder you place the MDX file in determines the category, registry entry, and canonical lowercase URL.

How do I convert Simplified Chinese docs to Traditional Chinese accurately?

Mirror the English structure and translate prose and frontmatter, but do not rely on pure character conversion. Terms differ, for example 状态 becomes 狀態, 默认 becomes 預設, and 组件 becomes 組件, while the code demo stays identical.

Why is my new hook missing from doc and blog links?

The hook registry was not regenerated after adding the docs. Run bash scripts/generate-hook-registry.sh, which walks the English docs folder and rewrites scripts/hook-registry.json with each hook's category and lowercase URL.