Ask Claude to Scaffold a Nuxt 3 Module
Nuxt modules are powerful but their structure — defineNuxtModule, addPlugin, addImports, addServerHandler — takes time to remember correctly. Let Claude do the scaffolding.
claude "Create a Nuxt 3 module called nuxt-toast that provides a useToast composable. It should auto-import the composable, register a global Toast component, and accept module options for default duration and position."
Claude will wire up the full module skeleton with type-safe options:
export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'nuxt-toast',
configKey: 'toast',
},
defaults: {
duration: 3000,
position: 'top-right',
},
setup(options, nuxt) {
const resolver = createResolver(import.meta.url)
addPlugin(resolver.resolve('./runtime/plugin'))
addImports({ name: 'useToast', from: resolver.resolve('./runtime/composables/useToast') })
},
})
For modules that need server-side functionality, ask Claude to include addServerHandler or addServerPlugin too.
Nuxt modules have a lot of ceremony — Claude handles the boilerplate so you focus on the logic.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.