audit-clerk-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClerk CLI Skill Audit
Clerk CLI Skill 审计
Cross-check in this repository against the actual Clerk CLI source and propose precise edits where the skill has drifted. The CLI is the source of truth; the skill is maintainer documentation that must track it.
skills/core/clerk-cli/This task needs a complete command inventory, not a quick grep pass. Build the source model first, then compare it to the skill's current claims.
将本仓库中的与实际的Clerk CLI源码进行交叉校验,针对skill出现偏差的地方提出精准修改建议。CLI是权威来源;skill是维护者文档,必须与CLI保持一致。
skills/core/clerk-cli/此任务需要完整的命令清单,而非简单的grep扫描。首先构建源码模型,再将其与skill当前的描述进行对比。
Inputs
输入
- CLI source of truth: a checkout containing
clerk/cli, pluspackages/cli-core/src/commands/**,packages/cli-core/src/cli.ts,cli-program.ts, and any referenced files inmode.ts.packages/cli-core/src/lib/ - Target skill: and
skills/core/clerk-cli/SKILL.md.skills/core/clerk-cli/references/*.md
- CLI权威来源:包含的
packages/cli-core/src/commands/**检出代码,以及clerk/cli、packages/cli-core/src/cli.ts、cli-program.ts和mode.ts中所有被引用的文件。packages/cli-core/src/lib/ - 目标skill:和
skills/core/clerk-cli/SKILL.md。skills/core/clerk-cli/references/*.md
Source Checkout Resolution
源码检出路径解析
Resolve the CLI source checkout in this order:
- Use when supplied. The path must contain
--source <path>.packages/cli-core/src/commands/ - If the current repository itself contains , use the current repository root.
packages/cli-core/src/commands/ - If is set, use that path. Do not print the variable value if it contains sensitive path fragments.
CLERK_CLI_REPO - In Conductor, look for exactly one sibling workspace matching . If multiple match, ask which one to use.
../cli/*/packages/cli-core/src/commands/ - If no checkout is available and network access is acceptable for the task, clone the public CLI repository into :
.context/clerk-cli-source
sh
mkdir -p .context
cd .context
git clone --depth 1 https://github.com/clerk/cli.git clerk-cli-sourceIf none of these work, stop and ask the user for a CLI source path. Do not audit against the installed binary alone, because the binary may be stale and does not expose every source-level branch.
clerk按以下顺序确定CLI源码检出路径:
- 如果提供了参数,则使用该路径。该路径必须包含
--source <path>。packages/cli-core/src/commands/ - 如果当前仓库本身包含,则使用当前仓库根目录。
packages/cli-core/src/commands/ - 如果已设置环境变量,则使用该路径。若变量值包含敏感路径片段,请勿打印。
CLERK_CLI_REPO - 在Conductor中,查找恰好一个匹配的同级工作区。如果找到多个,询问用户使用哪一个。
../cli/*/packages/cli-core/src/commands/ - 如果没有可用的检出代码,且任务允许网络访问,则将公开的CLI仓库克隆到:
.context/clerk-cli-source
sh
mkdir -p .context
cd .context
git clone --depth 1 https://github.com/clerk/cli.git clerk-cli-source如果以上方法都不适用,请停止操作并询问用户提供CLI源码路径。请勿仅针对已安装的二进制文件进行审计,因为二进制文件可能已过时,且无法展示所有源码层面的分支。
clerkWorkflow
工作流程
1. Inventory the CLI
1. 梳理CLI命令清单
Walk and build a structured inventory. For each top-level command and subcommand capture:
packages/cli-core/src/commands/- Full command path, such as or
clerk config patch.clerk api ls - Purpose, from the command description or help string in source.
- Flags, including short form, type, default, and destructive behavior.
- Exit codes beyond the default if the command overrides them.
- Agent-mode branches gated on ,
isAgentMode(), TTY detection, or related helpers.CLERK_MODE - Whether the command mutates remote state and needs ,
--dry-run, or production-targeting guidance.--yes
Read as secondary context only. Use those files to flag mocked or stubbed commands and to cross-check API endpoint claims in . Do not propose copying command READMEs into this repository; they include internal implementation detail and would bloat the skill.
packages/cli-core/src/commands/<name>/README.mdreferences/recipes.mdAlso capture cross-cutting behavior:
- Runner preference logic, including lockfile to package-runner mapping.
- Auth, key resolution, , and
--apptargeting.--instance - checks and
doctoroutput shape.--json - Agent-mode behavior for prompts, JSON defaults, browser opening, OAuth callbacks, deploy handoff, and sandbox warnings.
- or equivalent handoff behavior if the skill mentions it.
clerk init --prompt
Prefer reading source over running the binary. When runtime behavior is unclear, use tests under or as supporting evidence.
packages/cli-core/src/**/*.test.tspackages/cli-core/src/test/遍历并构建结构化的命令清单。针对每个顶级命令和子命令,记录以下信息:
packages/cli-core/src/commands/- 完整命令路径,例如或
clerk config patch。clerk api ls - 用途,取自源码中的命令描述或帮助字符串。
- 标志(Flags),包括短格式、类型、默认值和破坏性行为。
- 若命令覆盖了默认退出码,则记录非默认的退出码。
- 基于、
isAgentMode()、TTY检测或相关助手函数的agent-mode分支逻辑。CLERK_MODE - 命令是否会修改远程状态,以及是否需要、
--dry-run或面向生产环境的指导说明。--yes
仅将作为辅助参考。使用这些文件标记模拟(mocked)或存根(stubbed)命令,并交叉校验中关于API端点的描述。请勿提议将命令的README文件复制到本仓库;这些文件包含内部实现细节,会导致skill内容冗余。
packages/cli-core/src/commands/<name>/README.mdreferences/recipes.md同时记录通用行为:
- 运行器偏好逻辑,包括锁文件到包运行器的映射。
- 认证(Auth)、密钥解析、和
--app目标定位。--instance - 检查和
doctor输出格式。--json - Agent-mode下的提示、JSON默认值、浏览器打开、OAuth回调、部署交接和沙箱警告行为。
- 如果skill中提及,则记录或等效的交接行为。
clerk init --prompt
优先阅读源码而非运行二进制文件。当运行时行为不明确时,使用或下的测试用例作为佐证。
packages/cli-core/src/**/*.test.tspackages/cli-core/src/test/2. Extract the Skill's Claims
2. 提取Skill的描述内容
Read and each file under . Extract every concrete claim:
skills/core/clerk-cli/SKILL.mdskills/core/clerk-cli/references/- Commands in the core command table and invocation guidance.
- Flags named in prose, tables, and examples.
- Agent-mode behavior bullets.
- Exit code, error format, and JSON output claims.
- Cross-references between and
SKILL.md.references/*.md
读取和下的所有文件,提取每一项具体描述:
skills/core/clerk-cli/SKILL.mdskills/core/clerk-cli/references/- 核心命令表中的命令和调用指导。
- 在正文、表格和示例中提及的标志。
- Agent-mode行为的项目符号描述。
- 退出码、错误格式和JSON输出的描述。
- 与
SKILL.md之间的交叉引用。references/*.md
3. Diff Source Against Skill
3. 对比源码与Skill的差异
Produce a structured diff with four buckets:
- Missing from skill: commands, subcommands, flags, or behaviors that exist in source but are not mentioned anywhere in the skill.
- Stale in skill: claims in the skill that no longer match source, including renamed flags, changed defaults, removed commands, shifted exit codes, or reworked agent-mode branches.
- Thin in skill: commands mentioned but under-specified relative to their real complexity or footgun surface.
- Over-specified: details the skill encodes that , generated examples, or referenced files cover better.
clerk <cmd> --help
For buckets 1 through 3, cite both the source file and line and the target skill location.
生成结构化差异报告,分为四类:
- Skill中缺失的内容:源码中存在但skill未提及的命令、子命令、标志或行为。
- Skill中过时的内容:skill中的描述与源码不符,包括重命名的标志、修改的默认值、已移除的命令、变更的退出码或重构的agent-mode分支。
- Skill中描述不足的内容:已提及但相对于实际复杂度或风险点描述不够详细的命令。
- Skill中过度描述的内容:、生成的示例或引用文件已能更好覆盖的细节,skill却额外进行了编码描述。
clerk <cmd> --help
对于第1到第3类,需同时引用源码文件及行号,以及目标skill的位置。
4. Decide Placement
4. 确定修改内容的放置位置
Route changes by maintenance value:
- Core loop, mental model, and safety stay in .
SKILL.md - Per-command flag details, recipes, and edge cases belong in or a new reference file.
references/recipes.md - Agent-mode branches belong in ;
references/agent-mode.mdgets only a concise summary.SKILL.md - Auth, key resolution, and targeting belong in .
references/auth.md
Prefer over duplicating generated help. Flags with destructive semantics, hidden interactions, or agent-mode divergence deserve skill coverage. Self-explanatory flags should usually be removed from prose and delegated to .
clerk <command> --help--helpTreat skill shrinkage as a valid proposal when it reduces drift risk. The goal is an accurate, durable skill, not a larger one.
根据维护价值确定修改内容的放置位置:
- 核心流程、心智模型和安全相关内容保留在中。
SKILL.md - 每个命令的标志细节、使用示例和边缘情况应放在或新的参考文件中。
references/recipes.md - Agent-mode分支逻辑放在中;
references/agent-mode.md仅保留简洁的摘要。SKILL.md - 认证、密钥解析和目标定位放在中。
references/auth.md
优先使用而非重复生成的帮助内容。具有破坏性语义、隐藏交互或与agent-mode行为不一致的标志值得在skill中覆盖说明。自解释性的标志通常应从正文中移除,交由处理。
clerk <command> --help--help当缩减skill内容能降低偏差风险时,这是一个合理的提议。目标是打造准确、持久的skill,而非内容更庞大的skill。
5. Propose Edits
5. 提出修改建议
Emit a review-ready proposal. For each change include:
- Path, such as or
skills/core/clerk-cli/SKILL.md.skills/core/clerk-cli/references/agent-mode.md - Severity: ,
drift, orgap.polish - Why, with a source citation such as .
packages/cli-core/src/commands/<cmd>/<file>.ts:<line> - Target location in this repository.
- A unified diff when practical, otherwise a concise before and after block.
Group the proposal by target file. Do not rewrite accurate neighboring sections just because they are nearby.
生成可供审核的修改建议。每项修改需包含:
- 文件路径,例如或
skills/core/clerk-cli/SKILL.md。skills/core/clerk-cli/references/agent-mode.md - 严重程度:(偏差)、
drift(缺失)或gap(优化)。polish - 修改原因,并引用源码,例如。
packages/cli-core/src/commands/<cmd>/<file>.ts:<line> - 本仓库中的目标位置。
- 可行时提供统一差异(unified diff),否则提供简洁的修改前后对比块。
按目标文件分组整理修改建议。请勿仅因为相邻就重写内容准确的章节。
6. Apply or Hand Back
6. 应用修改或返回建议
Default behavior: present the proposal and stop for review.
If invoked with , apply and edits directly, then list suggestions for review. After applying edits, run available formatting or validation commands for this repository. If no formatter exists, validate Markdown and JSON structure with lightweight checks.
--applydriftgappolish默认行为:展示修改建议并等待审核。
如果使用参数调用,则直接应用和类修改,然后列出类建议供审核。应用修改后,运行本仓库可用的格式化或验证命令。如果没有格式化工具,则通过轻量检查验证Markdown和JSON结构。
--applydriftgappolishGuardrails
约束规则
- Never invent flags. If a flag appears in tests but not in the command parser, mark it for human review.
- Preserve the existing skill's terse, third-person voice.
clerk-cli - Do not use em dashes in proposals or edits.
- Keep near the 500-line guidance. Move detailed material to
skills/core/clerk-cli/SKILL.mdinstead of bloating the main skill.references/ - Do not treat the installed binary as authoritative over source. Use
clerkonly to confirm generated presentation when source and tests leave ambiguity.--help - Do not commit or print secrets. If the audit touches env guidance, preserve the repository's 1Password and no-plaintext-secret rules.
- 切勿凭空创造标志。如果某个标志仅出现在测试中而未在命令解析器中定义,标记出来供人工审核。
- 保留现有skill简洁的第三人称语气。
clerk-cli - 在修改建议或编辑内容中请勿使用破折号。
- 保持的内容接近500行的指导规模。将详细内容移至
skills/core/clerk-cli/SKILL.md目录,避免主skill内容冗余。references/ - 切勿将已安装的二进制文件视为比源码更权威的来源。仅当源码和测试存在歧义时,使用
clerk确认生成的展示内容。--help - 切勿提交或打印机密信息。如果审计涉及环境配置指导,请遵守仓库的1Password和明文机密禁止规则。
Output Shape
输出格式
Return the proposal as:
markdown
undefined按以下格式返回修改建议:
markdown
undefinedclerk-cli skill audit - <YYYY-MM-DD>
clerk-cli skill audit - <YYYY-MM-DD>
Summary
Summary
<counts per bucket, plus the largest drift>
<counts per bucket, plus the largest drift>
skills/core/clerk-cli/SKILL.md
skills/core/clerk-cli/SKILL.md
<section name>
<section name>
- [drift|gap|polish] <one-line description>
- source: packages/cli-core/src/commands/<...>:<line>
- target: skills/core/clerk-cli/SKILL.md:<line>
- change: <diff or concise before/after>
- [drift|gap|polish] <one-line description>
- source: packages/cli-core/src/commands/<...>:<line>
- target: skills/core/clerk-cli/SKILL.md:<line>
- change: <diff or concise before/after>
skills/core/clerk-cli/references/<file>.md
skills/core/clerk-cli/references/<file>.md
...
...
New files
New files
...
...
Open questions
Open questions
...
Keep the result skimmable so a maintainer can approve, reject, or apply each entry independently....
保持结果易于浏览,以便维护者可以独立批准、拒绝或应用每一项修改建议。