--- name: coder-workspaces description: > Use an existing Coder deployment from the command line with the `coder` CLI: list, inspect, create, start, stop, and delete workspaces; run commands and edit files inside a workspace over `coder ssh`; forward ports; and read build and agent logs. Use when the user asks to run something "in my workspace", mentions their Coder workspaces or deployment, or wants a remote environment to work in. Do not use for installing or upgrading Coder itself (use the setup skill), authoring a template from scratch (use the templates skill), or adding registry modules to a template (use the modules skill). --- # Workspaces Operate an existing Coder deployment with the `coder` CLI. A workspace is a remote development environment, and it is where a coding agent does its work: the agent runs commands, edits files, and serves ports inside the workspace instead of on the user's machine. This skill covers getting into one, working in it, and driving its lifecycle. ## Source of truth `coder --help` is authoritative for flags and output columns, and both change between releases. Read it before running a command you have not run in this session. Anything the CLI does not cover is at . ## Preconditions Run `coder whoami`. Three outcomes: - Succeeds: continue. - `coder` is not on `PATH`: install it with `curl -fsSL https://coder.com/install.sh | sh`, or use the setup skill if the user has no deployment yet. - Authentication fails: tell the user to run `coder login ` and stop. The flow opens a browser for a session token, so they run it, not you. Then check whether you are already inside a Coder workspace: `CODER_AGENT_TOKEN` or `CODER_WORKSPACE_NAME` in the environment means you are. In that case work with local tools directly instead of `coder ssh`, and never stop or delete the workspace you are running in. ## Non-interactive use Every command below has to run without a human at the terminal. - Pass `-o json` wherever it is offered and parse that. Table output is for humans and its columns move. - Pass `-y` to `coder create`, `start`, `stop`, `restart`, and `delete`. Without it they block on a confirmation prompt. - `coder ssh -- ` runs one command and exits. Bare `coder ssh ` opens an interactive shell and will hang. Never run it. - Commands that stream (`coder logs -f`, `coder port-forward`, `coder ping` without `-n`) run until interrupted. Give them a bound or run them in the background. - Workspaces belonging to someone else are addressed as `/`. - A workspace with more than one agent needs the agent name: `coder ssh . -- `. Without it the CLI errors and lists the available agents. ## Workflow 1. Find the target. `coder list -o json` lists the user's workspaces; `coder list -o json --search ` or `--all` widens it. `coder show ` prints resources, agents, and apps for one. 2. Make sure it is running. A stopped workspace shows `status: stopped` in `coder list`. `coder start -y` starts it, or let `coder ssh` autostart it. 3. Do the work (tables below). 4. Verify. `coder logs ` for the last build, `coder show ` for the current state. 5. Report the outcome in one or two sentences, naming the workspace and its status. ### Lifecycle | Task | Command | | --- | --- | | List workspaces | `coder list -o json` (add `--all` or `--search`) | | Inspect one | `coder show ` | | Create from a template | `coder create --template