genvm-lint
它能做什么
这项技能说明如何使用 GenVM 代码检查工具检查 GenLayer 智能合约。它能发现被禁止的导入、非确定性代码和 SDK 错误,适合希望尽早发现合约问题的开发者。
适用场景
- ✓当你刚编写或修改了 GenLayer 合约,并想对其进行检查的时候。
- ✓当你想确认合约使用了正确的 SDK 类型和装饰器时。
- ✓当你希望从合约检查中获得机器可读的报告的时候。
技能链接
https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/genvm-lint/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想在运行任何测试之前,先检查我的 GenLayer 合约是否有错误。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会对合约文件运行检查工具。检查结合了快速的代码安全扫描和 SDK 规则检查。该技能要求在运行测试之前修复所有错误。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
GenVM Lint
Validate intelligent contracts for safety, correctness, and SDK compliance.
Setup
Requires genvm-linter (included in requirements.txt for boilerplate projects):
pip install genvm-linter
Workflow
Always lint before testing. Run genvm-lint check after writing or modifying a contract. Fix all errors before running tests.
genvm-lint check contracts/my_contract.py
check runs both lint (AST safety) and validate (SDK semantics) in one pass.
Commands
check (recommended)
genvm-lint check contracts/my_contract.py
genvm-lint check contracts/my_contract.py --json # Machine-readable output
lint (fast AST checks only, ~50ms)
genvm-lint lint contracts/my_contract.py
Catches:
- Forbidden imports (
os,sys,subprocess,random, etc.) - Non-deterministic patterns (bare
floatusage) - Contract header structure issues
validate (SDK semantic checks, ~200ms)
genvm-lint validate contracts/my_contract.py
Validates:
- Types exist in SDK (
TreeMap,DynArray,Address, etc.) - Decorators correctly applied (
@gl.public.view,@gl.public.write) - Storage fields have valid types (no
dict/list) - Method signatures correct
schema (extract ABI)
genvm-lint schema contracts/my_contract.py
genvm-lint schema contracts/my_contract.py --json
genvm-lint schema contracts/my_contract.py --output abi.json
typecheck (Pyright/Pylance)
genvm-lint typecheck contracts/my_contract.py
genvm-lint typecheck contracts/my_contract.py --json
genvm-lint typecheck contracts/my_contract.py --strict
Runs Pyright with SDK paths auto-configured. Catches type mismatches, missing attributes, undefined variables.
download (pre-download GenVM artifacts)
genvm-lint download # Latest
genvm-lint download --version v0.2.12 # Specific
genvm-lint download --list # Show cached
Output Formats
Human (default)
✓ Lint passed (3 checks)
✓ Validation passed
Contract: MyContract
Methods: 8 (5 view, 3 write)
JSON (--json)
{"ok":true,"lint":{"ok":true,"passed":3},"validate":{"ok":true,"contract":"MyContract","methods":8,"view_methods":5,"write_methods":3,"ctor_params":2}}
Exit Codes
0— All checks passed1— Lint or validation errors found2— Contract file not found3— SDK download failed
Agent Workflow
When fixing lint errors iteratively:
- Run
genvm-lint check contract.py --json - Parse JSON for specific errors
- Fix each error in the contract
- Re-run check until
"ok": true - Proceed to tests
常见问题
这个检查工具能发现哪些问题?
被禁止的导入(例如 os 或 subprocess)、非确定性写法(例如裸浮点数),以及 SDK 的类型或装饰器错误。
应该在测试前还是测试后运行它?
在测试前。该技能要求先进行检查,并在运行测试前修复所有错误。
能否以程序可读的格式获取结果?
可以。检查命令提供 JSON 输出选项。
详情
作者的原始描述
Validate GenLayer intelligent contracts with the GenVM linter.
热度
- GitHub 星标
- 7.0k
- 排名
- #13628
- 许可证
- —
- 更新时间
- 2026/10/26
评论
- …
同一仓库的更多技能
internet-court
7.0k帮你的智能体安全地向其他 AI 智能体或付费服务付款、雇用或进行交易,并指引它找到合适的专业指南。
genlayer-erc7710-connector
7.0k帮你的智能体把 AI 审核结果与权限系统连接起来,使不合格的审核可以限制或取消智能体的权限。
genlayer-intelligent-contracts
7.0k帮你的智能体定义 AI 裁判的规则、证据和输出,用于检查另一个智能体是否遵循了其授权范围。
x402-erc7710
7.0k帮你的智能体按次为网络服务付款,并设置在权限预算范围内的持续支出。