---
name: react-component-documenter
description: "A clear markdown reference for one React component: what it is for, every prop in a table, its state and hooks, and a copy-paste usage example, so the next developer never has to read the source. Use when a React component needs a markdown reference page with a props table, state, hooks, and a usage example for other developers. Do not use for generating the component itself, auditing it for bugs, or documenting a whole design system. Related topics: coding, react."
---

# React Component Documenter

A clear markdown reference for one React component: what it is for, every prop in a table, its state and hooks, and a copy-paste usage example, so the next developer never has to read the source.

## When to use

Use this skill when a React component needs a markdown reference page with a props table, state, hooks, and a usage example for other developers. Do not use it for generating the component itself, auditing it for bugs, or documenting a whole design system.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Write a two-sentence overview that says what the component renders and when a developer should reach for it.
3. Fill the props table with name, type, required or default value, and a plain-English description for every prop, including callback argument shapes.
4. Describe each state variable by what it tracks and what changes it, and each hook by its role in this component.
5. Make the usage example runnable as written with the most common props set.
6. Read the whole page as the next developer would and remove anything the source already says more clearly.

## Inputs

- **Component name** (free text, e.g. "MyComponent")
- **What it does** (longer free text)
- **Props** (longer free text)
- **State variables** (longer free text)
- **Hooks used** (choose any: useState, useEffect, useContext, useReducer, useMemo, useCallback)
- **Example usage** (longer free text)

## Output

One markdown document with Overview, a Props table (name, type, required or default, description), State, Hooks, and Example Usage, in that order.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### React Component Documentation

Document this React component.

- Component name: {{Component name}}
- What it does: {{What it does}}
- Props: {{Props}}
- State variables: {{State variables}}
- Hooks used: {{Hooks used}}
- Example usage: {{Example usage}}

Write for a developer who is about to use the component, not for one rewriting it. Open with a two-sentence overview of what the component renders and when to reach for it. Put every prop in a table with name, type, required or default value, and a plain-English description; mark callbacks with their argument shape. Describe each state variable by what it tracks and what changes it, not by its initial value alone. For each hook, say what it is doing in this component (useEffect fetching on mount, useMemo caching a sort) rather than what the hook does in general. Make the example runnable as written and show the most common props.

Return a single markdown document with the sections Overview, Props (table), State, Hooks, and Example Usage in that order.

## Pitfalls

- Listing a prop's type without its default, so readers cannot tell what happens when they omit it.
- Explaining what useEffect is instead of what this component's effect does.
- Pasting an example that references props the component does not accept, which fails the first time someone copies it.
