Deploy with Agent Skills
Defang provides skills for safe, deterministic deployments to AWS, GCP, and Azure.
Add the Skills
- npx
- Claude Code
- Codex
npx skills add DefangLabs/defang
Add the Defang marketplace, then install the plugin:
/plugin marketplace add DefangLabs/defang
/plugin install defang@defang-skills
Then reload plugins to activate everything:
/reload-plugins
Add the Defang marketplace entry to your personal marketplace file at ~/.agents/plugins/marketplace.json:
{
"name": "defang-skills",
"owner": {
"name": "DefangLabs"
},
"plugins": [
{
"name": "defang",
"source": {
"source": "github",
"repo": "DefangLabs/defang",
"path": "codex-plugin"
},
"category": "Infrastructure"
}
]
}
Then install the plugin from within Codex:
/plugin install defang@defang-skills
Codex's public plugin registry is not yet available. Until it launches, installation requires adding the marketplace entry manually as shown above.
Estimate deployment cost
Before deploying, you can ask your agent to estimate the cost of your deployment:
/defang:estimate
Your agent will analyze your compose.yaml and provide a cost estimate based on the services you're deploying, their resource requirements, and the current pricing for the cloud resources which will be used. This can help you identify expensive services or configurations before you deploy.
How the estimate works
- Validate the CLI — checks if the Defang CLI is installed, and provides install instructions if not
- Authenticate — verifies you're logged in to Defang, or runs
defang login - Find your
compose.yaml— locates your Compose file - Determine target stack — identifies the cloud provider, region, and deployment mode to base the estimate on (or asks you to specify them)
- Run the estimate — executes
defang compose estimatewith the appropriate flags - Explain the results — summarizes cost breakdowns and suggests lower-cost alternatives if needed
Estimate flags
--provider aws|gcp: override the provider--region REGION: override the region--mode affordable|balanced|high_availability: override the deployment mode
Deploy your project
Navigate to your project directory and run:
/defang:deploy
Your agent will guide you through each step of the deployment:
- Validate the CLI — checks if the Defang CLI is installed, and provides install instructions if not
- Authenticate — verifies you're logged in to Defang, or runs
defang login - Find or create a
compose.yaml— locates your Compose file or helps you create one - Select or create a stack — lists existing stacks or creates a new one for your target cloud and region
- Set required configs — identifies unset environment variables in your Compose file and prompts you to provide values
- Deploy — runs
defang compose upand streams logs - Verify — checks service status and surfaces endpoints
If the agent installs the Defang CLI for the first time, reload your plugins afterward to activate the Defang MCP server without restarting your agent.
Check deployment status
If your deployment fails or you want to check the status of your services, you can ask your agent for updates:
/defang:status
How status checks work
- Validate the CLI — checks if the Defang CLI is installed, and provides install instructions if not
- Authenticate — verifies you're logged in to Defang, or runs
defang login - Find your
compose.yaml— locates your Compose file to identify services - Check the current stack — runs
defang stack lsto determine active stack - Check deployment status — runs
defang compose psto see service health - Fetch recent logs — retrieves logs with
defang logs --since 15mand scans for errors - Summarize and recommend — diagnoses issues with root cause analysis and actionable next steps
- Use the Defang MCP server
Once the Defang CLI is installed, the plugin also registers the Defang MCP server. This gives your agent direct access to Defang tools — so instead of running skill steps, you can ask things like:
- "What services are currently running?"
- "Show me the logs for my api service."
- "How much will this deployment cost?"
If the MCP server fails to start, this usually means the Defang CLI is not installed or not in your $PATH.
For a deeper discussion of how Defang deployments work, see our Getting Started guide and Stacks docs.