跳到正文
Skillpedia
测试7.0k · #13628

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/genvm-lint/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 float usage)
  • 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 passed
  • 1 — Lint or validation errors found
  • 2 — Contract file not found
  • 3 — SDK download failed

Agent Workflow

When fixing lint errors iteratively:

  1. Run genvm-lint check contract.py --json
  2. Parse JSON for specific errors
  3. Fix each error in the contract
  4. Re-run check until "ok": true
  5. Proceed to tests
常见问题

这个检查工具能发现哪些问题?

被禁止的导入(例如 os 或 subprocess)、非确定性写法(例如裸浮点数),以及 SDK 的类型或装饰器错误。

应该在测试前还是测试后运行它?

在测试前。该技能要求先进行检查,并在运行测试前修复所有错误。

能否以程序可读的格式获取结果?

可以。检查命令提供 JSON 输出选项。

详情

作者的原始描述

Validate GenLayer intelligent contracts with the GenVM linter.

repo: internet-court/internet-court-skill

热度

GitHub 星标
7.0k
排名
#13628
许可证
—
更新时间
2026/10/26

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能