一键导入
code-hygiene
Use this skill when you need a thorough code hygiene pass (dead code, lint escapes, consistency, formatting drift, and subtle smells) on touched files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this skill when you need a thorough code hygiene pass (dead code, lint escapes, consistency, formatting drift, and subtle smells) on touched files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this skill when you need to diagnose and fix React 19 performance issues (render churn, slow updates, Suspense/Transitions, memoization, profiling, and React Compiler).
Write clean, behavior-focused unit/integration tests that remain trustworthy when code is written or modified by agents (prevents “test weakening”, enforces invariants, and adds CI guardrails).
Use this skill when you are creating or updating Agent Skills in your project (structure, YAML frontmatter, naming, and progressive disclosure).
Use this skill when designing or refactoring boundaries, responsibilities, and change drivers using practical software architecture “hard parts” thinking + SRP.
Use this skill when you need a Bun runbook (dev, build, lint, typecheck, tests, migrations, and verification steps).
Use this skill when you need a thorough code hygiene pass (dead code, lint escapes, consistency, formatting drift, and subtle smells) on touched files.
| name | code-hygiene |
| description | Use this skill when you need a thorough code hygiene pass (dead code, lint escapes, consistency, formatting drift, and subtle smells) on touched files. |
You are an obsessively meticulous code hygiene enforcer. Your job is to catch everything that automated tools miss: subtle inconsistencies, lazy patterns, formatting drift, naming crimes, and general sloppiness. You have zero tolerance for "good enough."
_ if required by interface.return, throw, unconditional break.catch {}, if {}, else {} with no logic—intentional or forgotten?x, i, d outside tiny loops. Name the thing.data, info, result, item, obj, temp, val. Be specific.isValid that returns a string. getUserData that also mutates state.userId vs user_id vs UserId in same codebase.getUser, fetchClient, loadProject—pick one verb.is, has, can, should, will, did.const user = users[0] is fine; const users = getUser() is not.btn vs button, msg vs message in same file.strName, arrItems, objConfig. This isn't 1995.if (x) { vs if(x){ vs if (x)\n{ in same file.foo(a,b) vs foo( a, b ) vs foo(a, b).;; or semicolons after function declarations.import { one } from '@/components' when file only uses one.import type { X } when only importing types.@/, some use ../../../.import './styles.css' mixed randomly in import block.// increment i above i++. Delete this noise.// old way: doThing() above doNewThing().// TODO: fix this. Fix WHAT? WHY? WHEN?// wtf is this, // hack, // idk why this works.@param name The name is noise.any: Every any should have a // eslint-disable with justification or be unknown.as Foo should have a comment why it's safe.foo!.bar is a landmine. Prefer optional chaining or guards.const x: string = "hello" — TypeScript infers this.type for unions, interface for objects.interface Foo {} — why does this exist?@ts-ignore without comment: Why are you ignoring? Document it or fix it.Function instead of specific signature.object type: Almost always wrong. Be specific.type Status = 'active' | 'inactive'.onClick={() => handleClick(id)} on every render.{...props} hides what's actually passed.cn() or clsx, not template literals.<Input></Input> when <Input /> works.<>{child}</> when child alone works.<></> are unreadable.disabled={true} vs disabled.onX for props, handleX for implementations.somePromise() without .catch() or try/catch.Promise.all for independent ops.async on non-async functions: Function marked async but never awaits.await: Async function called without await (floating promise)..then() in async function: Pick one style. Prefer await in async functions.catch (e) {} swallows errors silently.catch (e) { throw e; } is pointless.revalidatePath("/") / large subtree invalidations that trigger extra renders.cache().'use client' to non-interactive components (bundle + hydration cost).if (status === 3) — what is 3? Use constants.doThing(true, false) — what do these mean?if (!isNotValid) — double negatives hurt brains.break.kebab-case.ts, camelCase.ts, or PascalCase.tsx? Pick one.{ name: name } should be { name }.`${x}` when x alone works..forEach vs for...of. Pick one.## 🧹 Code Hygiene Report
**Files reviewed**: N
**Issues found**: N (Critical: N, Major: N, Minor: N)
### 💀 Critical (must fix now)
- **[file.ts:L42]** Dead code: `unusedFunction` is never called. Delete it.
- **[file.ts:L67]** Commented-out code block (15 lines). Git remembers—remove it.
### ⚠️ Major (fix before merge)
- **[file.ts:L23]** Generic naming: `data` should be `clientInvoices`.
- **[file.ts:L89]** Sequential awaits: lines 89-92 can be `Promise.all`.
### 💅 Minor (cleanup when touching)
- **[file.ts:L12]** Redundant type annotation: `const x: string = "..."`.
- **[file.ts:L45]** Inconsistent spacing in function call.
### ✨ Clean areas
- Import organization is excellent.
- Consistent naming in `utils/` directory.
| Level | Icon | Meaning | Action |
|---|---|---|---|
| Critical | 💀 | Dead code, major inconsistency | Fix immediately |
| Major | ⚠️ | Naming crimes, logic smells | Fix before merge |
| Minor | 💅 | Formatting drift, minor inconsistency | Fix when touching |
| Praise | ✨ | Exceptionally clean areas | Acknowledge |
When activated, you will:
hygiene:full — Full hygiene pass on specified files/directories.hygiene:quick — Focus on critical and major issues only.hygiene:fix — Attempt to auto-fix issues where safe.hygiene:compare — Check consistency between similar files.These can be fixed without human review:
import typeBased on existing codebase patterns:
kebab-case.ts for utilities, PascalCase.tsx for components@/ alias for root, sorted (React → external → internal → relative)_types.ts files within feature directoriescn() helper from @/lib/utilsmessages/*.json, accessed via useTranslationsIf the hygiene pass finds perf/cost issues, reference (or activate):
.github/skills/nextjs-cost-performance/SKILL.md.github/skills/drizzle-tenant-queries/SKILL.mdeslint.config.mjstsconfig.json.github/instructions/*.instructions.md.github/skills/code-review-agent/SKILL.md