一键导入
clean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Senior agent organizer with expertise in assembling and coordinating multi-agent teams. Your focus spans task analysis, agent capability mapping, workflow design, and team optimization.
AI agent design principles. Agent loops, tool calling, memory architectures, multi-agent coordination, human-in-the-loop gates, and guardrails. Use when building AI agents, autonomous workflows, or any system where an LLM plans and executes multi-step tasks.
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Main application building orchestrator. Creates full-stack applications from natural language requests. Determines project type, selects tech stack, coordinates agents.
Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
| name | clean-code |
| description | Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments |
| allowed-tools | Read, Write, Edit, Glob, Grep |
| version | 1.0.0 |
| last-updated | "2026-03-12T00:00:00.000Z" |
| applies-to-model | gemini-2.5-pro, claude-3-7-sonnet |
Code is read far more than it is written. Write for the next person. That person is often you, six months from now, confused.
Clean code is not aesthetic. It is functional. Messy code is slow to change, easy to break, and hard to debug. These standards exist to make code safe to modify — not to make it look clever.
Names are the primary documentation. Choose them seriously.
Rules:
is, has, can, shouldi, j) and throwaway lambdasurl, id, dto, api)user not userObjectFromDatabase// ❌ Unclear
const d = new Date();
const fn = (x) => x * 1.2;
// ✅ Self-documenting
const createdAt = new Date();
const applyTax = (price: number) => price * 1.2;
A function does one thing. If you need "and" to describe it, split it.
// ❌ Flag argument
function createUser(data: UserData, sendEmail: boolean) { ... }
// ✅ Two clear functions
function createUser(data: UserData) { ... }
function createUserAndNotify(data: UserData) { ... }
Comments explain why — not what.
// ❌ Pointless comment
// Get the user by id
const user = await getUser(id);
// ✅ Useful comment
// Retry up to 3 times — payment gateway times out under load
const result = await retry(() => chargeCard(amount), 3);
Errors are part of the contract. Don't hide them.
try/catch or .catch()catch (e) {})Tests make refactoring safe. Without them, every change is a gamble.
AAA Pattern — every test:
Arrange → set up what you need
Act → call the thing being tested
Assert → verify the outcome
Test pyramid:
Rules:
expect calls OK if they verify the same outcome)should return 401 when token is expired not test authMeasure first. Optimize what is actually slow.
These are not optional:
AI coding assistants (like you) fall into specific bad habits when writing code. These are strictly forbidden under the clean-code standard:
/** Adds two numbers. @param a First number @param b Second number @returns The sum */ function add(a, b) { return a + b; }function add(a: number, b: number): number { return a + b; }null checks where the TypeScript compiler or the previous tier has already guaranteed validity.AbstractDataManager factory class with interfaces to parse a simple CSV file. Code what is needed now.const when a single readable line would suffice.// TODO: Refactor this later or // I assumed this was the right way. If you write it, own it. If it's incomplete, flag the user.When this skill produces or reviews code, structure your output as follows:
━━━ Clean Code Report ━━━━━━━━━━━━━━━━━━━━━━━━
Skill: Clean Code
Language: [detected language / framework]
Scope: [N files · N functions]
─────────────────────────────────────────────────
✅ Passed: [checks that passed, or "All clean"]
⚠️ Warnings: [non-blocking issues, or "None"]
❌ Blocked: [blocking issues requiring fix, or "None"]
─────────────────────────────────────────────────
VBC status: PENDING → VERIFIED
Evidence: [test output / lint pass / compile success]
VBC (Verification-Before-Completion) is mandatory. Do not mark status as VERIFIED until concrete terminal evidence is provided.
Slash command: /generate, /review-types
Active reviewers: logic-reviewer · type-safety-reviewer
any types: Failing to strictly type a critical parameter or return value.Review these questions before confirming code generation or review:
✅ Does this function do strictly ONE thing?
✅ Have I removed all pointless comments explaining *what* the code does?
✅ Did I use specific, business-logic naming rather than generic abbreviations?
✅ Are all edge cases and rejections properly handled (no swallowed errors)?
✅ Did I avoid over-engineering this solution?
CRITICAL: You must follow a strict "evidence-based closeout" state machine.