Skip to main content
Tazovsky

claude-rshiny-plugin

by Tazovskyv1.0.0

Launch R Shiny apps, interact via Playwright browser automation, and monitor server logs in real time. 4 skills for full app lifecycle management.

Installation guide →
4 skills GitHub

Keywords

r-shinyplaywrightbrowser-automationshiny-applog-monitoring

Documentation

# claude-rshiny-plugin

Claude Code plugin for running R Shiny apps with Playwright browser automation and real-time log monitoring.

## Skills

| Skill | Command | Purpose |
|-------|---------|---------|
| **rshiny-run** | `/rshiny-run "instructions"` | Launch app, open browser, follow instructions, monitor logs |
| **rshiny-stop** | `/rshiny-stop` | Kill app, close browser tab |
| **rshiny-logs** | `/rshiny-logs` | Show recent server log output |
| **rshiny-status** | `/rshiny-status` | Check if app is running + health |

## Install

```
/install-plugin /path/to/claude-rshiny-plugin
```

Or add to your plugins config manually.

## Prerequisites

- **R** with `shiny` package installed
- **Playwright MCP plugin** configured in Claude Code (provides `browser_navigate`, `browser_snapshot`, etc.)

## Usage

### Launch and interact

```
/rshiny-run "create a new project and fill in the details"
```

This will:
1. Kill any previous Shiny process
2. Launch the app on a random port
3. Open it in a browser via Playwright
4. Autonomously follow your instructions by reading UI snapshots
5. Monitor server logs after every action for errors
6. Report what was done

### Launch only (no instructions)

```
/rshiny-run
```

Starts the app and opens the browser. The app stays running for manual interaction.

### Check status

```
/rshiny-status
```

### View logs

```
/rshiny-logs
```

### Stop

```
/rshiny-stop
```

## How It Works

- **Random port**: Shiny picks an available port automatically. The port is extracted from the "Listening on" log line and saved to `~/.claude/rshiny-state/port.txt` for cross-session use.
- **Log capture**: Server output redirected to `~/.claude/rshiny-state/shiny.log` with `TERM=dumb` to prevent ANSI escape codes.
- **Error detection**: After every browser action, the skill reads new log lines and checks for hard errors (abort) vs warnings (continue).
- **Browser console**: Client-side JS errors checked via `browser_console_messages` alongside server logs.
- **Bounded execution**: Max 100 iterations, 3-failure circuit breaker, immediate abort on server crash/disconnect.

## Runtime State

All runtime artifacts stored in `~/.claude/rshiny-state/`:

| File | Purpose |
|------|---------|
| `shiny.log` | Server stdout/stderr (recreated each run) |
| `port.txt` | Random port chosen by Shiny (persists for stop/status) |