Skip to main content

Overview

The Lua CLI creates a clean, minimal project structure by default. You can optionally include examples with --with-examples.
your-project/
β”œβ”€β”€ src/
β”‚   └── index.ts           # Agent configuration (LuaAgent)
β”œβ”€β”€ lua.skill.yaml         # Configuration (auto-managed)
β”œβ”€β”€ package.json           # Dependencies
β”œβ”€β”€ tsconfig.json          # TypeScript config
β”œβ”€β”€ .env.example           # Environment template
└── README.md              # Quick start guide

Core Files

src/index.ts

Your agent’s main configuration file.
import { LuaAgent } from "lua-cli";

const agent = new LuaAgent({
    name: `my-agent`,
    persona: `You are a helpful assistant...`,
    
    skills: [],        // Add your skills here
    
    // Optional components:
    // webhooks: [],
    // jobs: [],
    // preProcessors: [],
    // postProcessors: [],
});

lua.skill.yaml

Auto-managed configuration file. Created during lua init, updated automatically by CLI commands.
agent:
  agentId: agent_abc123
  orgId: org_xyz789

skills:
  - name: my-skill
    version: 1.0.0
    skillId: skill_xyz  # Auto-created during compile
Do not manually edit this file! The lua.skill.yaml is managed by the CLI and stores state only (IDs and versions). All configuration belongs in your code:
  • Persona β†’ LuaAgent in src/index.ts
  • Tool definitions β†’ Your tool files
  • Skill configuration β†’ LuaSkill in code
  • Environment variables β†’ .env file or lua env command
The only exception: you may manually increment the version number before pushing a new release.
IDs like skillId, webhookId, and jobId are auto-generated during compilation. Never edit these manually.

package.json

Standard Node.js package configuration:
{
  "name": "lua-skill",
  "type": "module",
  "dependencies": {
    "lua-cli": "^3.1.0",
    "zod": "^3.24.1"
  }
}

Building Your Project

As your project grows, organize it like this:
src/
β”œβ”€β”€ index.ts                    # Agent configuration
β”œβ”€β”€ skills/
β”‚   β”œβ”€β”€ tools/                  # Tool implementations
β”‚   β”‚   β”œβ”€β”€ WeatherTool.ts
β”‚   β”‚   β”œβ”€β”€ ProductTools.ts     # Multiple related tools
β”‚   β”‚   └── OrderTool.ts
β”‚   β”œβ”€β”€ weather.skill.ts        # Weather skill
β”‚   └── ecommerce.skill.ts      # E-commerce skill
β”œβ”€β”€ webhooks/                   # (Optional) HTTP endpoints
β”‚   └── PaymentWebhook.ts
β”œβ”€β”€ jobs/                       # (Optional) Scheduled tasks
β”‚   └── DailyReportJob.ts
└── services/                   # (Optional) Shared utilities
    └── ApiClient.ts

File Naming Conventions

TypePatternExample
Tools*Tool.ts or *Tools.tsWeatherTool.ts, ProductTools.ts
Skills*.skill.tsweather.skill.ts
Webhooks*Webhook.tsPaymentWebhook.ts
Jobs*Job.tsDailyReportJob.ts
Preprocessors*.preprocessor.tsfilter.preprocessor.ts
Postprocessors*.postprocessor.tsformat.postprocessor.ts

Auto-Generated Directories

dist/

Compiled JavaScript output. Created by lua compile.
dist/
β”œβ”€β”€ deployment.json       # Deployment metadata
β”œβ”€β”€ index.js             # Compiled main file
└── tools/               # Compiled tool bundles

.lua/

CLI cache directory. Safe to delete - will be regenerated.

Environment Files

.env

Your local environment variables (create this file):
# External API Keys
STRIPE_API_KEY=sk_test_abc123
OPENAI_API_KEY=sk-...

# Configuration
API_BASE_URL=https://api.example.com
Add .env to .gitignore - never commit secrets!

.env.example

Template for environment variables (commit this):
STRIPE_API_KEY=your_stripe_key_here
OPENAI_API_KEY=your_openai_key_here

Git Configuration

βœ… Commit These

.gitignore
.env.example
lua.skill.yaml
package.json
tsconfig.json
README.md
src/

❌ Don’t Commit These

.env
node_modules/
dist/
.lua/

Sample .gitignore

# Dependencies
node_modules/

# Build output
dist/
.lua/

# Environment
.env
.env.local
.env.*.local

# OS
.DS_Store

# IDE
.vscode/
.idea/

Project Size Patterns

src/
β”œβ”€β”€ index.ts
└── skills/
    β”œβ”€β”€ tools/
    β”‚   └── MyTools.ts    # All tools in one file
    └── my.skill.ts

Next Steps

Building Skills

Learn how to build custom skills

Best Practices

Follow recommended patterns

API Reference

Available platform APIs

Examples

See working code examples