home / skills / phrazzld / claude-config / cli-reference

cli-reference skill

/skills/cli-reference

This skill provides CLI references for configuring infrastructure services, enabling rapid environment setup and consistent cross-platform parity.

npx playbooks add skill phrazzld/claude-config --skill cli-reference

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.1 KB
---
name: cli-reference
description: |
  CLI commands for all infrastructure services. Invoke when:
  - Configuring any external service (Vercel, Convex, Stripe, Sentry, PostHog, GitHub)
  - Before suggesting any dashboard action
  - Setting environment variables across platforms
  Keywords: env var, configure, dashboard, settings, production, deploy, CLI
effort: low
---

# CLI Reference

Every infrastructure operation has a CLI command. Never send users to dashboards.

## Environment Variables

### Vercel
```bash
# Add (use printf to avoid trailing newlines)
printf '%s' 'value' | vercel env add KEY production
printf '%s' 'value' | vercel env add KEY preview
printf '%s' 'value' | vercel env add KEY development

# List (filter output manually - no env flag)
vercel env ls | grep production

# Remove
vercel env rm KEY production
```

### Convex
```bash
# Set (dev is default, use --prod for production)
npx convex env set KEY "value"
npx convex env set --prod KEY "value"

# List
npx convex env list
npx convex env list --prod

# Remove
npx convex env unset KEY
npx convex env unset --prod KEY
```

## Stripe

```bash
# Always use profile flag
stripe -p sandbox products list
stripe -p production products list

# Create product + price
stripe -p production products create --name "Pro Plan"
stripe -p production prices create \
  --product prod_xxx \
  --unit-amount 999 \
  --currency usd \
  --recurring[interval]=month

# Webhooks
stripe -p production webhook_endpoints list
stripe events resend EVENT_ID --webhook-endpoint EP_ID
```

## Sentry

```bash
# List issues
sentry-cli issues list --project=$SENTRY_PROJECT --status=unresolved

# Create release
sentry-cli releases new $VERSION
sentry-cli releases set-commits $VERSION --auto

# Upload source maps
sentry-cli sourcemaps upload --release=$VERSION ./dist
```

## PostHog (API)

No official CLI. Use curl with API key:

```bash
# Get project ID first
curl -s "https://us.posthog.com/api/projects/" \
  -H "Authorization: Bearer $POSTHOG_API_KEY" | jq '.[0].id'

# Query events
curl -s "https://us.posthog.com/api/projects/$PROJECT_ID/events/" \
  -H "Authorization: Bearer $POSTHOG_API_KEY" | jq '.results[:5]'

# Feature flags
curl -s "https://us.posthog.com/api/projects/$PROJECT_ID/feature_flags/" \
  -H "Authorization: Bearer $POSTHOG_API_KEY" | jq '.results'
```

## GitHub

```bash
# Issues
gh issue create --title "..." --body "..."
gh issue list --state open

# PRs
gh pr create --title "..." --body "..."
gh pr list --state open
gh pr merge --squash

# API for advanced operations
gh api repos/{owner}/{repo}/actions/runs --jq '.workflow_runs[:5]'
```

## Cross-Platform Parity

Always set env vars on ALL platforms:
```bash
# Example: Adding POSTHOG_KEY everywhere
printf '%s' 'phc_xxx' | vercel env add NEXT_PUBLIC_POSTHOG_KEY production
npx convex env set --prod NEXT_PUBLIC_POSTHOG_KEY "phc_xxx"
echo 'NEXT_PUBLIC_POSTHOG_KEY=phc_xxx' >> .env.local
```

## Related Skills
- `/env-var-hygiene` - Validation and parity checks
- `/stripe` - Complete Stripe lifecycle
- `/sentry-observability` - Error tracking setup
- `/triage` - Production incident response

Overview

This skill provides concise, actionable CLI commands for configuring and managing infrastructure services without using dashboards. It covers environment variables, deployments, webhooks, releases, and basic API calls for Vercel, Convex, Stripe, Sentry, PostHog, and GitHub. Use it to perform repeatable, auditable operations from the terminal.

How this skill works

The skill maps common infrastructure actions to their exact CLI or curl commands, including adding/listing/removing environment variables, creating products and webhooks in Stripe, managing Sentry releases and source maps, and querying PostHog via API. It emphasizes cross-platform parity by showing how to set the same env var across Vercel, Convex, and local .env files. Commands include flags and minimal examples designed to be copy-paste ready for production and preview environments.

When to use it

  • Configuring or rotating environment variables across platforms
  • Preparing deployments or releases without opening a dashboard
  • Creating Stripe products, prices, or replaying webhook events
  • Uploading Sentry releases and source maps from CI
  • Querying PostHog or creating GitHub issues/PRs programmatically

Best practices

  • Always use secure input (printf or stdin) to avoid trailing newlines and accidental logging of secrets
  • Set and verify environment variables on every platform (production, preview, development) for parity
  • Use profile or production flags (e.g., stripe -p production) to avoid acting in the wrong account
  • Automate release and sourcemap uploads in CI to keep error traces accurate
  • List and confirm state after changes (env list, issues list, events query) before assuming success

Example use cases

  • Add a production API key to Vercel, Convex, and local .env in one workflow
  • Create a Stripe product and monthly recurring price from CI or a deploy script
  • Create a Sentry release, set commits, and upload source maps as part of a release pipeline
  • Query PostHog for recent events or feature flags using curl and jq for quick diagnostics
  • Create or merge a GitHub PR via the gh CLI in scripted automation

FAQ

How do I avoid exposing secrets in CI logs?

Pipe secret values via printf or stdin and avoid echoing them; use CI secret storage and the platform-specific env add/set commands instead of printing values.

What if a command affects the wrong environment?

Always include explicit flags (e.g., --prod, -p production) and verify with list commands after changes. Use CI and separate profiles to reduce human error.

Is there an official PostHog CLI?

No. Use curl with an API key and jq for parsing; ensure you scope the API key and limit results when testing.