Skip to content

Commit 358b3ff

Browse files
authored
Merge pull request #47 from DiffyWebsite/diffy-skills
add claude skills
2 parents 4641da0 + 5819cfd commit 358b3ff

13 files changed

Lines changed: 1190 additions & 0 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "diffy",
3+
"owner": {
4+
"name": "Diffy",
5+
"email": "support@diffy.website"
6+
},
7+
"metadata": {
8+
"description": "Diffy visual-regression skills for Claude Code."
9+
},
10+
"plugins": [
11+
{
12+
"name": "diffy",
13+
"source": "./plugins/diffy",
14+
"description": "Create Diffy projects, capture/upload screenshots, and run visual diffs.",
15+
"version": "1.0.0",
16+
"author": {
17+
"name": "Diffy"
18+
},
19+
"homepage": "https://diffy.website/",
20+
"category": "testing",
21+
"tags": ["visual-regression", "screenshots", "diffy", "testing", "ui"]
22+
}
23+
]
24+
}

plugins/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Claude Code plugins for diffy-cli
2+
3+
This directory holds Claude Code plugins distributed through the marketplace defined at
4+
[`../.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json).
5+
6+
## `diffy`
7+
8+
Visual-regression skills built on the `diffy` CLI — create projects, capture/upload screenshots, and run
9+
visual diffs. See [`diffy/README.md`](diffy/README.md).
10+
11+
## Install (once this repo is pushed)
12+
13+
```shell
14+
/plugin marketplace add diffywebsite/diffy-cli
15+
/plugin install diffy@diffy
16+
```
17+
18+
Then the skills are available namespaced, e.g. `/diffy:visual-diff`. Claude also invokes them
19+
automatically based on your request.
20+
21+
## Local development / testing (no install)
22+
23+
```bash
24+
# from the repo root
25+
claude --plugin-dir ./plugins/diffy
26+
claude plugin validate ./plugins/diffy # run before publishing / submitting
27+
```
28+
29+
Use `/reload-plugins` inside a session to pick up edits without restarting.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "diffy",
3+
"description": "Diffy visual-regression skills: create projects, capture/upload screenshots, and run visual diffs via the diffy CLI.",
4+
"version": "1.0.0",
5+
"author": {
6+
"name": "Diffy",
7+
"email": "support@diffy.website"
8+
},
9+
"homepage": "https://diffy.website/",
10+
"license": "MIT"
11+
}

plugins/diffy/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# diffy plugin
2+
3+
Claude Code skills for [Diffy](https://diffy.website/) visual-regression testing, built on the `diffy` CLI.
4+
Claude invokes these automatically based on what you ask; you can also call them explicitly with their
5+
namespaced names (`/diffy:<skill>`).
6+
7+
## Skills
8+
9+
| Skill | What it does |
10+
|---|---|
11+
| `/diffy:create-project` | Create a new Diffy project from a base URL, pages, and breakpoints. |
12+
| `/diffy:update-project-settings` | Edit an existing project's pages, environments, breakpoints, masks, login, schedule, etc. |
13+
| `/diffy:upload-screenshot` | Capture a running app with Playwright and upload it as a Diffy screenshot set. |
14+
| `/diffy:compare-screenshots` | Create a diff from two existing screenshot set IDs. |
15+
| `/diffy:get-diff-info` | Fetch and summarize a diff: % changed, per-page/per-breakpoint table, report link, JUnit. |
16+
| `/diffy:visual-diff` | End-to-end before/after regression: baseline your UI, edit, then compare — pages/breakpoints read from the project. |
17+
18+
`visual-diff` is the one-shot orchestrator (baseline → edit → compare). The other five are granular
19+
building blocks you can compose yourself.
20+
21+
## Prerequisites
22+
23+
- **`diffy` CLI** on `PATH` (or `./vendor/bin/diffy` in the repo). Install the phar:
24+
```bash
25+
wget -O /usr/local/bin/diffy https://github.com/diffywebsite/diffy-cli/releases/latest/download/diffy.phar && chmod a+x /usr/local/bin/diffy
26+
```
27+
Pick a bin directory you can write to — `/usr/local/bin` may need `sudo`; Homebrew on Apple Silicon uses
28+
`/opt/homebrew/bin`.
29+
- **Authentication:** `diffy auth:login <API_KEY>` (get a key at https://app.diffy.website/#/keys). Stored
30+
in `~/.diffy-cli/diffy-cli.yaml`.
31+
- **Playwright** (only for `upload-screenshot` and `visual-diff`):
32+
`npm i -D playwright && npx playwright install chromium`.
33+
34+
## Working files & .gitignore
35+
36+
These skills write intermediate files (configs, PNGs, upload payloads, diff JSON) under `.diffy-skills/`
37+
(granular skills) and `.diffy-visual/` (`visual-diff`). Add both to your project's `.gitignore`:
38+
39+
```gitignore
40+
.diffy-skills/
41+
.diffy-visual/
42+
```
43+
44+
## Notes
45+
46+
Diffy is a cloud service — these skills need an account, API key, and project; they do not do a purely
47+
local pixel diff.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: compare-screenshots
3+
description: >-
4+
Create a Diffy visual diff from two existing screenshot set IDs with diff:create. Use when the user asks
5+
to compare screenshots, compare two uploaded screenshot sets, create a diff from screenshot IDs, or get a
6+
diff ID for before/after screenshots.
7+
allowed-tools: Bash, Read, Write
8+
---
9+
10+
# compare-screenshots
11+
12+
Create a diff from two screenshot set IDs and return a `DIFF_ID`. Do not upload screenshots or do detailed
13+
diff result analysis in this skill.
14+
15+
## Preflight
16+
17+
1. Resolve the CLI:
18+
- Prefer `diffy` from `PATH`.
19+
- Else, if `./vendor/bin/diffy` exists in the current repo, use that.
20+
- Else, ask the user to install it and stop until it is available. Suggested install (pick a bin
21+
directory the user can write to — `/usr/local/bin` may need `sudo`; Homebrew on Apple Silicon uses
22+
`/opt/homebrew/bin`):
23+
`wget -O /usr/local/bin/diffy https://github.com/diffywebsite/diffy-cli/releases/latest/download/diffy.phar && chmod a+x /usr/local/bin/diffy`
24+
2. Check authentication: `~/.diffy-cli/diffy-cli.yaml` must exist. If it does not, run
25+
`diffy auth:login <API_KEY>` after the user provides the key (key from https://app.diffy.website/#/keys).
26+
27+
Required:
28+
- `PROJECT_ID`
29+
- first screenshot ID
30+
- second screenshot ID
31+
32+
If screenshot IDs are missing, inspect recent screenshot sets:
33+
34+
```bash
35+
diffy screenshot:list <PROJECT_ID> --limit=10
36+
```
37+
38+
This prints a PHP `var_export` dump, not JSON. Read each set's ID from its `'id' => <number>` line
39+
rather than trying to parse the output as JSON.
40+
41+
Ask only for the missing ID(s). Treat the first ID as the baseline/before screenshot and the second ID as
42+
the after/current screenshot unless the user says otherwise.
43+
44+
## Compare
45+
46+
Use `--wait` by default unless the user explicitly asks to start the diff asynchronously.
47+
48+
```bash
49+
diffy diff:create <PROJECT_ID> <SCREENSHOT_ID_BEFORE> <SCREENSHOT_ID_AFTER> --wait --name="<diff-name>"
50+
```
51+
52+
The command prints the `DIFF_ID`.
53+
54+
Naming:
55+
- If the user provides a name, use it exactly.
56+
- Otherwise use a concise generated name, for example `Uploaded screenshots 2026-07-06`.
57+
58+
Wait behavior:
59+
- `--wait` polls until Diffy completes or fails.
60+
- `--max-wait=<seconds>` can be added when the user needs a custom timeout.
61+
- If the command returns before completion, use `get-diff-info` later to check status and results.
62+
63+
## Output
64+
65+
Write metadata to `.diffy-skills/diffs/last-diff.json`:
66+
67+
```json
68+
{
69+
"projectId": 12345,
70+
"beforeScreenshotId": 111,
71+
"afterScreenshotId": 222,
72+
"diffId": 333,
73+
"name": "Uploaded screenshots 2026-07-06",
74+
"createdAt": "2026-07-06T12:00:00Z"
75+
}
76+
```
77+
78+
Return:
79+
- diff ID
80+
- project ID
81+
- before screenshot ID
82+
- after screenshot ID
83+
- whether the command waited
84+
85+
Stop there. Tell the user to use `get-diff-info` for the detailed changed-page report.
86+
87+
This skill writes metadata under `.diffy-skills/`; offer to add `.diffy-skills/` to the repo's `.gitignore`
88+
if it is not already ignored.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
name: create-project
3+
description: >-
4+
Create a Diffy project with the diffy CLI from user-provided project details. Use when the user asks to
5+
create a Diffy project, set up a new project in Diffy, or turn a base URL, pages, and breakpoints into a
6+
new Diffy project. Requires the user to provide base_url and returns the created project ID.
7+
allowed-tools: Bash, Read, Write
8+
---
9+
10+
# create-project
11+
12+
Create Diffy projects only. Do not update existing project settings, upload screenshots, create diffs, or
13+
summarize diff results in this skill.
14+
15+
Always generate a fresh JSON config from the user's input. Do not use the repo's example JSON or YAML files
16+
as the project creation input.
17+
18+
## Preflight
19+
20+
1. Resolve the CLI:
21+
- Prefer `diffy` from `PATH`.
22+
- Else, if `./vendor/bin/diffy` exists in the current repo, use that.
23+
- Else, ask the user to install it and stop until it is available. Suggested install (pick a bin
24+
directory the user can write to — `/usr/local/bin` may need `sudo`; Homebrew on Apple Silicon uses
25+
`/opt/homebrew/bin`):
26+
`wget -O /usr/local/bin/diffy https://github.com/diffywebsite/diffy-cli/releases/latest/download/diffy.phar && chmod a+x /usr/local/bin/diffy`
27+
2. Check authentication: `~/.diffy-cli/diffy-cli.yaml` must exist. If it does not, run
28+
`diffy auth:login <API_KEY>` after the user provides the key (key from https://app.diffy.website/#/keys).
29+
30+
## Inputs
31+
32+
Required:
33+
- `base_url`: the production/base URL for the new project, for example `https://www.example.com`. This is
34+
written to the config as the `production` field (same field name `update-project-settings` uses).
35+
36+
If `base_url` is missing, ask the user for it before creating the config. Do not infer it from examples.
37+
38+
Optional:
39+
- `name`: default to the hostname from `base_url` if omitted.
40+
- `pages` or `urls`: default to only the homepage path `/` if omitted.
41+
- `breakpoints`: default to `[640, 1024, 1200]` if omitted.
42+
- `staging`: default to an empty string if omitted.
43+
- `development`: default to an empty string if omitted.
44+
- `schedule`: omit by default (no monitoring schedule). The create endpoint expects a schedule *string*
45+
such as `"mon:false, tue:false, wed:false, thu:false, fri:false, sat:false, sun:false"`, so only add this
46+
field when the user asks for a schedule.
47+
48+
Create a JSON config in `.diffy-skills/project-create/<safe-name>.json`. Do not overwrite an existing
49+
config unless the user asked for that exact file to be replaced.
50+
51+
Generated JSON shape:
52+
53+
```json
54+
{
55+
"name": "Project name",
56+
"breakpoints": [640, 1024, 1200],
57+
"production": "https://www.example.com",
58+
"staging": "https://staging.example.com",
59+
"development": "",
60+
"urls": [
61+
"https://www.example.com/",
62+
"https://www.example.com/about"
63+
]
64+
}
65+
```
66+
67+
Rules:
68+
- Keep `urls` absolute by resolving each page path against `base_url`.
69+
- Do not create from example/sample config files.
70+
- This skill creates one project per run unless the user explicitly provides several `base_url` values.
71+
72+
## Create
73+
74+
Run:
75+
76+
```bash
77+
diffy project:create <generated-config.json>
78+
```
79+
80+
The command prints created IDs in this form:
81+
82+
```text
83+
[12345] created.
84+
```
85+
86+
Parse and report the numeric project ID(s). Then verify each project:
87+
88+
```bash
89+
diffy project:get <PROJECT_ID>
90+
```
91+
92+
Return a concise result with:
93+
- project ID
94+
- project name
95+
- production/base URL
96+
- pages count
97+
- breakpoints
98+
- config file path used
99+
100+
If creation fails, show the exact CLI error and the config path. Do not retry by changing project settings;
101+
that belongs to `update-project-settings`.
102+
103+
This skill writes its generated config under `.diffy-skills/`; offer to add `.diffy-skills/` to the repo's
104+
`.gitignore` if it is not already ignored.

0 commit comments

Comments
 (0)