Skip to content

Commit f539ae5

Browse files
committed
feat(claude-skill): add Claude Code skill installer and brev-cli skill
- Add `brev claude-skill` command with install/uninstall subcommands - Integrate skill installation prompt into `brev login` flow - Add standalone bash installer script for non-brev users - Add comprehensive brev-cli skill with prompts, reference docs, and examples - Support BREV_SKILL_BRANCH env var for testing from branches - Document Claude Code integration in README
1 parent 6aece4f commit f539ae5

File tree

14 files changed

+2039
-96
lines changed

14 files changed

+2039
-96
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Installing the Brev CLI Claude Code Skill
2+
3+
## One-Liner Install
4+
5+
```bash
6+
curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-claude-skill.sh | bash
7+
```
8+
9+
## What Gets Installed
10+
11+
```
12+
~/.claude/skills/brev-cli/
13+
├── SKILL.md # Main skill definition
14+
├── prompts/
15+
│ ├── quick-session.md # Quick GPU session workflow
16+
│ ├── ml-training.md # ML training setup workflow
17+
│ └── cleanup.md # Instance cleanup workflow
18+
├── reference/
19+
│ ├── commands.md # Full command reference
20+
│ └── search-filters.md # GPU search options
21+
└── examples/
22+
└── common-patterns.md # Common command patterns
23+
```
24+
25+
## Options
26+
27+
### Install from a specific branch
28+
29+
**Using the standalone script:**
30+
```bash
31+
curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-claude-skill.sh | bash -s -- --branch my-branch
32+
```
33+
34+
**Using the CLI command:**
35+
```bash
36+
BREV_SKILL_BRANCH=my-branch brev claude-skill
37+
```
38+
39+
### Uninstall
40+
41+
```bash
42+
curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-claude-skill.sh | bash -s -- --uninstall
43+
```
44+
45+
### Manual Installation
46+
47+
If you prefer to install manually:
48+
49+
```bash
50+
# Clone the repo
51+
git clone https://github.com/brevdev/brev-cli.git
52+
cd brev-cli
53+
54+
# Copy skill to Claude directory
55+
mkdir -p ~/.claude/skills/
56+
cp -r .claude/skills/brev-cli ~/.claude/skills/
57+
```
58+
59+
## After Installation
60+
61+
1. **Restart Claude Code** or start a new conversation
62+
2. **Verify installation:**
63+
```bash
64+
ls ~/.claude/skills/brev-cli/
65+
```
66+
3. **Test the skill:**
67+
- Say "search for A100 GPUs" or
68+
- Use `/brev-cli`
69+
70+
## Troubleshooting
71+
72+
### Skill not appearing
73+
74+
- Make sure you restarted Claude Code
75+
- Check the file exists: `cat ~/.claude/skills/brev-cli/SKILL.md`
76+
- Verify YAML frontmatter is valid (no tabs, proper formatting)
77+
78+
### Permission denied
79+
80+
```bash
81+
# Fix permissions
82+
chmod -R 755 ~/.claude/skills/brev-cli/
83+
```
84+
85+
### Update to latest version
86+
87+
Just run the installer again - it will overwrite existing files:
88+
89+
```bash
90+
curl -fsSL https://raw.githubusercontent.com/brevdev/brev-cli/main/scripts/install-claude-skill.sh | bash
91+
```

.claude/skills/brev-cli/SKILL.md

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
---
2+
name: brev-cli
3+
description: Manage GPU cloud instances with the Brev CLI. Use when users want to create GPU instances, search for GPUs, SSH into instances, open editors, copy files, port forward, manage organizations, or work with cloud compute. Trigger keywords - brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine.
4+
allowed-tools: Bash, Read, AskUserQuestion
5+
argument-hint: [create|search|shell|exec|open|ls|delete] [instance-name]
6+
---
7+
<!--
8+
Token Budget:
9+
- Level 1 (YAML): ~100 tokens
10+
- Level 2 (This file): ~1900 tokens (target <2000)
11+
- Level 3 (prompts/, reference/): Loaded on demand
12+
-->
13+
14+
# Brev CLI
15+
16+
Manage GPU cloud instances from the command line. Create, search, connect, and manage remote GPU machines.
17+
18+
## When to Use
19+
20+
Use this skill when users want to:
21+
- Create GPU instances (with smart defaults or specific types)
22+
- Search for available GPU types (A100, H100, L40S, etc.)
23+
- SSH into instances or run commands remotely
24+
- Open editors (VS Code, Cursor, Windsurf) on remote instances
25+
- Copy files to/from instances
26+
- Port forward from remote to local
27+
- Manage organizations and instances
28+
29+
**Trigger Keywords:** brev, gpu, instance, create instance, ssh, vram, A100, H100, cloud gpu, remote machine, shell
30+
31+
## Quick Start
32+
33+
```bash
34+
# Search for GPUs (sorted by price)
35+
brev search
36+
37+
# Create an instance with smart defaults
38+
brev create my-instance
39+
40+
# Create with specific GPU
41+
brev create my-instance --type g5.xlarge
42+
43+
# List your instances
44+
brev ls
45+
46+
# SSH into an instance (interactive)
47+
brev shell my-instance
48+
49+
# Run a command on an instance (non-interactive)
50+
brev exec my-instance "nvidia-smi"
51+
52+
# Open in VS Code/Cursor
53+
brev open my-instance code
54+
brev open my-instance cursor
55+
```
56+
57+
## Core Commands
58+
59+
### Search GPUs
60+
```bash
61+
# All available GPUs
62+
brev search
63+
64+
# Filter by GPU name
65+
brev search --gpu-name A100
66+
brev search --gpu-name H100
67+
68+
# Filter by VRAM, sort by price
69+
brev search --min-vram 40 --sort price
70+
71+
# Filter by boot time
72+
brev search --max-boot-time 5 --sort price
73+
74+
# Filter by instance features
75+
brev search --stoppable --min-total-vram 40 --sort price
76+
```
77+
78+
### Create Instances
79+
```bash
80+
# Smart defaults (cheapest matching GPU)
81+
brev create my-instance
82+
83+
# Specific type
84+
brev create my-instance --type g5.xlarge
85+
86+
# Multiple types (fallback chain)
87+
brev create my-instance --type g5.xlarge,g5.2xlarge
88+
89+
# Pipe from search
90+
brev search --gpu-name A100 | brev create my-instance
91+
92+
# Use search filters directly on create
93+
brev create my-instance --gpu-name A100 --min-vram 40
94+
95+
# Multiple instances
96+
brev create my-cluster --count 3
97+
98+
# With startup script
99+
brev create my-instance --startup-script @setup.sh
100+
brev create my-instance --startup-script 'pip install torch'
101+
102+
# Dry run (preview matching types without creating)
103+
brev create my-instance --dry-run
104+
```
105+
106+
### Instance Access
107+
```bash
108+
# SSH into instance (interactive shell)
109+
brev shell my-instance
110+
111+
# Run command on instance (non-interactive)
112+
brev exec my-instance "nvidia-smi"
113+
brev exec my-instance "python train.py"
114+
115+
# Run a local script on the instance (@ prefix reads local file)
116+
brev exec my-instance @setup.sh
117+
brev exec my-instance @/path/to/script.sh
118+
119+
# Run on multiple instances
120+
brev exec instance1 instance2 instance3 "nvidia-smi"
121+
122+
# Open in editor
123+
brev open my-instance # default editor
124+
brev open my-instance code # VS Code
125+
brev open my-instance cursor # Cursor
126+
brev open my-instance windsurf # Windsurf
127+
brev open my-instance terminal # Terminal window
128+
brev open my-instance tmux # Terminal + tmux
129+
130+
# Copy files
131+
brev copy ./local-file my-instance:/remote/path/
132+
brev copy my-instance:/remote/file ./local-path/
133+
134+
# Port forward
135+
brev port-forward my-instance -p 8080:8080
136+
```
137+
138+
### Instance Management
139+
```bash
140+
# List instances
141+
brev ls
142+
brev ls --json
143+
144+
# Delete instance
145+
brev delete my-instance
146+
147+
# Stop/start (if supported)
148+
brev stop my-instance
149+
brev start my-instance
150+
151+
# Reset (recover from errors)
152+
brev reset my-instance
153+
```
154+
155+
### Pipeable Workflows
156+
```bash
157+
# Stop all running instances
158+
brev ls | awk '/RUNNING/ {print $1}' | brev stop
159+
160+
# Delete all stopped instances
161+
brev ls | awk '/STOPPED/ {print $1}' | brev delete
162+
163+
# Start all stopped instances
164+
brev ls | awk '/STOPPED/ {print $1}' | brev start
165+
166+
# Stop instances matching pattern
167+
brev ls | grep "test-" | awk '{print $1}' | brev stop
168+
169+
# Run command on all running instances
170+
brev ls | awk '/RUNNING/ {print $1}' | brev exec "nvidia-smi"
171+
172+
# Create and run setup
173+
brev search --gpu-name A100 | brev create my-box | brev exec @setup.sh
174+
175+
# Create and open in one command
176+
brev search --gpu-name A100 | brev create my-box | brev open cursor
177+
```
178+
179+
### Organizations
180+
```bash
181+
# List orgs
182+
brev org ls
183+
184+
# Set active org
185+
brev org set my-org
186+
brev set my-org # alias
187+
188+
# Generate invite link
189+
brev invite
190+
```
191+
192+
## Common Workflows
193+
194+
1. **Quick GPU Session** ([prompts/quick-session.md](prompts/quick-session.md))
195+
- Search → Create → Open editor
196+
197+
2. **ML Training Setup** ([prompts/ml-training.md](prompts/ml-training.md))
198+
- Find high-VRAM GPU → Create with startup script → Copy data → Run training
199+
200+
3. **Instance Cleanup** ([prompts/cleanup.md](prompts/cleanup.md))
201+
- List instances → Identify unused → Delete
202+
203+
## Safety Rules - CRITICAL
204+
205+
**NEVER do these without explicit user confirmation:**
206+
- Delete instances (`brev delete`)
207+
- Stop running instances (`brev stop`)
208+
- Create multiple instances (`--count > 1`)
209+
- Create expensive instances (H100, multi-GPU)
210+
211+
**ALWAYS do these:**
212+
- Show instance cost/type before creating
213+
- Confirm instance name before deletion
214+
- Check `brev ls` before assuming instance exists
215+
216+
## Troubleshooting
217+
218+
**"Instance not found":**
219+
- Run `brev ls` to see available instances
220+
- Check if you're in the correct org: `brev org ls`
221+
222+
**"Failed to create instance":**
223+
- Try a different instance type: `brev search --sort price`
224+
- Check quota/credits with org admin
225+
226+
**SSH connection fails:**
227+
- Run `brev refresh` to update SSH config
228+
- Ensure instance is running: `brev ls`
229+
230+
**Editor won't open:**
231+
- Verify editor is in PATH: `which code` / `which cursor`
232+
- Set default: `brev open --set-default code`
233+
234+
## References
235+
236+
- **[reference/commands.md](reference/commands.md)** - Full command reference
237+
- **[reference/search-filters.md](reference/search-filters.md)** - GPU search options
238+
- **[prompts/](prompts/)** - Workflow guides
239+
- **[examples/](examples/)** - Common patterns

0 commit comments

Comments
 (0)