AdonisJS Ace CLI expert for building TypeScript backend applications. Use when users need to scaffold, develop, build, or manage AdonisJS projects, run migrations, create models/controllers, or configure packages.
/plugin marketplace add leobrival/topographic-studio-plugins/plugin install dev@topographic-plugins-officialThis skill inherits all available tools. When active, it can use any tool Claude has access to.
reference/commands-reference.mdreference/common-patterns.mdreference/troubleshooting.mdAdonisJS is a TypeScript-first Node.js framework for building server-side applications. Ace is the command-line framework embedded into AdonisJS core. This guide provides essential workflows and quick references for common AdonisJS operations.
# Create new AdonisJS project
npm init adonisjs@latest my-app
# Navigate to project
cd my-app
# Generate app key
node ace generate:key
# Start development server
node ace serve --hmr
# List all available commands
node ace list
# Get help for a command
node ace serve --help
# Create API project
npm init adonisjs@latest my-api -- --kit=api
cd my-api
# Generate app key
node ace generate:key
# Install and configure database
node ace add @adonisjs/lucid
# Create initial model with migration
node ace make:model User -m
# Run migrations
node ace migration:run
# Start dev server with HMR
node ace serve --hmr
# Create complete resource (model, migration, factory, controller)
node ace make:model Post -mfc
# Create validators for the resource
node ace make:validator post --resource
# Create service for business logic
node ace make:service post
# Edit migration file (database/migrations/xxxxx_posts.ts)
# Add table columns
# Run migration
node ace migration:run
# Create seeder for testing data
node ace make:seeder Post
# Run seeder
node ace db:seed
# Create migration
node ace make:migration add_slug_to_posts
# Preview migration changes (dry run)
node ace migration:run --dry-run
# Run migrations
node ace migration:run
# Check migration status
node ace migration:status
# Rollback last batch
node ace migration:rollback
# Refresh database (reset + run)
node ace migration:refresh --seed
# Install authentication package
node ace add @adonisjs/auth
# Install session support
node ace add @adonisjs/session
# Create auth controllers
node ace make:controller auth/login
node ace make:controller auth/register
# Create auth middleware
node ace make:middleware auth
# Run auth migrations
node ace migration:run
# Build application
node ace build
# Navigate to build directory
cd build
# Install production dependencies
npm ci --production
# Run migrations in production
node ace migration:run --force
# Start production server
node server.js
When to use which command:
node ace serve --hmrnode ace make:model Name -mfc (includes migration, factory, controller)node ace make:controller name --resource --apimigration:run, migration:rollback, migration:status)node ace add @adonisjs/package-namenode ace make:validator name --resourcenode ace list:routes --middleware# RESTful API controller
node ace make:controller posts --resource --api
# Generates controller with:
# - index() GET /posts
# - store() POST /posts
# - show() GET /posts/:id
# - update() PUT /posts/:id
# - destroy() DELETE /posts/:id
// One-to-Many (User has many Posts)
// app/models/user.ts
@hasMany(() => Post)
declare posts: HasMany<typeof Post>
// app/models/post.ts
@belongsTo(() => User)
declare user: BelongsTo<typeof User>
// Query with relationships
const user = await User.query().preload('posts')
const post = await Post.query().preload('user').first()
// Create validator: node ace make:validator post --resource
// app/validators/post.ts
import vine from '@vinejs/vine'
export const createPostValidator = vine.compile(
vine.object({
title: vine.string().minLength(3).maxLength(255),
content: vine.string().minLength(10),
isPublished: vine.boolean().optional(),
})
)
// Use in controller
const payload = await request.validateUsing(createPostValidator)
// Create table migration
export default class extends BaseSchema {
protected tableName = 'posts'
async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('title').notNullable()
table.text('content').notNullable()
table.integer('user_id').unsigned()
.references('users.id').onDelete('CASCADE')
table.timestamp('created_at')
table.timestamp('updated_at')
})
}
async down() {
this.schema.dropTable(this.tableName)
}
}
// Session-based login
export default class LoginController {
async store({ request, auth, response }: HttpContext) {
const { email, password } = request.only(['email', 'password'])
const user = await User.verifyCredentials(email, password)
await auth.use('web').login(user)
return response.redirect('/dashboard')
}
}
// API token generation
export default class TokensController {
async store({ request, response }: HttpContext) {
const { email, password } = request.only(['email', 'password'])
const user = await User.verifyCredentials(email, password)
const token = await User.accessTokens.create(user)
return response.created({ token: token.value!.release() })
}
}
Common Issues:
Server won't start
lsof -i :3333node ace generate:keyMigration fails
node ace migration:status.envDatabase connection refused
.env credentialspsql -h localhost -U postgresValidation always fails
vine.compile(schema)Route not found (404)
node ace list:routesFor detailed troubleshooting steps, see the Troubleshooting Guide.
Load as needed for detailed information:
Commands Reference - Complete Ace CLI command documentation with all flags and options. Use when you need exact syntax, flag details, or comprehensive command documentation.
Common Patterns - Real-world patterns for CRUD resources, authentication, validation, relationships, events, testing, and production deployment. Use for implementing specific features or architectural patterns.
Troubleshooting Guide - Detailed error messages, diagnosis steps, and resolution strategies for server, database, authentication, routing, build, and performance issues. Use when encountering errors or unexpected behavior.
When to use each reference:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.