diff options
| author | Clawd <ai@clawd.bot> | 2026-04-11 20:43:41 -0700 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-04-11 20:43:41 -0700 |
| commit | d0ae31c24c3c98ae89eebd67227c0c0d01606ed5 (patch) | |
| tree | c684469e0f7d3b65477cfc631ecdaafa3c6a218a /skills/ship-env/SKILL.md | |
| parent | 5548b36e0953c17dbe30f6b63c892b7c83196b20 (diff) | |
Add ship-* Claude skills and plan
Introduces a skills/ directory with 8 Claude skills that reimagine ship
as a set of composable, human-driven deployment tools backed by Claude's
reasoning rather than a rigid CLI.
Skills:
- ship-setup: one-time VPS config, saves host to ~/.config/ship/config.json
- ship-status: derives live state from server, no local state file
- ship-env: read/write env vars with merge semantics, never overwrites
- ship-binary: deploy Go binaries with SQLite backup, correct restart behavior
- ship-caddy: manage per-app Caddyfile with validate-before-reload
- ship-service: systemd management and log inspection
- ship-static: rsync static sites with SPA routing support
- ship-deploy: orchestration runbook tying the others together
Also adds SKILLS_PLAN.md documenting the architecture and rationale.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'skills/ship-env/SKILL.md')
| -rw-r--r-- | skills/ship-env/SKILL.md | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/skills/ship-env/SKILL.md b/skills/ship-env/SKILL.md new file mode 100644 index 0000000..692904d --- /dev/null +++ b/skills/ship-env/SKILL.md | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | --- | ||
| 2 | name: ship-env | ||
| 3 | description: Read or write environment variables for a deployed app. Always merges — never overwrites existing vars. Use when you need to set, update, or view env vars for an app without redeploying. | ||
| 4 | argument-hint: "<app-name> [KEY=VALUE ...]" | ||
| 5 | --- | ||
| 6 | |||
| 7 | # ship-env | ||
| 8 | |||
| 9 | Read and write environment variables for a deployed app on a ship VPS. | ||
| 10 | Always merges new values into the existing file — existing vars are never lost. | ||
| 11 | |||
| 12 | ## Read Config | ||
| 13 | |||
| 14 | Load the host from `~/.config/ship/config.json`: | ||
| 15 | |||
| 16 | ```bash | ||
| 17 | python3 -c " | ||
| 18 | import json, os | ||
| 19 | cfg = json.load(open(os.path.expanduser('~/.config/ship/config.json'))) | ||
| 20 | nick = '<nickname-or-default>' | ||
| 21 | h = cfg['hosts'].get(nick, cfg['hosts'][cfg['default']]) | ||
| 22 | print(h['host']) | ||
| 23 | " | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ## Usage Patterns | ||
| 27 | |||
| 28 | ### View current env vars for an app | ||
| 29 | |||
| 30 | ```bash | ||
| 31 | ssh <host> "sudo cat /etc/ship/env/<app-name>.env" | ||
| 32 | ``` | ||
| 33 | |||
| 34 | Show them to the user clearly. Remind them that PORT, SHIP_NAME, and SHIP_URL are | ||
| 35 | managed by ship and shouldn't be manually changed. | ||
| 36 | |||
| 37 | ### Set or update one or more vars | ||
| 38 | |||
| 39 | Given vars like `FOO=bar BAZ=qux`, merge them into the existing env file: | ||
| 40 | |||
| 41 | ```bash | ||
| 42 | # Read current env | ||
| 43 | ssh <host> "sudo cat /etc/ship/env/<app-name>.env 2>/dev/null" | ||
| 44 | ``` | ||
| 45 | |||
| 46 | Then write the merged result back: | ||
| 47 | |||
| 48 | ```bash | ||
| 49 | ssh <host> "sudo tee /etc/ship/env/<app-name>.env > /dev/null << 'EOF' | ||
| 50 | PORT=9013 | ||
| 51 | SHIP_NAME=myapp | ||
| 52 | SHIP_URL=https://myapp.example.com | ||
| 53 | FOO=bar | ||
| 54 | BAZ=qux | ||
| 55 | EOF" | ||
| 56 | ``` | ||
| 57 | |||
| 58 | **Merge rules:** | ||
| 59 | - Start with all existing vars | ||
| 60 | - Overwrite any keys that appear in the new set | ||
| 61 | - Add any new keys that didn't exist before | ||
| 62 | - Never remove existing keys unless explicitly asked | ||
| 63 | |||
| 64 | ### Delete a var | ||
| 65 | |||
| 66 | Only delete a var if the user explicitly asks to remove it by name. Show them the | ||
| 67 | current value and confirm before removing. | ||
| 68 | |||
| 69 | ### Restart after changes | ||
| 70 | |||
| 71 | After writing new env vars, ask the user if they want to restart the service to apply | ||
| 72 | them. If yes, use ship-service to restart: | ||
| 73 | |||
| 74 | ```bash | ||
| 75 | ssh <host> "sudo systemctl restart <app-name>" | ||
| 76 | ``` | ||
| 77 | |||
| 78 | ## Notes | ||
| 79 | |||
| 80 | - Env file lives at `/etc/ship/env/<app-name>.env` | ||
| 81 | - PORT, SHIP_NAME, and SHIP_URL are written by ship-binary/ship-deploy — don't remove them | ||
| 82 | - If the env file doesn't exist, the app probably isn't deployed yet — say so | ||
| 83 | - Use the default host unless a host nickname was specified (e.g. "set FOO=bar on staging") | ||
| 84 | - After updating, remind the user the service needs a restart to pick up changes | ||
