# Write Fast GenLayer Direct Tests

GenLayer contract testing can be slow when every change needs a full node or container. This skill helps Claude, Codex, and Claude Code create focused direct mode tests with pytest fixtures, mocks, and VMContext controls.

## Install

```bash
npx skillstore add internet-court/direct-tests
```

## Metadata

- Status: approved
- Slug: internet-court-direct-tests
- Skillstore revision: r1
- Version status: missing
- Tree hash: 2634c73e992158426d52ba6327dcea8fb44d5a168517cdc056744d02590f0793
- Author: internet-court
- GitHub username: internet-court
- License: MIT
- Repository: https://github.com/internet-court/internet-court-skill/tree/main/vendored/genlayer/direct-tests
- Ref: 3f6e026a3363e0954ede7bef0cfe88d4475de137
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 77
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/internet-court-direct-tests
- Manifest: https://skillstore.pages.dev/api/skills/internet-court-direct-tests/manifest

## Capabilities

- Shows pytest commands for running direct test suites and individual test cases.
- Documents GenLayer direct test fixtures, including direct\_vm, direct\_deploy, and account fixtures.
- Provides patterns for state transitions, access control, revert checks, and edge cases.
- Explains how to mock web requests and LLM responses in direct mode tests.
- Shows VMContext controls for sender, value, snapshots, balance changes, and time travel.

## Use Cases

- Add contract unit tests: Create fast direct tests for contract methods, state changes, and expected return values.
- Check access control: Test sender changes, owner-only methods, unauthorized calls, and expected reverts before integration testing.
- Mock nondeterministic inputs: Validate contract parsing logic with mocked web responses and mocked LLM outputs.

## Prompt Templates

### Create a first direct test

```
Use direct-tests to add a pytest direct mode test for this GenLayer contract method. Set the sender, deploy the contract, call the method, and assert the expected state.
```

### Cover validation errors

```
Use direct-tests to add tests for invalid input, unauthorized sender behavior, and expected reverts. Keep each test focused on one failure case.
```

### Mock external responses

```
Use direct-tests to test this contract logic with mocked web responses or mocked LLM outputs. Include success and parsing failure scenarios.
```

### Design a direct test suite

```
Use direct-tests to design a direct mode test suite for this GenLayer contract. Cover state transitions, access control, edge cases, mocked nondeterministic calls, and gaps that need integration tests.
```

## Limitations

- Direct mode runs leader logic only and does not validate full consensus behavior.
- The skill assumes the genlayer-test pytest plugin is available in the project.
- Mocked web and LLM responses may not reveal live integration failures.
- It documents patterns but does not include reusable test files or scripts.

## Best Practices

- Set direct\_vm.sender before every write method to make authorization behavior explicit.
- Mock web and LLM responses with realistic success and failure data.
- Use integration tests for validator logic and full consensus behavior.

## Anti Patterns

- Do not rely on direct mode tests as the only coverage for consensus behavior.
- Do not share mutable mock state across unrelated test scenarios.
- Do not skip revert and unauthorized caller tests for write methods.

## Security Audit

- Audited at: 2026-07-21T02:58:51.063\+00:00
- Summary: All 30 external-command alerts are false positives caused by Markdown backticks in documentation, not executable shell or Ruby substitutions. The two reconnaissance alerts describe contract-test state snapshots and authorization cases, not host discovery. No prompt injection, data exfiltration, or malicious intent was found.

## Stats

- Views: 0
- Downloads: 4
- Favorites: 1
- Popularity score: 0
