Vue

From williamzujkowski/standards · View interactive version

Vue is an AI agent skill from the GitHub repository williamzujkowski/standards. Composition API vs Options API

How to use this skill

Skill file

Vue.js Frontend Development Skill

Level 1: Quick Reference (~700-900 tokens)

Core Concepts

Composition API vs Options API

// Composition API (recommended for new projects)
import { ref, computed } from 'vue';

const count = ref(0);
const doubled = computed(() => count.value * 2);

// Options API (traditional)
export default {
  data() { return { count: 0 }; },
  computed: { doubled() { return this.count * 2; } }
};

Reactivity Fundamentals

// ref - for primitives and single values
const count = ref(0);
count.value++; // access with .value

// reactive - for objects
const state = reactive({ count: 0, name: 'Vue' });
state.count++; // direct access

// computed - derived state
const doubled = computed(() => count.value * 2);

// watch - side effects
watch(count, (newVal, oldVal) => {
  console.log(`Count changed from ${oldVal} to ${newVal}`);
});

Component Communication

// Props (parent → child)
defineProps<{ message: string }>();

// Emits (child → parent)
const emit = defineEmits<{ submit: [data: FormData] }>();
emit('submit', formData);

// Provide/Inject (ancestor → descendant)
// Parent
provide('theme', ref('dark'));
// Child
const theme = inject<Ref<string>>('theme');

Essential Checklist

Setup & Configuration

Component Development

Routing & Navigation

State Management

Performance

Accessibility (WCAG 2.1 AA)

Security


Level 2:

📚 Full Examples: See REFERENCE.md for complete code samples, detailed configurations, and production-ready implementations.

Implementation Guide (~4000-5000 tokens)

1. Vue 3 Composition API

Setup Function & Script Setup

The Composition API provides better TypeScript support and code organization:

See REFERENCE.md for complete implementation.

Reactive Primitives

ref vs reactive:

See REFERENCE.md for complete implementation.

Computed Properties

See REFERENCE.md for complete implementation.

Watchers

See REFERENCE.md for complete implementation.

2. Component Architecture

Props & Emits

See REFERENCE.md for complete implementation.

Slots

See REFERENCE.md for complete implementation.

Provide/Inject

See REFERENCE.md for complete implementation.

3. Vue Router

Route Configuration

See REFERENCE.md for complete implementation.

Navigation Guards

See REFERENCE.md for complete implementation.

Typed Routes

See REFERENCE.md for complete implementation.

4. State Management with Pinia

Store Definition

See REFERENCE.md for complete implementation.

Store Composition

See REFERENCE.md for complete implementation.

Store Persistence

See REFERENCE.md for complete implementation.

5. Performance Optimization

Virtual Scrolling

See REFERENCE.md for complete implementation.

Lazy Loading

See REFERENCE.md for complete implementation.

Memoization

See REFERENCE.md for complete implementation.

Build Optimization

See REFERENCE.md for complete implementation.

6. Testing with Vitest

Component Testing

See REFERENCE.md for complete implementation.

Store Testing

See REFERENCE.md for complete implementation.

Composable Testing

See REFERENCE.md for complete implementation.

7. Accessibility (WCAG 2.1 AA)

Semantic HTML

See REFERENCE.md for complete implementation.

ARIA Attributes

See REFERENCE.md for complete implementation.

Keyboard Navigation

See REFERENCE.md for complete implementation.

Focus Management

See REFERENCE.md for complete implementation.

8. Security Best Practices

XSS Prevention

See REFERENCE.md for complete implementation.

Content Security Policy

See REFERENCE.md for complete implementation.

Secure API Communication

See REFERENCE.md for complete implementation.

Input Validation

See REFERENCE.md for complete implementation.


Level 3: Deep Dive Resources

Official Documentation

Advanced Topics

Performance & Optimization

Accessibility

Security

Bundled Resources

Examples

Basic Usage

// TODO: Add basic example for vue
// This example demonstrates core functionality

Advanced Usage

// TODO: Add advanced example for vue
// This example shows production-ready patterns

Integration Example

// TODO: Add integration example showing how vue
// works with other systems and services

See examples/vue/ for complete working examples.

Integration Points

This skill integrates with:

Upstream Dependencies

Downstream Consumers

Related Skills

Common Integration Patterns

  1. Development Workflow: How this skill fits into daily development
  2. Production Deployment: Integration with production systems
  3. Monitoring & Alerting: Observability integration points

Common Pitfalls

Pitfall 1: Insufficient Testing

Problem: Not testing edge cases and error conditions leads to production bugs

Solution: Implement comprehensive test coverage including:

Prevention: Enforce minimum code coverage (80%+) in CI/CD pipeline

Pitfall 2: Hardcoded Configuration

Problem: Hardcoding values makes applications inflexible and environment-dependent

Solution: Use environment variables and configuration management:

Prevention: Use tools like dotenv, config validators, and secret scanners

Pitfall 3: Ignoring Security Best Practices

Problem: Security vulnerabilities from not following established security patterns

Solution: Follow security guidelines:

Prevention: Use security linters, SAST tools, and regular dependency updates

Best Practices:


Note: This skill focuses on Vue 3 Composition API, modern tooling (Vite, Vitest), and production-ready patterns. For options API or Vue 2, refer to the official migration guides.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.