Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Select and apply numerical differentiation schemes for PDE/ODE discretization. Use when choosing finite difference/volume/spectral schemes, building stencils, handling boundaries, estimating truncation error, or analyzing dispersion and dissipation.
.claude/skills/differentiation-schemes/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | — | — |
| case-16 | ✗→✓ | ▲ Improved | — | — |
| case-03 | ✗→✓ | ▲ Improved | — | — |
| case-08 | ✗→✓ | ▲ Improved | — | — |
| case-15 | ✗→✓ | ▲ Improved | — | — |
Provide a reliable workflow to select a differentiation scheme, generate stencils, and assess accuracy for simulation discretization.
| Input | Description | Example | |-------|-------------|---------| | Derivative order | First, second, etc. | 1 or 2 | | Target accuracy | Order of truncation error | 2 or 4 | | Grid type | Uniform, nonuniform | uniform | | Boundary type | Periodic, Dirichlet, Neumann | periodic | | Smoothness | Smooth or discontinuous | smooth |
Is the field smooth?
├── YES → Is domain periodic?
│ ├── YES → Use central differences or spectral
│ └── NO → Use central interior + one-sided at boundaries
└── NO → Are there shocks/discontinuities?
├── YES → Use upwind, TVD, or WENO
└── NO → Use central with limiters| Situation | Recommended Scheme | |-----------|-------------------| | Smooth, periodic | Central, spectral | | Smooth, bounded | Central + one-sided BCs | | Advection-dominated | Upwind | | Shocks/fronts | TVD, WENO | | High accuracy needed | Compact (Padé), spectral |
| Script | Key Outputs | |--------|-------------| | scripts/stencil_generator.py | offsets, coefficients, order, accuracy | | scripts/scheme_selector.py | recommended, alternatives, notes | | scripts/truncation_error.py | error_scale, order, notes |
scripts/scheme_selector.pyscripts/stencil_generator.pyscripts/truncation_error.pyUser: I need to discretize a second derivative for a diffusion equation on a uniform grid. I want 4th-order accuracy.
Agent workflow:
bash python3 scripts/scheme_selector.py --smooth --periodic --order 2 --accuracy 4 --json
bash python3 scripts/stencil_generator.py --order 2 --accuracy 4 --scheme central --json
[-1/12, 4/3, -5/2, 4/3, -1/12] / dx².bash# Select scheme for smooth periodic problem python3 scripts/scheme_selector.py --smooth --periodic --order 1 --accuracy 4 --json # Generate central difference stencil for first derivative python3 scripts/stencil_generator.py --order 1 --accuracy 2 --scheme central --json # Generate 4th-order second derivative stencil python3 scripts/stencil_generator.py --order 2 --accuracy 4 --scheme central --json # Estimate truncation error python3 scripts/truncation_error.py --dx 0.01 --order 2 --accuracy 2 --scale 1.0 --json
| Error | Cause | Resolution | |-------|-------|------------| | order must be positive | Invalid derivative order | Use 1, 2, 3, ... | | accuracy must be even for central | Odd accuracy requested | Use 2, 4, 6, ... | | Unknown scheme | Invalid scheme type | Use central, upwind, compact |
| Property | Meaning | |----------|---------| | Symmetric offsets | Central scheme (no directional bias) | | Asymmetric offsets | One-sided or upwind scheme | | More points | Higher accuracy but wider stencil |
| Accuracy Order | Error Scales As | Refinement Factor | |----------------|-----------------|-------------------| | 2nd order | O(dx²) | 2× refinement → 4× error reduction | | 4th order | O(dx⁴) | 2× refinement → 16× error reduction | | 6th order | O(dx⁶) | 2× refinement → 64× error reduction |
| Derivative | Accuracy | Points | Coefficients (× 1/dx or 1/dx²) | |------------|----------|--------|-------------------------------| | 1st | 2 | 3 | -1/2, 0, 1/2] | | 1st | 4 | 5 | 1/12, -2/3, 0, 2/3, -1/12] | | 2nd | 2 | 3 | 1, -2, 1] | | 2nd | 4 | 5 | -1/12, 4/3, -5/2, 4/3, -1/12] |
references/stencil_catalog.md - Common stencilsreferences/boundary_handling.md - One-sided schemesreferences/scheme_selection.md - FD/FV/spectral comparisonreferences/error_guidance.md - Truncation error scaling| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +41 percentage points is the difference between those two pass rates over the 21 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.