Imported from visiongeist/coolifycli (
AGENTS.md). Install upstream withnpx skills add visiongeist/coolifycli. Copyright stays with the author.
Agent Instructions for Coolify CLI
This document provides guidance for AI agents (like GitHub Copilot, Claude, or other AI assistants) when working with the Coolify CLI project.
Project Overview
coolifycli is a command-line interface and OpenClaw skill for managing Coolify deployments, applications, databases, and infrastructure via the Coolify API. It's designed to be used both as a standalone CLI tool and as an AI agent skill.
Repository Structure
/Users/damien.antipa/Code/coolifycli/
├── LICENSE # MIT License
├── README.md # Main documentation
├── SKILL.md # Root skill definition
├── AGENTS.md # This file
└── skills/coolify/
├── SKILL.md # Detailed skill documentation
├── references/
│ └── API.md # Coolify API reference
└── scripts/
└── coolify # Main CLI script (bash)
Core Technologies
- Bash - Primary scripting language for the CLI
- curl - HTTP client for API requests
- jq - JSON processing
- Coolify API - REST API for Coolify platform management
Key Concepts
1. OpenClaw Skill Format
This project follows the OpenClaw skill format, which means:
- Skills are defined in
SKILL.mdfiles with YAML frontmatter - Commands are designed to be agent-invocable
- All output is structured JSON for programmatic consumption
- Environment variables are used for configuration
2. Coolify API Integration
- API endpoint:
https://app.coolify.io/api/v1(default) or self-hosted - Authentication: Bearer token via
COOLIFY_TOKENenvironment variable - All API responses are JSON
- Rate limiting is handled automatically
3. Command Structure
Commands follow this pattern:
./scripts/coolify <domain> <action> [options]
Examples:
./scripts/coolify applications list./scripts/coolify deploy --uuid abc-123./scripts/coolify databases create-postgresql --project-uuid proj-123 --server-uuid server-456
Common Tasks
When a User Wants to Deploy an Application
-
First, list available resources:
./scripts/coolify servers list ./scripts/coolify projects list -
Create or identify the application:
./scripts/coolify applications list # or create new: ./scripts/coolify applications create-public --project-uuid X --server-uuid Y --git-repository "https://github.com/user/repo" --git-branch main -
Configure if needed:
./scripts/coolify applications envs create --uuid APP_UUID --key KEY --value VALUE -
Deploy:
./scripts/coolify deploy --uuid APP_UUID
When a User Needs Database Management
-
List existing databases:
./scripts/coolify databases list -
Create a new database:
./scripts/coolify databases create-postgresql --project-uuid X --server-uuid Y --name "mydb" -
Configure backups:
./scripts/coolify databases backups create --uuid DB_UUID --frequency "0 2 * * *" --enabled true
When a User Wants to Troubleshoot
-
Check application status:
./scripts/coolify applications get --uuid APP_UUID -
View logs:
./scripts/coolify applications logs --uuid APP_UUID -
Check recent deployments:
./scripts/coolify deployments list-for-app --uuid APP_UUID
Important Conventions
1. Always Use UUIDs
- Most commands require UUIDs, not names
- Always list resources first to get the correct UUID
- Example:
./scripts/coolify applications listbefore operating on an app
2. Environment Variables Required
COOLIFY_TOKEN- Required for all API operationsCOOLIFY_API_URL- Optional, defaults tohttps://app.coolify.io/api/v1- Check if these are set before running commands
3. JSON Output Format
All commands return structured JSON:
{
"success": true,
"data": { ... },
"count": 42
}
Or on error:
{
"success": false,
"error": {
"type": "APIError",
"message": "...",
"hint": "..."
}
}
4. Command Naming Patterns
- Domain commands:
<domain> <action>(e.g.,applications list) - Nested resources:
<domain> <resource> <action>(e.g.,applications envs list) - Creation commands: Often include type in name (e.g.,
create-postgresql,create-public)
Agent Workflow Guidelines
When Asked to "Deploy Something"
- Gather information - What needs to be deployed? From where?
- Check prerequisites - Is
COOLIFY_TOKENset? Are servers available? - List resources - Show available projects, servers, existing apps
- Propose a plan - Outline the steps before executing
- Execute incrementally - Run commands step by step, checking results
- Verify success - Check deployment status and logs
When Asked to "Create a Database"
- Determine database type - PostgreSQL, MySQL, MongoDB, Redis, etc.
- List servers - Where should it be created?
- Create database - Use appropriate
create-*command - Configure if needed - Set up backups, credentials
- Provide connection info - Show the database UUID and connection details
When Asked to "Debug an Issue"
- Gather context - What's the symptom? Which resource is affected?
- Get resource details - Use
getcommand to see current state - Check logs - View application or deployment logs
- Check deployments - List recent deployments for the app
- Propose solutions - Based on the error type, suggest fixes
When Working with Environment Variables
- List existing - Always check what's already configured
- Create or update - Use appropriate command
- Remember to restart - Environment changes require app restart
- Validate - Confirm the changes took effect
Error Handling
Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| "API token not configured" | Missing COOLIFY_TOKEN |
Ask user to set the environment variable |
| "Application not found" | Invalid UUID | Run applications list to find correct UUID |
| "Rate limit exceeded" | Too many requests | Wait and retry, inform user about rate limiting |
| "connect ECONNREFUSED" | Cannot reach API | Check COOLIFY_API_URL and internet connection |
| "Deployment failed" | Build or runtime error | Check logs with applications logs and deployments get |
Always Provide Context
When an error occurs:
- Explain what went wrong in user-friendly terms
- Show the relevant error message
- Provide the specific command to fix or investigate further
- If needed, explain the underlying Coolify/API concept
Development Guidelines
When Adding New Features
- Check API.md - See if the endpoint exists in Coolify API
- Follow existing patterns - Match the structure of similar commands
- Update SKILL.md - Document the new command with examples
- Test manually - Run the command with real API credentials
- Update README.md - Add to relevant section
When Fixing Bugs
- Reproduce first - Understand the exact failure case
- Check API response - Is it an API issue or CLI parsing issue?
- Test fix - Verify it works with the actual Coolify API
- Consider edge cases - What if UUID is invalid? What if response is empty?
Code Style
- Use bash best practices (quote variables, check exit codes)
- Use jq for JSON parsing, not string manipulation
- Provide clear error messages with actionable hints
- Always output valid JSON on success or failure
Reference Documentation
- README.md - Overview, installation, quick start
- SKILL.md - Root skill definition
- skills/coolify/SKILL.md - Complete command reference
- skills/coolify/references/API.md - Coolify API documentation
Common Agent Mistakes to Avoid
❌ DON'T assume application names can be used as identifiers (always use UUIDs)
❌ DON'T run commands without checking if COOLIFY_TOKEN is set
❌ DON'T forget to list resources before operating on them
❌ DON'T ignore error messages - they contain helpful hints
❌ DON'T forget that environment variable changes require app restart
✅ DO list resources first to get UUIDs
✅ DO check prerequisites before running commands
✅ DO provide context and explain what each command does
✅ DO handle errors gracefully with helpful suggestions
✅ DO verify operations completed successfully
Testing Commands
Before suggesting commands to users:
- Validate syntax - Check that all required options are provided
- Check dependencies - Does the command require UUIDs from other commands?
- Consider state - Will this work given the current state? (e.g., can't restart a stopped app without starting it first)
- Explain side effects - Will this trigger a deployment? Will it restart services?
Quick Command Reference
Most Common Operations
# List everything
./scripts/coolify applications list
./scripts/coolify databases list
./scripts/coolify servers list
./scripts/coolify projects list
# Get details
./scripts/coolify applications get --uuid UUID
./scripts/coolify databases get --uuid UUID
# Lifecycle management
./scripts/coolify applications start|stop|restart --uuid UUID
./scripts/coolify databases start|stop|restart --uuid UUID
# Deployments
./scripts/coolify deploy --uuid UUID
./scripts/coolify deployments list
./scripts/coolify applications logs --uuid UUID
# Environment variables
./scripts/coolify applications envs list --uuid UUID
./scripts/coolify applications envs create --uuid UUID --key KEY --value VALUE
Working Directory
The CLI script is located at:
/Users/damien.antipa/Code/coolifycli/skills/coolify/scripts/coolify
Always use absolute paths or run from the repository root.
Final Notes
- This is a real project that interacts with production Coolify instances
- Always be cautious with destructive operations (delete, stop, etc.)
- When in doubt, list resources first to understand the current state
- Explain commands before running them so users understand what will happen
- Provide complete examples that users can run directly
For questions or issues, refer to the main documentation files or the Coolify documentation at https://coolify.io/docs/