Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

First-Principles Clean Code Audit

БесплатноЗапускает вложенные скриптыНе проверен

第一性原理 clean code 审计法。从单根前提「代码是写给人看的」推导出两根判据—— A. 理解成本(读起来费不费劲)/ B. 修改风险(改起来怕不怕),用红/黄/绿三档给代码打分, 并明确允许「有意的、注释了的、范围可控的技术债」暂时存在。专用于审计你自己的 WorkBuddy Skill 脚本或其他…

elisabeth15501от elisabeth15501703 установки в других каталогах

Об этом скилле

第一性原理 Clean Code 审计 / First-Principles Clean Code Audit

30 秒上手 / Quick Start(5 行)

  1. 给我一个文件 / 函数 / 目录当审计目标(没给 → 我会先问你审哪个)。Give me one file / function / dir as the target (none given → I ask first).
  2. 选语言:说 zh / en 强制,或不说走 auto(按你消息语言判定)。Pick language: say zh/en to force, or leave it for auto (follows your message).
  3. 我只读目标,按「理解成本 / 修改风险」两轴 + 红黄绿打分,每项带 文件:行 证据。I read-only the target, score via comprehension/change axes + red/amber/green, each item with file:line evidence.
  4. 产出:报告 clean_code_audit_<target>.md + 可勾选清单(中文 clean_code_checklist.html / 英文 clean_code_checklist.en.html)。Output: report clean_code_audit_<target>.md + tickable checklist (zh clean_code_checklist.html / en clean_code_checklist.en.html).
  5. 想快筛疑点:可跑 scripts/metric_probe.py --src <file>(纯 stdlib,只提示不判级)。Quick scan: run scripts/metric_probe.py --src <file> (pure stdlib; hints only, no grading).

完整流程见下方「审计流程」;边界 / FAQ 见 references/faq.md(中文)或 references/faq.en.md(英文)。Full flow below under "Audit Flow"; boundaries / FAQ in references/faq.md (zh) or references/faq.en.md (en).

合规与边界声明(网络访问)/ Compliance & Boundary Statement (Network Access)

  • 本 skill 不发起任何网络请求,不调用任何第三方 / 海外 API,不读取任何凭据、密钥或环境变量;它只读被审计的代码本身(从不修改被审源码),并额外把自身产出(审计报告 + 清单)写到工作区——写入范围仅限这两类产物,且在此声明(见下方 Trust 红线)。 This skill makes no network requests, calls no third-party / overseas API, reads no credentials, secrets, or env vars; it reads only the code under audit (never modifies the source being reviewed) and additionally writes its own output artifacts (audit report + checklist) to the workspace — its writes are limited to those two artifact types, disclosed here (see the Trust red line below).
  • 不提供、不指导、不支持任何规避网络管理措施的能力;不使用非公开接口、不破解访问控制、不伪造身份绕过鉴权。 Provides / instructs / supports no means to circumvent network-management measures; no private interfaces, no access-control bypass, no identity spoofing.
  • 无「数据源 / 海外源」概念——全部输入来自本地文件,故「海外源不可达需降级」场景不适用(N/A)。 No "data source / overseas source" concept — all input is local, so "overseas source unreachable → degrade" is N/A.
  • 若运行环境禁止网络,本 skill 行为完全不受影响(它本就不联网)。 If the runtime forbids network, this skill is unaffected (it never goes online).
  • Requirements(声明与行为一致 / declared == behaved):核心审计零外部二进制(python/git/gh/node/npx/shell 均不调用)、零环境变量、零凭据、零运行时依赖。可选的辅助脚本 scripts/metric_probe.py 需 Python 3,但也是纯标准库、零网络、零凭据、只读——不是运行时依赖,不调用即不影响审计。 Requirements (declared == behaved): the core audit needs no external binaries (calls no python/git/gh/node/npx/shell), no env vars, no credentials, zero runtime deps. The optional helper scripts/metric_probe.py needs Python 3 but is also pure stdlib, offline, no credentials, read-only — not a runtime dependency; the audit works without invoking it.

语言选择 / Language

本 skill 的全部产物(交互清单、审计报告、范例、FAQ)均提供中文版与英文版。触发时先定语言模式,再开工——语言绝不是隐藏默认值。

This skill ships every artifact (interactive checklist, audit report, samples, FAQ) in both Chinese and English. Pick the language mode before starting — language is never a hidden default.

三种模式 / Three modes:

  • auto(默认):按你与 Agent 交互所用的语言自动判定并切换——消息为英文 → 英文产物;中文 → 中文产物;中英混排以你的主语言为准;纯代码 / 路径、无自然语言 → 主动问你「报告用中文还是英文?」。 auto (default): follows the language of your exchange with the agent — English message → English artifacts; Chinese → Chinese; mixed → your dominant language; pure code / path with no natural language → ask "Chinese or English report?".
  • zh:强制中文——所有产物一律中文,忽略交互语言。 zh: force Chinese — all artifacts in Chinese, ignoring the exchange language.
  • en:强制英文——所有产物一律英文,忽略交互语言。 en: force English — all artifacts in English, ignoring the exchange language.

判定优先级 / Resolution order:你显式说 zh / en > 交互语言推断 auto > 兜底询问。整轮审计不中途切换(避免报告半中半英);下一轮可重新判定。

Resolution priority: your explicit zh/en > inferred auto from exchange language > ask. No mid-audit switch (avoids mixed-language report); re-resolved next round.

产物按模式选文件(中英各一套,含清单 / 两种样例 / FAQ,完整映射表见 references/faq.md §8)。产物按模式选文件,缺失英文版时 fallback 到中文并注明,不静默给错语言。Pick artifacts by mode (full mapping table in references/faq.md §8); if an English version is missing, fall back to Chinese and note it — never silently give the wrong language.

执行模型(方法论型,非工具型)/ Execution Model (Methodology, Not Tool)

本 skill 是方法论型:交付「判据 + 流程 + 可勾选清单」,由你(Agent)逐项判断并给 文件:行号 证据。审计的核心动作是判断(这段代码偏 A 还是偏 B、是红还是有意的债),本质是人的推理,无法预先写成确定性自动流程。 This skill is methodology-type: it ships criteria + flow + a tickable checklist that you (the agent) apply item by item with file:line evidence. The core action is judgment, which cannot be pre-encoded into a deterministic pipeline.

因此没有端到端自动化脚本是设计决策,不是缺失。 本 skill 提供的 scripts/metric_probe.py 是可选加速器——只探测指标信号帮你快速定位疑点,只提示不判级;用不用它,审计质量标准不变。 The absence of an end-to-end automation script is a design decision, not a gap. The `scripts/metric

Полный SKILL.md на ClawHub

Установить First-Principles Clean Code Audit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл First-Principles Clean Code Audit?

第一性原理 clean code 审计法。从单根前提「代码是写给人看的」推导出两根判据—— A. 理解成本(读起来费不费劲)/ B. 修改风险(改起来怕不怕),用红/黄/绿三档给代码打分, 并明确允许「有意的、注释了的、范围可控的技术债」暂时存在。专用于审计你自己的 WorkBuddy Skill 脚本或其他 Python 代码,产出带证据(文件:行)的可勾选报告。 触发词:「用第一性原理审代码」「理解成本/修改风险」「clean code 审计」「审计我的 Skill 脚本」 「按红黄绿审代码」「clean code 审计样例」。注意:本 skill 只做可读性/可维护性的第一性原理审计, 不做通用 PR/MR 审查(那用 code-review-assistant 或 critical-code-reviewer), 不替代 clean-code 的写代码规范手册,也不做 lint/格式化(那用 project-code-standard)。 First-Principles Clean Code Audit. Derives two criteria from one root premise — "code is written for humans": A. Comprehension cost (how hard to read) / B. Change risk (how scary to modify) — scored red/amber/green, explicitly permitting intentional, documented, scoped tech debt. Audits your own WorkBuddy skill scripts or Python code, emitting an evidence-backed (file:line) checklist report. Triggers: "audit code with first principles", "comprehension/change risk", "clean code audit", "audit my skill scripts". Read-only on the code under audit — never modifies the source being reviewed; writes its own local report/checklist artifacts only (disclosed side effect). Note: this skill does first-principles readability/maintainability audit only — not generic PR/MR review (use code-review-assistant / critical-code-reviewer), not a style handbook (use clean-code), and not lint/format (use project-code-standard).

Как установить скилл First-Principles Clean Code Audit?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл First-Principles Clean Code Audit запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить First-Principles Clean Code Audit с