AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Unlicense Self-run

Julia Scratch

skill-krastanov-juliallmagentskills-julia-scratch · by Krastanov

Use Scratch.jl for package-specific mutable data containers (caches, compiled objects, host-specific data). Use this skill when storing or managing scratch spaces in Julia packages.

No reviews yet
0 installs
20 views
0.0% view→install

Install

$ agentstack add skill-krastanov-juliallmagentskills-julia-scratch

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-krastanov-juliallmagentskills-julia-scratch)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Julia Scratch? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Julia Scratch Spaces

Use Scratch.jl to create and manage mutable, package-specific data directories for caches, compiled objects, and machine-specific data.

When to Use Scratch Spaces vs Artifacts

  • Scratch spaces: mutable, write-many/read-many, machine-specific data (caches,

compiled objects, host introspection results, user-specific data).

  • Artifacts: immutable, write-once/read-many, distributable across machines.

Scratch spaces are not user-facing -- don't use them for files users access via file browsers. For user-facing output, write to a user-specified path instead.

Basic Usage

Always initialize scratch paths in __init__() for relocatability:

module MyPackage
using Scratch

download_cache = ""

function __init__()
    global download_cache = @get_scratch!("downloaded_files")
end

function download_dataset(url)
    fname = joinpath(download_cache, basename(url))
    if !isfile(fname)
        download(url, fname)
    end
    return fname
end

end # module

The @get_scratch! macro automatically detects the calling module's UUID. The verbose equivalent uses get_scratch!:

function __init__()
    global download_cache = get_scratch!(@__MODULE__, "downloaded_files")
end

Regenerate Data on Empty Directory

Check contents after get_scratch! to handle users who called clear_scratchspaces!():

function get_dataset_dir()
    dataset_dir = @get_scratch!("dataset")
    if isempty(readdir(dataset_dir))
        perform_expensive_dataset_generation(dataset_dir)
    end
    return dataset_dir
end

Version-Specific Scratch Spaces

Incorporate package version into the key to isolate data across versions:

module VersionSpecificExample
using Pkg.TOML, Scratch

function get_version()
    return VersionNumber(TOML.parsefile(joinpath(dirname(@__DIR__), "Project.toml"))["version"])
end
const pkg_version = get_version()

const version_specific_scratch = Ref{String}()

function __init__()
    scratch_name = "data_for_version-$(pkg_version.major).$(pkg_version.minor)"
    global version_specific_scratch[] = @get_scratch!(scratch_name)
end

end # module

Cleanup

  • Automatic: Pkg.gc() removes scratch spaces for uninstalled packages (Julia 1.6+).
  • Manual per-package: clear_scratchspaces!(pkg).
  • Manual full wipe: clear_scratchspaces!().
  • Single space: delete_scratch!(key; pkg_uuid).

Converting Scratch Space to Artifact

When data is mature and ready to share, export it as an immutable Artifact:

using Pkg, Scratch, Pkg.Artifacts

function export_scratch(scratch_name::String)
    scratch_dir = @get_scratch!(scratch_name)

    hash = create_artifact() do artifact_dir
        rm(artifact_dir)
        cp(scratch_dir, artifact_dir)
    end

    mktempdir() do upload_dir
        tarball_path = joinpath(upload_dir, "$(scratch_name).tar.gz")
        tarball_hash = archive_artifact(hash, tarball_path)
        tarball_url = upload_tarball(tarball_path)  # user-defined upload function

        bind_artifact!(
            joinpath(@__DIR__, "Artifacts.toml"),
            scratch_name,
            hash;
            download_info=[(tarball_url, tarball_hash)],
            force=true,
        )
    end
end

Disable Access Logging

Set JULIA_SCRATCH_TRACK_ACCESS=0 to disable logging to logs/scratch_usage.toml.

Reference

  • [Scratch.jl API](references/scratch-api.md) - Full API reference and patterns

Related Skills

  • julia-package-dev - Package development workflows
  • julia-package-dev - Package bootstrapping (add Scratch.jl as a dependency)
  • julia-toml - TOML parsing (used for version-specific scratch keys)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.