> For the complete documentation index, see [llms.txt](https://docs.stoobly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stoobly.com/getting-started/configuring-an-ai-assistant/skills/stoobly-triage.md). Agents can also search and read this documentation through its [MCP server](https://docs.stoobly.com/~gitbook/mcp).

# Triage

````markdown
---
name: stoobly-triage
description: Diagnoses and fixes general Stoobly setup and runtime problems. Use when the
  user has HTTPS/certificate errors, traffic that isn't being intercepted, port
  conflicts, Stoobly failing to start, standalone (non-scaffold) issues, or wants a
  broad "something's broken" triage — including 499s and wrong responses outside of a
  test run. If the problem is a failing scaffolded E2E test (Playwright/Cypress), use
  stoobly-e2e-test-troubleshoot instead.
---

# Triage

You are helping the user diagnose and fix a problem with their Stoobly setup or usage.

## Inputs

- `app-dir-path` (optional) — scaffold app root from the `stoobly` router or the user. When set, use it; do not re-run `stoobly-agent scaffold describe` just to rediscover it.

## Step 1: Detect existing state

Use `app-dir-path` from Inputs when provided. Otherwise resolve with `stoobly-agent scaffold describe` per the `stoobly` skill Step 1 (do not restate those validity rules here). Do not read `.config.yml` directly.

- If a scaffold is available, note the runtime (docker or local) and proxy mode (forward or reverse).
- If not (inputs absent and describe invalid), the user is running standalone (no scaffold app).

## Step 2: Ask the user these questions (ask all at once, in a single message)

1. **Symptom**: What are you seeing? Choose the closest match:
   - 499 errors on some or all requests
   - HTTPS/certificate errors (SSL handshake failures, untrusted cert warnings)
   - Traffic not being intercepted (requests going directly to the real service)
   - Wrong or stale responses (getting old recorded data or unexpected responses)
   - Port conflict (Stoobly won't start, address already in use)
   - Something else — describe it

2. **Setup**: Are you using a scaffold app or running Stoobly standalone?

3. **Context**: Did this show up while running an E2E test (Playwright, Cypress, etc.), or during general usage?

**Routing check — do this before Step 3.** If the answer to question 3 is that the problem surfaced during an E2E test run, hand off now regardless of which symptom was chosen in question 1. `stoobly-e2e-test-troubleshoot` covers test-framework log cross-referencing, trace inspection, and the recording-fix workflow that this skill does not.

To hand off:

1. Invoke the `stoobly-e2e-test-troubleshoot` skill using your assistant's skill invocation (in Claude Code, the Skill tool or `/stoobly-e2e-test-troubleshoot`).
2. Carry over what Step 1 already established so the other skill does not rediscover it — whether a scaffold was detected, and the runtime and proxy mode.

Do not continue to Step 3 below — `stoobly-e2e-test-troubleshoot` owns the rest of the diagnosis. Return here only if it concludes the cause is environmental (certificate, port conflict, or intercept never enabled).

## Step 3: Look up the relevant commands

Get exact syntax from the CLI, not from memory: `stoobly-agent opencli show <group>` (groups: `intercept`, `request`, `scaffold`, `scenario`, `setting`, `snapshot`; root index via `stoobly-agent opencli show`). For `ca-cert`, use `stoobly-agent ca-cert --help`. Then start from the checklist for the symptom:

| Symptom | Check |
|---|---|
| 499 errors | The request exists in the active scenario (`stoobly-agent setting scenario show`); rewrite, match, and filter rules (`setting` group) and lifecycle hooks aren't changing the request; reproduce with `stoobly-agent mock <url>` or `stoobly-agent request response show <REQUEST-KEY>` |
| HTTPS / cert errors | The Stoobly CA cert is installed and trusted by the client: `stoobly-agent ca-cert install`; for scaffold apps with HTTPS services, `stoobly-agent scaffold workflow mkcert <workflow>` |
| Traffic not intercepted | `stoobly-agent intercept show` (enable with `intercept enable`); forward proxy: the app points `HTTP_PROXY` / `HTTPS_PROXY` at the proxy port (`proxy-port`, default 8080); reverse proxy: `stoobly-agent scaffold hostname install` |
| Wrong / stale responses | The correct scenario is active (`stoobly-agent setting scenario show`); match rules; inspect with `request response show`; for one wrong request, switch to `stoobly-request-update` |
| Port conflict | Find the process holding the port with your OS's tools and stop it, or pick another with `--proxy-port` / `--ui-port` (see `stoobly-agent opencli show`) |

If the user has a scaffold app, also run the runtime-specific checks (runtime from Step 1):

- **Docker:** confirm Docker is running and accessible (`docker ps`; a non-default socket needs the `--docker-socket-path` set when the app was created). Container logs and intercepted request logs come from the scaffold Makefile: `make -f .stoobly/services/.Makefile <workflow>/logs` and `<workflow>/request/logs` (add `options="--follow"` or `options="--level error"`).
- **Local:** confirm `python3 --version` and `stoobly-agent --version` work, then re-run the workflow with verbose output: `stoobly-agent scaffold workflow up <workflow> --log-level debug`.

## Step 4: Run diagnostics and fixes

Using the checklist and CLI output above, determine the exact diagnostic and fix commands for their specific setup (scaffold+docker, scaffold+local, or standalone).

**Always start by checking the logs** — run these immediately before anything else:

For scaffold apps:
```bash
# Show what requests the workflow saw and their mock/record status
stoobly-agent scaffold request logs list <workflow>   # e.g. mock, record, test

# Show the raw workflow process output (startup errors, config issues)
stoobly-agent scaffold workflow logs <workflow>
```

For standalone (no scaffold):
```bash
# Show intercepted request logs (supports --follow, --level, --status-code filters)
stoobly-agent request logs list
```

Run diagnostic commands immediately using Bash (no confirmation needed — these are read-only checks). Show the output and interpret it for the user.

For fix commands, show what you plan to run and ask: "Ready to apply this fix? (yes / let me review first)" Once confirmed, execute each fix command using Bash. After each command, report whether it succeeded or failed. If a command fails, stop and show the full error output before asking how to proceed.

## Step 5: Surface next steps

End with context-appropriate next steps. Examples:

> - If you resolved a 499 issue: run the scaffold mock workflow again to confirm responses are now served correctly.
> - If you updated recordings: run scaffold test workflow to verify the new recordings match the live API.
> - If you're still stuck: check logs with `stoobly-agent scaffold request logs list <workflow>` and `stoobly-agent scaffold workflow logs <workflow>` (scaffold), or `stoobly-agent request logs list` (standalone), and look for error messages.
> - If the problem is happening inside a failing scaffold E2E test (Playwright/Cypress) and isn't resolved, switch to `stoobly-e2e-test-troubleshoot` for the deep test-log cross-referencing and recording-fix workflow.
>
> Docs: https://docs.stoobly.com/faq/troubleshooting
````
