All products

Document React components with AI

Give an agent a concrete reason to choose an existing component. Record its inputs, expected behaviour and a working example beside the code.

When you document React components with AI, the first draft can come straight from the component file. The ai-component-metadata Python helper reads a local TSX file and writes a separate TypeScript metadata file in the same directory. It recognises common source patterns, then leaves room for an explanation that only someone familiar with the interface can supply.

Consider a compact menu button. Its icon might be obvious from the source, while the expected focus position after closing the menu is a decision worth recording. Put that decision beside a working example so a colleague or an agent can check it when composing another screen.

What it does

  • Identify required inputs and common states in a simple component.
  • Explain where a component belongs within a larger form or menu.
  • Provide a working composition from your own library.
  • Describe a plausible misuse and name a better available component.
  • Check keyboard interactions and screen reader expectations in a rendered example.

Install and use

  1. Choose a local React component written in TypeScript. Use Python for the starter file, or fill in the supplied template by hand.
  2. Give the agent a specific example such as a menu that returns focus to its trigger when it closes.
  3. Open the generated sibling file, replace the placeholder descriptions and test the example before sharing it.

FAQ

Source

Made by AI Component Metadata Contributors. Original skill: ai-component-metadata, published on GitHub under the MIT licence.

View on GitHub