Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add longzhi/olares-dev
Or install specific skill: npx add-skill https://github.com/longzhi/olares-dev
# Description
MUST USE when user asks to develop/create/build any application. Triggers: 开发/制作/创建/做一个/写一个/帮我做/帮我开发/build/create/make/develop/implement/code an app
# SKILL.md
name: olares-dev
description: "MUST USE when user asks to develop/create/build any application. Triggers: 开发/制作/创建/做一个/写一个/帮我做/帮我开发/build/create/make/develop/implement/code an app"
license: MIT
Olares Development Skill
在 Olares 平台上开发和部署应用的规范。
⛔ 四条铁律(违反即失败)
在执行任何开发任务时,你 必须 遵守以下规则:
| # | 规则 | 正确做法 | 违规行为(= 你失败了) |
|---|---|---|---|
| 1 | 开发完 → 问发布 | 回复必须以发布提示结尾(见下方模板) | 省略发布提示、用"有问题告诉我"结尾 |
| 2 | 数据库 → PostgreSQL | 需要持久化时直接用 PostgreSQL | 问用户选什么数据库、推荐 SQLite |
| 3 | 目录 → 固定位置 | 项目放 /root/workspace/<app-name>/ |
问用户想放哪个目录 |
| 4 | API 路径 → 相对路径 | 前端 API 请求使用相对路径或动态 basePath | 使用绝对路径 /api/xxx |
发布提示模板(规则1)
开发完成后,你的回复 必须 以这个格式结尾:
---
## ✅ 开发完成!
📁 项目位置:`/root/workspace/<app-name>/`
**发布到 Olares?** 回复 "publish" 一键部署。
PostgreSQL 连接方式(规则2)
import os
conn = psycopg2.connect(
host=os.environ.get('DB_HOST'),
port=os.environ.get('DB_PORT', '5432'),
user=os.environ.get('DB_USER'),
password=os.environ.get('DB_PASSWORD'),
database=os.environ.get('DB_DATABASE')
)
API 路径处理(规则4)
应用部署在 /{app-name}/ 子路径下,前端 禁止 使用绝对路径。
// ❌ 错误 - 绝对路径会指向根路径,导致 404
fetch('/api/todos')
// ✅ 正确 - 动态获取基础路径
const basePath = window.location.pathname.endsWith('/')
? window.location.pathname
: window.location.pathname + '/';
fetch(basePath + 'api/todos')
🎯 触发词
开发触发词(加载此 skill)
- 中文:制作 / 开发 / 创建 / 做一个 / 写一个 / 帮我做 / 帮我写 / 帮我开发 / 实现 / 编写
- English: build / create / make / develop / help me build / help me create / implement / code
发布触发词(执行部署)
用户说以下词时,立即执行部署:
- 发布 / publish / 好 / 可以 / OK / yes / 确认 / go / 上线 / deploy / ship it / release
📐 开发工作流
用户请求开发
↓
创建项目: /root/workspace/<app-name>/ ← 不要问目录
↓
需要数据库?→ 直接用 PostgreSQL ← 不要问选择
↓
编写完整可运行的代码
↓
回复以发布提示结尾 ← 必须!
↓
用户确认 → 执行部署
🚀 部署命令
# 格式
olares-deploy <app-name> <image> <port> [startup-command]
# 示例
olares-deploy todo-app python:3.11-slim 8080 "pip install -r requirements.txt && python app.py"
# 部署后必须更新 Nginx
python3 /root/.local/bin/olares-nginx-config
部署后回复模板
✅ 部署成功!
🌐 访问地址:https://8cf849020.{username}.olares.com/{app-name}/
📁 代码目录:/root/workspace/{app-name}/
管理命令:
• 查看日志:olares-manage logs {app-name}
• 查看状态:olares-manage info {app-name}
• 删除应用:olares-manage delete {app-name}
🛠️ 管理命令
olares-manage list # 列出所有应用
olares-manage info <app-name> # 查看应用详情
olares-manage logs <app-name> # 查看日志
olares-manage delete <app-name> # 删除应用
olares-urls # 显示所有 URL
🌐 网络架构
用户浏览器 → https://8cf849020.{username}.olares.com/{app-name}/
↓
Olares Ingress → OpenCode Container:3000 (Nginx)
↓
├─ / → localhost:4096 (OpenCode Server)
└─ /{app-name}/ → {app-name}-svc:{port}
🔧 故障排查
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 502 Bad Gateway | Pod 未运行 | olares-manage logs <app-name> |
| 404 Not Found | Nginx 未配置 | python3 /root/.local/bin/olares-nginx-config |
| 数据库连接失败 | 环境变量未设置 | 检查 OlaresManifest.yaml |
📚 参考文档
| 文档 | 内容 |
|---|---|
docs/database-reference.md |
PostgreSQL 详细用法 |
docs/deployment-reference.md |
部署命令和网络架构 |
docs/helm-reference.md |
Helm Chart 打包格式 |
docs/github-submission.md |
Market 提交流程 |
✅ 示例:正确的开发回复
好的,我来帮你创建一个待办事项应用。
[创建 /root/workspace/todo-app/app.py]
[创建 /root/workspace/todo-app/requirements.txt]
[创建 /root/workspace/todo-app/static/index.html]
应用已创建并测试通过:
- 后端:Flask + PostgreSQL
- 前端:简洁的 HTML/CSS/JS
- API:GET/POST/DELETE /api/todos
---
## ✅ 开发完成!
📁 项目位置:`/root/workspace/todo-app/`
**发布到 Olares?** 回复 "publish" 一键部署。
❌ 示例:错误的开发回复
首先,你想用什么数据库?PostgreSQL、MySQL 还是 SQLite? ← 违反规则2
你想把项目放在哪个目录? ← 违反规则3
应用已创建完成!有问题随时告诉我。 ← 违反规则1
fetch('/api/todos') ← 违反规则4(应使用相对路径)
# README.md
Olares Development Skill
🚀 Complete Olares development and deployment skill for OpenCode AI, including automated tools and Nginx reverse proxy system.
OpenCode skill for developing and deploying applications to Olares - a self-hosted cloud operating system.
📦 Contents
olares-dev.md- Enhanced skill file with DevBox Quick Deploy + Nginx reverse proxytemplates/- Boilerplate templates for quick chart creationtools/- NEW Automated deployment and management toolsdocs/- NEW Complete documentation and guides
🎯 What's New
Automated DevBox Deployment System
- ✅ Direct
kubectldeployment (no Helm charts needed for dev) - ✅ Automatic Nginx reverse proxy configuration
- ✅ Unified entry point (port 3000) with path-based routing
- ✅ OpenCode Server external access support
- ✅ Zero-downtime configuration updates
Network Architecture
External Browser
↓ HTTPS
https://{hash}-3000.{domain}/{path}
↓
Olares Ingress → OpenCode Container (port 3000)
↓
Nginx Reverse Proxy (path routing)
↓
├─ / → localhost:4096 (OpenCode Server)
├─ /my-app/ → my-app-svc:port
└─ /health → Nginx health check
🚀 Quick Start
1. Install Tools
# Install to system
mkdir -p ~/.local/bin ~/.local/lib
cp tools/olares-* ~/.local/bin/
cp tools/olares_deployer.py ~/.local/lib/
chmod +x ~/.local/bin/olares-*
# Add to PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
2. Install Skill
# Install to OpenCode
cp olares-dev.md ~/.config/opencode/skills/
3. Deploy Your First App
# 1. Deploy application
olares-deploy my-app python:3.11-slim 8080 "python app.py"
# 2. Update Nginx config (REQUIRED)
python3 ~/.local/bin/olares-nginx-config
# 3. Access at:
# https://{hash}-3000.{domain}/my-app/
📋 Standard Deployment Flow
# Step 1: Deploy
olares-deploy app-name image:tag port "startup-command"
# Step 2: Update Nginx (Mandatory!)
python3 olares-nginx-config
# Step 3: Access
https://{hash}-3000.{domain}/app-name/
🛠️ Available Tools
Deployment
olares-deploy- Deploy apps to Kubernetesolares-nginx-config- Generate/update Nginx reverse proxy configsolares_deployer.py- Python API for programmatic deployment
Management
olares-manage- Manage deployed apps (list, info, logs, delete)olares-urls- Show all deployed app URLsolares-init- Initialize environment (install kubectl, verify RBAC)
📚 Documentation
| Document | Description |
|---|---|
olares-dev.md |
Complete OpenCode skill definition |
docs/FINAL_SOLUTION.md |
Complete architecture and solution guide |
docs/NGINX_PROXY_COMPLETE.md |
Nginx configuration detailed guide |
docs/SOLUTION_SUMMARY.md |
Problem and solution summary |
🌐 Access Patterns
OpenCode Server
https://{hash}-3000.{domain}/
Root path for OpenCode Server (port 4096).
Deployed Applications
# By app name
https://{hash}-3000.{domain}/my-app/
# By port number
https://{hash}-3000.{domain}/8080/
# Health check
https://{hash}-3000.{domain}/health
📖 Usage in OpenCode
Traditional (Helm Charts)
For production apps intended for Olares Market:
# Use templates
cp templates/* my-app/
# Edit Chart.yaml, OlaresManifest.yaml, etc.
# Package and deploy via Studio UI
DevBox Quick Deploy (Recommended for Development)
For rapid development and testing:
# Just run deploy command
olares-deploy my-app python:3.11-slim 8080 "python app.py"
python3 olares-nginx-config
# App is live immediately!
🎨 Example: Hello World
# Create app
echo '<h1>Hello World</h1>' > index.html
# Deploy
olares-deploy hello-world python:3.11-slim 8080 "python -m http.server 8080"
# Update Nginx
python3 olares-nginx-config
# Access
https://{hash}-3000.{domain}/hello-world/
✨ Key Features
Traditional Helm Deployment
- Application Packaging - Helm chart structure + OlaresManifest.yaml
- Database Provisioning - PostgreSQL, Redis, MongoDB integration
- Permission Configuration - App data, user data, system APIs
- Deployment Workflow - Studio UI steps, Playwright automation
- Troubleshooting - Common issues and solutions
NEW: DevBox Quick Deploy
- One-Command Deployment - No Helm charts needed
- Automatic Nginx Proxy - Unified entry with path routing
- OpenCode Server Support - External access to development tools
- Zero Downtime - Graceful Nginx reloads
- Auto Framework Detection - Flask, FastAPI, Express, Django
🔑 Key Concepts
- Unified Entry Point: All requests through port 3000
- Path-Based Routing: Different apps on different URL paths
- OpenCode Server: Root path (
/) for development environment - Automatic Configuration: One command to update all proxy rules
- No Port Conflicts: Unlimited apps without port exhaustion
Traditional Concepts:
- No REST API: Olares deployment is through Studio UI (automate with Playwright)
- System Services: PostgreSQL/Redis/MongoDB are pre-installed, just declare in manifest
- User Isolation: Each user gets isolated app instances
🐛 Troubleshooting
App not accessible externally
# Did you update Nginx?
python3 olares-nginx-config
# Check Nginx status
python3 olares-nginx-config status
502 Bad Gateway
# Check if pod is running
kubectl get pods -n namespace -l app=app-name
# View logs
kubectl logs -n namespace -l app=app-name
Configuration issues
# View generated config
cat /etc/nginx/conf.d/dev/app-name.conf
# Test Nginx config
nginx -t
# Reload Nginx
nginx -s reload
📞 Support
- GitHub Issues: https://github.com/longzhi/olares-skill/issues
- Olares Documentation: https://docs.olares.com/developer/develop/
- Official App Repository: https://github.com/beclab/apps
🤝 Contributing
Contributions welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Submit a Pull Request
📄 License
MIT License
🎉 Happy Developing on Olares!
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.