From harness-claude
Explains Nuxt 3 auto-imports for composables, components, and utilities. Helps resolve import errors and configure custom auto-import directories.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:nuxt-auto-importsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Use composables, components, and utilities in Nuxt without writing any import statements
Use composables, components, and utilities in Nuxt without writing any import statements
ref, computed, useState, useFetch, or custom composables.vue filescomposables/ — any function exported from a file in this directory is auto-imported by name. Use named exports for tree-shaking.components/ — components are auto-imported using their file path as the component name (e.g., components/base/Button.vue becomes <BaseButton />).utils/ — exported functions are auto-imported globally.ref, computed, watch, reactive, etc.) and Nuxt composables (useFetch, useRoute, useState, etc.) are always auto-imported — never import them manually.imports.dirs in nuxt.config.ts:// nuxt.config.ts
export default defineNuxtConfig({
imports: {
dirs: ['stores', 'services'],
},
});
imports.autoImport: false. To disable per-file, add // @ts-nocheck or restructure to use explicit imports.#imports for explicit imports in edge cases (e.g., Vitest tests that run outside Nuxt context):import { ref, computed } from '#imports';
.nuxt/types/imports.d.ts — regenerate with nuxt prepare when stale.Nuxt's auto-import system is powered by unplugin-auto-import and unplugin-vue-components. At build time, Nuxt scans the configured directories and generates TypeScript declaration files in .nuxt/ that declare each composable and component as a global. The result: zero import statements in application code while retaining full type safety.
Component naming convention:
The component name is derived from its path relative to components/. Nested directories are flattened using PascalCase concatenation:
components/
ui/
Card.vue → <UiCard />
button/
Primary.vue → <UiButtonPrimary />
base/
Input.vue → <BaseInput />
Lazy-loading components:
Prefix with Lazy to defer loading until the component is mounted:
<LazyHeavyChart v-if="showChart" />
Explicit disabling for testing:
Vitest runs outside Nuxt's build pipeline, so auto-imports are unavailable by default. Use @nuxt/test-utils or import from #imports:
// In test files
import { mountSuspended } from '@nuxt/test-utils/runtime';
When NOT to use auto-imports:
server/ — server routes use a separate auto-import layer with different ruleshttps://nuxt.com/docs/guide/concepts/auto-imports
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeStandardizes Nuxt 3 project conventions: pages, layouts, SSR/SSG/SPA rendering, data fetching with useFetch/useAsyncData, route middleware, plugins, modules, and server routes.
Guides Nuxt 4+ development with server routes, file-based routing, middleware, composables, and configuration. Covers h3 v1 and nitropack v2 patterns. Updated for v4.3+.
Guides Vue.js 3 Composition API patterns, component architecture, reactivity, Pinia state management, Vue Router, and Nuxt SSR. Activates for Vue, Nuxt, Vite, or Pinia projects.