AGENT SKILL

rust-rules

MUST NOT / SHOULD NOT rules for Rust: lints, test layout, file size, parallelism, hot loops, caching, build hygiene, and performance claims. Use when writing or reviewing Rust code or running heavy cargo builds.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 11
Forks
1

01 前言 Front Matter

name
rust-rules
description
MUST NOT / SHOULD NOT rules for Rust: lints, test layout, file size, parallelism, hot loops, caching, build hygiene, and performance claims. Use when writing or reviewing Rust code or running heavy cargo builds.

03 SKILL.md 正文

Rust rules

MUST NOT is a defect. SHOULD NOT needs a stated reason.

  • MUST NOT silence lints with inline #[allow]; fix the code. Warnings fail the build.
  • MUST NOT lock a global Mutex<HashMap> or other process-wide lock per item inside parallel iterators; shard or use concurrent maps.
  • MUST NOT read files, spawn processes, compile regexes, or reparse inside a hot loop; hoist them (LazyLock/OnceLock for regexes).
  • MUST NOT rebuild a repo-wide index or do linear scans per item; index once, then look up.
  • MUST NOT emit nondeterministic output from parallel work; sort or merge before rendering.
  • MUST NOT persist caches between runs unless the design calls for it; cache in memory per run.
  • MUST NOT block an async runtime or the Node event loop with CPU-heavy native calls; run them on a thread pool.
  • MUST NOT exclude files from coverage (--ignore-filename-regex); refactor them to meet the gate.
  • MUST NOT claim a speedup without matched before/after measurements with instrumentation off.
  • SHOULD NOT put tests inline in source files; keep them in separate test files.
  • SHOULD NOT exceed about 200 lines per source file or 500 per test file.
  • SHOULD NOT write fixture files from test code; save fixtures and copy them in.
  • SHOULD NOT run several heavy cargo or coverage jobs at once on a shared machine; cap jobs, prefer CI, push early.
  • SHOULD NOT leave throwaway target/ directories behind; delete them after use.

04 同仓库更多 Skills

jonathanong
jonathanong/no-mistakes

rollout-rules

MUST NOT / SHOULD NOT rules for shipping changes safely: feature flags, deploy order across services, API and message compatibility, irreversible actions, and string-referenced config. Use when adding a flag, changing an API or message contract, deploying a change that spans services, or touching money-moving or irreversible actions.

★ 11
jonathanong
jonathanong/no-mistakes

observability-rules

MUST NOT / SHOULD NOT rules for logs, metrics, and alerts: static messages and structured fields, personal data, metric cardinality, fields monitors depend on, absence alerts, and context binding. Use when adding or reviewing logging, metrics, or monitors.

★ 11
jonathanong
jonathanong/no-mistakes

integrations-rules

MUST NOT / SHOULD NOT rules for third-party APIs and inbound webhooks: response classification, retries and idempotency, delivery records, payload mapping, timestamps and units, batch failure policy, and signature verification. Use when calling, parsing, or receiving a partner or vendor API.

★ 11
jonathanong
jonathanong/no-mistakes

typescript-rules

MUST NOT / SHOULD NOT rules for TypeScript, JavaScript, and Node.js: async and promises, errors, mutation, aliases and dead paths, static analysis, process lifecycle, HTTP clients, caches like Redis or Valkey, and package boundaries. Use when writing or reviewing TS/JS or Node code.

★ 11
jonathanong
jonathanong/no-mistakes

security-rules

MUST NOT / SHOULD NOT rules for application security and HTTP APIs: secrets, auth and sessions, SSRF, injection, CSRF, CSP, LLM prompts, response exposure, and API shape. Use when writing or reviewing an endpoint, auth code, secret handling, outbound fetches, or LLM calls.

★ 11
jonathanong
jonathanong/no-mistakes

react-rules

MUST NOT / SHOULD NOT rules for React and Next.js: rendering, server and client boundaries, data fetching, caching, metadata, scripts, routing, and accessibility. Use when writing or reviewing React components or a Next.js app.

★ 11