验证笔记本
jsboige2026-10-25查看 1110复制 1524
通过迭代修复来验证和测试 Jupyter notebook。参数:[target] [--quick] [--fix] [--python-only] [--dotnet-only]
📘如何使用这个技能
- 1复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
- 2打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
- 3粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
- 4直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景
💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。
SKILL.md2660 chars
---
name: verify-notebooks
description: Verify and test Jupyter notebooks with iterative fixing. Arguments: [target] [--quick] [--fix] [--python-only] [--dotnet-only]
---
# Verify Notebooks
Verify and test Jupyter notebooks in the CoursIA repository.
**Target**: `$ARGUMENTS`
## Arguments
- `target`: Notebook path, family name (`Sudoku`, `Search`, `SymbolicAI`, `Argument_Analysis`, `GenAI`, `ML`, `Probas`, `IIT`, `Tweety`, `Lean`, `GameTheory`), or `all`
- `--quick`: Structure validation only, no execution
- `--fix`: Attempt automatic fixes (max 3 attempts per cell)
- `--python-only` / `--dotnet-only`: Filter by kernel type
## Process
1. **Parse target** - Determine individual file, family, or all
2. **Discover notebooks** - Use `python scripts/notebook_tools/notebook_tools.py validate {target} --quick` for rapid discovery and structure check
3. **Categorize by kernel** - `python scripts/notebook_tools/notebook_helpers.py detect-kernel {path}`
4. **Execute tests**:
- **Python (preferred)**: `python scripts/notebook_tools/notebook_tools.py execute {target} --timeout 300`
- **Python (alternative)**: `python scripts/notebook_tools/notebook_helpers.py execute {path} --verbose` (cell-by-cell with output)
- **.NET**: MCP cell-by-cell only (see `mcp-jupyter` skill) - Papermill does NOT work
5. **Analyze errors** - `python scripts/notebook_tools/notebook_helpers.py list {path} --verbose` to inspect failed cells
6. **If --fix**: Use notebook-cell-iterator agent (model: sonnet) for targeted cell corrections (max 3 attempts)
7. **Generate summary report**
## Family Reference
| Family | Path | Kernel | Notes |
|--------|------|--------|-------|
| Sudoku | Sudoku/ | Mixed | C# (`#!import`, cell-by-cell only) + Python, one twin per notebook |
| Search | Search/ | Mixed | GeneticSharp=C#, PyGad=Python |
| SymbolicAI | SymbolicAI/ | Mixed | Tweety=Python+JPype |
| GenAI | GenAI/ | Python | API keys required, use `/validate-genai` first |
| Probas | Probas/ | .NET C# | Infer.NET |
| GameTheory | GameTheory/ | Python (WSL) | OpenSpiel |
| Lean | SymbolicAI/Lean/ | Lean 4 / Python (WSL) | WSL kernels |
## GenAI-Specific
For GenAI notebooks, use dedicated scripts:
```bash
python scripts/genai-stack/validate_stack.py
python scripts/genai-stack/validate_notebooks.py MyIA.AI.Notebooks/GenAI/Image/
```
Use `/validate-genai` to validate the stack before running notebooks.
## Known Limitations
1. Widgets/interactive notebooks cannot run in batch mode
2. GenAI notebooks require GPU for some operations
3. .NET cold start may timeout initially (30-60s), retry once
4. External services (DBpedia, etc.) may be unavailable