cli-scaffold-compiled
Generate a production-grade CLI scaffold in a compiled language — Rust, Go, or .NET. Use when the user requests a CLI in one of those three languages. Not the entry point — scaffold-cli resolves the language and dispatches here; a raw request such as "scaffold a new command-line tool in Rust" should go to scaffold-cli first. Produces a lib+binary split where the core library has zero CLI-framework imports, packaging metadata for the language's idiomatic channel, and a snapshot test for --help. Loads the cli-architecture doctrine first, generates freeform from the per-language reference, then hands the scaffold to the cli-scaffold-verifier before presenting; fixes any fixable gaps and re-verifies.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- cli-scaffold-compiled
- description
- Generate a production-grade CLI scaffold in a compiled language — Rust, Go, or .NET. Use when the user requests a CLI in one of those three languages. Not the entry point — scaffold-cli resolves the language and dispatches here; a raw request such as "scaffold a new command-line tool in Rust" should go to scaffold-cli first. Produces a lib+binary split where the core library has zero CLI-framework imports, packaging metadata for the language's idiomatic channel, and a snapshot test for --help. Loads the cli-architecture doctrine first, generates freeform from the per-language reference, then hands the scaffold to the cli-scaffold-verifier before presenting; fixes any fixable gaps and re-verifies.
02 资源文件 3
- 参考文档references/dotnet.md2.4 KB
- 参考文档references/go.md2.3 KB
- 参考文档references/rust.md2.6 KB
03 SKILL.md 正文
Compiled CLI scaffold (Rust / Go / .NET)
You generate a CLI in Rust, Go, or .NET. All rules come from the
cli-architecture doctrine — load it first and follow it; this skill does
not restate it.
Precondition — invoked via scaffold-cli
This skill assumes scaffold-cli has already resolved the language and
dispatched here with paradigm: compiled (Rust, Go, or .NET). If invoked
directly and no resolved language was handed off, do not resolve it
yourself — stop and tell the user to invoke scaffold-cli instead. If you
must confirm ambiguity, you may re-run
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/lang_router.py" "<language-as-given>",
but only continue if its JSON paradigm is compiled; on AMBIGUOUS:,
UNSUPPORTED:, or any other paradigm, refuse and name scaffold-cli as the
correct entry point — mirroring scaffold-cli's own AMBIGUOUS/UNSUPPORTED
handling rather than scaffolding anyway.
Step 1 — Load doctrine
Load the cli-architecture skill. Do not generate anything before it is loaded.
Step 2 — Read the per-language reference
Read the reference for the resolved language (each maps 1:1 onto the five pillars):
- Rust →
${CLAUDE_PLUGIN_ROOT}/skills/cli-scaffold-compiled/references/rust.md - Go →
${CLAUDE_PLUGIN_ROOT}/skills/cli-scaffold-compiled/references/go.md - .NET →
${CLAUDE_PLUGIN_ROOT}/skills/cli-scaffold-compiled/references/dotnet.md
Step 3 — Resolve the write target (in code)
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/write_scope.py" "<app-name>"
Write the scaffold only under the path it prints. If it exits non-zero, stop and ask for a valid app name — never write outside the declared output scope.
Step 4 — Generate the scaffold freeform
Following the reference idioms (not stored boilerplate), generate:
- the lib + binary split: a core library file with zero CLI-framework imports, and a thin binary entry point that only parses, dispatches into the core, formats output, and maps the frozen exit codes;
- packaging metadata for the one idiomatic channel named in the reference;
- a snapshot test for
--help; - the discoverability, NO_COLOR,
--json,--no-input, and stdout/stderr behavior the doctrine requires; - a root
cli-scaffold.manifest.jsondeclaring the file roles (see the doctrine for the schema) — the verifier reads this.
Identical requests must converge on the same structure.
Step 5 — Verify before presenting (mandatory)
Hand the scaffold to the cli-scaffold-verifier agent for a read-only check against the doctrine and reference. The verifier runs:
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/verify_scaffold.py" "<scaffold-dir>" "<language>"
- Exit 0 (verdict
pass) → present the scaffold. - Exit 1 (verdict
gaps) → read the JSON report path it prints. For each finding withdisposition: fixable, fix it and re-run the verifier. Only findings markeddisposition: needs-human-judgmentare surfaced to the user unmodified. The verifier bounds the loop itself: afterMAX_FIX_ITERATIONSit HALTs — if that happens, surface the remaining findings to the user instead of looping.
A report with both kinds of finding looks like this:
{
"verdict": "gaps",
"findings": [
{
"disposition": "fixable",
"rule": "snapshot-test-missing",
"detail": "No snapshot test found for `--help` output."
},
{
"disposition": "needs-human-judgment",
"rule": "packaging-channel-ambiguous",
"detail": "Both a workspace Cargo.toml and a standalone one are plausible; pick one."
}
]
}
Never present a scaffold that still has fixable findings.
Step 6 — Render the architecture tree
Once verification passes, render the scaffold's real file tree, each file
tagged with which five-pillar role it plays — derived from the same
cli-scaffold.manifest.json keys the verifier just read, not re-invented:
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/build_architecture_tree.py" "<scaffold-dir>" \
--template "${CLAUDE_PLUGIN_ROOT}/assets/architecture-tree-viewer.html" \
--d3 "${CLAUDE_PLUGIN_ROOT}/assets/inline-d3.html" \
--tokens "${CLAUDE_PLUGIN_ROOT}/assets/tokens.css"
Writes <scaffold-dir>/ARCHITECTURE.html — inside the scaffold itself, since
here the output IS the deliverable, not a report about existing code.
Mention this path when presenting the scaffold.
04 同仓库更多 Skills
toy-check
A skill that checks things in the repository and reports what it finds.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
demo-check
Reports which generated files changed since the last generation run. Use when the user asks what drifted. Read-only; never edits a file.
zirkel-verify-assumptions
Checks exactly ONE named assumption against real evidence in at most 3 steps and reports one outcome: confidence raised (>=90), reading changed, or still unresolved. Use to resolve a single load-bearing uncertainty — typically a blocking entry surfaced by zirkel-clarify-scope: "verify this one assumption", "is it actually true that X", "check this before we rely on it". For multiple uncertainties, invoke once per uncertainty — the step budget is never shared.