원클릭으로
scaffold-render-command
Add a new RenderCommand variant to the retained scene description and wire its Canvas executor in the impure shell
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Add a new RenderCommand variant to the retained scene description and wire its Canvas executor in the impure shell
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | scaffold-render-command |
| description | Add a new RenderCommand variant to the retained scene description and wire its Canvas executor in the impure shell |
Use when adding a new visual element to the game (sprite, tile, text, shape, etc.).
Every render concern is split across two functions — never combined:
| Part | Layer | Pure? | What it does |
|---|---|---|---|
| Projection | render/ | ✅ Pure | state → RenderCommand[] — describes what to draw |
| Executor | effects/ | ❌ Impure | RenderCommand → Canvas draw calls — actually draws it |
Never write to CanvasRenderingContext2D inside the projection. The projection must be fully testable without a Canvas.
RenderCommandIn packages/game/lib/core/actions.ts:
export type RenderCommand =
| {
readonly type: "fill-rect";
readonly xPos: number;
readonly yPos: number;
readonly width: number;
readonly height: number;
readonly color: string;
}
| { readonly type: "YOUR_COMMAND"; readonly /* payload fields */ };
In packages/game/lib/render/project-render-commands.ts, compose the new command into the root foreground projection. Extract a helper only when it is reused or materially improves readability.
import type { RenderCommand } from "../core/actions.ts";
import type { GameState } from "../core/types.ts";
const projectYourThing = (state: GameState): ReadonlyArray<RenderCommand> =>
state.entities.map((e) => ({
type: "YOUR_COMMAND",
/* derive fields from state only — no Canvas access */
}));
export default projectYourThing;
The root projection returns the ordered ReadonlyArray<RenderCommand> for the current foreground frame. It does not emit the animated background; the background remains shell-rendered before foreground commands.
In packages/game/lib/effects/execute-render-command.ts, add a case to the executor switch:
case "YOUR_COMMAND": {
context./* Canvas draw calls here */;
break;
}
End the switch with an exhaustiveness guard:
default: {
const _exhaustive: never = command;
return _exhaustive;
}
import { describe, expect, it } from "vitest";
import projectYourThing from "./your-command.js";
describe("projectYourThing", () => {
it("produces the expected render commands from state", () => {
const state = /* minimal GameState */;
expect(projectYourThing(state)).toStrictEqual([
{ type: "YOUR_COMMAND", /* expected fields */ },
]);
});
});
No CanvasRenderingContext2D mock is needed for projection tests — the projection is pure. Add or update browser-provider tests in packages/game/lib/effects/execute-render-command.test.ts for the Canvas executor branch. If the command changes player/enemy observability, update renderStatsForState and its tests.
ctx.fillStyle / ctx.drawImage / etc. inside render/void from the projection — it must return ReadonlyArray<RenderCommand>RenderStats when the visible output changes. The effects renderer reports latest stats for window.__bruffTestApi.getRenderStats().Write cutting-edge and modern native CSS. Apply this skill whenever writing, reviewing, or refactoring CSS for components, layouts, design systems, or theming, even if the user doesn't say "modern CSS" explicitly. Covers a self-contained design-token scale (color, size, shadow, ease, type), cascade layers (@layer), @scope for component isolation (donut scopes, :scope specificity, scoping proximity), container queries, :has(), OKLCH/color-mix, native nesting, subgrid, fluid typography via clamp(), scroll-driven animations, logical properties, and concrete native replacements for SCSS mixins, maps, and variables.
Apply this skill whenever the task involves web security: writing or auditing HTTP security headers, configuring CSP, CORS, HSTS, or Permissions-Policy, sanitising untrusted HTML (Sanitizer API / DOMPurify), implementing Trusted Types to prevent DOM-XSS, setting up the Reporting API to capture CSP/COEP/deprecation violations, hardening cookies (SameSite, HttpOnly, Secure, Partitioned), implementing WebAuthn / Credential Management, using Web Crypto for client-side cryptography, or auditing code for XSS, CSRF, clickjacking, MIME-sniffing, mixed content, or cross-origin data leakage. Triggers on keywords: XSS, CSRF, CSP, CORS, HSTS, SameSite, innerHTML, eval, Trusted Types, Sanitizer, ReportingObserver, WebAuthn, cross-origin, clickjacking, Content-Security-Policy, Referrer-Policy, Permissions-Policy, subresource integrity, cookie security, secure context, same-origin, mixed content.
Patterns for invoking the GitHub CLI (gh) from agents. Covers structured output, pagination, repo targeting, search vs list, gh api fallback.
Audit and update durable architecture guidance after a cross-layer implementation, file move, package boundary change, coverage config change, or SDTE feature. Use when agent needs to reconcile AGENTS.md, package AGENTS.md files, local .agents/skills, older specs, dynamic imports, and test or coverage configuration with the architecture that was actually implemented.
Run the Spec → Design → Tasks → Execution workflow for non-trivial work — produces /specs/<feature>/{spec,design,tasks}.md, drives atomic per-task execution, and ends with a Review phase. Invoke when starting a new package, new game system, GameState shape change, or any change touching > 3 files or crossing a layer boundary.
Best practices for building scalable plain Web Components without turning custom elements into “god objects”. Provides patterns that keep Web Components modular, reusable, maintainable, and focused on UI concerns.