Back to Nuxt.js

nuxt-modules

Nuxt.jsModule developmentVue.jsnpmCI/CDTestingPluginsComposables
⭐ 682πŸ•’ 2026-06-01Source β†—

Install this skill

npx skills add onmax/nuxt-skills

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

Nuxt modules allow developers to extend the core framework functionality by injecting custom logic, components, or configuration into a project. By using the 'defineNuxtModule' function and the official Nuxt Kit, these modules can automate setup, modify internal build steps, or add global runtime utilities. They function at different integration levels: inline within a configuration file for quick patches, inside a local directory for project-specific needs, or as external packages shared across multiple applications. Unlike standard Vue plugins, modules operate at the build-time stage, granting control over the Nuxt build process itself, such as adding auto-imports, modifying Vite configurations, or registering server middleware. This capability is essential for creating reusable infrastructure that integrates deeply with the Nuxt ecosystem while maintaining clean, modular project boundaries.

When to Use This Skill

  • β€’Creating reusable UI libraries that require global configuration or styling
  • β€’Abstracting complex third-party API integrations into a plug-and-play module
  • β€’Standardizing security headers or middleware across a company's fleet of sites
  • β€’Automating the setup of database drivers or SDKs during application startup

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • β€œCreate a new Nuxt module using the starter template
  • β€œHow do I use Nuxt Kit to modify the project build
  • β€œInitialize a local module in my Nuxt project
  • β€œAdd a custom server hook to my Nuxt module
  • β€œHow to register auto-imports from a custom Nuxt module

Pro Tips

  • πŸ’‘Always leverage `defineNuxtModule` and Nuxt Kit utilities for consistent API and future-proof compatibility.
  • πŸ’‘Implement comprehensive E2E tests for your modules to ensure stability across different Nuxt versions and configurations, especially when extending core features.
  • πŸ’‘Consider integrating with Nuxt DevTools to provide better debugging capabilities and enhance the developer experience for users of your module.

What this skill does

  • β€’Injecting custom server middleware or API routes into Nuxt applications
  • β€’Registering global components and composables automatically for auto-importing
  • β€’Hooking into the Nuxt build lifecycle to modify Vite or Webpack configurations
  • β€’Extending the user's nuxt.config object programmatically
  • β€’Adding custom Nitro server plugins for backend application logic

When not to use it

  • βœ•When a standard Vue plugin or simple utility function suffices without build-time access
  • βœ•For simple style modifications that can be handled via CSS or global UI components

Example workflow

  1. Initialize the module structure using the nuxi module starter template
  2. Define module functionality within src/module.ts using defineNuxtModule
  3. Implement runtime logic within the src/runtime directory
  4. Test the module implementation using the built-in playground environment
  5. Execute the module test suite to verify end-to-end integration

Prerequisites

  • –Node.js environment
  • –Familiarity with Nuxt framework architecture
  • –Understanding of the Nuxt Kit API

Pitfalls & limitations

  • !Accidentally creating excessive build-time overhead by performing heavy logic in the module entry point
  • !Conflicts between multiple modules attempting to mutate the same configuration properties
  • !Difficulty debugging modules since they run during the build process rather than the client browser

FAQ

What is the difference between a local module and a published module?
Local modules reside within your project and are not meant for distribution, while published modules are packaged as npm dependencies intended for reusability across multiple applications.
Can I use external npm packages inside my module?
Yes, you can import any dependencies required for your logic, but ensure they are correctly defined in your module's package.json to avoid runtime errors.
What is the Nuxt Kit?
The Nuxt Kit is a set of utilities provided by the framework to make writing modules easier by abstracting complex internal tasks and providing stable APIs.
Where should I define runtime code?
Runtime code such as composables, plugins, and components should be placed inside the 'src/runtime' directory, which is specifically treated by the module builder.

How it compares

While manual configuration involves repetitive edits to nuxt.config, building a module provides a structured, testable, and automated way to manage extensions at scale.

Source & trust

⭐ 682 starsπŸ•’ Updated 2026-06-01
πŸ“„ Full skill instructions β€” original source: onmax/nuxt-skills
# Nuxt Module Development

Guide for creating Nuxt modules that extend framework functionality.

**Related skills:** nuxt (basics), vue (runtime patterns)

## Quick Start

npx nuxi init -t module my-module
cd my-module && npm install
npm run dev # Start playground
npm run dev:build # Build in watch mode
npm run test # Run tests


## Available Guidance

- **[references/development.md](references/development.md)** - Module anatomy, defineNuxtModule, Kit utilities, hooks
- **[references/testing-and-publishing.md](references/testing-and-publishing.md)** - E2E testing, best practices, releasing, publishing
- **[references/ci-workflows.md](references/ci-workflows.md)** - Copy-paste CI/CD workflow templates

**Load based on context:**

- Building module features? β†’ [references/development.md](references/development.md)
- Testing or publishing? β†’ [references/testing-and-publishing.md](references/testing-and-publishing.md)
- CI workflow templates? β†’ [references/ci-workflows.md](references/ci-workflows.md)

## Module Types

| Type | Location | Use Case |
| --------- | ---------------- | -------------------------------- |
| Published | npm package | @nuxtjs/, nuxt- distribution |
| Local | modules/ dir | Project-specific extensions |
| Inline | nuxt.config.ts | Simple one-off hooks |

## Project Structure

my-module/
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ module.ts # Entry point
β”‚ └── runtime/ # Injected into user's app
β”‚ β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ composables/
β”‚ β”œβ”€β”€ plugins/
β”‚ └── server/
β”œβ”€β”€ playground/ # Dev testing
└── test/fixtures/ # E2E tests


## Resources

- [Module Guide](https://nuxt.com/docs/guide/going-further/modules)
- [Nuxt Kit](https://nuxt.com/docs/api/kit)
- [Module Starter](https://github.com/nuxt/starter/tree/module)

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/nuxt-modules/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/onmax/nuxt-skills/nuxt-modules/SKILL.md
  • Cursor: ~/.cursor/skills/onmax/nuxt-skills/nuxt-modules/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/onmax/nuxt-skills/nuxt-modules/SKILL.md

πŸš€ Install with CLI:
npx skills add onmax/nuxt-skills

Read the Master Guide: Mastering Agent Skills β†’

Related Skill Units

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid nuxt.js issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Nuxt.js and is published by Onmax, maintained in onmax/nuxt-skills.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.