dev-test-workflow

A development testing checklist written in Chinese for an Electron application. Electron is a framework for building desktop apps with web technologies.

In plain words
What is it for?
Use it after UI or feature changes to run the React and Electron builds, restart the app, and capture screenshots through Chrome DevTools Protocol.
Why use it?
It gives a repeatable way to check that changes compile, restart the app, and look correct in a real window.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/zhangdszq/teamclaw/dev-test-workflow
Clone the repo
git clone --depth 1 https://github.com/zhangdszq/teamclaw

Made for: Cursor.

Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.00724
Opus 5 $0.00013 $0.00362
Sonnet 5 $0.00005 $0.00145
Haiku 4.5 $0.00003 $0.00072

Measured 2d ago against content hash 1fac5d5e91a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dev-test-workflow scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

import json, base64, asyncio, websockets, urllib.request
.cursor/rules/dev-test-workflow.mdc · 83 lines

What it actually says

开发测试工作流

每次完成 UI / 功能开发后,按以下流程验证效果。

1. 编译验证(必须先通过)

# React + TypeScript 编译
cd /Users/zhang/git-repos/VK-Cowork && bun run build

# Electron 端编译
bun run transpile:electron

两条命令均 exit 0 才继续,否则先修复错误。

2. 重启应用

pkill -f electron 2>/dev/null; pkill -f vite 2>/dev/null
sleep 1 && npm run dev &
sleep 10  # 等待 Electron 窗口出现

3. Electron 调试端口截图

应用不带 --remote-debugging-port 时,用 Python CDP 直接连 9222(若需要则重启带端口):

# 带调试端口启动(替代 npm run dev)
pkill -f electron 2>/dev/null; pkill -f vite 2>/dev/null; sleep 1
bun run dev:react &
sleep 3 && npx electron . --remote-debugging-port=9222 &
sleep 6
# 截图脚本(保存至 screenshots/)
import json, base64, asyncio, websockets, urllib.request

async def screenshot(path="screenshots/test.png"):
    # 获取页面列表
    pages = json.loads(urllib.request.urlopen("http://localhost:9222/json").read())
    ws_url = pages[0]["webSocketDebuggerUrl"]
    async with websockets.connect(ws_url) as ws:
        await ws.send(json.dumps({"id": 1, "method": "Page.enable"}))
        await ws.recv()
        await ws.send(json.dumps({"id": 2, "method": "Page.captureScreenshot", "params": {"format": "png"}}))
        resp = json.loads(await ws.recv())
        open(path, "wb").write(base64.b64decode(resp["result"]["data"]))
        print(f"Screenshot: {path}")

asyncio.run(screenshot())

4. 激活窗口截全屏(备用方案)

osascript -e 'tell application "System Events" to tell process "Electron" to set frontmost to true'
sleep 1 && screencapture -o screenshots/test.png

5. 反复排查流程

遇到崩溃或渲染异常:

  1. 检查 better-sqlite3 是否需要重编:
    npx electron-rebuild -f -w better-sqlite3 --electron-version 39.2.7
    
  2. 重启(步骤 2)→ 截图(步骤 3/4)→ 对比

注意

  • CDP websocket URL 每次启动会变,从 http://localhost:9222/json 动态获取
  • pip3 install websockets --break-system-packages(首次需要)
  • Vite dev server 地址:http://localhost:5173,Electron 嵌入 API:http://localhost:2620
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 83 lines · 26 tokens per session scan A 1fac5d5e91a5

Subscribe to this mod's changes

dev-test-workflow is a cursor rule published in the GitHub repository zhangdszq/teamclaw (113 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 26 tokens to every session and 724 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.