Skip to content
Back to skills

Api Pattern

ASecurity

Provides Vue component structure templates for Composition API and Options API. Used when generating .vue components and views to match user's selected API pattern preference.

  • 57 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 17, 2026
developmenttypescriptreactvueapi

Works with

  • api

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill api-pattern --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Pattern?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Pattern
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-api-pattern/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-api-pattern)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-pattern
description: Provides Vue component structure templates for Composition API and Options API. Used when generating .vue components and views to match user's selected API pattern preference.
---

# API Pattern Skill

## Purpose
Provides Vue component structure templates and patterns for both Composition API and Options API styles.

## User Choice
The user selects their preferred Vue API pattern:
- `composition-api`: Modern functional approach (recommended for Vue 3)
- `options-api`: Traditional object-based approach (familiar from Vue 2)

## When to Use

Use this skill when generating:
- Vue components (`src/components/**/*.vue`)
- View components (`src/views/**/*.vue`)
- Root App component (`src/App.vue`)
- Any `.vue` single-file component

## Pattern Selection Logic

**Composition API** should be used when:
- User explicitly selects `composition-api`
- Building new Vue 3 applications (recommended default)
- Need better TypeScript integration
- Want improved code reusability via composables
- Working with complex component logic

**Options API** should be used when:
- User explicitly selects `options-api`
- Migrating from Vue 2 applications
- Team preference for object-based structure
- Developer familiarity with Vue 2 patterns

## Templates

See `examples.md` for complete component templates including:
- Basic component structure
- Component with props and emits
- Component with lifecycle hooks
- Component with computed properties
- Component with watchers
- Component with composables/mixins
- View component examples
- Store integration examples

## Key Differences Summary

### Composition API
- Uses `<script setup lang="ts">`
- Reactivity via `ref()`, `reactive()`, `computed()`
- Lifecycle hooks as functions (`onMounted`, `onUpdated`, etc.)
- Code organized by logical concern
- Better tree-shaking and TypeScript inference

### Options API
- Uses `defineComponent()`
- Reactivity via `data()` return object
- Lifecycle hooks as methods (`mounted()`, `updated()`, etc.)
- Code organized by option type
- Familiar structure for Vue 2 developers

## Notes
- Always use TypeScript (`lang="ts"`)
- Always use scoped styles (`<style scoped lang="scss">`)
- Import theme variables: `@use '@/theme/' as *;`
- Follow naming conventions: PascalCase for component names
- Include proper type definitions for props and emits

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.