befund-preflight
Verifies language detection, tool availability, smoke-parseability, house-rules presence, git/CI presence, and doc presence, then assigns a Ready/Ready-with-gaps/Not-ready verdict per downstream skill. Use when the user asks to "check if this repo is ready for befund", "run preflight", "can befund analyze this codebase", or before any other befund-* skill runs for the first time in a repo; also invoked at the start of befund-autopilot's CHECK phase.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- befund-preflight
- description
- Verifies language detection, tool availability, smoke-parseability, house-rules presence, git/CI presence, and doc presence, then assigns a Ready/Ready-with-gaps/Not-ready verdict per downstream skill. Use when the user asks to "check if this repo is ready for befund", "run preflight", "can befund analyze this codebase", or before any other befund-* skill runs for the first time in a repo; also invoked at the start of befund-autopilot's CHECK phase.
03 SKILL.md 正文
befund-preflight
Determine whether this repository is ready for befund's analysis skills, and which downstream skills can run at full strength versus degraded.
Step 0: Read settings and check the gate
Run, from the plugin root:
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/befund_cli.py" check-enabled --repo <repo_root> --skill befund-preflight
A non-zero exit means the skill is disabled in .claude/befund.local.md -- stop and tell
the user plainly, quoting the stderr message. On success, the JSON on stdout carries the
resolved settings (including output_dir, default analysis/befund). Use that output_dir for
every output path in this skill, resolved through resolve-output-path (see Step 6) before
any write.
Step 1: Run all 6 checks, unconditionally
Rule preflight-runs-all-checks requires every check below to run and report its own status,
even when an earlier check fails. Do not short-circuit. Wrap each check in isolation (a failed
git invocation, a missing manifest, a parse error) so one check's failure cannot prevent the
next from running:
- languages -- glob the repo for manifest files (
package.json,pyproject.toml,go.mod,Cargo.toml,pom.xml, etc.) and count files by extension. Calldetect-languages --manifests <json list of manifest basenames found> --extension-counts <json map of extension to count>. This enforces the language-detection-threshold rule (an extension only counts once >=3 files exist and no manifest already claimed that language in pass 1) -- do not reimplement the threshold by hand. - tools -- probe for a language's usual toolchain (e.g.
python3 --version,node --version,go version) for each detected language; record found/missing per tool. - smoke_parse -- for exactly one file per detected language (the smallest by line count is
a reasonable pick), attempt a lightweight parse: Python via
python3 -m py_compile, JavaScript/TypeScript vianode --check(or a bare syntax check), Go viagofmt -l, etc. Do not smoke-parse more than one file per language -- that is this skill's own scope limit, not a downstream skill's job. - house_rules -- check for
.claude/house-rules.md, falling back toCLAUDE.mdwith abest-effortlabel if absent. - git_remotes_ci -- check for a
.gitdirectory and at least one CI config file (.github/workflows/*,.gitlab-ci.yml,Jenkinsfile,.circleci/config.yml,azure-pipelines.yml). Status isfailwhen no.gitdirectory is found,partialwhen.gitis present but no CI config file is found, andpasswhen both are present. - docs -- check for
README.md,ARCHITECTURE.md,DECISIONS.md, or ADR files.
Record each check's name (matching exactly: languages, tools, smoke_parse,
house_rules, git_remotes_ci, docs) and status (pass, partial, or fail) regardless
of outcome.
Step 2: Assign per-skill verdicts
Using the check results, assign each downstream skill a verdict in
{"Ready", "Ready-with-gaps", "Not-ready"}:
befund-ci-topologyisNot-readyifgit_remotes_ci's status isfail(no.gitdirectory found) -- the skill's own rule refuses to run outside git.befund-ui-auditisReady-with-gaps(neverNot-ready) when no UI files are found -- it degrades to "Not applicable" itself, this skill just flags the gap in advance.- Any skill whose language was detected only via extension count (not manifest) is
Ready-with-gaps. - Everything else with a passing smoke-parse and detected language is
Ready.
Step 3: Validate before writing
Build preflight_summary.json with top-level checks (list of the 6 results above) and
verdicts (map of skill id to verdict), then validate it before writing:
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/befund_cli.py" validate-artifact --kind preflight_summary --file <path-or-inline-json>
This rejects the artifact if any of the 6 required checks is missing or any verdict is outside the three allowed values -- it is not enough to intend to run all 6 checks, the validator confirms all 6 are actually present.
Two worked instances of preflight_summary.json. All 6 checks passing:
{
"checks": [
{"name": "languages", "status": "pass"},
{"name": "tools", "status": "pass"},
{"name": "smoke_parse", "status": "pass"},
{"name": "house_rules", "status": "pass"},
{"name": "git_remotes_ci", "status": "pass"},
{"name": "docs", "status": "pass"}
],
"verdicts": {
"befund-arch-health": "Ready",
"befund-ci-topology": "Ready",
"befund-ui-audit": "Ready"
}
}
With a gap -- no .git directory found, so git_remotes_ci is fail and
befund-ci-topology drops to Not-ready per Step 2's rule, while unrelated skills stay
Ready:
{
"checks": [
{"name": "languages", "status": "pass"},
{"name": "tools", "status": "pass"},
{"name": "smoke_parse", "status": "pass"},
{"name": "house_rules", "status": "pass"},
{"name": "git_remotes_ci", "status": "fail"},
{"name": "docs", "status": "pass"}
],
"verdicts": {
"befund-arch-health": "Ready",
"befund-ci-topology": "Not-ready",
"befund-ui-audit": "Ready"
}
}
Step 4: Write outputs
Resolve both output paths first:
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/befund_cli.py" resolve-output-path --repo <repo_root> --filename PREFLIGHT.md
python3 -B "${CLAUDE_PLUGIN_ROOT}/scripts/befund_cli.py" resolve-output-path --repo <repo_root> --filename preflight_summary.json
A non-zero exit here means the configured output_dir or filename escapes the plugin's write
scope -- stop, do not write anywhere else instead. On success, write PREFLIGHT.md (a
human-readable table of the 6 checks and verdicts) and preflight_summary.json to the resolved
paths using the Write tool.
Read-only constraint
This skill never uses Write/Edit for anything except the two output files above, and never runs Bash with a mutating flag. All 6 checks are read-only inspection.
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.