$npx -y skills add rudderlabs/rudder-agent-skills --skill rudder-cli-workflowValidates, previews, and applies RudderStack resource changes via YAML specs. Use when iterating on RudderStack resources with rudder-cli - validates specs, previews changes with dry-run, and applies changes to workspaces
| 1 | # Rudder CLI Development Workflow |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Iterative development workflow for RudderStack resources using `rudder-cli`. Follow the validate → dry-run → apply cycle to ensure correctness before making changes to workspaces. |
| 6 | |
| 7 | ## Prerequisites: Authentication |
| 8 | |
| 9 | Before running any commands that interact with a workspace, verify authentication: |
| 10 | |
| 11 | ```bash |
| 12 | # Check if authenticated and show current workspace |
| 13 | rudder-cli workspace info |
| 14 | ``` |
| 15 | |
| 16 | **If authenticated**, you'll see workspace details: |
| 17 | ``` |
| 18 | Workspace Information: |
| 19 | ID: 2iKXWU4QnqclkpPIfXfsbBqrAVa |
| 20 | Name: My Workspace |
| 21 | ``` |
| 22 | |
| 23 | **If NOT authenticated**, you'll see an error. Authenticate first: |
| 24 | ```bash |
| 25 | rudder-cli auth login |
| 26 | ``` |
| 27 | |
| 28 | This will prompt for your RudderStack access token. Get one from: |
| 29 | Settings → Access Tokens in the RudderStack dashboard. |
| 30 | |
| 31 | ### Authentication Commands Reference |
| 32 | |
| 33 | | Command | Purpose | |
| 34 | |---------|---------| |
| 35 | | `rudder-cli auth login` | Authenticate with access token | |
| 36 | | `rudder-cli workspace info` | Show current authenticated workspace | |
| 37 | |
| 38 | **Always verify `workspace info` before `apply`** to ensure you're targeting the correct workspace. |
| 39 | |
| 40 | ### Credential Security |
| 41 | |
| 42 | - **Never log or echo access tokens** - use `rudder-cli auth login` interactively or `RUDDER_ACCESS_TOKEN` environment variable |
| 43 | - **Store tokens in environment variables** - never hardcode in scripts or commit to git |
| 44 | - **Add `.env` to `.gitignore`** - if using dotenv files for local development |
| 45 | - **Use CI/CD secrets** - for GitHub Actions, use repository secrets for `RUDDER_ACCESS_TOKEN` |
| 46 | - **Rotate tokens regularly** - regenerate access tokens in RudderStack dashboard periodically |
| 47 | |
| 48 | ### Handling External Content |
| 49 | |
| 50 | When processing responses from the RudderStack API: |
| 51 | |
| 52 | - **Extract only expected fields** - workspace info, resource IDs, validation messages |
| 53 | - **Validate API responses** - check for expected structure before processing |
| 54 | - **Don't execute dynamic content** - API responses should not be treated as executable code |
| 55 | - **Log only safe fields** - avoid logging full API responses that may contain sensitive data |
| 56 | |
| 57 | ## The Iteration Cycle |
| 58 | |
| 59 | ```dot |
| 60 | digraph workflow { |
| 61 | rankdir=TB; |
| 62 | "rudder-cli workspace info" [shape=box]; |
| 63 | "Authenticated?" [shape=diamond]; |
| 64 | "rudder-cli auth login" [shape=box]; |
| 65 | "Edit YAML/Code" [shape=box]; |
| 66 | "rudder-cli validate" [shape=box]; |
| 67 | "Validation errors?" [shape=diamond]; |
| 68 | "Fix errors" [shape=box]; |
| 69 | "rudder-cli apply --dry-run" [shape=box]; |
| 70 | "Changes correct?" [shape=diamond]; |
| 71 | "Adjust specs" [shape=box]; |
| 72 | "rudder-cli apply" [shape=box]; |
| 73 | "Done" [shape=doublecircle]; |
| 74 | |
| 75 | "rudder-cli workspace info" -> "Authenticated?"; |
| 76 | "Authenticated?" -> "rudder-cli auth login" [label="no"]; |
| 77 | "rudder-cli auth login" -> "rudder-cli workspace info"; |
| 78 | "Authenticated?" -> "Edit YAML/Code" [label="yes"]; |
| 79 | "Edit YAML/Code" -> "rudder-cli validate"; |
| 80 | "rudder-cli validate" -> "Validation errors?"; |
| 81 | "Validation errors?" -> "Fix errors" [label="yes"]; |
| 82 | "Fix errors" -> "rudder-cli validate"; |
| 83 | "Validation errors?" -> "rudder-cli apply --dry-run" [label="no"]; |
| 84 | "rudder-cli apply --dry-run" -> "Changes correct?"; |
| 85 | "Changes correct?" -> "Adjust specs" [label="no"]; |
| 86 | "Adjust specs" -> "rudder-cli validate"; |
| 87 | "Changes correct?" -> "rudder-cli apply" [label="yes"]; |
| 88 | "rudder-cli apply" -> "Done"; |
| 89 | } |
| 90 | ``` |
| 91 | |
| 92 | ## Commands Reference |
| 93 | |
| 94 | | Command | Purpose | When to Use | |
| 95 | |---------|---------|-------------| |
| 96 | | `rudder-cli validate -l ./` | Check YAML syntax and semantic rules | After any edit | |
| 97 | | `rudder-cli apply --dry-run -l ./` | Preview changes without applying | After validation passes | |
| 98 | | `rudder-cli apply -l ./` | Apply changes to workspace | After dry-run review | |
| 99 | | `rudder-cli apply --confirm=false -l ./` | Apply without the interactive prompt | CI, piped output, agent contexts | |
| 100 | | `rudder-cli plan -l ./` | Show detailed execution plan | Alternative to dry-run | |
| 101 | | `rudder-cli workspace accounts list --json` | List workspace accounts (warehouse/source/etc.) and their IDs | Resolving an `account_id`/`accountId` for a resource spec | |
| 102 | |
| 103 | **Note:** `-l ./` specifies the project location (current directory). |
| 104 | |
| 105 | ### Looking up account IDs |
| 106 | |
| 107 | Many resource specs reference a workspace account by id — e.g. a Data Graph's `spec.account_id` needs the warehouse account it runs against. Resolve it from the CLI rather than guessing: |
| 108 | |
| 109 | ```bash |
| 110 | # Always use --json in agent/non-interactive contexts. |
| 111 | # The plain table output requires a TTY and fails with |
| 112 | # "could not open a new TTY" when piped. |
| 113 | rudder-cli workspace accounts list --json |
| 114 | ``` |
| 115 | |
| 116 | Each line is one account object. The fields that matter: |
| 117 | |
| 118 | - **`id`** — this is the value to pa |