修复LLM产物
fix-llm-artifacts
by anderskev
Applies fixes from a prior review-llm-artifacts run, with safe/risky classification
安装
claude skill add --url https://github.com/openclaw/skills文档
Fix LLM Artifacts
Apply fixes from a previous review-llm-artifacts run with automatic safe/risky classification.
Usage
/beagle-core:fix-llm-artifacts [--dry-run] [--all] [--category <name>]
Flags:
--dry-run- Show what would be fixed without changing files--all- Fix entire codebase (runs review with --all first)--category <name>- Only fix specific category:tests|dead-code|abstraction|style
Instructions
1. Parse Arguments
Extract flags from $ARGUMENTS:
--dry-run- Preview mode only--all- Full codebase scan--category <name>- Filter to specific category
2. Pre-flight Safety Checks
# Check for uncommitted changes
git status --porcelain
If working directory is dirty, warn:
Warning: You have uncommitted changes. Creating a git stash before proceeding.
Run `git stash pop` to restore if needed.
Create stash if dirty:
git stash push -m "beagle-core: pre-fix-llm-artifacts backup"
3. Load Review Results
Check for existing review file:
cat .beagle/llm-artifacts-review.json 2>/dev/null
If file missing:
- If
--allflag: Runreview-llm-artifacts --all --jsonfirst - Otherwise: Fail with: "No review results found. Run
/beagle-core:review-llm-artifactsfirst."
If file exists, validate freshness:
# Get stored git HEAD from JSON
stored_head=$(jq -r '.git_head' .beagle/llm-artifacts-review.json)
current_head=$(git rev-parse HEAD)
if [ "$stored_head" != "$current_head" ]; then
echo "Warning: Review was run at commit $stored_head, but HEAD is now $current_head"
fi
If stale, prompt: "Review results are stale. Re-run review? (y/n)"
4. Partition Findings by Safety
Parse findings from JSON and classify by fix_safety field:
Safe Fixes (auto-apply):
unused_import- Unused importstodo_comment- Stale TODO/FIXME commentsdead_code_obvious- Obviously unreachable codeverbose_comment- Overly verbose LLM-style commentsredundant_type- Redundant type annotations
Risky Fixes (require confirmation):
test_refactor- Test structure changesabstraction_change- Class/function extractioncode_removal- Removing functional codemock_boundary- Test mock scope changeslogic_change- Any behavioral modifications
5. Apply Safe Fixes
If --dry-run:
## Safe Fixes (would apply automatically)
| File | Line | Type | Description |
|------|------|------|-------------|
| src/api.py | 15 | unused_import | Remove `from typing import List` |
| src/models.py | 42 | verbose_comment | Remove 23-line docstring |
...
Otherwise, spawn parallel agents per category with Task tool:
Task: Apply safe fixes for category "{category}"
Files: [list of files with findings in this category]
Instructions: Apply each fix, preserving surrounding code. Report success/failure per fix.
Categories to parallelize:
style- Comments, formattingdead-code- Imports, unreachable codetests- Test-related safe fixesabstraction- Safe refactors
6. Handle Risky Fixes
For each risky fix, prompt interactively:
[src/services/auth.py:156] Remove seemingly unused authenticate_legacy() method?
This method has no callers in the codebase but may be used externally.
(y)es / (n)o / (s)kip all risky:
Track user choices:
y- Apply this fixn- Skip this fixs- Skip all remaining risky fixes
7. Post-Fix Verification
Detect project type and run appropriate linters:
Python:
# Check if ruff config exists
if [ -f "pyproject.toml" ] || [ -f "ruff.toml" ]; then
ruff check --fix .
ruff format .
fi
# Check if mypy config exists
if [ -f "pyproject.toml" ] || [ -f "mypy.ini" ]; then
mypy .
fi
TypeScript/JavaScript:
# Check for eslint
if [ -f "eslint.config.js" ] || [ -f ".eslintrc.json" ]; then
npx eslint --fix .
fi
# Check for TypeScript
if [ -f "tsconfig.json" ]; then
npx tsc --noEmit
fi
Go:
if [ -f "go.mod" ]; then
go vet ./...
go build ./...
fi
8. Run Tests
# Python
if [ -f "pyproject.toml" ] || [ -f "pytest.ini" ]; then
pytest
fi
# JavaScript/TypeScript
if [ -f "package.json" ]; then
npm test 2>/dev/null || yarn test 2>/dev/null || true
fi
# Go
if [ -f "go.mod" ]; then
go test ./...
fi
9. Report Results
## Fix Summary
### Applied Fixes
- [x] src/api.py:15 - Removed unused import `List`
- [x] src/models.py:42-64 - Removed verbose docstring
- [x] src/auth.py:156-189 - Removed dead method (user confirmed)
### Skipped Fixes
- [ ] src/services/cache.py:23 - User declined risky fix
- [ ] tests/test_api.py:45 - Test refactor skipped
### Verification Results
- Linter: PASSED
- Type check: PASSED
- Tests: PASSED (42 passed, 0 failed)
### Diff Summary
```bash
git diff --stat
Cleanup
On successful completion (all verifications pass):
rm .beagle/llm-artifacts-review.json
If any verification fails, keep the file and report:
Review file preserved at .beagle/llm-artifacts-review.json
Fix issues and re-run, or restore with: git stash pop
Example
# Preview all fixes without applying
/beagle-core:fix-llm-artifacts --dry-run
# Fix only dead code issues
/beagle-core:fix-llm-artifacts --category dead-code
# Full codebase scan and fix
/beagle-core:fix-llm-artifacts --all
# Fix style issues only, preview first
/beagle-core:fix-llm-artifacts --category style --dry-run
相关 Skills
Claude接口
by anthropics
面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。
✎ 想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心
计算机视觉
by alirezarezvani
聚焦目标检测、图像分割与视觉系统落地,覆盖 YOLO、DETR、Mask R-CNN、SAM 等方案,适合定制数据集训练、推理优化及 ONNX/TensorRT 部署。
✎ 把目标检测、图像分割到推理部署串成完整工程链路,主流框架与 YOLO、DETR、SAM 等方案都覆盖,落地视觉 AI 会省心很多。
智能体流程设计
by alirezarezvani
面向生产级多 Agent 编排,梳理顺序、并行、分层、事件驱动、共识五种工作流设计,覆盖 handoff、状态管理、容错重试、上下文预算与成本优化,适合搭建复杂 AI 协作系统。
✎ 帮你把多智能体流程设计、编排和自动化统一起来,复杂工作流也能更稳地落地,适合追求强控制力的团队。
相关 MCP 服务
知识图谱记忆
编辑精选by Anthropic
Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。
✎ 帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。
顺序思维
编辑精选by Anthropic
Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。
✎ 这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。
PraisonAI
编辑精选by mervinpraison
PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。
✎ 如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。