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:
  • PersonaLuaAgent in src/index.ts
  • Tool definitions → Your tool files
  • Skill configurationLuaSkill 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