direct-tests
Write and run fast direct mode tests for GenLayer intelligent contracts.
Install / Use
npx skills add internet-court/internet-court-skill --skill direct-testsInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OperationsSupported Platforms
Our assessment of direct-tests
direct-tests scores 89/100 on our quality scale, 342nd of 745 Operations skills we index (top 46%).
Its SKILL.md is 4.8 KB long, well organised into 23 sections with 12 code examples: a solid amount of guidance for an agent.
With 7,124 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 21 days ago, so direct-tests is actively maintained.
- Our last check on 2026-10-31 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit ā read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-27. Automated pattern scan on 2026-09-27. It catches known dangerous patterns, not every risk ā read a skill before letting an agent act on it.
direct-tests compared with similar skills
All 4 of these similar skills score higher than direct-tests; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| direct-tests (this skill)by internet-court | 89 | 7.1k | 21d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 103.6k | 2d ago | MCP Server |
| crawl4aiby unclecode | 100 | 87.4k | 3d ago | MCP Server |
Frequently asked questions
- How do I install direct-tests?
- Run
npx skills add internet-court/internet-court-skill --skill direct-tests. The install tabs above show the steps for each supported agent. - Which AI agents does direct-tests work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is direct-tests safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is direct-tests still maintained?
- The repository was last updated 21 days ago, so direct-tests is actively maintained.
Skill content
View source on GitHubname: direct-tests description: Write and run fast direct mode tests for GenLayer intelligent contracts. allowed-tools:
- Bash
- Read
- Write
- Edit
Direct Mode Tests
Write fast, in-memory tests for intelligent contracts. No server, no Docker ā tests run in ~30-50ms.
Running Tests
pytest tests/direct/ -v
pytest tests/direct/test_specific.py -v
pytest tests/direct/test_specific.py::test_one_case -v
Fixtures
Available from genlayer-test pytest plugin:
def test_example(direct_vm, direct_deploy, direct_alice, direct_bob):
# direct_vm ā VMContext with cheatcodes
# direct_deploy ā deploy a contract file
# direct_alice ā test address
# direct_bob ā test address
pass
All fixtures: direct_vm, direct_deploy, direct_alice, direct_bob, direct_charlie, direct_owner, direct_accounts
Basic Test Pattern
def test_set_and_get(direct_vm, direct_deploy, direct_alice):
contract = direct_deploy("contracts/my_contract.py")
direct_vm.sender = direct_alice
contract.set_data("hello")
result = contract.get_data(direct_alice)
assert result == "hello"
Mocking Web Requests
For contracts that call gl.nondet.web.get():
import json
def test_with_web_mock(direct_vm, direct_deploy, direct_alice):
contract = direct_deploy("contracts/my_contract.py")
direct_vm.sender = direct_alice
# Pattern: regex matching on URL
direct_vm.mock_web(
r".*api\.example\.com/prices.*",
{"status": 200, "body": '{"price": 42.5}'},
)
contract.update_price("ETH/USD")
assert contract.get_price("ETH/USD") == 42.5
Full mock format (when you need headers/method control)
direct_vm.mock_web(
r"api\.example\.com/data",
{
"response": {
"status": 200,
"headers": {},
"body": json.dumps({"key": "value"}).encode()
},
"method": "GET"
}
)
Mocking LLM Responses
For contracts that call gl.nondet.exec_prompt():
direct_vm.mock_llm(
r".*Extract the match result.*", # Regex on prompt text
json.dumps({"score": "2:1", "winner": 1}),
)
Clearing Mocks
direct_vm.clear_mocks() # Reset between test scenarios
VMContext Cheatcodes
# Set transaction sender
direct_vm.sender = direct_alice
# Set native value (wei)
direct_vm.value = 1000000000000000000 # 1 ETH
# Expect a revert
with direct_vm.expect_revert("Insufficient balance"):
contract.withdraw(1000)
# Temporary sender change
with direct_vm.prank(direct_bob):
contract.method() # Called as bob
# Snapshot and restore state
snap_id = direct_vm.snapshot()
contract.modify_state()
direct_vm.revert(snap_id) # State restored
# Set account balance
direct_vm.deal(direct_alice, 1000000000000000000)
# Time travel
direct_vm.warp("2024-06-01T12:00:00Z")
Test Organization
tests/direct/
āāā conftest.py # Shared fixtures and mock helpers
āāā test_<feature>.py # Tests per feature/method
āāā test_<feature>_web.py # Tests requiring web/LLM mocks
What to Test in Direct Mode
| Category | Example | |----------|---------| | State transitions | Create ā read back ā verify fields | | Validation / reverts | Invalid inputs, unauthorized callers | | Access control | Owner-only methods, role checks | | Edge cases | Empty state, boundary values, overflow | | Web/LLM parsing | Mock responses ā verify extraction logic |
Common Patterns
Testing access control
def test_only_owner(direct_vm, direct_deploy, direct_alice, direct_bob):
contract = direct_deploy("contracts/my_contract.py")
direct_vm.sender = direct_alice
contract.create_item("item_1")
direct_vm.sender = direct_bob
with direct_vm.expect_revert("Only owner"):
contract.delete_item("item_1")
Testing state transitions
def test_state_flow(direct_vm, direct_deploy, direct_alice):
contract = direct_deploy("contracts/my_contract.py")
direct_vm.sender = direct_alice
contract.create_item("item_1")
assert contract.get_item("item_1")["status"] == "pending"
contract.approve_item("item_1")
assert contract.get_item("item_1")["status"] == "approved"
Reusable mock helpers (conftest.py)
import json
def mock_price_api(direct_vm, pair: str, price: float):
"""Mock a price API response."""
direct_vm.mock_web(
rf".*api\.example\.com/prices/{pair}.*",
{"status": 200, "body": json.dumps({"price": price})},
)
Tips
- Always
direct_vm.sender = ...before calling write methods - Use
--jsonflag ongenvm-lint checkbefore writing tests to understand the contract's interface - Direct mode runs leader function only ā validator logic is not exercised. Use integration tests for full consensus validation.
Related Skills
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu ā one CLI, zero API fees.
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
103.6kš·ļø The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
crawl4ai
87.4kOfficial Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit ā see the Safety scan above for what the skill file itself contains.
