Skip to content
vike-skills logo

Vike Skills (Vue)

vike-skills

Use when building or working with Vike + Vue SSR/SSG applications - establishes best practices for page creation, data fetching, routing, and layouts

SKILL.md

Full skill instructions

Vike Skills (Vue)

Core principle: Build fast, SEO-friendly Vue applications with server-side rendering using Vike's flexible architecture.

When to Use This Skill

Always use when:

  • Creating new Vike + Vue pages
  • Setting up data fetching with +data hooks
  • Configuring layouts and nested layouts
  • Implementing route guards and authentication
  • Managing head tags and SEO
  • Working with client-only components

Don't use for:

  • Non-Vike Vue applications (use Nuxt or plain Vue)
  • React or Solid projects (use vike-react or vike-solid)

Documentation Quick Links

Development Checklist

When creating a new page, use TodoWrite to track:

  • Create +Page.vue component
  • Add +data.js if page needs data fetching
  • Use useData() to access data in component
  • Add +guard.js if page requires authentication
  • Configure head tags (+title, +description) for SEO
  • Handle errors with throw render() or throw redirect()
  • Use clientOnly() for browser-only components

Essential Requirements

Every Page Must Have

  1. +Page.vue component - The page's Vue component
  2. Proper data access - Use useData() not direct pageContext
  3. Error handling - Handle missing data gracefully
  4. SEO consideration - Title and description for public pages

Every Data Hook Must Have

  1. Type exports - export type Data = Awaited<ReturnType<typeof data>>
  2. Error handling - Use throw render(404) for missing resources
  3. Minimal data - Only return what the page needs (auto-serialized)

Every Layout Must Have

  1. Children slot - <slot /> to render nested content
  2. Proper scoping - Place in correct directory for inheritance
  3. No data fetching assumptions - Layouts share page's +data

Every Guard Must Have

  1. Clear conditions - Check auth state before render
  2. Proper redirects - Use throw redirect('/​login') or throw render(401)
  3. Async support - Guards can be async for API checks

Core Patterns

Basic Page with Data

<!-- /​pages/​movies/​+Page.vue -->
<script setup lang="ts">
import { useData } from 'vike-vue/​useData'
import type { Data } from './​+data'

const { movies } = useData<Data>()
</​script>

<template>
  <h1>Movies</​h1>
  <ul>
    <li v-for="movie in movies" :key="movie.id">
      {{ movie.title }}
    </​li>
  </​ul>
</​template>
// /​pages/​movies/​+data.ts
export type Data = Awaited<ReturnType<typeof data>>

export async function data() {
  const movies = await fetchMovies()
  return { movies }
}

Layout

<!-- /​pages/​+Layout.vue -->
<script setup>
import Navigation from '../​components/​Navigation.vue'
</​script>

<template>
  <Navigation />
  <main>
    <slot />
  </​main>
</​template>

Route Guard

// /​pages/​admin/​+guard.ts
import { redirect } from 'vike/​abort'

export async function guard(pageContext) {
  if (!pageContext.user) {
    throw redirect('/​login')
  }
  if (!pageContext.user.isAdmin) {
    throw render(403, 'Admin access required')
  }
}

File Naming Conventions

FilePurpose
+Page.vuePage component
+Layout.vueLayout wrapper
+data.tsServer-side data fetching
+guard.tsRoute protection
+config.tsPage/​directory configuration
+title.tsPage title
+Head.vueCustom head tags

File Suffixes

SuffixRuns On
.server.tsServer only (default for +data)
.client.tsClient only
.shared.tsBoth server and client

Red Flags - Stop If You See

  • Accessing window or document in SSR code without clientOnly()
  • Missing passToClient for server data needed on client
  • Data fetching inside Vue components (use +data instead)
  • Hardcoded URLs instead of using routing
  • Missing error handling in +data hooks
  • Guards that don't throw (they must throw, not return)
  • Layouts without <slot /> for children

Common Rationalizations

ExcuseReality
"I'll add SEO later"Missing titles hurt from day one
"Guards can return false"Guards must throw redirect() or throw render()
"I can access window in +data"+data runs on server by default
"pageContext has everything"Use useData() for type-safe data access

Configuration Inheritance

Vike configs cascade down the directory tree:

pages/
  +config.ts          # Applies to ALL pages
  +Layout.vue         # Global layout
  (marketing)/
    +Layout.vue       # Nested inside global layout
    about/​+Page.vue   # Has both layouts
  admin/
    +guard.ts         # Applies to all admin pages
    +config.ts        # Admin-specific config
    users/​+Page.vue   # Protected by guard

passToClient Defaults

With client routing, these are automatically available client-side:

  • pageContext.Page
  • pageContext.data
  • pageContext.config
  • pageContext.routeParams
  • pageContext.urlOriginal
  • pageContext.urlPathname
  • pageContext.urlParsed

For custom properties (like user), add to +config.ts:

export default {
  passToClient: ['user']
}

Quick Workflow

  1. Need API details? → Check reference.md
  2. Need examples? → Check examples.md
  3. Building something? → Follow checklist above, use TodoWrite
  4. Stuck? → Check official docs at https://vike.dev

Final Rule

Every Vike + Vue page must have:
1. +Page.vue component
2. +data.ts for server data (if needed)
3. useData() for type-safe data access
4. Error handling for edge cases
5. SEO tags for public pages

Follow these principles for fast, SEO-friendly Vue applications.

More Marketing skills

copywriting logo
Marketing

copywriting

Marketing copy for homepages, landing pages, pricing pages, and other conversion-focused web pages.

53.3K 216.1K
View
flux-2-klein logo
Marketing

flux-2-klein

Fast image generation with Flux 2 Klein, optimized for sub-second iteration and multi-reference brand styling.

52 176.2K
View

Psychological principles and mental models for understanding customer behavior and influencing marketing decisions.

53.3K 153K
View

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
ai-seo logo
Marketing

ai-seo

Optimize content for discovery, citation, and visibility across AI search platforms and LLM assistants.

53.3K 136.7K
View
copy-editing logo
Marketing

copy-editing

Systematic improvement of existing marketing copy through seven focused editing passes.

53.3K 136.4K
View

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View
revops logo
Marketing

revops

Design and optimize systems connecting marketing, sales, and customer success into a unified revenue engine.

53.3K 104.9K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Convert websites into professional HyperFrames videos with guided storyboarding and brand-aligned composition.

57K 93.5K
View

Sales & marketing AI tools

KreadoAI logo
Sales & marketing

KreadoAI

Revolutionize Video Creation with AI-Generated Avatars and Voices

Paid
View
Followr logo
Sales & marketing

Followr

Social media on autopilot

Paid
View
Logodiffusion logo
Sales & marketing

Logodiffusion

Design custom logos instantly with AI.

Paid
View
I
Sales & marketing

Ideogram

Text-heavy marketing and design images

Freemium
View
Prompt Silo logo
Sales & marketing

Prompt Silo

Boost Your SEO with Content and SEO Silos

Free
View
Marketing Blocks logo
Sales & marketing

Marketing Blocks

Revolutionize Your Marketing with AI-Powered MarketingBlocks!

Paid
View
Scrip AI logo
Sales & marketing

Scrip AI

10X faster & free AI content creation for 100+ use cases

Free
View
Tribescaler logo
Sales & marketing

Tribescaler

Tribescaler | Make Your Tweets Go Viral

Paid
View