julia-threads/SKILL.md
Implement and debug Julia multithreading with Threads.@threads, Threads.@spawn, threadpools, locks, atomics, and race-avoidance patterns. Use this skill when parallelizing CPU work, configuring Julia thread counts, fixing data races, or handling thread-specific caveats such as task migration.
npx skillsauth add krastanov/juliallmagentskills julia-threadsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use Julia Base.Threads tools to parallelize CPU work while preserving thread safety.
Use CLI flags or env vars before launch:
julia --threads 4
export JULIA_NUM_THREADS=4
Check runtime layout:
Threads.nthreads(:default)
Threads.nthreads(:interactive)
Threads.threadid()
Use threadpools for responsiveness and interactive tasks.
Threads.@threads for parallel loops over iteration spaces.Threads.@spawn for task-based parallel decomposition.@spawn :interactive ... for latency-sensitive tasks.For reduction-style work, avoid shared mutable accumulators; split work into independent chunks and combine results after fetch.
Treat race freedom as a hard requirement:
ReentrantLock, @lock, or lock(... do ...).Base.Lockable to bind lock + protected object.Threads.Atomic / atomic_* for primitive shared counters and similar patterns.@atomic, @atomicswap, @atomicreplace, @atomiconce) when field-level ordering is required.threadid() stays constant inside a task.threadid() unless migration constraints are handled.@spawn scheduling order to be nondeterministic.GC.safepoint() in long compute-bound loops if needed to prevent GC starvation.include/eval of types/modules/methods.references/threading-patterns.md - thread setup, safety, and synchronization patternsjulia-async - task/channel concurrency and event schedulingjulia-tests - validating threaded behavior in teststesting
Run and write Julia tests with Test.jl, TestItemRunner.jl, and ParallelTestRunner.jl. Use when organizing test suites, choosing a test runner, or filtering package tests.
tools
Create and develop Julia packages in local environments, including package bootstrapping, multi-package workspaces, package extensions, and Pkg apps. Use when starting a package or managing package environments, dependencies, structure, and related development workflows.
development
Analyze Julia code with JET.jl for type errors, undefined references, and optimization failures. Use this skill when setting up or running JET analysis on Julia packages.
development
Fix trailing whitespace and ensure files end with newlines. Use this skill when preparing code for commit or when whitespace issues are detected.