# Dify Playwright

> Inspect, patch, publish, run, and diagnose workflows on a user-configured Dify deployment through Playwright and Dify APIs. Use for authenticated console operations, workflow run inspection, batch execution, and vision-input debugging.

- Skill: `juneqqq/dify-playwright` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add juneqqq/dify-playwright`
- Raw SKILL.md: https://api.skillmd.com/api/skills/juneqqq/dify-playwright/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: juneqqq (https://skillmd.com/u/juneqqq)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/juneqqq/dify-playwright

---


# Dify Playwright

Use this skill when a task requires access to a Dify workflow draft, console-only execution logs, or repeatable workflow runs.

## Choose The Correct API

| Path | Authentication | Best for |
| --- | --- | --- |
| Console API | Dify email/password through Playwright | Read/write drafts, publish, inspect node executions |
| Service API | Dify app API key | Run an already published workflow |

Prefer the Service API when no draft or console-only data is needed.

## Setup

```bash
cd /path/to/dify-playwright
npm install
npx playwright install chromium
cp .env.example .env
set -a; source .env; set +a
```

The console path requires `DIFY_BASE_URL`, `DIFY_EMAIL`, and `DIFY_PASSWORD`. App-specific operations also require `DIFY_APP_ID`. Never print or commit these values.

## Console Workflow Procedure

1. Read the current draft with `npm run dify -- get-draft output/draft.json`.
2. Inspect node IDs, edges, node types, and the current workflow hash.
3. Patch a local copy while preserving unrelated graph data.
4. Save with `npm run dify -- save-draft input/save-payload.json`.
5. If Dify rejects a stale hash, fetch the draft again and reapply the patch.
6. Publish only after validating graph structure and required node references.
7. Run representative inputs and fetch node executions instead of trusting final text alone.

## Published Runs

```bash
export DIFY_APP_API_KEY='<app-api-key>'
npm run dify -- run-formal input/run.json output/result.json
```

The command forces streaming mode and extracts the final workflow event.

## Batch Runs And Logs

- Use `scripts/run_workflow_batch.mjs` for generic parallel draft or installed-app runs.
- Use `scripts/fetch_batch_node_usage.mjs` to collect LLM node model, token, latency, loop, and status fields.
- Keep input and output files out of Git when they contain private workflow data.

## Vision Workflows

Read [references/dify-vision-files.md](references/dify-vision-files.md). Verify actual LLM prompt file counts from node executions; plausible output text does not prove that an image reached the model.

## Completion Checklist

- Confirm the chosen API path matches the task.
- Confirm the intended draft hash changed before reporting a saved edit.
- Confirm publish completed when the user requested a published change.
- Fetch node executions for representative runs.
- Check image file counts for vision workflows.
- Separate HTTP/file preparation time from LLM time when diagnosing latency.
- Do not expose credentials, cookies, private URLs, or workflow payloads in logs or commits.

