---
name: vue-component-documenter
description: "Produces the reference page for a Vue component: props with types and defaults, emitted events with payloads, slots with their scope, exposed methods, and a usage example, so consumers never open the source. Use when a Vue component needs a reference page with its props, events, slots, and exposed methods for the people who consume it. Do not use for documenting a Svelte store or TypeScript types, or explaining a component's internal implementation. Related topics: coding, vue."
---

# Vue Component Documenter

Produces the reference page for a Vue component: props with types and defaults, emitted events with payloads, slots with their scope, exposed methods, and a usage example, so consumers never open the source.

## When to use

Use this skill when a Vue component needs a reference page with its props, events, slots, and exposed methods for the people who consume it. Do not use it for documenting a Svelte store or TypeScript types, or explaining a component's internal implementation.

## 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. Extract every prop with type, required flag, default, and validator from the source and write a meaning for each that states its effect.
3. Extract every emitted event from the emits declaration and the template, with its payload type and trigger.
4. List the default slot and each named slot with the scope props it exposes.
5. Include methods only when exposed with defineExpose or public on the Options API, and skip the section otherwise.
6. Write a runnable parent-template example using common props, one handler, and one slot when requested, then assemble the sections in order.

## Inputs

- **Component file path** (free text, e.g. "src/components/DataTable.vue")
- **Component name** (free text, e.g. "DataTable")
- **Component source** (longer free text)
- **What it does** (longer free text)
- **Props definition if not in the source** (longer free text)
- **Emitted events** (longer free text)
- **Slots** (longer free text)
- **Include a usage example** (choose one: Yes, No)

## Output

One markdown document with Overview, Props table, Emits table, Slots table, Methods when exposed, and Example when requested, in that order.

## Prompt template

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

### Vue Component Documenter

Document the component below for the developers who will use it.

- Component file path: {{Component file path}}
- Component name: {{Component name}}
- Component source: {{Component source}}
- What it does: {{What it does}}
- Props definition if not in the source: {{Props definition if not in the source}}
- Emitted events: {{Emitted events}}
- Slots: {{Slots}}
- Include a usage example: {{Include a usage example}}

Document the public contract and nothing internal. Read props from defineProps or the props option, including validators and defaults, and write a Props table with name, type, required, default, and a one-line meaning that says what changing it does rather than restating the name. Read emits from defineEmits or the emits option and the $emit calls in the template; document each event with its payload type and when it fires. List every named slot and the default slot with the scope props it exposes. Include methods only when they are exposed with defineExpose or are public Options API methods a parent would call through a ref.

For the example, show the component in a parent template with the most common props, one event handler, and one slot, as code that runs.

### Output
Return one markdown document with these sections in order: Overview, Props (table), Emits (table), Slots (table), Methods (only when any are exposed), Example (only when requested). No text outside the document.

## Pitfalls

- Listing internal methods and refs as API, which invites parents to call things that will change.
- Missing events emitted directly from the template with $emit because only defineEmits was read.
- Writing a prop meaning that restates its name (disabled: whether it is disabled) instead of the effect of changing it.
