Skip to content

Commit 544ed4c

Browse files
committed
Improve cloudamqp-cli skill based on review and testing
1 parent d1e24b0 commit 544ed4c

2 files changed

Lines changed: 60 additions & 95 deletions

File tree

cmd/skills/cloudamqp-cli/SKILL.md

Lines changed: 39 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,41 @@
11
---
22
name: cloudamqp-cli
3-
description: Manage CloudAMQP instances, VPCs, teams, and RabbitMQ/LavinMQ configuration from the command line. Use when the user needs to create, configure, monitor, upgrade, or troubleshoot CloudAMQP message broker instances.
4-
allowed-tools: Bash(cloudamqp:*)
3+
description: Manage CloudAMQP instances, VPCs, teams, and RabbitMQ/LavinMQ configuration using the cloudamqp CLI. Use this skill whenever the user wants to create, list, inspect, update, delete, upgrade, restart, or troubleshoot CloudAMQP instances — even if they just say "spin up a RabbitMQ", "check my instances", or "upgrade my broker". Also use it for VPC setup, team management, and RabbitMQ config changes.
4+
allowed-tools: Bash(cloudamqp:*), Bash(jq:*), Bash(cat:*), Bash(echo:*), Bash(chmod:*), Bash(grep:*), Bash(sleep:*)
55
---
66

77
# CloudAMQP CLI
88

99
## Quick start
1010

1111
```bash
12-
# list all instances
1312
cloudamqp instance list
14-
15-
# get instance details (includes connection URL and API key)
16-
cloudamqp instance get --id 1234
17-
18-
# create an instance and wait for it to be ready
19-
cloudamqp instance create --name=my-instance --plan=bunny-1 --region=amazon-web-services::us-east-1 --wait
20-
21-
# restart RabbitMQ on an instance
22-
cloudamqp instance restart-rabbitmq --id 1234
23-
24-
# delete an instance
25-
cloudamqp instance delete --id 1234
13+
cloudamqp instance get --id <id>
14+
cloudamqp instance create --name=<name> --plan=<plan> --region=<region> --wait
15+
cloudamqp instance restart-rabbitmq --id <id>
16+
cloudamqp instance delete --id <id> --force
2617
```
2718

2819
## Authentication
2920

30-
Before running any commands, check that auth is configured — the CLI won't work without it and can't prompt interactively when run by an agent.
21+
Check auth before running anything — interactive prompts don't work in agent context:
3122

3223
```bash
33-
# check if already configured
3424
cat ~/.cloudamqprc 2>/dev/null || echo "not configured"
35-
36-
# if not set up, ask the user for their API key, then write it:
37-
echo "YOUR_API_KEY" > ~/.cloudamqprc
38-
chmod 600 ~/.cloudamqprc
3925
```
4026

41-
The CLI checks in this order:
27+
If not configured, ask the user for their API key (from https://customer.cloudamqp.com/apikeys), then:
4228

43-
1. `CLOUDAMQP_APIKEY` environment variable
44-
2. `~/.cloudamqprc` file (plain text, just the key)
45-
3. Interactive prompt (won't work in agent context — use one of the above)
29+
```bash
30+
echo "<api-key>" > ~/.cloudamqprc
31+
chmod 600 ~/.cloudamqprc
32+
```
4633

47-
Base URL defaults to `https://customer.cloudamqp.com/api` (override with `CLOUDAMQP_URL`).
34+
Alternatively, set `CLOUDAMQP_APIKEY` in the environment. If neither is set, all commands will fail.
4835

4936
## Output
5037

51-
All commands support `-o json` for machine-readable output and `-o table` (default) for human-readable output. Use `-fields` to select specific columns.
38+
Use `-o json` for parsing, `-o table` (default) for display. Use `--fields` to select columns.
5239

5340
## Commands
5441

@@ -63,25 +50,18 @@ cloudamqp instance delete --id <id> [--force]
6350
cloudamqp instance resize-disk --id <id> --disk-size=<gb> [--allow-downtime]
6451
```
6552

66-
### Copy settings between instances
53+
### Copy settings between instances (dedicated only)
6754

6855
```bash
69-
cloudamqp instance create --name=staging --plan=bunny-1 --region=amazon-web-services::us-east-1 \
70-
--copy-from-id=1234 --copy-settings=metrics,firewall,config,alarms,logs,definitions,plugins --wait
56+
cloudamqp instance create --name=staging --plan=<plan> --region=<region> \
57+
--copy-from-id=<id> --copy-settings=metrics,firewall,config,alarms,logs,definitions,plugins --wait
7158
```
7259

73-
Only works between dedicated instances (not shared plans).
74-
75-
### Node management
60+
### Node and plugin management
7661

7762
```bash
7863
cloudamqp instance nodes list --id <id>
7964
cloudamqp instance nodes versions --id <id>
80-
```
81-
82-
### Plugin management
83-
84-
```bash
8565
cloudamqp instance plugins list --id <id>
8666
```
8767

@@ -96,19 +76,19 @@ cloudamqp instance config set --id <id> --key <key> --value <value>
9676
### Instance actions
9777

9878
```bash
99-
# restart
79+
# restarts (rolling for HA clusters)
10080
cloudamqp instance restart-rabbitmq --id <id> [--nodes=node1,node2]
101-
cloudamqp instance restart-cluster --id <id>
102-
cloudamqp instance restart-management --id <id> [--nodes=node1,node2]
81+
cloudamqp instance restart-cluster --id <id> # full restart, causes downtime
82+
cloudamqp instance restart-management --id <id>
10383

10484
# start/stop
105-
cloudamqp instance start --id <id> [--nodes=node1,node2]
106-
cloudamqp instance stop --id <id> [--nodes=node1,node2]
107-
cloudamqp instance reboot --id <id> [--nodes=node1,node2]
85+
cloudamqp instance start --id <id>
86+
cloudamqp instance stop --id <id>
87+
cloudamqp instance reboot --id <id>
10888
cloudamqp instance start-cluster --id <id>
10989
cloudamqp instance stop-cluster --id <id>
11090

111-
# upgrades (async, return immediately)
91+
# upgrades async, return immediately, poll until ready
11292
cloudamqp instance upgrade-erlang --id <id>
11393
cloudamqp instance upgrade-rabbitmq --id <id> --version=<version>
11494
cloudamqp instance upgrade-all --id <id>
@@ -118,7 +98,7 @@ cloudamqp instance upgrade-versions --id <id>
11898
### VPC management
11999

120100
```bash
121-
cloudamqp vpc create --name=<name> --region=<region> --subnet=<cidr> [--tags=<tag>]
101+
cloudamqp vpc create --name=<name> --region=<region> --subnet=<cidr>
122102
cloudamqp vpc list
123103
cloudamqp vpc get --id <id>
124104
cloudamqp vpc update --id <id> --name=<name>
@@ -134,36 +114,26 @@ cloudamqp team update --user-id=<id> --role=<role>
134114
cloudamqp team remove --email=<email>
135115
```
136116

137-
### Audit log
117+
### Plans, regions, audit
138118

139119
```bash
120+
cloudamqp plans [--backend=rabbitmq|lavinmq] # always fetch, never guess
121+
cloudamqp regions [--provider=<provider>] # always fetch, never guess
140122
cloudamqp audit [--timestamp=2024-01]
141-
```
142-
143-
### API key rotation
144-
145-
```bash
146123
cloudamqp rotate-key
147124
```
148125

149-
## Important behavior
150-
151-
- **Async operations**: Instance creation, disk resizes, and upgrades are async. Use `--wait` on create, or poll with `instance get --id <id>` until `ready: true`.
152-
- **Destructive commands** (delete, stop) prompt for confirmation. Use `--force` to skip in scripts.
153-
- **Multiple tags**: Use `--tags` multiple times: `--tags=prod --tags=web`.
154-
- **Shell completion**: Run `source <(cloudamqp completion zsh)` for tab completion of commands, instance IDs, plans, and regions.
155-
156-
## Plans and regions
126+
## Key behaviors
157127

158-
Always fetch live data — don't guess plan names or regions:
128+
- **Async**: creation, resizes, upgrades return immediately. Use `--wait` on create, or poll `instance get --id <id> -o json | jq -r '.ready'` until `"true"`.
129+
- **Destructive commands** prompt for confirmation — use `--force` to skip.
130+
- **Multiple tags**: repeat the flag: `--tags=prod --tags=web`.
131+
- **Plan/region names**: always run `cloudamqp plans` / `cloudamqp regions` first — never hardcode them.
159132

160-
```bash
161-
cloudamqp plans [--backend=rabbitmq|lavinmq]
162-
cloudamqp regions [--provider=amazon-web-services]
163-
```
133+
## Reference guides
164134

165-
## Specific tasks
135+
Read these before tackling the relevant task:
166136

167-
* **Scripting and automation** [references/scripting.md](references/scripting.md)
168-
* **Instance upgrades and maintenance** [references/upgrades.md](references/upgrades.md)
169-
* **VPC and network setup** [references/vpc-setup.md](references/vpc-setup.md)
137+
- **Scripting, JSON parsing, batch ops** [references/scripting.md](references/scripting.md)
138+
- **Upgrades, restarts, maintenance workflows** [references/upgrades.md](references/upgrades.md)
139+
- **VPC creation and network setup** [references/vpc-setup.md](references/vpc-setup.md)

cmd/skills/cloudamqp-cli/references/scripting.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,36 @@
22

33
## JSON output for parsing
44

5-
All commands support `-o json` for structured output. Combine with `jq` for extraction:
5+
All commands support `-o json`. Combine with `jq`:
66

77
```bash
88
# get connection URL for an instance
9-
cloudamqp instance get --id 1234 -o json | jq -r '.url'
9+
cloudamqp instance get --id <id> -o json | jq -r '.url'
1010

11-
# list instance IDs matching a tag
12-
cloudamqp instance list -o json | jq -r '.[] | select(.tags[]? == "production") | .id'
11+
# find instances that aren't ready
12+
cloudamqp instance list -o json | jq -r '.[] | select(.ready == false) | "\(.id) \(.name)"'
1313

14-
# get all instance names and plans
15-
cloudamqp instance list -o json | jq -r '.[] | "\(.id) \(.name) \(.plan)"'
14+
# get IDs matching a tag
15+
cloudamqp instance list -o json | jq -r '.[] | select(.tags[]? == "staging") | .id'
1616
```
1717

1818
## Create and capture instance ID
1919

2020
```bash
21-
RESULT=$(cloudamqp instance create --name=temp --plan=lemming --region=amazon-web-services::us-east-1 -o json)
21+
# fetch a valid plan and region first
22+
PLAN=$(cloudamqp plans --backend=rabbitmq -o json | jq -r '.[0].name')
23+
REGION=$(cloudamqp regions -o json | jq -r '.[0].id')
24+
25+
RESULT=$(cloudamqp instance create --name=temp --plan="$PLAN" --region="$REGION" -o json)
2226
INSTANCE_ID=$(echo "$RESULT" | jq -r '.id')
23-
echo "Created instance: $INSTANCE_ID"
2427
```
2528

2629
## Wait for instance readiness
2730

28-
Use the built-in `--wait` flag (default timeout: 15 minutes):
31+
Prefer the built-in flag:
2932

3033
```bash
31-
cloudamqp instance create --name=my-instance --plan=bunny-1 \
32-
--region=amazon-web-services::us-east-1 --wait --wait-timeout=20m
34+
cloudamqp instance create --name=my-instance --plan=<plan> --region=<region> --wait --wait-timeout=20m
3335
```
3436

3537
Or poll manually:
@@ -42,27 +44,18 @@ while true; do
4244
done
4345
```
4446

45-
## Skip confirmations
46-
47-
Use `--force` on destructive commands:
47+
## Skip confirmations in scripts
4848

4949
```bash
50-
cloudamqp instance delete --id 1234 --force
51-
```
52-
53-
## Environment-based configuration
54-
55-
```bash
56-
export CLOUDAMQP_APIKEY="your-api-key"
57-
cloudamqp instance list # no prompts
50+
cloudamqp instance delete --id <id> --force
51+
cloudamqp vpc delete --id <id> --force
5852
```
5953

6054
## Batch operations
6155

6256
```bash
6357
# restart all instances tagged "staging"
6458
for ID in $(cloudamqp instance list -o json | jq -r '.[] | select(.tags[]? == "staging") | .id'); do
65-
echo "Restarting instance $ID"
6659
cloudamqp instance restart-rabbitmq --id "$ID"
6760
done
6861
```
@@ -72,9 +65,11 @@ done
7265
```bash
7366
cloudamqp instance create \
7467
--name=staging-copy \
75-
--plan=bunny-1 \
76-
--region=amazon-web-services::us-east-1 \
77-
--copy-from-id=1234 \
68+
--plan=<plan> \
69+
--region=<region> \
70+
--copy-from-id=<source-id> \
7871
--copy-settings=alarms,metrics,logs,firewall,config,definitions,plugins \
7972
--wait
8073
```
74+
75+
Only works between dedicated instances (not shared plans).

0 commit comments

Comments
 (0)