dx-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDX Audit
DX Audit
Audit or improve what developers import, run, configure, or read when something fails.
- IS: a bounded review of public APIs, developer-facing errors, CLI commands, exported types, install and first-run behavior, and config, with fixes only when asked.
- IS NOT: a repo-wide quality sweep (), end-user UI (
pr-reviewerAudit mode), agent trust review (ui-design), docs prose (ax-audit), README (docs-writing), repository architecture (readme-creator), or building a new CLI (codebase-architecture).scaffold-cli
审计或优化开发者在遇到问题时导入、运行、配置或查阅的内容。
- 适用场景:针对公共API、面向开发者的错误信息、CLI命令、导出类型、安装与首次运行行为及配置的限定性评审,仅在明确要求时提供修复方案。
- 不适用场景:全仓库质量扫描()、终端用户UI审计(
pr-reviewerAudit模式)、Agent信任评审(ui-design)、文档文案撰写(ax-audit)、README创建(docs-writing)、仓库架构设计(readme-creator)或构建新CLI(codebase-architecture)。scaffold-cli
Modes
模式
Pick the narrowest mode the request supports, and write a one-line scope receipt before reading code:
| Mode | When | Output |
|---|---|---|
| Targeted (default) | a named or changed public surface | findings report, read-only |
| Fix | the user says fix, improve, simplify, or implement | localized edits inside the receipt, then verification |
| Exhaustive | the user explicitly asks for the whole package or every public surface | every material finding, partitioned by surface |
text
Scope: <mode>; surfaces: <commands/exports/config>; prefixes: <err-, cli->; excludes: <UI, docs, architecture, private internals>"DX", "gold standard", and "review holistically" do not by themselves widen a targeted audit into exhaustive. When several skills are invoked together, this one owns only the surfaces above.
选择请求支持的最窄模式,并在查看代码前撰写一行范围确认:
| 模式 | 适用场景 | 输出 |
|---|---|---|
| 定向模式(默认) | 指定或变更的公共接口 | 只读的问题报告 |
| 修复模式 | 用户明确要求修复、优化、简化或实现 | 范围确认内的本地化修改,随后进行验证 |
| 全面模式 | 用户明确要求审计整个包或所有公共接口 | 按接口分类的所有实质性问题 |
text
Scope: <mode>; surfaces: <commands/exports/config>; prefixes: <err-, cli->; excludes: <UI, docs, architecture, private internals>仅“DX”“黄金标准”或“全面评审”本身不足以将定向审计扩展为全面审计。当多个技能同时调用时,本技能仅负责上述接口范围。
Audit progress
审计流程
text
DX audit progress:
- [ ] 1. Lock the public surface and write the scope receipt
- [ ] 2. Gather local evidence and run the safe probes
- [ ] 3. Select prefixes, then open candidate rules
- [ ] 4. Rank root causes
- [ ] 5. Report, or fix when asked
- [ ] 6. Verify on the same scopetext
DX audit progress:
- [ ] 1. 锁定公共接口并撰写范围确认
- [ ] 2. 收集本地证据并运行安全探测
- [ ] 3. 选择规则前缀,然后查看候选规则
- [ ] 4. 对根本原因排序
- [ ] 5. 生成报告,或按要求修复
- [ ] 6. 在同一范围内验证1. Lock the public surface
1. 锁定公共接口
Start from against the normal base and keep only changed files reachable from a public entry point: or , a command registry, an exported type, a documented config loader, or an observed error path. With no useful diff, use the command, export, error, or config the user named. A private helper enters scope only through a public caller.
git diffpackage.jsonexportsbin从与基准版本的开始,仅保留可从公共入口点访问的变更文件:的或字段、命令注册表、导出类型、文档化的配置加载器或已观察到的错误路径。若无有效diff,则使用用户指定的命令、导出项、错误或配置。私有辅助函数仅在被公共调用者引用时才纳入范围。
git diffpackage.jsonexportsbin2. Gather evidence, then stop
2. 收集证据后停止
- Local instructions, the manifest, and the diff or named entry point.
- Direct public dependencies and the nearest tests that pin behavior.
- Safe probes against the local build:
- CLI: ,
--help, one success path, one invalid-input path, and the same command with stdout piped (--version) to see non-TTY behavior. Never trigger a real mutation to test DX; use| catwhere it exists.--dry-run - Package: and
npx publintafter a build. These inspect packaging, but packing may invoke lifecycle scripts. Inspect those scripts first or use a disposable checkout before callingnpx @arethetypeswrong/cli --pack ..--pack
- CLI:
- The prior release contract, only when the diff changes a public export, signature, or return shape.
Stop when the behavior is proven, disproven, private, or out of scope. External research is for an explicit comparison request or a named uncertainty local evidence cannot resolve; carries the standards this skill already leans on.
references/standards-map.md- 本地说明、清单文件,以及diff或指定的入口点。
- 直接公共依赖项和最接近的固定行为测试用例。
- 针对本地构建的安全探测:
- CLI:执行、
--help、一条成功路径、一条无效输入路径,以及通过管道输出的相同命令(--version)以查看非TTY行为。测试DX时切勿触发真实的变更操作;若存在| cat则使用该参数。--dry-run - 包:构建后执行和
npx publint。这些工具会检查打包情况,但打包可能会触发生命周期脚本。请先检查这些脚本,或在调用npx @arethetypeswrong/cli --pack .前使用一次性检出环境。--pack
- CLI:执行
- 仅当diff变更了公共导出项、签名或返回结构时,才参考先前版本的契约。
当行为被证实、证伪、属于私有内容或超出范围时停止。仅在明确要求对比或本地证据无法解决特定不确定性时才进行外部研究;包含本技能遵循的标准。
references/standards-map.md3. Dispatch rules candidate-first
3. 按候选优先级分配规则
Read , then select prefixes by surface:
rules/_sections.md| Priority | Prefix | Category | Default impact | Rules |
|---|---|---|---|---|
| 1 | | Public API and SDK | CRITICAL | 7 |
| 2 | | Developer-facing errors | CRITICAL | 5 |
| 3 | | CLI UX for humans and agents | HIGH | 13 |
| 4 | | Exported type ergonomics | HIGH | 5 |
| 5 | | Install and first run | HIGH | 5 |
| 6 | | Config ergonomics | MEDIUM | 3 |
| Surface | Prefixes |
|---|---|
| Public API entry point | |
| CLI command | |
| Exported declarations | |
Install, | |
| Config loader | |
Applicability outranks priority: a CLI-only audit never loads because API rules rank higher.
api-Targeted mode: list the filenames for the selected prefixes (the names are the checklist), look for concrete evidence, then open only the rule files a finding needs. Exhaustive mode: read every rule in the selected prefixes.
Capability gates, applied inside a selected prefix:
- Structured JSON input, schema introspection, and compact polling snapshots apply when automation or agent use is promised, requested, or already supported.
- Dry-run and confirmation apply to destructive, expensive, or hard-to-reverse mutations.
- Progress and resume apply to operations that can block, outlive one command, or be retried after ambiguous output.
- applies when the command semantically accepts file or stream data.
stdin - Stable-contract comparison applies only when a public contract changed.
阅读,然后按接口选择规则前缀:
rules/_sections.md| 优先级 | 前缀 | 分类 | 默认影响级别 | 规则数量 |
|---|---|---|---|---|
| 1 | | 公共API与SDK | CRITICAL | 7 |
| 2 | | 面向开发者的错误处理 | CRITICAL | 5 |
| 3 | | 面向人类与Agent的CLI UX | HIGH | 13 |
| 4 | | 导出类型的易用性 | HIGH | 5 |
| 5 | | 安装与首次运行 | HIGH | 5 |
| 6 | | 配置易用性 | MEDIUM | 3 |
| 接口 | 前缀 |
|---|---|
| 公共API入口点 | |
| CLI命令 | |
| 导出声明 | |
安装、 | |
| 配置加载器 | |
适用性优先于优先级:仅审计CLI时绝不会加载规则,即使API规则优先级更高。
api-定向模式:列出所选前缀对应的文件名(作为检查清单),寻找具体证据,然后仅打开发现问题所需的规则文件。全面模式:阅读所选前缀下的所有规则。
能力限制,适用于所选前缀内:
- 当承诺、请求或已支持自动化或Agent使用时,适用结构化JSON输入、模式自省和紧凑轮询快照。
- 针对破坏性、高成本或难以撤销的变更,适用Dry-run和确认机制。
- 针对可能阻塞、超出单命令生命周期或可在输出模糊后重试的操作,适用进度跟踪与恢复机制。
- 当命令在语义上接受文件或流数据时,适用。
stdin - 仅当公共契约变更时,适用稳定契约对比。
4. Rank root causes, not instances
4. 对根本原因排序,而非实例
- Order CRITICAL, HIGH, MEDIUM by each cited rule's frontmatter , copied exactly. Impact is the rule's declared consequence, not a confidence score.
impact - Merge repeated instances of one root cause into one finding with up to three representative locations. Missing JSDoc, error codes, or across a surface is one finding, not one per symbol.
--json - A missing feature with no current consumer path is not a defect.
- Targeted mode: every CRITICAL finding, then the highest-value remainder up to five total; summarize the rest by category.
- 按照每条引用规则前置元数据中的值,依次排列CRITICAL、HIGH、MEDIUM级别。影响级别是规则声明的后果,而非置信度评分。
impact - 将同一根本原因的重复实例合并为一项发现,最多包含三个代表性位置。某一接口中缺失JSDoc、错误代码或属于一项发现,而非每个符号对应一项。
--json - 当前无消费者路径的缺失功能不视为缺陷。
- 定向模式:列出所有CRITICAL发现,然后最多列出5个最高价值的剩余发现;其余按类别汇总。
5. Report or fix
5. 生成报告或修复
Audit requests are read-only. A fix request authorizes localized changes inside the receipt, not a redesign of adjacent docs, UI, or architecture.
markdown
undefined审计请求默认可读模式。修复请求授权在范围确认内进行本地化修改,而非重新设计相邻的文档、UI或架构。
markdown
undefinedDX Audit
DX Audit
Scope: CLI; , ; 4 files inspected.
tool statuserr-cli-Scope: CLI; , ; 4 files inspected.
tool statuserr-cli-Findings
Findings
- [HIGH] at
cli-idempotent-resume: retrying the same target creates a second job. Fix: return the existing job id and state unless the caller passessrc/start.ts:42.--fresh
- [HIGH] at
cli-idempotent-resume: retrying the same target creates a second job. Fix: return the existing job id and state unless the caller passessrc/start.ts:42.--fresh
Deferred
Deferred
- 2 lower-impact config candidates were outside the locked CLI scope.
List only files with findings; a clean surface gets one pass line naming the surfaces and rule files checked. In fix mode, replace `Deferred` with `Changed` and `Verification` (the exact commands or probes that passed). Length follows findings, not the template.- 2 lower-impact config candidates were outside the locked CLI scope.
仅列出存在问题的文件;无问题的接口只需一行说明检查的接口和规则文件。修复模式下,将`Deferred`替换为`Changed`和`Verification`(即通过的具体命令或探测)。长度由发现的问题决定,而非模板。6. Verify on the same scope
6. 在同一范围内验证
Re-open every touched or cited location, rerun the same probes and focused project checks, and reapply the same candidate rules. Match the evidence to the claim: a clean build does not prove CLI behavior, a runtime probe does not prove exported types, and only or a consumer-style import proves a types resolution.
attwtsc重新检查所有修改或引用的位置,重新运行相同的探测和聚焦项目检查,并重新应用相同的候选规则。确保证据与声明匹配:干净的构建不能证明CLI行为,运行时探测不能证明导出类型,只有或消费者风格的导入才能证明类型解析正确。
attwtscReference files
参考文件
| File | Read when |
|---|---|
| Every audit, for prefix applicability and priority |
| A candidate has evidence, or exhaustive mode |
| A finding needs an external citation, the user asks why something is a rule, or a borderline call needs a tie-break |
| Changing this skill; never during a user task |
| Adding or editing a rule |
| 文件 | 阅读场景 |
|---|---|
| 每次审计,用于确定前缀的适用性和优先级 |
| 候选规则有证据支持,或处于全面模式 |
| 发现需要外部引用、用户询问规则原因,或边界情况需要决策依据 |
| 修改本技能时;用户任务期间绝不加载 |
| 添加或编辑规则时 |
Gotchas
注意事项
- and a global install probe the registry copy, not the working tree.
npx <pkg>, exit codes, and error strings then describe a released version. Build, then invoke the local entry point (--help).node ./dist/cli.js - is
process.stdout.isTTYunder a pipe, notundefined. A guard written asfalsenever disables color or spinners when piped, so ANSI codes reach the redirected file. Probe withisTTY === falserather than trusting the guard.| cat - right after
process.exit(1)can truncate the output it was meant to explain. stdout writes are asynchronous when piped, so a CLI that prints usage and callsconsole.logcan emit nothing underexit(). The fix is| catand a natural return (process.exitCode = 1).cli-exit-codes - An map that reads correctly can still resolve wrong.
exportspointing at a"require"file under.jsmasquerades as CJS, and a"type": "module"condition listed aftertypesis never reached.importandpublintcatch both; reading the map does not (attw).onboard-exports-resolve-typed - A rule id cited from memory drifts from the file. The frontmatter title and impact are the contract. Open the file before citing it, and drop the citation if no such file exists.
- Downgrading an impact because the instance feels small hides a class of defect. Exit 0 on failure in one subcommand is still HIGH; the CI gate it defeats is the same. Copy the frontmatter value.
- 和全局安装探测的是注册表中的副本,而非工作目录版本。
npx <pkg>、退出码和错误字符串描述的是已发布版本。请先构建,然后调用本地入口点(--help)。node ./dist/cli.js - 管道环境下为
process.stdout.isTTY,而非undefined。 若守卫逻辑写为false,则在管道输出时绝不会禁用颜色或加载动画,导致ANSI代码进入重定向文件。请使用isTTY === false进行探测,而非依赖守卫逻辑。| cat - 在后立即调用
console.log可能会截断本应说明问题的输出。 管道环境下stdout写入是异步的,因此打印用法后调用process.exit(1)的CLI在exit()下可能无输出。修复方案是设置| cat并自然返回(process.exitCode = 1规则)。cli-exit-codes - 读取正确的映射仍可能解析错误。 在
exports下,"type": "module"指向"require"文件会伪装成CJS,而.js条件列在types之后则永远不会被读取。import和publint能发现这两种情况;仅读取映射无法发现(attw规则)。onboard-exports-resolve-typed - 凭记忆引用的规则ID可能与文件中的不符。 前置元数据中的标题和影响级别是契约。引用前请打开文件,若不存在该文件则删除引用。
- 因实例看似轻微而降低影响级别会掩盖一类缺陷。 某个子命令执行失败却返回0仍属于HIGH级别;它绕过的CI检查是相同的。请直接复制前置元数据中的值。
Related skills
相关技能
- Audit mode: rendered end-user frontend quality and accessibility
ui-design - : same files, different reader; asks whether an agent can operate and recover, where this skill asks whether a developer finds the surface ergonomic
ax-audit - : builds a new CLI with these patterns already in place; this skill audits what exists
scaffold-cli - : general correctness and structure of a diff
pr-reviewer - : documentation prose and information quality
docs-writing - : README structure and first-reader narrative
readme-creator - : AGENTS.md and CLAUDE.md instruction files
agents-md - : repository structure and module contracts inside the repo, rather than the surface a package ships outward
codebase-architecture
Maintenance only: contains regression scenarios for changes to this skill; it does not load during a user task.
evals/evals.json- Audit模式:渲染后的终端用户前端质量与可访问性
ui-design - :检查同一文件,但关注点不同;本技能关注开发者对接口的易用性感受,而
ax-audit关注Agent能否操作与恢复ax-audit - :构建已包含这些模式的新CLI;本技能审计现有内容
scaffold-cli - :diff的通用正确性与结构
pr-reviewer - :文档文案与信息质量
docs-writing - :README结构与首次阅读叙事
readme-creator - :AGENTS.md和CLAUDE.md说明文件
agents-md - :仓库内部的结构与模块契约,而非包对外提供的接口
codebase-architecture
仅维护用途:包含本技能变更的回归场景;用户任务期间不会加载。",
evals/evals.json