---
name: vue-component-formatter
description: "Assembles the template markup, state, and methods you already have into one clean, lint-ready Vue single-file component with Composition API conventions, consistent naming, and scoped styles. Use when you already have the markup, state, and methods for a Vue component as loose pieces and want them combined into one lint-clean single-file component. Do not use for designing a component from a spec with nothing written, or breaking an oversized component into smaller ones. Related topics: coding, vue."
---

# Vue Component Formatter

Assembles the template markup, state, and methods you already have into one clean, lint-ready Vue single-file component with Composition API conventions, consistent naming, and scoped styles.

## When to use

Use this skill when you already have the markup, state, and methods for a Vue component as loose pieces and want them combined into one lint-clean single-file component. Do not use it for designing a component from a spec with nothing written, or breaking an oversized component into smaller ones.

## 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. Place the supplied template, script, and style in the conventional order for the chosen style; nothing is added or dropped.
3. Convert state and functions to the chosen script style (ref, reactive, setup or Options API) with their bodies unchanged.
4. Apply naming conventions: PascalCase component, camelCase script identifiers, kebab-case template events and attributes.
5. Fix the lint rules the recommended config flags: v-for keys, v-if and v-for separation, void element closing, attribute order.
6. List each lint fix applied and each reference in the template that no supplied piece defines.

## Inputs

- **Component name** (free text, e.g. "ProfileForm")
- **Template markup** (longer free text)
- **Props** (longer free text)
- **Reactive state** (longer free text)
- **Methods and functions** (longer free text)
- **Script style** (choose one: Vue 3 script setup, Vue 3 Composition API with setup(), Vue 2 Options API)
- **Styles** (choose one: Scoped, Global, None)
- **Lint rules** (choose one: eslint-plugin-vue recommended, Prettier plus Vue recommended, Project default)

## Output

One vue code block with the assembled single-file component, then a bulleted list of lint fixes applied and unresolved references.

## Prompt template

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

### Vue Component Formatter

Assemble the pieces below into a clean single-file component that passes the linter.

- Component name: {{Component name}}
- Template markup: {{Template markup}}
- Props: {{Props}}
- Reactive state: {{Reactive state}}
- Methods and functions: {{Methods and functions}}
- Script style: {{Script style}}
- Styles: {{Styles}}
- Lint rules: {{Lint rules}}

Treat the supplied pieces as the source of truth and change only what the linter or Vue conventions require. Put the sections in template, script, style order (script first only when the Vue 2 style guide asks for it). Convert the state to ref or reactive and the functions to const arrow functions or plain functions as the chosen style expects, keeping their bodies as written. Rename only to meet conventions: PascalCase component names, camelCase in script, kebab-case events and attributes in the template. Fix template lint issues the recommended rules flag: a key on every v-for, no v-if with v-for on the same element, self-closing void elements, and attribute order. Mark props used in the template as declared and remove references to anything not supplied.

Do not add features, fetch calls, or styling that was not provided; note gaps instead.

### Output
Return the complete .vue file in one code block tagged vue, followed by a short list of the lint fixes applied and any piece that was referenced but not supplied.

## Pitfalls

- Rewriting the supplied method bodies while converting them, which changes behaviour the author did not ask to change.
- Leaving v-for without a key or combining it with v-if, which the recommended rules reject on the first lint run.
- Inventing a fetch call or default styling to fill a gap instead of listing the gap for the author.
