guard-agent-work
Auto-guardrail for agent-authored changes. Use at the start of any coding session to prevent the most common agent mistakes in this repo.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Auto-guardrail for agent-authored changes. Use at the start of any coding session to prevent the most common agent mistakes in this repo.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Iterate on visualizer UI, workspace chrome, and CSS with fast feedback loops. Use when changing frontend components, styling, layout, or animation without needing the full MilkDrop runtime.
Modify the flagship visualizer runtime safely. Use when changing the shared runtime, loader, renderer, shell, controls, audio flows, capability checks, or canonical-route behavior.
Review changes to module loading, bootstrap, toy manifest, library resolution, or gamepad polling. Use when a PR touches src/js/bootstrap/, src/js/loader.ts, src/js/router.ts, src/js/toy-view.ts, src/data/toys.json, or gamepad polling code.
Review changes to renderer capability probing, fallback chains, timeout logic, or audio worklet initialization. Use when a PR touches src/js/core/renderer-*, src/js/core/audio-handler.ts, or src/js/milkdrop/runtime/backend-fallback.ts.
Review changes to WebGPU/WebGL dual-backend parity. Use when a PR touches feedback managers, renderer adapters, shader lowering, or any code that affects both WebGPU and WebGL rendering paths.
Review changes to React workspace UI state, URL routing, toast/panel behavior, or engine adapter interactions. Use when a PR touches src/js/frontend/*, especially App.tsx, workspace hooks, or url-state.ts.
| name | guard-agent-work |
| description | Auto-guardrail for agent-authored changes. Use at the start of any coding session to prevent the most common agent mistakes in this repo. |
Use this skill at the start of every coding session before writing or editing code. It prevents the mistakes that agents make most often in this repo.
~38 of the last 400 commits were codex/* fix branches—agents fixing what previous agents got wrong. The same patterns repeat:
This skill is a mandatory pre-flight checklist that runs automatically before you edit.
Run this to classify your session:
bun run agent:guard --detect
It reads git status, git diff --name-only, or your stated intent and tells you which guardrails apply:
Detected surfaces:
- milkdrop/parity → apply parity-guard
- core/renderer → apply fallback-guard
- frontend/ui → apply ui-guard
- tests/* → apply test-guard
- .agent/skills/* → apply mcp-guard
- docs/* → apply docs-guard
@ts-nocheckIf you think you need it, you are wrong. Fix the type error or ask for help.
src/js/frontend/* must not import from src/js/milkdrop/runtime.ts, vm.ts, or compiler/*. Only milkdrop-engine-adapter.ts is allowed.
console.log in production codeUse the debug snapshot system (stimState.getDebugSnapshot) or the agent API instead.
If you touch .agent/skills/* or .agent/workflows/*, you must update:
scripts/mcp-shared.ts (import + markdownSources + agentCapabilities)docs/agents/custom-capabilities.mddocs/agents/visualizer-workflows.mdmilkdrop/feedback-*, milkdrop/renderer-adapter*, compiler/gpu-descriptor-plan.ts)Before saving any file in this surface:
bun run test:compat — does it pass?bun run test tests/milkdrop-renderer-adapter.test.ts — does it pass?One-liner: bun run agent:guard --surface parity
core/renderer-*, core/audio-handler.ts, milkdrop/runtime/backend-fallback.ts)Before saving any file in this surface:
?renderer=webgl forced?One-liner: bun run agent:guard --surface fallback
frontend/*, assets/css/app-shell.css)Before saving any file in this surface:
bun run check:quick for CSS token violations??agent=true mode, not just default?One-liner: bun run agent:guard --surface ui
tests/*, scripts/* that generate fixtures)Before saving any file in this surface:
bun run test tests/your-file.test.ts pass in isolation?One-liner: bun run agent:guard --surface test
.agent/skills/*, .agent/workflows/*)Before saving any file in this surface:
scripts/mcp-shared.ts?markdownSources?agentCapabilities?docs/agents/custom-capabilities.md?docs/agents/visualizer-workflows.md?bun run check:quick to verify the build still compiles?One-liner: bun run agent:guard --surface mcp
docs/*, AGENTS.md)Before saving any file in this surface:
bun run check:seo catches some)docs/DOCS_MAINTENANCE.md if the maintenance contract changed?docs/README.md if routing/discoverability changed?bun run ... not raw bun test?One-liner: bun run agent:guard --surface docs
Before any significant change, ask yourself (or the guard tool):
Given the files I'm about to change, what is the most likely way
this breaks in production? What test or check would catch it?
If you can't answer both parts, do not proceed until you can.
If you genuinely need to bypass a guard (e.g., emergency hotfix):
Add to your .zshrc or agent bootstrap:
alias codex='bun run agent:guard --detect && bun run session:codex'
Or add to AGENTS.md quick-start:
Before editing, run
bun run agent:guard --detectto surface the relevant guardrails.
review-webgpu-parity — deep parity reviewreview-renderer-fallback — deep fallback reviewreview-test-harness — deep test reviewreview-workspace-ui-state — deep UI reviewaudit-recurring-fixes — refresh guards from commit history