一键导入
query-prod-data
Query production D1 database and Analytics Engine telemetry. Use when: looking up users, rooms, player geo, load timing, telemetry.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Query production D1 database and Analytics Engine telemetry. Use when: looking up users, rooms, player geo, load timing, telemetry.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run full quality pipeline, auto-fix lint/format issues, then commit and push. Use when: quality fix commit push, run quality, fix lint, fix format, quality commit push.
Structured debugging workflow: diagnose bugs/abnormal behavior, locate root cause, verify fix. Use when: debugging, bug, issue investigation, error, crash, not working, not rendering, timeout, disconnect.
Generate delegation prompts for specialist agents. Use when delegating tasks, writing expert prompts, or finding a specialist workflow.
Execute a minor release end-to-end: collect changes, write announcement, bump version, commit, tag, push. Use when: minor-release, minor release, new version, release minor.
Add a new preset board to PRESET_TEMPLATES. Use when: adding a board, creating a template, new preset.
Add a new Playwright E2E spec for a night role, flow, or feature. Use when: adding an e2e test, new playwright spec.
| name | query-prod-data |
| description | Query production D1 database and Analytics Engine telemetry. Use when: looking up users, rooms, player geo, load timing, telemetry. |
| argument-hint | Query description (e.g., where are players in room 8817 from, recent registrations, load performance in a time range) |
输出语言:执行本 skill 过程中,所有面向用户的输出(进度报告、询问、完成通知、错误提示)一律使用中文。
Query D1 database and Analytics Engine telemetry data via the wrangler CLI.
Failed to fetch auth token: 400 Bad Request.cd packages/api-worker && npx wrangler login (interactive browser auth).packages/api-worker directory.werewolf-db)Structured business data. Query via npx wrangler d1 execute werewolf-db --remote --command "SQL".
Table overview:
| Table | Purpose | Key Columns |
|---|---|---|
users | User accounts | id, email, display_name, is_anonymous, wechat_openid, last_country, last_colo, created_at |
rooms | Room metadata | id, code, host_user_id, created_at |
user_stats | User stats/level | FK user_id |
draw_history | Gacha draw records | FK user_id |
refresh_tokens | Refresh tokens | FK user_id |
login_attempts | Login attempts | email_hash, attempted_at (no IP) |
password_reset_tokens | Password reset | id, user_id |
users full columns:
id, email, password_hash, display_name, avatar_url, custom_avatar_url, avatar_frame, equipped_flair, equipped_name_style, equipped_effect, equipped_seat_animation, wechat_openid, is_anonymous, token_version, last_country, last_colo, created_at, updated_at
load_timing dataset)Client-side load performance telemetry. Query via Cloudflare SQL API (requires OAuth token).
Field mapping:
| Field | Meaning |
|---|---|
index1 | Resource short filename |
blob1 | Full URL |
blob2 | User Agent |
blob3 | Country (CF cf.country) |
blob4 | CF Colo (edge node, e.g., LAX/NRT/HKG) |
blob5 | ISP/ASN organization name |
double1 | Total resource load duration ms |
double2 | transfer size bytes |
double3 | decoded body size |
double4 | DNS lookup ms |
double5 | TCP connect ms |
double6 | TLS handshake ms |
double7 | TTFB ms |
double8 | download time ms |
double9 | Page total startup time ms |
double10 | HTML document TTFB ms |
Real-time game state within rooms (player list, role assignments, night actions) is stored in DO memory/SQLite.
curl -s "https://api.werewolfjudge.eu.org/room/state?roomCode=XXXX"SELECT r.*, u.display_name, u.last_country, u.last_colo
FROM rooms r
JOIN users u ON r.host_user_id = u.id
WHERE r.code = '{ROOM_CODE}'
Room participants are not stored in D1, but can be inferred via creation time window (players auto-register when scanning QR code to join):
SELECT id, display_name, last_country, last_colo, created_at
FROM users
WHERE created_at >= datetime('{ROOM_CREATED_AT}', '-3 minutes')
AND created_at <= datetime('{ROOM_CREATED_AT}', '+10 minutes')
ORDER BY created_at
curl -s "https://api.cloudflare.com/client/v4/accounts/a38318fda66da2d2d931d8ab2d98e1c0/analytics_engine/sql" \
-H "Authorization: Bearer $(cat /Users/eyan/Library/Preferences/.wrangler/config/default.toml | grep oauth_token | head -1 | sed 's/.*= "\(.*\)"/\1/')" \
-d "SELECT blob3 as country, blob4 as colo, count() as cnt, avg(double1) as avg_load_ms
FROM load_timing
WHERE timestamp >= '{START_UTC}' AND timestamp <= '{END_UTC}'
GROUP BY blob3, blob4
ORDER BY cnt DESC"
Note: The wrangler OAuth token file path is
/Users/eyan/Library/Preferences/.wrangler/config/default.toml(macOS Preferences directory), not~/.wrangler/.
SELECT count(*) as total FROM users
SELECT id, display_name, last_country, last_colo, created_at
FROM users ORDER BY created_at DESC LIMIT 20
SELECT * FROM draw_history WHERE user_id = '{USER_ID}' ORDER BY created_at DESC LIMIT 20
SELECT * FROM user_stats WHERE user_id = '{USER_ID}'
datetime() for time arithmetic, INTERVAL is not supported.password_hash is a sensitive column. Do not SELECT * on users, explicitly list needed columns.a38318fda66da2d2d931d8ab2d98e1c0.