Overview
Theapplad instruct command is the CLI surface of the lad — Applad’s AI-powered assistant. You give instructions in plain language and the lad translates them into config changes, migrations, and applad up operations.
Every instruction is attributed to your SSH key identity in the audit trail. The exact prompt is recorded alongside every change made — AI-assisted changes are always traceable to the human who authorized them.
Basic Usage
- Understand your request
- Plan the necessary changes
- Create or modify config files
- Generate migrations if needed
- Show you what it would do
Scaffold and Configure
Create database tables
tables/users.yaml with fields for email, name, avatar_url, and soft delete support (deleted_at). Also generates the corresponding migration SQL and updates .env.example if needed.
Add search functionality
tables/posts.yaml to add the index definition and generates a migration that creates the fulltext index in the database.
Create functions
functions/send-welcome-message.yaml with a source block pointing to a local path, a trigger on auth.user.created, and appropriate container security settings. Also scaffolds the function source file at the configured path.
Set up deployments
deployments/android-production.yaml with type: play-store, a source block pointing to the project’s configured GitHub repo, and a build config for Flutter. Prompts for signing credential setup if not already configured.
deployments/web.yaml with type: web, the configured domain, SSL, sensible security headers, and a source block pointing to the web app repo.
Configure rate limiting
observability/observability.yaml — sets a per-user limit appropriate for payment operations.
Create workflows
workflows/post-published.yaml that triggers on a post status change to published, sends a push notification via the push channel and an email via the email channel.
Configure messaging templates
Infrastructure
Provision cloud resources
project.yaml. Updates database/database.yaml with a production environment override pointing to the RDS connection. Updates .env.example with the new required credentials. Then runs applad up --env production --dry-run so you can review before applying.
Set up staging environments
project.yaml to target a Hetzner VPS, mirroring the infrastructure configuration of the production environment. Runs applad up --env staging --dry-run for review.
Migrate storage adapters
storage/storage.yaml to use the S3 adapter, adds the required ${VAR} references, updates .env.example with S3_BUCKET, S3_REGION, S3_ACCESS_KEY, S3_SECRET_KEY, and runs applad up --dry-run so you can review the change.
Switch email providers
messaging/messaging.yaml switching the email provider from the current one to SES, adds the required credential references, and updates .env.example.
Manage cloud VMs
applad cloud list while running. Cost and duration are logged to the runtime database.
Optimize cloud resources
applad cloud list, cross-references their usage patterns from the analytics database, and suggests which resources appear idle or underutilized and could be torn down.
Debug and Diagnose
Troubleshoot errors
Performance optimization
tables/*.yaml, and suggests index changes that would improve performance. Generates the index definition and migration if you confirm.
Security audits
tables/*.yaml and identifies any rules that could allow unintended data access — missing auth filters, overly broad role permissions, or missing row-level filters.
Cost analysis
Context Flags
Use--context to narrow the lad’s focus to a specific data source. Without --context the lad draws on all available sources. With --context it focuses specifically on the named source, giving faster and more precise answers for targeted questions.
—context logs
Focuses the lad on recent log output. Useful for diagnosing a specific failure that just happened.—context tables
Focuses the lad on thetables/ directory. Useful for performance questions that relate specifically to schema and indexing decisions.
—context security
Focuses the lad on the security event log. Useful for targeted security investigations.—context cloud
Focuses the lad on currently provisioned cloud resources. Useful for cost and utilization questions.—context deployments
Focuses the lad on deployment logs and history. Useful for debugging a specific deployment failure.—context functions
Focuses the lad on function execution logs and error rates.—context instruct-history
Focuses the lad on the audit trail of previous instruct actions. Useful for reviewing what the lad (and who) changed recently, or for understanding the history of a specific piece of config.Dry Run
The--dry-run flag shows the complete plan the lad would execute without making any changes. Shows every file that would be created or modified, every migration that would be generated, and every applad up operation that would run.
Use --dry-run to review and understand what an instruction would do before committing to it. Especially important for infrastructure changes and anything touching production.
Scoping
By defaultinstruct operates in the context of the active project and environment (set by applad projects switch and the current environment). Use these flags to override.
—project
Runs the instruction in the context of a specific project regardless of which project is currently active.—env
Runs the instruction in the context of a specific environment. Useful for asking environment-specific questions without switching your active environment.Examples
Create a complete feature
Diagnose and fix production issues
Set up infrastructure
Best Practices
- Always use —dry-run first for infrastructure changes and production deployments
- Be specific in your instructions — the more context you provide, the better the result
- Review the audit trail — every instruct action is logged with the exact prompt used
- Use context flags for faster, more focused answers to targeted questions
- Iterate incrementally — break large changes into smaller instructions you can review individually