agentleFS
aviateskaviatesk/JET.jl/.agents/skills/write-test/SKILL.md

write-test

Skill884 starsChanged 4 months agoMITView on GitHub

Use when adding or modifying JET tests. Covers component placement, independently runnable test modules, shared test utilities, `@testset` organization, and focused assertions for JET reports.

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 1 is distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when adding new JET tests or modifying existing test code.

    line 11
  2. Very specific:

    Place tests beside the component they cover and include new files from test/runtests.jl.

    line 15
  3. Very specific:

    Use a root-level file under test/ for cross-component integration or miscellaneous behavior when that matches the neighboring tests.

    line 24
  4. Very specific:

    Do not include the shared setup automatically when direct using JET, Test or narrow imports are sufficient.

    line 70
  5. Very specific:

    Use concise behavior-oriented @testset names.

    line 75
  6. Very specific:

    Keep using, import, helper functions, macros, and type definitions at module scope unless local placement is specifically required.

    line 79
  7. Very specific:

    When an @testset contains multiple test units, use a separate let block for each unit to prevent variable collisions.

    line 82
  8. Very specific:

    Prefer assertions on report types, fields, counts, and semantic properties.

    line 88
  9. Very specific:

    Use the run-test workflow and run the most specific relevant test before broader validation.

    line 94

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Write JET tests

Use this skill when adding new JET tests or modifying existing test code.

Choose the test location

Place tests beside the component they cover and include new files from test/runtests.jl. Existing component directories include:

  • test/abstractinterpret/
  • test/analyzers/
  • test/toplevel/
  • test/ui/

Use a root-level file under test/ for cross-component integration or miscellaneous behavior when that matches the neighboring tests.

Test file structure

New test files should normally define an independent module with a test_ prefix matching the file name. For example, test/toplevel/test_feature.jl should follow this structure:

module test_feature

include("../setup.jl")

@testset "feature behavior" begin
    let source = "x = 1"
        result = report_text(source)
        @test isempty(result.res.toplevel_error_reports)
    end
    let source = "x ="
        result = report_text(source)
        @test !isempty(result.res.toplevel_error_reports)
    end
end

end # module test_feature

Include it from test/runtests.jl under the relevant component:

@testset "toplevel" begin
    @testset "feature.jl" include("toplevel/test_feature.jl")
end

Most existing tests follow this convention. Do not copy the known exception in test/abstractinterpret/test_inferenceerrorreport.jl, which currently depends on running in Main.

Shared test utilities

Subdirectory tests that need JET's report helpers generally include test/setup.jl with include("../setup.jl"). It loads Test, JET, and the helpers from test/interactive_utils.jl.

Do not include the shared setup automatically when direct using JET, Test or narrow imports are sufficient.

Organize test code

Use concise behavior-oriented @testset names. Group related cases into coherent @testset blocks so testrunner can select them by name. Nest @testset blocks when a larger behavior area has useful subgroups.

Keep using, import, helper functions, macros, and type definitions at module scope unless local placement is specifically required.

When an @testset contains multiple test units, use a separate let block for each unit to prevent variable collisions. A let block is unnecessary when the @testset contains only one unit because there is no later unit with which its variables can collide. A helper function or do block also provides local scope.

Prefer assertions on report types, fields, counts, and semantic properties. Reserve output-string assertions for formatting and UI behavior, such as tests under test/ui/, unless the exact rendered message is the behavior under test.

After writing tests

Use the run-test workflow and run the most specific relevant test before broader validation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.