Agent skill

Contract Test

by scalus3 in scalus3/scalus

Guide for testing Scalus smart contracts. An agent skill from scalus3/scalus.

Apache-2.0Auto-check passedBackend & APIs

Install Contract Test

skills CLI
$ npx skills add scalus3/scalus --skill contract-test -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install scalus3/scalus contract-test --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/scalus3/scalus.git skills-src && mkdir -p .claude/skills && cp -r skills-src/scalus-skills/skills/contract-test .claude/skills/contract-test && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
contract-test
GitHub stars
105
Token cost
~1.6k tokens
SKILL.md length
549 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
Apache-2.0

At a glance

Guide for testing Scalus smart contracts. An agent skill from scalus3/scalus.

  • Works in 6 steps: validFromOrFail / validToOrFail: an… → hasSameTokensAndAtLeastAda and exact… → findContinuingOutputOrFail: an output… → …
  • Emulator tests for Cardano validators
  • SKILL.md covers Documentation, Test Examples, Testing Patterns and Running Tests, plus 1 more section
  • Reaches scalus.org

What it does

Contract Test is an agent skill from scalus3/scalus. Guide for testing Scalus smart contracts. Use when writing unit, property, budget, or Emulator tests for Cardano validators.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Smart contracts and Integration testing. The repository describes itself as: Scalus - Smart contracts & dApps Development Platform for Cardano. The licence is Apache-2.0.

When your agent uses it

  • Emulator tests for Cardano validators
  • Tasks that involve Smart contracts
  • Tasks that involve Integration testing

Example prompts

  • “/contract-test”

Requirements

  • Docker

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. validFromOrFail / validToOrFail: an unbounded validity range (Interval.always) fails.
  2. hasSameTokensAndAtLeastAda and exact value checks: an output whose value is below the expected
  3. findContinuingOutputOrFail: an output with the script payment credential but a different
  4. findUniqueOrFail on inputs: a second own input in the same transaction fails (each script run
  5. mint.hasOnly / onlyBurnsUnder: an extra token name under the policy fails; a burn action that
  6. hasNft / hasPaidTagged: quantity 2 of the beacon fails; one tagged output claimed by two

What it can do on your machine

Read from SKILL.md and the folder at commit 073969c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are scala and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • scalus.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Contract Test loads about 1.6k tokens when it runs. Until then it costs about 35 tokens; SKILL.md has 549 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~35
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from scalus3/scalus at commit 073969c, republished under its Apache-2.0 licence (© scalus3). 549 words, ~1,582 tokens.

Download SKILL.mdSave it as .claude/skills/contract-test/SKILL.md (or your agent's skills folder).
name
contract-test
description
Guide for testing Scalus smart contracts. Use when writing unit, property, budget, or Emulator tests for Cardano validators.

Scalus Smart Contract Testing

Before writing test code from memory, fetch https://scalus.org/llms-api.txt and check the testkit signatures you plan to use.

Documentation

In the Scalus repo, read scalus-site/content/<path>.mdx; in any other project, fetch https://scalus.org/docs/<path>.md.

Testing fundamentals:

  • testing/unit-testing - ScalusTest trait, property-based testing
  • smart-contracts/evaluating-script - Script evaluation patterns
  • testing/debugging - Debugging techniques

Integration testing:

  • testing/emulator - in-memory Emulator testing
  • testing/local-devnet - Yaci DevKit integration tests
  • Use the local-development skill for the full Emulator + TxBuilder loop.

Test Examples

Study existing tests before writing new ones:

  • Fetch https://scalus.org/llms-examples.txt - validators with their tests; HtlcTest.scala is the reference style.
  • In the Scalus repo: scalus-examples/jvm/src/test/scala/scalus/examples/.

Testing Patterns

Emulator test with ScalusTest (the standard pattern; see HtlcTest):

scala
class MyValidatorTest extends AnyFunSuite, ScalusTest {
    private given env: CardanoInfo = TestUtil.testEnvironment
    private val contract = MyContract.compiled.withErrorTraces

    test("valid spend succeeds") {
        val provider = Emulator.withAddresses(Seq(Alice.address, Bob.address))
        val utxos = provider.findUtxos(address = Alice.address).await().toOption.get
        // build a transaction with txBuilder, then:
        assert(provider.submit(tx).await().isRight)
    }
}

Assertions from scalus.testing.kit:

  • assertScriptFail(expectedError) { buildTx } - expect a validator failure
  • assertEvalResult(expected)(program) - check an evaluation result

Budget assertions from scalus.testing.dsl.EvalTestDsl:

  • .assertBudgetWithin(memory, steps) - upper bound
  • .assertBudgetEquals(memory, steps) - exact pin (baseline tests)

Pin convention:

  • Every new prelude/stdlib operation gets a budget: test in scalus-core that pins mem, cpu and the mainnet fee: assertEvalWithBudgetAndFee(code, arg, expected, ExUnits(memory = m, steps = s), Coin(fee)) from scalus.testing.kit.EvalTestKit. Pass the input as arg (it goes in as Data) so constant folding cannot remove the work being measured.
  • Example validator tests pin the exact ExUnits of every transaction, and the fee where the test already does (result.budget.fee == Coin(2398) in HtlcTest). Wrap a pin in ScalaCompilerVersion.baseline(pre38 = ..., since38 = ...) only when the two compiler generations differ; otherwise write the bare value.
  • Format: ExUnits(memory = 27127, steps = 11_541882), named parameters, _ at the million boundary.

Property-based testing: ScalusTest provides generators (e.g. genByteStringOfN); use ScalaCheck forAll for on-chain function properties.

Negative cases: three idioms; pick one per test, do not mix them:

  • Builder path (HtlcTest): keep the default evaluator and wrap the build in assertScriptFail(expectedError) { buildTx }. The builder runs the script while balancing, throws, and the helper matches expectedError against the script logs, so pass the validator's own error constant.
  • Emulator path (EditableNftValidatorTest): build with TxBuilder(env, PlutusScriptEvaluator.constMaxBudget(env)) so the builder skips script evaluation, then provider.submit(tx).await() and assert(result.isLeft). Use it when the transaction must get past the builder (for example, to reach the ledger's own checks).
  • Unit path (VestingValidatorTest): build a ScriptContext by hand, run compiled.runScript(ctx) and assert(result.isFailure, "..."). For an on-chain helper evaluated directly, assertEvalFailsWithMessage[OnchainError](msg)(expr) checks the message.
Show full SKILL.md (195 more words)Show less
scala
assertScriptFail(HtlcValidator.InvalidReceiverPreimage) {
    txCreator.reveal(utxos = utxos, lockedUtxo = lockedUtxo, preimage = wrongPreimage, ...)
}

Negative-test convention: every safety operation the validator uses gets one Fail: ... test where the UNSAFE input fails. The transaction is valid apart from the one change. Minimum set:

  1. validFromOrFail / validToOrFail: an unbounded validity range (Interval.always) fails.
  2. hasSameTokensAndAtLeastAda and exact value checks: an output whose value is below the expected amount fails; native tokens stripped from the continuing output fails.
  3. findContinuingOutputOrFail: an output with the script payment credential but a different staking credential fails; a second output to the script address fails.
  4. findUniqueOrFail on inputs: a second own input in the same transaction fails (each script run must fail, see "double satisfaction" in VestingValidatorTest).
  5. mint.hasOnly / onlyBurnsUnder: an extra token name under the policy fails; a burn action that mints nothing fails.
  6. hasNft / hasPaidTagged: quantity 2 of the beacon fails; one tagged output claimed by two script instances fails.

Shape of one case (unit path, VestingValidatorTest "Fail: continuing output redirects the staking credential"):

scala
val hijacked = Address(
  ScriptCredential(contractHash),
  Option.Some(StakingCredential.StakingHash(Credential.PubKeyCredential(attackerPKH)))
)
val outputs = List(TxOut(hijacked, Value.lovelace(remaining), OutputDatum.OutputDatum(datum.toData)))
val result = compiled.runScript(ScriptContext(txInfo = txInfo(outputs), redeemer = redeemer.toData, scriptInfo = spending))
assert(result.isFailure, "Redirecting the staking credential must fail")

Running Tests

In a user project: sbt test or scala-cli test .. In the Scalus repo:

bash
sbtn scalusJVM/test              # Core tests
sbtn scalusExamplesJVM/test      # Example tests
sbtn scalusCardanoLedgerJVM/test # Ledger tests
sbtn scalusCardanoLedgerIt/test  # Integration tests (requires Docker)

Test Organization

  • Tests mirror the source structure.
  • Use ScalaTest (AnyFunSuite) with ScalaCheck for property-based tests.
  • Fork the JVM for integration tests (Test/fork := true).

© scalus3, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in scalus-skills/skills/contract-test of scalus3/scalus.

Open the folder on GitHubat commit 073969c

Compare with similar skills

Contract Test next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Contract Test compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Contract Test this skillscalus3/scalus105—~1.6kAutomated safety check: PassApache-2.0
Web3 Testingwshobson/agents40k11 repos~2kAutomated safety check: PassMIT
Solana Development Playbookinternet-court/internet-court-skill6.4k—~3kAutomated safety check: PassMIT
Fork TestOriginProtocol/origin-dollar153—~1.2kAutomated safety check: PassMIT
DevchainNethereum/Nethereum2.3k—~1.7kAutomated safety check: PassMIT
Hybrid Cloud Test Gengetsentry/sentry45k—~2.6kAutomated safety check: PassCustom licence

Similar skills

  • Web3 Testing

    wshobson/agents

    Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking.

    40k GitHub starsUsed in 11 repos~2k tokens
    Testing & QAAuto-check passed
  • Solana Development Playbook

    internet-court/internet-court-skill

    End-to-end Solana development guide covering wallet connection, Anchor and Pinocchio programs, Codama clients, local testing, security checks and RPC lookups with curl.

    6.4k GitHub stars~3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Fork Test

    OriginProtocol/origin-dollar

    Generate Foundry fork tests for contracts that need real on-chain integration coverage.

    153 GitHub stars~1.2k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Devchain

    Nethereum/Nethereum

    Help users run a local Ethereum dev chain, write integration tests, fork networks, debug transactions, or replace Hardhat/Anvil with Nethereum DevChain (.NET).

    2.3k GitHub stars~1.7k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Hybrid Cloud Test Gen

    getsentry/sentry

    Official

    Generate hybrid cloud tests for the Sentry codebase. An agent skill from getsentry/sentry.

    45k GitHub stars~2.6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Contract Testing

    proffesor-for-testing/agentic-qe

    Consumer-driven contract testing for microservices using Pact, schema validation, API versioning, and backward compatibility testing.

    494 GitHub stars~1.8k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed

More from scalus3/scalus

  • Optimize Contract

    scalus3/scalus

    Optimize Scalus/Cardano smart contracts for execution budget (CPU steps and memory).

    105 GitHub stars~3.6k tokensUpdated yesterday
    Auto-check passed
  • Security review for Scalus/Cardano smart contracts. An agent skill from scalus3/scalus.

    105 GitHub stars~4.2k tokensUpdated yesterday
    Auto-check passed
  • Contract

    scalus3/scalus

    Guide for developing Scalus smart contracts. An agent skill from scalus3/scalus.

    105 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Local Development

    scalus3/scalus

    A skill your agent uses when developing or testing Scalus smart contracts with the local Emulator and TxBuilder.

    105 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Pretty

    scalus3/scalus

    A skill your agent uses when writing or changing a Pretty typeclass instance (paiges Doc DSL) in scalus-core, for example in scalus/utils/Pretty.scala or the cardano/ledger types.

    105 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed

Questions about Contract Test

What does Contract Test do?

Guide for testing Scalus smart contracts. An agent skill from scalus3/scalus. Contract Test is an agent skill from scalus3/scalus. Guide for testing Scalus smart contracts.

When should I use Contract Test?

Contract Test fits situations like: emulator tests for Cardano validators; tasks that involve Smart contracts; tasks that involve Integration testing.

How do I install Contract Test in Claude Code?

Run `npx skills add scalus3/scalus --skill contract-test -a claude-code`. Or copy the skill folder (scalus-skills/skills/contract-test in scalus3/scalus) into .claude/skills/contract-test in your project. Claude Code loads it when a task matches its description.

How do I install Contract Test in Codex?

Run `npx skills add scalus3/scalus --skill contract-test -a codex`. Or copy the skill folder (scalus-skills/skills/contract-test in scalus3/scalus) into .agents/skills/contract-test in your project. Codex loads it when a task matches its description.

Can I use Contract Test in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add scalus3/scalus --skill contract-test -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/contract-test, .gemini/skills/contract-test, .github/skills/contract-test and .opencode/skills/contract-test in your project.

What does Contract Test need to run?

SKILL.md names no scripts, command-line tools or credentials: Contract Test is instructions for the agent only. Our summary lists: Docker.

Does Contract Test access the network?

SKILL.md names 1 domain. In commands or code: scalus.org; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Contract Test safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Contract Test use?

Contract Test is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Contract Test use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Contract Test?

Skills that share tags, products or a category with Contract Test: Web3 Testing (wshobson/agents, 40k stars), Solana Development Playbook (internet-court/internet-court-skill, 6.4k stars), Fork Test (OriginProtocol/origin-dollar, 153 stars) and Devchain (Nethereum/Nethereum, 2.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Contract Test?

scalus3 (a GitHub organization) maintains it in scalus3/scalus, which has 105 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 6, 2026.

Source: scalus3/scalus on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.