scipy-best-practices
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Best practices for SciPy scientific computing, optimization, signal processing, and statistical analysis in Python
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
38 rules. About 0 are common, 14 are distinctive, and 24 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
24
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Write concise, technical Python code with accurate SciPy examples
- Distinctive: line 14
Use functional programming patterns for mathematical operations
- Distinctive: line 15
Prefer vectorized operations over explicit loops
- Distinctive: line 16
Use descriptive variable names reflecting scientific context
- Distinctive: line 17
Follow PEP 8 style guidelines
- Very specific: line 21
Use scipy.optimize.minimize() for general-purpose optimization
- Very specific: line 28
Use scipy.optimize.curve_fit() for nonlinear least squares fitting
- Very specific: line 29
Use scipy.optimize.root() for finding roots of equations
- Very specific: line 33
Prefer scipy.linalg over numpy.linalg for additional functionality
- Very specific: line 34
Use scipy.linalg.solve() instead of computing matrix inverse
- Very specific: line 36
Use scipy.linalg.lu_factor() and lu_solve() for multiple right-hand sides
- Very specific: line 37
Use sparse matrix solvers from scipy.sparse.linalg for large sparse systems
- Distinctive: line 41
Use distribution objects for probability calculations
- Very specific: line 43
Use hypothesis testing functions: ttest_ind(), chi2_contingency(), mannwhitneyu()
- Very specific: line 45
Use .fit() for parameter estimation from data
- Very specific: line 49
Use scipy.interpolate.interp1d() for 1D interpolation
- Very specific: line 50
Use scipy.interpolate.griddata() for scattered data interpolation
- Very specific: line 52
Use spline functions for smooth interpolation: UnivariateSpline, BSpline
- Very specific: line 53
Consider RegularGridInterpolator for regular grid data
- Very specific: line 57
Use scipy.integrate.quad() for single integrals
- Very specific: line 58
Use scipy.integrate.dblquad(), tplquad() for multiple integrals
- Very specific: line 59
Use scipy.integrate.solve_ivp() for ordinary differential equations
- Very specific: line 65
Use scipy.signal.butter(), cheby1(), ellip() for filter design
- Very specific: line 67
Use scipy.signal.welch() for power spectral density estimation
- Very specific: line 68
Use scipy.signal.find_peaks() for peak detection
- Distinctive: line 73
Use appropriate sparse format for your use case:
- Very specific: line 79
Use scipy.sparse.linalg solvers for sparse linear systems
- Very specific: line 83
Use appropriate data types (float64 for precision, float32 for memory)
- Distinctive: line 86
Use in-place operations when available
- Distinctive: line 90
Check convergence status of optimization routines
- Distinctive: line 93
Use appropriate tolerances for convergence criteria
- Distinctive: line 97
Test against known analytical solutions
- Very specific: line 98
Use np.testing.assert_allclose() for numerical comparisons
- Distinctive: line 99
Test edge cases and boundary conditions
- Distinctive: line 100
Verify conservation laws and invariants
- Very specific: line 104
Import specific submodules: from scipy import optimize, stats, linalg
- Very specific: line 105
Use snake_case for variables and functions
- Distinctive: line 106
Document algorithm choices and parameters
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SciPy Best Practices
Expert guidelines for SciPy development, focusing on scientific computing, optimization, signal processing, and statistical analysis.
Code Style and Structure
- Write concise, technical Python code with accurate SciPy examples
- Prioritize numerical accuracy and computational efficiency
- Use functional programming patterns for mathematical operations
- Prefer vectorized operations over explicit loops
- Use descriptive variable names reflecting scientific context
- Follow PEP 8 style guidelines
scipy.optimize - Optimization
- Use
scipy.optimize.minimize()for general-purpose optimization - Choose appropriate method based on problem characteristics:
'BFGS'for smooth, unconstrained problems'L-BFGS-B'for bounded problems'SLSQP'for constrained optimization'Nelder-Mead'for non-differentiable functions
- Provide gradients when available for faster convergence
- Use
scipy.optimize.curve_fit()for nonlinear least squares fitting - Use
scipy.optimize.root()for finding roots of equations
scipy.linalg - Linear Algebra
- Prefer
scipy.linalgovernumpy.linalgfor additional functionality - Use
scipy.linalg.solve()instead of computing matrix inverse - Leverage specialized solvers for structured matrices (banded, triangular)
- Use
scipy.linalg.lu_factor()andlu_solve()for multiple right-hand sides - Use sparse matrix solvers from
scipy.sparse.linalgfor large sparse systems
scipy.stats - Statistics
- Use distribution objects for probability calculations
- Leverage
scipy.stats.describe()for summary statistics - Use hypothesis testing functions:
ttest_ind(),chi2_contingency(),mannwhitneyu() - Generate random samples with
.rvs()method on distributions - Use
.fit()for parameter estimation from data
scipy.interpolate - Interpolation
- Use
scipy.interpolate.interp1d()for 1D interpolation - Use
scipy.interpolate.griddata()for scattered data interpolation - Choose appropriate interpolation method: 'linear', 'cubic', 'nearest'
- Use spline functions for smooth interpolation:
UnivariateSpline,BSpline - Consider
RegularGridInterpolatorfor regular grid data
scipy.integrate - Integration
- Use
scipy.integrate.quad()for single integrals - Use
scipy.integrate.dblquad(),tplquad()for multiple integrals - Use
scipy.integrate.solve_ivp()for ordinary differential equations - Choose appropriate ODE method: 'RK45', 'BDF', 'LSODA'
- Provide Jacobian for stiff systems to improve performance
scipy.signal - Signal Processing
- Use
scipy.signal.butter(),cheby1(),ellip()for filter design - Apply filters with
scipy.signal.filtfilt()for zero-phase filtering - Use
scipy.signal.welch()for power spectral density estimation - Use
scipy.signal.find_peaks()for peak detection - Leverage
scipy.signal.convolve()andcorrelate()for convolution
scipy.sparse - Sparse Matrices
- Use appropriate sparse format for your use case:
csr_matrixfor efficient row slicing and matrix-vector productscsc_matrixfor efficient column slicingcoo_matrixfor constructing sparse matriceslil_matrixfor incremental construction
- Convert to optimal format before operations
- Use
scipy.sparse.linalgsolvers for sparse linear systems
Performance Optimization
- Use appropriate data types (
float64for precision,float32for memory) - Leverage BLAS/LAPACK through SciPy for optimized linear algebra
- Pre-allocate arrays when possible
- Use in-place operations when available
Error Handling and Validation
- Check convergence status of optimization routines
- Validate numerical results for reasonableness
- Handle ill-conditioned problems gracefully
- Use appropriate tolerances for convergence criteria
Testing Scientific Code
- Test against known analytical solutions
- Use
np.testing.assert_allclose()for numerical comparisons - Test edge cases and boundary conditions
- Verify conservation laws and invariants
Key Conventions
- Import specific submodules:
from scipy import optimize, stats, linalg - Use
snake_casefor variables and functions - Document algorithm choices and parameters
- Include convergence diagnostics in output
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
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.

