一键导入
lvt-production-ready
Transform app to production-ready - adds authentication, deployment config, environment setup, and best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Transform app to production-ready - adds authentication, deployment config, environment setup, and best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when deploying LiveTemplate applications to production - covers Docker containerization, Fly.io deployment, Kubernetes setup, database persistence, and production best practices
Transform app to production-ready - adds authentication, deployment config, environment setup, and best practices
Use when deploying LiveTemplate applications to production - covers Docker containerization, Fly.io deployment, Kubernetes setup, database persistence, and production best practices
Rapid end-to-end workflow - creates app, adds resources, sets up development environment in one flow
Generate test apps, capture screenshots, analyze UI for issues, and recursively fix problems in kit templates
Use when adding database migrations to LiveTemplate apps - guides both auto-generated migrations (from lvt gen resource) and custom migrations (indexes, constraints, data transformations)
| name | lvt-production-ready |
| description | Transform app to production-ready - adds authentication, deployment config, environment setup, and best practices |
| category | workflows |
| version | 1.0.0 |
| keywords | ["lvt","livetemplate","lt"] |
Transform a development app into a production-ready application with authentication, deployment configuration, environment variables, and production best practices.
This skill typically runs in existing LiveTemplate projects (.lvtrc exists).
✅ Context Established By:
.lvtrc exists (most common scenario)lvt-assistant agentKeyword matching (case-insensitive): lvt, livetemplate, lt
With Context: ✅ Generic prompts related to this skill's purpose
Without Context (needs keywords): ✅ Must mention "lvt", "livetemplate", or "lt" ❌ Generic requests without keywords
When to use:
Examples:
This skill chains together:
Use lvt:gen-auth skill:
Ask user about auth requirements:
Generate auth:
lvt gen auth
# Or with specific features:
lvt gen auth --no-magic-link # Password only
lvt gen auth --no-password # Magic link only
Apply migrations:
lvt migration up
cd database && sqlc generate && cd ../..
go mod tidy
Wire auth routes in main.go:
import (
"myapp/app/auth"
"myapp/shared/email"
)
// Email sender (production)
emailSender := email.NewSMTPSender(email.SMTPConfig{
Host: os.Getenv("SMTP_HOST"),
Port: 587,
Username: os.Getenv("SMTP_USER"),
Password: os.Getenv("SMTP_PASS"),
From: os.Getenv("EMAIL_FROM"),
})
// Auth handler
authHandler := auth.New(queries, emailSender)
// Auth routes
http.Handle("/auth/register", authHandler.HandleRegister())
http.Handle("/auth/login", authHandler.HandleLogin())
http.Handle("/auth/logout", authHandler.HandleLogout())
// Protect existing routes
http.Handle("/posts", auth.RequireAuth(queries, posts.Handler(queries)))
http.Handle("/dashboard", auth.RequireAuth(queries, dashboard.Handler()))
Use lvt:deploy skill:
Ask user about deployment target:
Generate deployment files:
lvt gen stack docker # For Docker
lvt gen stack fly # For Fly.io
lvt gen stack k8s # For Kubernetes
Verify deployment config created:
Create .env file (never commit this):
# Database
DATABASE_PATH=/data/app.db
# Server
PORT=8080
HOST=0.0.0.0
# Email (SMTP)
SMTP_HOST=smtp.gmail.com
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
EMAIL_FROM=noreply@yourapp.com
# Application
APP_ENV=production
APP_URL=https://yourapp.com
# Secrets
SESSION_SECRET=<generate-random-32-bytes>
CSRF_SECRET=<generate-random-32-bytes>
Generate secrets:
# Generate random secrets
openssl rand -hex 32 # For SESSION_SECRET
openssl rand -hex 32 # For CSRF_SECRET
Add to main.go:
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteString(`{"status":"ok"}`)
})
Add production deployment section:
## Production Deployment
### Prerequisites
- Docker installed (for Docker deployment)
- Environment variables configured (see .env.example)
- SMTP credentials for email
### Deploy to [Platform]
1. Copy .env.example to .env and fill in values
2. Generate secrets: `openssl rand -hex 32`
3. Build: `docker build -t myapp .`
4. Deploy: [platform-specific commands]
### Environment Variables
See .env.example for all required variables.
### Database
Run migrations before first deploy:
```bash
lvt migration up
Configure SMTP settings in .env for production email delivery.
## Quick Reference
### Full Production Setup (Docker + Auth)
```bash
# 1. Add authentication
lvt gen auth
lvt migration up
cd database && sqlc generate && cd ../..
go mod tidy
# 2. Add deployment config
lvt gen stack docker
# 3. Create environment file
cp .env.example .env
# Edit .env with production values
# 4. Generate secrets
echo "SESSION_SECRET=$(openssl rand -hex 32)" >> .env
echo "CSRF_SECRET=$(openssl rand -hex 32)" >> .env
# 5. Build and test locally
docker-compose up --build
# 6. Deploy
docker-compose up -d
# 1. Add auth
lvt gen auth
lvt migration up
cd database && sqlc generate && cd ../..
# 2. Generate Fly.io config
lvt gen stack fly
# 3. Deploy
fly launch
fly deploy
Best for: Any cloud provider, VPS, local hosting Pros: Universal, portable, reproducible Setup: Dockerfile + docker-compose.yml
Deploy:
docker-compose up -d
Best for: SQLite apps, global edge deployment Pros: Optimized for SQLite, automatic HTTPS, global CDN Setup: fly.toml + litestream.yml
Deploy:
fly deploy
Best for: Large scale, enterprise deployments Pros: Highly scalable, self-healing, enterprise-grade Setup: Deployment, Service, Ingress manifests
Deploy:
kubectl apply -f k8s/
Best for: Simple deployments, single server Pros: Simple, cost-effective Setup: systemd service + nginx
Deploy:
# Build binary
GOWORK=off CGO_ENABLED=1 go build -o myapp ./cmd/myapp
# Copy to server and run
./myapp
Production-ready setup is successful when:
Fly.io:
fly certs add yourdomain.com
Docker/VPS: Configure nginx or Caddy reverse proxy
Fly.io: Automatic Docker: Use Let's Encrypt + Caddy/nginx K8s: Use cert-manager
SQLite + Litestream:
# litestream.yml already configured
# Backups to S3/B2/Azure automatically
PostgreSQL: Set up pg_dump cron job