基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/benbrastmckie/nvim --skill skill-lake-repair命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | skill-lake-repair |
| description | Run Lean build with automatic error repair for missing cases, unused variables, and unused imports |
| allowed-tools | Read, Write, Edit, Bash |
Direct execution skill for automated Lean build repair. Runs lake build, parses errors, and automatically fixes common mechanical errors in an iterative loop.
This skill executes inline without spawning a subagent.
Extract flags from command input:
--clean: Run lake clean before building--max-retries N: Maximum fix iterations (default: 3)--dry-run: Preview fixes without applying--module NAME: Build specific module onlyclean=false
max_retries=3
dry_run=false
module=""
for arg in "$@"; do
case "$arg" in
--clean) clean=true ;;
--dry-run) dry_run=true ;;
--max-retries=*) max_retries="${arg#*=}" ;;
--module=*) module="${arg#*=}" ;;
esac
done
If --clean flag is set:
if [ "$clean" = true ]; then
echo "Running lake clean..."
lake clean
fi
Initialize tracking variables:
retry_count=0previous_errors="" (for cycle detection)total_fixes=0Decision note: this loop uses command substitution (build_output=$(...)) to capture build
output into a shell variable, which is incompatible with Bash(run_in_background: true) — a
detached call returns no stdout to the invoking shell. This carves the loop out of the
detachment obligation in context/project/lean4/operations/long-builds.md only; it still
routes through the build guard, gaining serialization against concurrent builds on the same
project and the guard's memory bounding. Residual exposure: a heavy first-time build in this loop
can still be killed at the foreground cap, but unlike a detached agent build the failure is not
silent — it surfaces as a failed command substitution, which the loop's existing error handling
(build_exit_code) already covers.
Attempt to build the project:
if [ -n "$module" ]; then
build_output=$(bash .claude/scripts/lake-build-guard.sh build --timeout 1800 -- "$module" 2>&1)
else
build_output=$(bash .claude/scripts/lake-build-guard.sh build --timeout 1800 2>&1)
fi
build_exit_code=$?
Extract errors and warnings from build output using regex pattern:
Pattern: ^(.+\.lean):(\d+):(\d+): (error|warning): (.+)$
| Error Pattern | Fix Type |
|---|---|
| Missing cases | missing_cases |
| Unused variable | unused_variable |
| Unused import | unused_import |
| All other | UNFIXABLE |
Add match cases with sorry placeholders.
Rename by adding underscore prefix: {name} -> _{name}
Remove the import line (only clean single-import lines).
After loop exits:
Lake Build Complete
===================
Build succeeded after {retry_count} iterations.
Fixes applied:
- {file}:{line} - {description}
All modules built successfully.
Fall back to lake build via Bash, through the build guard per Step 4 above (see
context/project/lean4/operations/long-builds.md).
Skip that particular fix, continue with others.
Treat as unfixable error.
sorry placeholdersOrchestrate multi-agent implementation with parallel phase execution. Spawns teammates for independent phases and coordinates dependent phases. Includes debugger teammate for error recovery.
Implement CSLib proofs with hard-mode contracts (H2 anti-analysis, H7 territory, H9 wrap-up with sorry_inventory). Invoke for --hard cslib implementation tasks.
Research CSLib formalization patterns with hard-mode contracts (H2 anti-analysis, H3 reference grounding with BibKey verification, H4 adversarial verification). Invoke for --hard cslib research tasks.