@kw-yeh/vibeflow 4.11.66 → 4.11.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/builtin-skills/address-review/scripts/pr-lib.mjs +29 -1
- package/dist/builtin-skills/pr/SKILL.md +112 -16
- package/dist/builtin-skills/pr-watch/SKILL.md +64 -31
- package/dist/builtin-skills/pr-watch/scripts/pr-lib.mjs +29 -1
- package/dist/builtin-skills/pr-watch/scripts/pr-watch.mjs +27 -11
- package/dist/builtin-skills/visual-parity/README.md +225 -0
- package/dist/builtin-skills/visual-parity/SKILL.md +168 -12
- package/dist/builtin-skills/visual-parity/scripts/parity.py +854 -63
- package/dist/builtin-skills/visual-parity/scripts/scaffold_verify.py +126 -0
- package/dist/builtin-skills/visual-parity/scripts/vendor/README +1 -0
- package/dist/builtin-skills/visual-parity/scripts/vendor/axe-core.LICENSE +362 -0
- package/dist/builtin-skills/visual-parity/scripts/vendor/axe.min.js +12 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/SKILL.md +46 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/features/README.md +18 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/features/home.md +19 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/flows/home.json +5 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/check-map.sh +33 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/cleanup.sh +27 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/doctor.sh +31 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/launch.sh +31 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/lib.sh +54 -0
- package/dist/builtin-skills/visual-parity/templates/verify-app/scripts/verify.sh +19 -0
- package/dist/builtin-skills/work-mode/SKILL.md +114 -0
- package/dist/builtin-skills/work-mode/playbooks/babysit-pr.md +19 -0
- package/dist/builtin-skills/work-mode/playbooks/bug-fix.md +19 -0
- package/dist/builtin-skills/work-mode/playbooks/feature.md +17 -0
- package/dist/builtin-skills/work-mode/playbooks/investigation.md +16 -0
- package/dist/builtin-skills/work-mode/playbooks/refactor.md +18 -0
- package/dist/vibeflow.mjs +370 -26
- package/dist/web/404/index.html +1 -1
- package/dist/web/404.html +1 -1
- package/dist/web/_next/static/{rGD00oN1g3FGv_hbb0V82 → VYsg0UtYDVl6PsB_NgjIH}/_buildManifest.js +1 -1
- package/dist/web/_next/static/chunks/{2362-46f5f7e798186269.js → 9038-bd3ba259c7af7029.js} +2 -2
- package/dist/web/_next/static/chunks/pages/{_app-cc5f3a5ded198d58.js → _app-16ca7c5ca7e39461.js} +1 -1
- package/dist/web/_next/static/chunks/pages/home-d30108228923847c.js +14 -0
- package/dist/web/_next/static/chunks/{webpack-d7cc7d90e557abc8.js → webpack-1f79da4960e22d5d.js} +1 -1
- package/dist/web/_next/static/css/77470e9065b0013a.css +2 -0
- package/dist/web/home/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/pages/home-c544d714b749bca6.js +0 -14
- package/dist/web/_next/static/css/2653922154b6a451.css +0 -2
- /package/dist/web/_next/static/{rGD00oN1g3FGv_hbb0V82 → VYsg0UtYDVl6PsB_NgjIH}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-__APP__
|
|
3
|
+
description: Drive the __APP__ web app in a real browser against its local dev server and capture proof (screenshots, flow report tied to a commit). Use when a change touches pages, components, routing or copy and you need to show it works beyond unit tests, or when someone names a screen loosely ("the list on the left of the member page") and you need to find it, reproduce it and screenshot it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verify __APP__
|
|
7
|
+
|
|
8
|
+
The app runs with `__START__` and is checked at `__ENTRY_URL__`.
|
|
9
|
+
|
|
10
|
+
**Find the feature first.** Read `features/README.md`, match the user's words against the feature list and its synonyms, then open that feature file. Do not ask the user where a screen is before searching the map.
|
|
11
|
+
|
|
12
|
+
## Launch, check, clean up
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
.claude/skills/verify-__APP__/scripts/launch.sh # starts the dev server, waits for 200
|
|
16
|
+
.claude/skills/verify-__APP__/scripts/doctor.sh # read-only: is it ours and serving?
|
|
17
|
+
.claude/skills/verify-__APP__/scripts/cleanup.sh # stops only what launch.sh started
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Never drive an instance this run did not start. Settings (port, host, start command) live in `scripts/lib.sh`.
|
|
21
|
+
|
|
22
|
+
## Drive and collect evidence
|
|
23
|
+
|
|
24
|
+
Each feature has a flow in `flows/<feature-id>.json`, written in visual-parity flow syntax with `{BASE}` for the origin and `{EVIDENCE}` for the evidence folder:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
.claude/skills/verify-__APP__/scripts/verify.sh <feature-id> # report + screenshots
|
|
28
|
+
.claude/skills/verify-__APP__/scripts/verify.sh <feature-id> --mutate # also prove the assertions can fail
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Evidence goes to `${VERIFY_OUT:-/tmp/verify-__APP__}/evidence/<feature-id>/`. The report starts with the commit and working-tree state; use that commit as the PR's `Verified at`.
|
|
32
|
+
|
|
33
|
+
For a path the map does not cover yet, write a new flow from the same syntax (see the visual-parity SKILL.md for every action), run it, then add the feature to the map.
|
|
34
|
+
|
|
35
|
+
## Keep the map true
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
.claude/skills/verify-__APP__/scripts/check-map.sh # contract, index, flows
|
|
39
|
+
.claude/skills/verify-__APP__/scripts/check-map.sh --live # also every route answers 200 (server up)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A change that adds, renames or removes a page updates `features/` and `flows/` in the same PR. A flow that no longer reaches its screen is a map bug: fix the map, then report.
|
|
43
|
+
|
|
44
|
+
## Not covered
|
|
45
|
+
|
|
46
|
+
__NOT_COVERED__
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# __APP__ verification map
|
|
2
|
+
|
|
3
|
+
Read this index, match the request against the names and synonyms below, then use the feature file as the recipe.
|
|
4
|
+
|
|
5
|
+
## Baseline preconditions
|
|
6
|
+
|
|
7
|
+
- `scripts/launch.sh` has run and `scripts/doctor.sh` reports `DOCTOR: good`.
|
|
8
|
+
- Never enter real credentials. Prefer paths that stay client-side, or stub the API in the flow.
|
|
9
|
+
|
|
10
|
+
## Feature entry contract
|
|
11
|
+
|
|
12
|
+
Each feature file has an H1, one paragraph, then four H2s: `Sub-features`, `How to get to it (user POV)`, `Driving it`, `Gotchas`. Routes are written in backticks (`/path`) so `check-map.sh --live` can probe them. Each feature has `flows/<id>.json`.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
| id | what users call it | file |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| home | 首頁, landing page, entry page | [home](./home.md) |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Entry page
|
|
2
|
+
|
|
3
|
+
The page at `__ENTRY__` that the app opens on. Replace this with what the page shows and does.
|
|
4
|
+
|
|
5
|
+
## Sub-features
|
|
6
|
+
|
|
7
|
+
- `home-render` the page renders its main heading.
|
|
8
|
+
|
|
9
|
+
## How to get to it (user POV)
|
|
10
|
+
|
|
11
|
+
- Open `__ENTRY__`.
|
|
12
|
+
|
|
13
|
+
## Driving it
|
|
14
|
+
|
|
15
|
+
`scripts/verify.sh home` runs `flows/home.json`: open the entry page, check it rendered, save a screenshot.
|
|
16
|
+
|
|
17
|
+
## Gotchas
|
|
18
|
+
|
|
19
|
+
- None recorded yet. Add what made this page hard to reach or assert on.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Keep the feature map honest: every feature file follows the entry contract, is listed in the
|
|
3
|
+
# index, and has a flow; every flow belongs to a feature. With the dev server up (--live), every
|
|
4
|
+
# route a feature names must answer 200. Exit 1 on any problem.
|
|
5
|
+
set -u
|
|
6
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
# shellcheck source=lib.sh
|
|
8
|
+
. "$HERE/lib.sh"
|
|
9
|
+
F="$HERE/../features"; FL="$HERE/../flows"; bad=0
|
|
10
|
+
problem() { echo "MAP FAIL $1"; bad=1; }
|
|
11
|
+
for f in "$F"/*.md; do
|
|
12
|
+
name="$(basename "$f" .md)"; [ "$name" = README ] && continue
|
|
13
|
+
for h in "Sub-features" "How to get to it (user POV)" "Driving it" "Gotchas"; do
|
|
14
|
+
grep -q "^## $h" "$f" || problem "$name.md lacks '## $h'"
|
|
15
|
+
done
|
|
16
|
+
grep -q "($name.md)\|(./$name.md)" "$F/README.md" || problem "$name.md is not listed in features/README.md"
|
|
17
|
+
[ -f "$FL/$name.json" ] || problem "$name.md has no flows/$name.json"
|
|
18
|
+
grep -q 'TODO' "$f" && problem "$name.md still has TODO"
|
|
19
|
+
done
|
|
20
|
+
for j in "$FL"/*.json; do
|
|
21
|
+
[ -e "$j" ] || continue
|
|
22
|
+
name="$(basename "$j" .json)"
|
|
23
|
+
[ -f "$F/$name.md" ] || problem "flows/$name.json has no features/$name.md"
|
|
24
|
+
python3 -c 'import json,sys; json.load(open(sys.argv[1]))' "$j" 2>/dev/null || problem "flows/$name.json is not valid JSON"
|
|
25
|
+
done
|
|
26
|
+
if [ "${1:-}" = --live ]; then
|
|
27
|
+
for route in $(find "$F" -name '*.md' ! -name README.md -exec grep -ho '`/[^` ]*`' {} + | tr -d '`' | sort -u); do
|
|
28
|
+
code=$(curl --noproxy '*' --resolve "$HOST:$PORT:127.0.0.1" -sk -o /dev/null -w '%{http_code}' "$SCHEME://$HOST:$PORT$route" || true)
|
|
29
|
+
[ "$code" = 200 ] || problem "route $route -> $code"
|
|
30
|
+
done
|
|
31
|
+
fi
|
|
32
|
+
[ $bad = 0 ] && echo "MAP: ok"
|
|
33
|
+
exit $bad
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop only the dev server this run started (recorded pid and all its descendants).
|
|
3
|
+
# Refuses to kill a pid that is no longer the process launch.sh started (pid reuse).
|
|
4
|
+
# Keeps evidence in $OUT/evidence. Fails if the port is still held afterwards.
|
|
5
|
+
set -u
|
|
6
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
# shellcheck source=lib.sh
|
|
8
|
+
. "$HERE/lib.sh"
|
|
9
|
+
if [ -f "$PID_FILE" ]; then
|
|
10
|
+
pid=$(file_pid)
|
|
11
|
+
if pid_file_matches; then
|
|
12
|
+
# shellcheck disable=SC2046
|
|
13
|
+
kill $(descendants "$pid") "$pid" 2>/dev/null
|
|
14
|
+
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
15
|
+
[ -z "$(port_listener)" ] && break
|
|
16
|
+
sleep 1
|
|
17
|
+
done
|
|
18
|
+
else
|
|
19
|
+
echo "pid $pid is not the process launch.sh started (gone or reused); not stopping anything" >&2
|
|
20
|
+
fi
|
|
21
|
+
rm -f "$PID_FILE" "$OUT/dev.log"
|
|
22
|
+
fi
|
|
23
|
+
if [ -n "$(port_listener)" ]; then
|
|
24
|
+
echo "port $PORT is still in use after cleanup; not killing by name, check it manually" >&2
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
echo "cleaned; port $PORT free; evidence kept in $OUT/evidence"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Read-only check: is the instance on $PORT ours, and is it serving?
|
|
3
|
+
set -u
|
|
4
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
. "$HERE/lib.sh"
|
|
7
|
+
ok=1
|
|
8
|
+
if [ "$HOST" != localhost ] && [ "$HOST" != 127.0.0.1 ]; then
|
|
9
|
+
if awk -v h="$HOST" '$1 !~ /^#/ && $1 == "127.0.0.1" { for (i = 2; i <= NF; i++) if ($i == h) f = 1 } END { exit !f }' /etc/hosts; then
|
|
10
|
+
echo "ok /etc/hosts maps $HOST to 127.0.0.1"
|
|
11
|
+
else
|
|
12
|
+
echo "FAIL /etc/hosts has no active 127.0.0.1 entry for $HOST"; ok=0
|
|
13
|
+
fi
|
|
14
|
+
fi
|
|
15
|
+
pid=$(file_pid)
|
|
16
|
+
if [ -n "$pid" ] && pid_file_matches; then
|
|
17
|
+
echo "ok dev server pid $pid alive and unchanged since launch"
|
|
18
|
+
else
|
|
19
|
+
echo "FAIL no live dev server started by this run (run scripts/launch.sh)"; ok=0; pid=""
|
|
20
|
+
fi
|
|
21
|
+
owner=$(port_listener)
|
|
22
|
+
if [ -z "$owner" ]; then
|
|
23
|
+
echo "FAIL nothing listens on $PORT"; ok=0
|
|
24
|
+
elif [ -n "$pid" ] && is_descendant "$owner" "$pid"; then
|
|
25
|
+
echo "ok port $PORT is owned by pid $owner, started by our pid $pid"
|
|
26
|
+
else
|
|
27
|
+
echo "FAIL port $PORT is owned by pid $owner, which this run did not start"; ok=0
|
|
28
|
+
fi
|
|
29
|
+
code=$(probe)
|
|
30
|
+
if [ "$code" = 200 ]; then echo "ok $ENTRY_URL -> 200 (loopback, no proxy)"; else echo "FAIL $ENTRY_URL -> $code"; ok=0; fi
|
|
31
|
+
if [ $ok = 1 ]; then echo "DOCTOR: good"; else echo "DOCTOR: bad"; exit 1; fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Start the dev server for verification and wait until the entry page serves.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
# shellcheck source=lib.sh
|
|
6
|
+
. "$HERE/lib.sh"
|
|
7
|
+
REPO="$(cd "$HERE/../../../.." && pwd)"
|
|
8
|
+
mkdir -p "$OUT"
|
|
9
|
+
if [ -n "$(port_listener)" ]; then
|
|
10
|
+
echo "port $PORT already in use; refusing to drive an instance this run did not start" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
cd "$REPO"
|
|
14
|
+
nohup sh -c "$START_CMD" > "$OUT/dev.log" 2>&1 &
|
|
15
|
+
pid=$!
|
|
16
|
+
for _ in $(seq 1 "$READY_TIMEOUT"); do
|
|
17
|
+
if ! kill -0 "$pid" 2>/dev/null; then
|
|
18
|
+
echo "dev server exited early; see $OUT/dev.log" >&2
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
if [ "$(probe)" = 200 ]; then
|
|
22
|
+
write_pid_file "$pid"
|
|
23
|
+
echo "ready: $ENTRY_URL (pid $pid)"
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
sleep 1
|
|
27
|
+
done
|
|
28
|
+
# shellcheck disable=SC2046
|
|
29
|
+
kill $(descendants "$pid") "$pid" 2>/dev/null || true
|
|
30
|
+
echo "not ready after ${READY_TIMEOUT}s; stopped it; see $OUT/dev.log" >&2
|
|
31
|
+
exit 1
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Shared settings and helpers for launch.sh, doctor.sh and cleanup.sh. Source it, do not run it.
|
|
3
|
+
# Generated by visual-parity scaffold_verify.py; edit the values here, not in the other scripts.
|
|
4
|
+
APP="__APP__"
|
|
5
|
+
OUT="${VERIFY_OUT:-/tmp/verify-__APP__}"
|
|
6
|
+
PORT=__PORT__
|
|
7
|
+
HOST=__HOST__
|
|
8
|
+
SCHEME=__SCHEME__
|
|
9
|
+
ENTRY_URL="$SCHEME://$HOST:$PORT__ENTRY__"
|
|
10
|
+
START_CMD="__START__"
|
|
11
|
+
READY_TIMEOUT=__TIMEOUT__
|
|
12
|
+
PID_FILE="$OUT/dev.pid"
|
|
13
|
+
|
|
14
|
+
# HTTP status of the entry page, pinned to loopback and bypassing any proxy.
|
|
15
|
+
probe() {
|
|
16
|
+
curl --noproxy '*' --resolve "$HOST:$PORT:127.0.0.1" -sk -o /dev/null -w '%{http_code}' "$ENTRY_URL" || true
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
port_listener() { lsof -nP -iTCP:"$PORT" -sTCP:LISTEN -t 2>/dev/null | head -1; }
|
|
20
|
+
|
|
21
|
+
descendants() {
|
|
22
|
+
local child
|
|
23
|
+
for child in $(pgrep -P "$1" 2>/dev/null); do
|
|
24
|
+
echo "$child"
|
|
25
|
+
descendants "$child"
|
|
26
|
+
done
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# True when $1 is $2 or below it in the process tree.
|
|
30
|
+
is_descendant() {
|
|
31
|
+
local p=$1
|
|
32
|
+
while [ -n "$p" ] && [ "$p" != 0 ] && [ "$p" != 1 ]; do
|
|
33
|
+
[ "$p" = "$2" ] && return 0
|
|
34
|
+
p=$(ps -o ppid= -p "$p" 2>/dev/null | tr -d ' ')
|
|
35
|
+
done
|
|
36
|
+
return 1
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
proc_start() { ps -p "$1" -o lstart= 2>/dev/null | sed 's/^[[:space:]]*//'; }
|
|
40
|
+
proc_command() { ps -p "$1" -o command= 2>/dev/null | sed 's/^[[:space:]]*//'; }
|
|
41
|
+
|
|
42
|
+
# The pid file holds three lines: pid, start time, command line.
|
|
43
|
+
write_pid_file() {
|
|
44
|
+
printf '%s\n%s\n%s\n' "$1" "$(proc_start "$1")" "$(proc_command "$1")" > "$PID_FILE"
|
|
45
|
+
}
|
|
46
|
+
file_pid() { sed -n '1p' "$PID_FILE" 2>/dev/null; }
|
|
47
|
+
|
|
48
|
+
# True only when the recorded pid is still the same process that launch.sh started.
|
|
49
|
+
pid_file_matches() {
|
|
50
|
+
local pid start cmd
|
|
51
|
+
pid=$(file_pid); start=$(sed -n '2p' "$PID_FILE" 2>/dev/null); cmd=$(sed -n '3p' "$PID_FILE" 2>/dev/null)
|
|
52
|
+
[ -n "$pid" ] && [ -n "$start" ] && [ -n "$cmd" ] || return 1
|
|
53
|
+
[ "$(proc_start "$pid")" = "$start" ] && [ "$(proc_command "$pid")" = "$cmd" ]
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run one feature's flow through visual-parity and keep the report as evidence.
|
|
3
|
+
# Usage: scripts/verify.sh <feature-id> [extra parity.py flow flags, e.g. --video x.mp4 --mutate]
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
6
|
+
# shellcheck source=lib.sh
|
|
7
|
+
. "$HERE/lib.sh"
|
|
8
|
+
ID="${1:?usage: verify.sh <feature-id> [flow flags]}"; shift
|
|
9
|
+
FLOW="$HERE/../flows/$ID.json"
|
|
10
|
+
[ -f "$FLOW" ] || { echo "no flow for '$ID' at $FLOW; see features/README.md" >&2; exit 2; }
|
|
11
|
+
PARITY="${VISUAL_PARITY:-$HOME/.claude/skills/visual-parity/scripts/parity.py}"
|
|
12
|
+
[ -f "$PARITY" ] || { echo "visual-parity not found at $PARITY (set VISUAL_PARITY)" >&2; exit 2; }
|
|
13
|
+
"$HERE/doctor.sh" >/dev/null || { echo "doctor is not good; run scripts/launch.sh first" >&2; exit 1; }
|
|
14
|
+
mkdir -p "$OUT/evidence/$ID"
|
|
15
|
+
TMP="$(mktemp)"; trap 'rm -f "$TMP"' EXIT
|
|
16
|
+
# Flows use {BASE} so the same file works whatever port or host this machine uses.
|
|
17
|
+
sed "s#{BASE}#$SCHEME://$HOST:$PORT#g; s#{EVIDENCE}#$OUT/evidence/$ID#g" "$FLOW" > "$TMP"
|
|
18
|
+
cd "$(cd "$HERE/../../../.." && pwd)" # the app repo, so the report records its commit
|
|
19
|
+
python3 "$PARITY" flow --steps "$TMP" --out "$OUT/evidence/$ID/report.md" "$@"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: work-mode
|
|
3
|
+
description: Task triage entry point — restate the task in your own words, decide which kind it is (new feature, bug fix, refactor, investigation, an existing PR), then follow that kind's playbook as a task list, calling other skills where it says so. Every task that changes code goes through a spec.md and plan.md first. Use when the user says "/work-mode", "use work mode", "用 work mode 處理", when a VibeFlow card hands over a task, or for any non-trivial development task given without a process. Not for plain questions, typos or one-line edits.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Work mode
|
|
7
|
+
|
|
8
|
+
One entry point; the process depends on the kind of task. This file only triages and holds the
|
|
9
|
+
shared rules; each kind's steps live in `playbooks/` next to this file.
|
|
10
|
+
|
|
11
|
+
Talk to the user in their language.
|
|
12
|
+
|
|
13
|
+
## 1. Restate
|
|
14
|
+
|
|
15
|
+
Say in your own words what problem is being solved, what success looks like, and where the scope
|
|
16
|
+
ends. Read the requirement source first (issue, ticket, PR link, design) and restate after; if you
|
|
17
|
+
cannot read it, name the gap instead of guessing its content.
|
|
18
|
+
|
|
19
|
+
In documents and PRs, cite the real source (the issue or ticket, or the user's own description) —
|
|
20
|
+
never "the VibeFlow card".
|
|
21
|
+
|
|
22
|
+
## 2. Classify
|
|
23
|
+
|
|
24
|
+
Pick one playbook. Judge by what the first step has to be, not by the words in the task title.
|
|
25
|
+
|
|
26
|
+
| Kind | Signals | Playbook |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Bug fix | A gap between current and expected behaviour; a bug report, error report, crash, "broken", "doesn't work" | [bug-fix.md](playbooks/bug-fix.md) |
|
|
29
|
+
| Feature / behaviour change | Add or change behaviour users can see, where the current behaviour is not wrong | [feature.md](playbooks/feature.md) |
|
|
30
|
+
| Refactor | Restructure, move files, extract components, modernise — **external behaviour must not change** | [refactor.md](playbooks/refactor.md) |
|
|
31
|
+
| Dependency change | Upgrade, add or remove packages | Settle the packages and lock file first (ask before changing the lock file); an upgrade with no behaviour change follows refactor, one whose breaking changes change behaviour follows feature |
|
|
32
|
+
| Investigation | Only an answer is wanted — "why", "how does it work", "is it", "how big is the impact" — no change asked for | [investigation.md](playbooks/investigation.md) |
|
|
33
|
+
| Existing PR | The user's own PR is open (check with `gh pr view --json author`): review comments, failing CI, base conflicts, watch until merge | [babysit-pr.md](playbooks/babysit-pr.md) |
|
|
34
|
+
| Review someone else's PR | A PR the user did not write, to review | No playbook: review it directly (or with a code-review skill if one is available) |
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
|
|
38
|
+
- A task that plainly holds two things ("fix X and tidy Y", "find the cause, fix it if you can")
|
|
39
|
+
is done in order, each through its own playbook.
|
|
40
|
+
- One thing that looks like two kinds → take the kind whose first step is more cautious:
|
|
41
|
+
investigation > bug fix > refactor > feature. "Something looks off here" starts as an
|
|
42
|
+
investigation and switches to bug-fix once the bug is confirmed.
|
|
43
|
+
- "Fix the bug and rewrite it nicely" is two things: the fix first, the refactor as its own task or
|
|
44
|
+
as a separate stage of the plan.
|
|
45
|
+
- Ask the user only when two readings lead to different results and a wrong guess is hard to undo.
|
|
46
|
+
Otherwise pick, and right after the restatement say in one sentence which playbook and why.
|
|
47
|
+
|
|
48
|
+
## 3. Task list
|
|
49
|
+
|
|
50
|
+
Open the chosen playbook and copy every item of its **Steps** into the task list (whatever task or
|
|
51
|
+
plan tool the environment provides), then start the first one. From there:
|
|
52
|
+
|
|
53
|
+
- Exactly one item in progress at a time.
|
|
54
|
+
- Finishing an item: pass that step's check → mark it done → commit if files changed → start the
|
|
55
|
+
next. Do not batch the updates or the commits at the end. Using this skill authorises those commits
|
|
56
|
+
on the task's feature branch only — no remote operations beyond push. On a shared branch such as
|
|
57
|
+
`main`, create a feature branch first.
|
|
58
|
+
- spec.md / plan.md are committed only once confirmed; documents still waiting stay uncommitted.
|
|
59
|
+
- A step whose check failed is not done.
|
|
60
|
+
- New steps you discover go into the task list, not only into prose.
|
|
61
|
+
- If the classification turns out wrong (the investigation found a bug), say why in one sentence,
|
|
62
|
+
switch playbooks, and replace the remaining items with the new playbook's.
|
|
63
|
+
|
|
64
|
+
## Shared rules
|
|
65
|
+
|
|
66
|
+
### Spec and plan
|
|
67
|
+
|
|
68
|
+
Playbooks that change the repo (feature, bug-fix, refactor, babysit-pr) create or update a
|
|
69
|
+
`spec.md` and a `plan.md`. Each playbook says what this kind of task must put in them.
|
|
70
|
+
|
|
71
|
+
- Where they go: follow the target project's convention (its CLAUDE.md / AGENTS.md, or an existing
|
|
72
|
+
`docs/features/<slug>/`-style folder). If a spec/plan skill is available (for example
|
|
73
|
+
`feature-spec-plan`), use it and its templates. Otherwise create `docs/features/<slug>/` with
|
|
74
|
+
- `spec.md`: problem and goal, scope (in / out), a **behaviour** table (situation → expected
|
|
75
|
+
behaviour), acceptance criteria as a checklist, constraints and open questions, a confirmation log.
|
|
76
|
+
- `plan.md`: investigation of the existing code (with `file:line`), approach and trade-offs,
|
|
77
|
+
implementation stages in order, risks and dependencies, an implementation-and-verification log.
|
|
78
|
+
- New task: a new folder with a new spec.md and plan.md. Continuing the same feature or PR: reuse
|
|
79
|
+
the existing documents and update them only where the latest facts disagree.
|
|
80
|
+
- Confirmation: present the spec and wait for the user's confirmation before the plan, and the plan
|
|
81
|
+
before implementing. If the user said beforehand that low-complexity tasks need no confirmation,
|
|
82
|
+
a task that is single-file, changes no API or data shape and can be undone in one line may go
|
|
83
|
+
straight on after the spec is shown; write "skipped confirmation per the user's prior permission"
|
|
84
|
+
in the confirmation log.
|
|
85
|
+
- Investigation changes nothing and writes no documents; once its answer calls for a change,
|
|
86
|
+
switch to the matching playbook and start the documents there.
|
|
87
|
+
|
|
88
|
+
### Verification
|
|
89
|
+
|
|
90
|
+
Take the check commands from the target project's CLAUDE.md / AGENTS.md and `package.json` (or its
|
|
91
|
+
equivalent), never from another project. A check you did not run is not verified — list it as such.
|
|
92
|
+
|
|
93
|
+
### Wrap-up (every playbook that opens a PR)
|
|
94
|
+
|
|
95
|
+
1. Get an independent review before the PR: if a pre-PR review skill is available (for example
|
|
96
|
+
`pre-pr-review`), loop with it until reviewer and author agree it is ready. Otherwise have a
|
|
97
|
+
fresh subagent review the diff against the spec, fix what is right, and say what you rejected and why.
|
|
98
|
+
2. Open a draft PR with the `pr` skill. If an acceptance video exists, add a PR comment with the
|
|
99
|
+
uploaded video as proof of completion; if you cannot upload, ask the user to and create the comment first.
|
|
100
|
+
3. Watch the PR and its base branch until it is merged or closed: call the `pr_watch_start` tool when
|
|
101
|
+
the session has it; otherwise use the `pr-watch` skill. With neither, tell the user the PR cannot be
|
|
102
|
+
watched automatically and stop at this step.
|
|
103
|
+
4. When woken while watching, follow [babysit-pr.md](playbooks/babysit-pr.md).
|
|
104
|
+
|
|
105
|
+
### Evidence
|
|
106
|
+
|
|
107
|
+
Screenshots, reports and videos go where the environment says: inside VibeFlow, under
|
|
108
|
+
`VIBEFLOW_ARTIFACTS_DIR` (temporary files under `VIBEFLOW_SCRATCH_DIR`); never commit them.
|
|
109
|
+
For UI checks use the `visual-parity` skill.
|
|
110
|
+
|
|
111
|
+
### Reporting
|
|
112
|
+
|
|
113
|
+
Before ending any turn: which steps are done, which checks ran (exact commands), what is not
|
|
114
|
+
verified, and who the next move is waiting on.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Playbook: existing PR
|
|
2
|
+
|
|
3
|
+
The PR is open; push it to mergeable — review comments, CI, base-branch conflicts.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Confirm the PR belongs to the current branch and its author is the user (`gh pr view --json author,headRefName`); if not, review it instead of taking it over. Find this feature's existing spec.md and plan.md.
|
|
8
|
+
2. Make sure it is being watched: if not yet, call the `pr_watch_start` tool (without it, use the `pr-watch` skill).
|
|
9
|
+
3. Handle what woke you:
|
|
10
|
+
- New review comments: sort and handle them with `address-review`. If a change alters confirmed behaviour or the agreed approach, mark spec.md / plan.md "awaiting re-confirmation" and update them; a detail fix only adds an entry to plan.md's implementation-and-verification log.
|
|
11
|
+
- Failing CI: follow the `pr-watch` skill's "Failed checks" — read the full log, find the root cause, reproduce locally, then fix. Call something flaky only with evidence from reruns, never by default.
|
|
12
|
+
- The base moved on or conflicts: follow the `pr-watch` skill's "Merge the base" — merge `origin/<base>` (never rebase and force-push), resolve conflicts unattended only when the repo's `.claude/pr.config.json` sets `verify_command` and an independent subagent agrees with the merge, then push normally. If a conflict involves a behaviour trade-off, stop and ask the user.
|
|
13
|
+
4. After each round, run the project's checks, commit, push and reply to the comments handled.
|
|
14
|
+
5. Wait for the next wake-up until the PR is merged or closed, then report its final state.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Skip tests, loosen lint rules or change test expectations to turn CI green.
|
|
19
|
+
- Merge the PR without the user's consent.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Playbook: bug fix
|
|
2
|
+
|
|
3
|
+
Prove the bug exists and find its root cause before fixing it. A fix without a reproduction is not a fix.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Read the requirement source (the bug report, issue and its comments) and write down reproduction steps, actual behaviour, expected behaviour and environment.
|
|
8
|
+
2. Reproduce: write a failing test, or follow the steps in the browser or on the command line and keep the output or a screenshot. If it does not reproduce, stop and report what you tried and what information is missing — do not fix by guessing.
|
|
9
|
+
3. Find the root cause. With two or more candidate causes, run the cheapest experiment that tells them apart first, not the one easiest to test. The root cause must point at a concrete `file:line` and trigger condition.
|
|
10
|
+
4. Write spec.md: the behaviour table reads "actual → expected", and the first acceptance criterion is the reproduction from step 2 passing. Once confirmed, write plan.md: the code investigation holds the root cause and its evidence; approach and trade-offs explain why the fix sits at this layer rather than blocking the symptom where it shows.
|
|
11
|
+
5. Commit the failing test (or reproduction script) first. Its check: it fails because of the bug, with a message that matches the actual behaviour from step 1. Then write the smallest fix that makes it pass. Never change the test's expectation to fit the code.
|
|
12
|
+
6. Search for other triggers of the same root cause (other callers of the same function, copy-pasted code) and fix them too, or record them in the plan as follow-ups.
|
|
13
|
+
7. Run the project's checks and the reproduction from step 2; record the results in plan.md's implementation-and-verification log. For UI, confirm on the real page with `visual-parity`.
|
|
14
|
+
8. Follow the wrap-up in SKILL.md. The PR type is `fix`; its Root Cause section comes from step 3.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Swallow the error with try/catch or add a null check that hides the symptom without explaining why the value is null.
|
|
19
|
+
- Change code before the bug is reproduced.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Playbook: feature / behaviour change
|
|
2
|
+
|
|
3
|
+
Pin down the observable behaviour and the data shapes before writing code.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Read the requirement source (issue, ticket, design, PR discussion) and list the open questions whose answers would change the approach.
|
|
8
|
+
2. Write spec.md: scope as "in / out"; every situation a user can see goes into the behaviour table, including errors, empty data, loading, permissions and responsive layouts. Get confirmation per the shared rules.
|
|
9
|
+
3. Write plan.md: first look for components and patterns in the project to reuse. When the change touches shared component props, exported types, API fields, store shape or event names, the plan lists every consumer and how each is checked. When it touches persisted data (localStorage, cookies, URL query, a database), the plan includes a migration step. When the direction is unclear or costly, compare the options from first principles before choosing.
|
|
10
|
+
4. Implement stage by stage in the plan's order; commit each stage once its checks pass.
|
|
11
|
+
5. Run the project's checks. Accept UI changes on the real page with `visual-parity` (against the design when there is one, and at 375 / 768 / 1440 widths); record a video as proof of completion when it helps. Record the results in plan.md.
|
|
12
|
+
6. Follow the wrap-up in SKILL.md. The PR type is `feat`.
|
|
13
|
+
|
|
14
|
+
## Don't
|
|
15
|
+
|
|
16
|
+
- Add settings, abstraction layers or "might need it later" parameters nobody asked for.
|
|
17
|
+
- Skip the spec and start from the plan.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Playbook: investigation
|
|
2
|
+
|
|
3
|
+
Read only. The result is an answer with evidence, not a code change.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Rephrase the question so evidence can answer it — "under which conditions does X happen", not "X is weird".
|
|
8
|
+
2. List two or three candidate answers and, for each, the evidence you would see if it were true.
|
|
9
|
+
3. Collect evidence: code (with `file:line`), git log and PR discussion, logs, transcripts, real run output. Start with whatever best tells the candidates apart.
|
|
10
|
+
4. Answer: the conclusion, the evidence for it, which candidates were ruled out and on what grounds, and what is still uncertain. Keep observed facts apart from inferences.
|
|
11
|
+
5. If the answer calls for a change, say what should change. If the task already allowed changes ("fix it if you can"), switch straight away; otherwise ask first. Switch to the bug-fix, feature or refactor playbook and start its spec.md and plan.md there.
|
|
12
|
+
|
|
13
|
+
## Don't
|
|
14
|
+
|
|
15
|
+
- Modify files or settings in the repo while investigating. Temporary scripts go in a scratch location and are removed at the end.
|
|
16
|
+
- Infer runtime behaviour from reading code alone without running it; if it cannot be run, say plainly that it is an inference.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Playbook: refactor
|
|
2
|
+
|
|
3
|
+
External behaviour must not change at all. Turn "unchanged" into checks that run before changing the structure.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Write down what this improves (duplication, coupling, readability, an upgrade) and how you will tell it improved. If you cannot name a concrete benefit, stop and ask instead of doing it.
|
|
8
|
+
2. Write spec.md: the behaviour table says "all existing behaviour unchanged" and lists the affected usage situations; acceptance criteria include "all existing tests pass" and the characterisation tests from step 3 passing.
|
|
9
|
+
3. Inventory test coverage of the affected area. For behaviour without tests, add characterisation tests first (record today's output without judging it), run them before the change, and commit them.
|
|
10
|
+
4. Write plan.md: list every caller and export, and split the work into small steps that each pass the tests on their own.
|
|
11
|
+
5. Change one step at a time, run the tests after each, commit when they pass. An existing bug found on the way is not fixed in passing: record it under the plan's risks and dependencies, report it, and handle it later as a bug fix.
|
|
12
|
+
6. Run all the project's checks; for UI components, compare before and after with `visual-parity` and confirm there is no difference. Record the results in plan.md.
|
|
13
|
+
7. Follow the wrap-up in SKILL.md. The PR type is `refactor`.
|
|
14
|
+
|
|
15
|
+
## Don't
|
|
16
|
+
|
|
17
|
+
- Change behaviour in the same PR.
|
|
18
|
+
- Change test expectations to make the tests pass.
|