用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/dkolba/bruff --skill scaffold-prng命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
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.
基于 SOC 职业分类
正在显示 SKILL.md
| name | scaffold-prng |
| description | Implement or extend the in-house seeded PRNG stored in GameState — zero external dependencies, fully deterministic |
Use when adding randomness to the game, or when setting up the PRNG for the first time.
Rule: All randomness flows through the seeded PRNG stored in GameState. Math.random() and crypto.randomUUID() are forbidden everywhere.
The in-house PRNG lives in packages/utils/module/fp/prng.ts and is exported from @bruff/utils.
export const createPrng = (seed: number): PrngState => ({
accumulator: seed,
type: "prng-state",
});
export const nextId = (prng: PrngState): { prng: PrngState; value: string };
In packages/game/lib/core/types.ts:
import type { PrngState } from "@bruff/utils"; // or local import
export type GameState = Readonly<{
stateVersion: number;
seed: number;
prng: PrngState;
frameIndex: number;
/* … other fields … */
}>;
In createInitialState, accept or derive a deterministic seed:
import { createPrng } from "@bruff/utils";
import { CURRENT_STATE_VERSION } from "../core/constants.js";
const createInitialState = (canvas: CanvasSize, seed = 1): GameState => ({
stateVersion: CURRENT_STATE_VERSION,
seed,
prng: createPrng(seed),
frameIndex: 0,
/* … */
});
Build entity IDs on top of nextId:
const drawId = <Tag extends string>(
prng: PrngState,
): { id: Brand<string, Tag>; prng: PrngState } => {
const step = nextId(prng);
return { id: brand<Tag>(step.value), prng: step.prng };
};
Usage in an entity factory:
const step = drawId<"EnemyId">(state.prng);
return { ...state, prng: step.prng /* use step.id */ };
import { test, fc } from "@fast-check/vitest";
import { expect } from "vitest";
import { createPrng, nextNumber } from "@bruff/utils";
test.prop([fc.integer()])(
"produces identical sequences for the same seed",
(seed) => {
const run = (s: number) => {
const first = nextNumber(createPrng(s));
const second = nextNumber(first.prng);
return [first.value, second.value];
};
expect(run(seed)).toStrictEqual(run(seed));
},
);
test.prop([fc.integer()])("produces values in [0, 1)", (seed) => {
const { value } = nextNumber(createPrng(seed));
expect(value).toBeGreaterThanOrEqual(0);
expect(value).toBeLessThan(1);
});
Math.random() anywhere in the codebasecrypto.randomUUID() or crypto.getRandomValues()