julia-development
Expert guidance for Julia package development following SciML standards, Distributions.jl patterns, and Julia ecosystem best practices
What this skill does
# Julia Package Development
Use this skill when working with Julia packages to ensure proper development workflows, testing patterns, documentation standards, and performance best practices.
## Development Workflow
### Environment Management
```bash
# Start Julia with project environment
julia --project=.
# Activate project in REPL
using Pkg
Pkg.activate(".")
# Install dependencies
Pkg.instantiate()
# Update dependencies (PREFERRED over direct Project.toml editing)
Pkg.update()
# Add new dependency
Pkg.add("PackageName")
# Add development dependency
Pkg.add("PackageName"; io=devnull) # Then manually move to extras/test deps
# Check package status
Pkg.status()
```
**IMPORTANT**: Always use `Pkg.update()` to update packages.
Never edit `Project.toml` directly for version updates.
### Testing
```bash
# Run all tests (from project root)
julia --project=. -e 'using Pkg; Pkg.test()'
# Run tests with test environment
julia --project=test test/runtests.jl
# Run tests skipping quality checks (if supported)
julia --project=test test/runtests.jl skip_quality
```
**Test Organization:**
- Use `TestItemRunner` with `@testitem` syntax for modular testing
- Organize tests by component: `test/component/`, `test/package/`
- Package-level tests in `test/package/` for quality (Aqua, DocTest, formatting)
- Use `@testitem "description" begin ... end` for individual test items
**Example test structure:**
```julia
using TestItemRunner
@testitem "Basic functionality" begin
using MyPackage
@test my_function(1) == 2
end
@testitem "Edge cases" begin
using MyPackage
@test_throws ArgumentError my_function(-1)
end
```
### Documentation
```bash
# Build documentation locally
julia --project=docs docs/make.jl
# Build docs skipping notebooks (faster)
julia --project=docs docs/make.jl --skip-notebooks
# or via environment variable
SKIP_NOTEBOOKS=true julia --project=docs docs/make.jl
# Start Pluto server for interactive notebooks
# (check project-specific task or command)
```
**Documentation Structure:**
- Use Documenter.jl for documentation
- Auto-deployment to GitHub Pages via CI
- Structure defined in `docs/pages.jl` or `docs/make.jl`
### Code Quality
```bash
# Run pre-commit hooks
pre-commit run --all-files
# JuliaFormatter (typically configured in .JuliaFormatter.toml)
# Usually handled by pre-commit hooks
```
**Quality Checks:**
- Aqua.jl tests for package quality
- JuliaFormatter.jl for code formatting
- Pre-commit hooks for automated checks
## Code Style Guidelines
### SciML Coding Standards
Follow SciML (Scientific Machine Learning) coding standards:
- Avoid type instability
- Ensure efficient precompilation
- Use appropriate type annotations for performance
- Write type-stable code
**Type Stability:**
```julia
# Good - type stable
function compute(x::Float64)
result = 0.0 # Type is known
for i in 1:10
result += x * i
end
return result
end
# Avoid - type unstable
function compute_bad(x)
result = 0 # Type might change
for i in 1:10
result = result + x * i # Type may vary
end
return result
end
```
### Formatting Rules
- Max 80 characters per line
- No trailing whitespace
- No spurious blank lines
- Use JuliaFormatter.jl for consistent formatting
## Documentation Standards
### Docstring Syntax
Use `@doc` with either raw strings or regular strings:
```julia
# For simple docstrings without LaTeX or templates
@doc "
Brief description of the function.
# Arguments
- `x`: Description of x
- `y`: Description of y
# Returns
- Description of return value
# Examples
```jldoctest
julia> my_function(1, 2)
3
```
"
function my_function(x, y)
return x + y
end
# For docstrings with LaTeX math
@doc raw"
Computes the mathematical function:
``f(x) = \int_0^x t^2 dt``
Use raw strings when including LaTeX to preserve backslashes.
"
function math_function(x)
# implementation
end
```
### DocStringExtensions Templates
**IMPORTANT**: Template expansion rules:
- Use `@doc "` (regular string) for templates (allows expansion)
- Use `@doc """` with escaped backslashes when combining templates with LaTeX
- **NEVER** use `@doc raw"` with templates (prevents expansion)
```julia
using DocStringExtensions
# Good - template will expand
@doc "
$(TYPEDSIGNATURES)
Brief description.
# Fields
$(TYPEDFIELDS)
"
struct MyType
"Field description"
field::Int
end
# Good - template + LaTeX with escaped backslashes
@doc """
\$(TYPEDSIGNATURES)
Computes: ``f(x) = \\int_0^x t^2 dt``
Note the escaped backslashes in LaTeX: \\int, not \int
"""
function combined_function(x)
# implementation
end
# Avoid - raw string prevents template expansion
@doc raw"
$(TYPEDSIGNATURES) # This will NOT expand!
"
```
### Documentation Structure Best Practices
- Keep interface method docstrings concise (1-2 lines)
- Use "See also" sections for cross-references
- Avoid duplication between related functions (pdf/logpdf, cdf/logcdf)
- Include mathematical formulations in main type/constructor docstrings
- Provide minimal but sufficient examples using `@example` blocks
**Cross-referencing:**
```julia
@doc "
Compute the cumulative distribution function.
See also: [`logcdf`](@ref)
"
function cdf(d::MyDist, x::Real)
# implementation
end
@doc "
Compute the log cumulative distribution function.
See also: [`cdf`](@ref)
"
function logcdf(d::MyDist, x::Real)
# implementation
end
```
## Package Structure
Typical Julia package structure:
```
MyPackage.jl/
├── src/
│ ├── MyPackage.jl # Main module file with exports
│ ├── component1.jl # Component implementations
│ ├── component2.jl
│ ├── docstrings.jl # DocStringExtensions templates
│ └── utils/
├── test/
│ ├── runtests.jl # Main test file
│ ├── component1/ # Tests by component
│ ├── component2/
│ └── package/ # Quality tests (Aqua, formatting)
├── docs/
│ ├── make.jl # Documentation build script
│ ├── src/ # Documentation source
│ └── pages.jl # Page structure (optional)
├── Project.toml # Package dependencies
└── README.md
```
## Performance Best Practices
### Type Stability
```julia
# Check type stability with @code_warntype
@code_warntype my_function(args...)
# Look for red (Any) types - indicates type instability
```
### Precompilation
```julia
# Ensure efficient precompilation
# Use PrecompileTools.jl for complex packages
using PrecompileTools
@compile_workload begin
# Representative workload for precompilation
my_function(example_args...)
end
```
### Performance Patterns
- Use in-place operations when possible (`!` suffix convention)
- Preallocate arrays for loops
- Use `@simd`, `@inbounds` when safe
- Consider `StaticArrays.jl` for small fixed-size arrays
- Profile with `@time`, `@benchmark` (BenchmarkTools.jl)
## Common Dependencies and Patterns
### Distributions.jl Interface
When implementing distributions:
- Implement required methods: `pdf`, `logpdf`, `cdf`, `logcdf`, `quantile`, `rand`
- Implement support methods: `minimum`, `maximum`, `insupport`
- Optionally implement: `mean`, `var`, `std` (if analytically tractable)
- Vectorization handled automatically via broadcasting
- Consider specialized batch methods: `pdf!`, `logpdf!`, `cdf!`
### Turing.jl and AD Compatibility
Ensure compatibility with automatic differentiation:
- ForwardDiff.jl
- ReverseDiff.jl
- Zygote.jl
- Enzyme.jl
Avoid non-differentiable operations in AD-sensitive code.
## Common Julia Ecosystem Tools
- **Pkg**: Package management
- **TestItemRunner**: Modern testing framework
- **Documenter.jl**: Documentation generation
- **DocStringExtensions**: Documentation templates
- **JuliaFormatter.jl**: Code formatting
- **Aqua.jl**: Package quality testing
- **BenchmarkTools.jl**: Performance benchmarking
- **PrecompileTools.jl**: Precompilation optimization
## When to Use This Skill
Activate this skill when:
- Developing Julia packageRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.