@elizaos/skills 2.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/package.json +53 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +96 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/bird/SKILL.md +224 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +203 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +284 -0
- package/skills/discord/SKILL.md +578 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/food-order/SKILL.md +48 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +77 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +74 -0
- package/skills/local-places/SERVER_README.md +101 -0
- package/skills/local-places/SKILL.md +102 -0
- package/skills/local-places/pyproject.toml +21 -0
- package/skills/local-places/src/local_places/__init__.py +2 -0
- package/skills/local-places/src/local_places/google_places.py +314 -0
- package/skills/local-places/src/local_places/main.py +65 -0
- package/skills/local-places/src/local_places/schemas.py +107 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +310 -0
- package/skills/nano-banana-pro/SKILL.md +58 -0
- package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/notion/SKILL.md +172 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-image-gen/SKILL.md +89 -0
- package/skills/openai-image-gen/scripts/gen.py +240 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +52 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
- package/skills/openhue/SKILL.md +51 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/security-ask-questions-if-underspecified/.claude-plugin/plugin.json +10 -0
- package/skills/security-ask-questions-if-underspecified/README.md +24 -0
- package/skills/security-ask-questions-if-underspecified/skills/ask-questions-if-underspecified/SKILL.md +85 -0
- package/skills/security-audit-context-building/.claude-plugin/plugin.json +10 -0
- package/skills/security-audit-context-building/README.md +58 -0
- package/skills/security-audit-context-building/commands/audit-context.md +21 -0
- package/skills/security-audit-context-building/skills/audit-context-building/SKILL.md +297 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/COMPLETENESS_CHECKLIST.md +47 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/FUNCTION_MICRO_ANALYSIS_EXAMPLE.md +355 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/OUTPUT_REQUIREMENTS.md +71 -0
- package/skills/security-building-secure-contracts/.claude-plugin/plugin.json +10 -0
- package/skills/security-building-secure-contracts/README.md +241 -0
- package/skills/security-building-secure-contracts/skills/algorand-vulnerability-scanner/SKILL.md +284 -0
- package/skills/security-building-secure-contracts/skills/algorand-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +405 -0
- package/skills/security-building-secure-contracts/skills/audit-prep-assistant/SKILL.md +409 -0
- package/skills/security-building-secure-contracts/skills/cairo-vulnerability-scanner/SKILL.md +329 -0
- package/skills/security-building-secure-contracts/skills/cairo-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +722 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/SKILL.md +218 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/ASSESSMENT_CRITERIA.md +355 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/EXAMPLE_REPORT.md +248 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/REPORT_FORMAT.md +33 -0
- package/skills/security-building-secure-contracts/skills/cosmos-vulnerability-scanner/SKILL.md +334 -0
- package/skills/security-building-secure-contracts/skills/cosmos-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +740 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/SKILL.md +252 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/ASSESSMENT_AREAS.md +329 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/DELIVERABLES.md +118 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/EXAMPLE_REPORT.md +298 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/SKILL.md +161 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/resources/EXAMPLE_REPORT.md +279 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/resources/WORKFLOW_STEPS.md +132 -0
- package/skills/security-building-secure-contracts/skills/solana-vulnerability-scanner/SKILL.md +389 -0
- package/skills/security-building-secure-contracts/skills/solana-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +669 -0
- package/skills/security-building-secure-contracts/skills/substrate-vulnerability-scanner/SKILL.md +298 -0
- package/skills/security-building-secure-contracts/skills/substrate-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +791 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/SKILL.md +362 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/resources/ASSESSMENT_CATEGORIES.md +571 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/resources/REPORT_TEMPLATES.md +141 -0
- package/skills/security-building-secure-contracts/skills/ton-vulnerability-scanner/SKILL.md +388 -0
- package/skills/security-building-secure-contracts/skills/ton-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +595 -0
- package/skills/security-burpsuite-project-parser/.claude-plugin/plugin.json +10 -0
- package/skills/security-burpsuite-project-parser/README.md +103 -0
- package/skills/security-burpsuite-project-parser/commands/burp-search.md +18 -0
- package/skills/security-burpsuite-project-parser/skills/SKILL.md +358 -0
- package/skills/security-burpsuite-project-parser/skills/scripts/burp-search.sh +99 -0
- package/skills/security-claude-in-chrome-troubleshooting/.claude-plugin/plugin.json +8 -0
- package/skills/security-claude-in-chrome-troubleshooting/README.md +31 -0
- package/skills/security-claude-in-chrome-troubleshooting/skills/claude-in-chrome-troubleshooting/SKILL.md +251 -0
- package/skills/security-constant-time-analysis/.claude-plugin/plugin.json +9 -0
- package/skills/security-constant-time-analysis/README.md +381 -0
- package/skills/security-constant-time-analysis/commands/ct-check.md +20 -0
- package/skills/security-constant-time-analysis/ct_analyzer/__init__.py +49 -0
- package/skills/security-constant-time-analysis/ct_analyzer/analyzer.py +1284 -0
- package/skills/security-constant-time-analysis/ct_analyzer/script_analyzers.py +3081 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/__init__.py +1 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_analyzer.py +1397 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/bn_excerpt.js +205 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/decompose_constant_time.c +181 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/decompose_vulnerable.c +74 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/decompose_vulnerable.go +78 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/decompose_vulnerable.rs +92 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.cs +174 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.java +161 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.kt +181 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.php +140 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.py +252 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.rb +188 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.swift +199 -0
- package/skills/security-constant-time-analysis/ct_analyzer/tests/test_samples/vulnerable.ts +154 -0
- package/skills/security-constant-time-analysis/pyproject.toml +52 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/README.md +90 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/SKILL.md +219 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/compiled.md +129 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/javascript.md +136 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/kotlin.md +252 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/php.md +172 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/python.md +179 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/ruby.md +198 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/swift.md +288 -0
- package/skills/security-constant-time-analysis/skills/constant-time-analysis/references/vm-compiled.md +354 -0
- package/skills/security-constant-time-analysis/uv.lock +8 -0
- package/skills/security-culture-index/.claude-plugin/plugin.json +8 -0
- package/skills/security-culture-index/README.md +79 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/SKILL.md +293 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/anti-patterns.md +255 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/conversation-starters.md +408 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/interview-trait-signals.md +253 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/motivators.md +158 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/patterns-archetypes.md +147 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/primary-traits.md +307 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/secondary-traits.md +228 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/references/team-composition.md +148 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/check_deps.py +108 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/culture_index/__init__.py +20 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/culture_index/constants.py +122 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/culture_index/extract.py +187 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/culture_index/models.py +16 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/culture_index/opencv_extractor.py +520 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/extract_pdf.py +237 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/scripts/pyproject.toml +18 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/burnout-report.md +113 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/comparison-report.md +103 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/hiring-profile.md +127 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/individual-report.md +85 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/predicted-profile.md +165 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/templates/team-report.md +109 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/analyze-team.md +188 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/coach-manager.md +267 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/compare-profiles.md +188 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/define-hiring-profile.md +220 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/detect-burnout.md +206 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/extract-from-pdf.md +121 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/interpret-individual.md +183 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/interview-debrief.md +234 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/mediate-conflict.md +306 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/plan-onboarding.md +322 -0
- package/skills/security-culture-index/skills/interpreting-culture-index/workflows/predict-from-interview.md +250 -0
- package/skills/security-differential-review/.claude-plugin/plugin.json +10 -0
- package/skills/security-differential-review/README.md +109 -0
- package/skills/security-differential-review/commands/diff-review.md +21 -0
- package/skills/security-differential-review/skills/differential-review/SKILL.md +220 -0
- package/skills/security-differential-review/skills/differential-review/adversarial.md +203 -0
- package/skills/security-differential-review/skills/differential-review/methodology.md +234 -0
- package/skills/security-differential-review/skills/differential-review/patterns.md +300 -0
- package/skills/security-differential-review/skills/differential-review/reporting.md +369 -0
- package/skills/security-dwarf-expert/.claude-plugin/plugin.json +10 -0
- package/skills/security-dwarf-expert/README.md +38 -0
- package/skills/security-dwarf-expert/skills/dwarf-expert/SKILL.md +93 -0
- package/skills/security-dwarf-expert/skills/dwarf-expert/reference/coding.md +31 -0
- package/skills/security-dwarf-expert/skills/dwarf-expert/reference/dwarfdump.md +50 -0
- package/skills/security-dwarf-expert/skills/dwarf-expert/reference/readelf.md +8 -0
- package/skills/security-entry-point-analyzer/.claude-plugin/plugin.json +10 -0
- package/skills/security-entry-point-analyzer/README.md +74 -0
- package/skills/security-entry-point-analyzer/commands/entry-points.md +18 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/SKILL.md +251 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/cosmwasm.md +182 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/move-aptos.md +107 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/move-sui.md +87 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/solana.md +155 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/solidity.md +135 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/ton.md +185 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/vyper.md +141 -0
- package/skills/security-firebase-apk-scanner/.claude-plugin/plugin.json +10 -0
- package/skills/security-firebase-apk-scanner/README.md +85 -0
- package/skills/security-firebase-apk-scanner/commands/scan-apk.md +18 -0
- package/skills/security-firebase-apk-scanner/scanner.sh +1408 -0
- package/skills/security-firebase-apk-scanner/skills/firebase-apk-scanner/SKILL.md +197 -0
- package/skills/security-firebase-apk-scanner/skills/firebase-apk-scanner/references/vulnerabilities.md +803 -0
- package/skills/security-fix-review/.claude-plugin/plugin.json +13 -0
- package/skills/security-fix-review/README.md +118 -0
- package/skills/security-fix-review/commands/fix-review.md +24 -0
- package/skills/security-fix-review/skills/fix-review/SKILL.md +264 -0
- package/skills/security-fix-review/skills/fix-review/references/bug-detection.md +408 -0
- package/skills/security-fix-review/skills/fix-review/references/finding-matching.md +298 -0
- package/skills/security-fix-review/skills/fix-review/references/report-parsing.md +398 -0
- package/skills/security-insecure-defaults/.claude-plugin/plugin.json +10 -0
- package/skills/security-insecure-defaults/README.md +45 -0
- package/skills/security-insecure-defaults/skills/insecure-defaults/SKILL.md +117 -0
- package/skills/security-insecure-defaults/skills/insecure-defaults/references/examples.md +409 -0
- package/skills/security-modern-python/.claude-plugin/plugin.json +10 -0
- package/skills/security-modern-python/README.md +58 -0
- package/skills/security-modern-python/hooks/hooks.json +16 -0
- package/skills/security-modern-python/hooks/intercept-legacy-python.bats +388 -0
- package/skills/security-modern-python/hooks/intercept-legacy-python.sh +109 -0
- package/skills/security-modern-python/hooks/test_helper.bash +75 -0
- package/skills/security-modern-python/skills/modern-python/SKILL.md +333 -0
- package/skills/security-modern-python/skills/modern-python/references/dependabot.md +43 -0
- package/skills/security-modern-python/skills/modern-python/references/migration-checklist.md +141 -0
- package/skills/security-modern-python/skills/modern-python/references/pep723-scripts.md +259 -0
- package/skills/security-modern-python/skills/modern-python/references/prek.md +211 -0
- package/skills/security-modern-python/skills/modern-python/references/pyproject.md +254 -0
- package/skills/security-modern-python/skills/modern-python/references/ruff-config.md +240 -0
- package/skills/security-modern-python/skills/modern-python/references/security-setup.md +255 -0
- package/skills/security-modern-python/skills/modern-python/references/testing.md +284 -0
- package/skills/security-modern-python/skills/modern-python/references/uv-commands.md +200 -0
- package/skills/security-modern-python/skills/modern-python/templates/dependabot.yml +36 -0
- package/skills/security-modern-python/skills/modern-python/templates/pre-commit-config.yaml +66 -0
- package/skills/security-property-based-testing/.claude-plugin/plugin.json +9 -0
- package/skills/security-property-based-testing/README.md +47 -0
- package/skills/security-property-based-testing/skills/property-based-testing/README.md +88 -0
- package/skills/security-property-based-testing/skills/property-based-testing/SKILL.md +109 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/design.md +191 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/generating.md +200 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/libraries.md +130 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/refactoring.md +181 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/reviewing.md +209 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/strategies.md +124 -0
- package/skills/semgrep-rule-creator/.claude-plugin/plugin.json +8 -0
- package/skills/semgrep-rule-creator/README.md +43 -0
- package/skills/semgrep-rule-creator/commands/semgrep-rule.md +26 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/SKILL.md +168 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/references/quick-reference.md +203 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/references/workflow.md +240 -0
- package/skills/semgrep-rule-variant-creator/.claude-plugin/plugin.json +9 -0
- package/skills/semgrep-rule-variant-creator/README.md +86 -0
- package/skills/semgrep-rule-variant-creator/skills/semgrep-rule-variant-creator/SKILL.md +205 -0
- package/skills/semgrep-rule-variant-creator/skills/semgrep-rule-variant-creator/references/applicability-analysis.md +250 -0
- package/skills/semgrep-rule-variant-creator/skills/semgrep-rule-variant-creator/references/language-syntax-guide.md +324 -0
- package/skills/semgrep-rule-variant-creator/skills/semgrep-rule-variant-creator/references/workflow.md +518 -0
- package/skills/session-logs/SKILL.md +115 -0
- package/skills/sharp-edges/.claude-plugin/plugin.json +10 -0
- package/skills/sharp-edges/README.md +48 -0
- package/skills/sharp-edges/skills/sharp-edges/SKILL.md +292 -0
- package/skills/sharp-edges/skills/sharp-edges/references/auth-patterns.md +252 -0
- package/skills/sharp-edges/skills/sharp-edges/references/case-studies.md +274 -0
- package/skills/sharp-edges/skills/sharp-edges/references/config-patterns.md +333 -0
- package/skills/sharp-edges/skills/sharp-edges/references/crypto-apis.md +190 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-c.md +205 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-csharp.md +285 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-go.md +270 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-java.md +263 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-javascript.md +269 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-kotlin.md +265 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-php.md +245 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-python.md +274 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-ruby.md +273 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-rust.md +272 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-swift.md +287 -0
- package/skills/sharp-edges/skills/sharp-edges/references/language-specific.md +588 -0
- package/skills/sherpa-onnx-tts/SKILL.md +103 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +370 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +111 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +46 -0
- package/skills/spec-to-code-compliance/.claude-plugin/plugin.json +10 -0
- package/skills/spec-to-code-compliance/README.md +67 -0
- package/skills/spec-to-code-compliance/commands/spec-compliance.md +22 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.md +349 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/COMPLETENESS_CHECKLIST.md +69 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/IR_EXAMPLES.md +417 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/OUTPUT_REQUIREMENTS.md +105 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/static-analysis/.claude-plugin/plugin.json +8 -0
- package/skills/static-analysis/README.md +59 -0
- package/skills/static-analysis/skills/codeql/SKILL.md +315 -0
- package/skills/static-analysis/skills/sarif-parsing/SKILL.md +479 -0
- package/skills/static-analysis/skills/sarif-parsing/resources/jq-queries.md +162 -0
- package/skills/static-analysis/skills/sarif-parsing/resources/sarif_helpers.py +331 -0
- package/skills/static-analysis/skills/semgrep/SKILL.md +337 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/testing-handbook-skills/.claude-plugin/plugin.json +8 -0
- package/skills/testing-handbook-skills/README.md +241 -0
- package/skills/testing-handbook-skills/scripts/pyproject.toml +8 -0
- package/skills/testing-handbook-skills/scripts/validate-skills.py +657 -0
- package/skills/testing-handbook-skills/skills/address-sanitizer/SKILL.md +341 -0
- package/skills/testing-handbook-skills/skills/aflpp/SKILL.md +640 -0
- package/skills/testing-handbook-skills/skills/atheris/SKILL.md +515 -0
- package/skills/testing-handbook-skills/skills/cargo-fuzz/SKILL.md +454 -0
- package/skills/testing-handbook-skills/skills/codeql/SKILL.md +549 -0
- package/skills/testing-handbook-skills/skills/constant-time-testing/SKILL.md +507 -0
- package/skills/testing-handbook-skills/skills/coverage-analysis/SKILL.md +607 -0
- package/skills/testing-handbook-skills/skills/fuzzing-dictionary/SKILL.md +297 -0
- package/skills/testing-handbook-skills/skills/fuzzing-obstacles/SKILL.md +426 -0
- package/skills/testing-handbook-skills/skills/harness-writing/SKILL.md +614 -0
- package/skills/testing-handbook-skills/skills/libafl/SKILL.md +625 -0
- package/skills/testing-handbook-skills/skills/libfuzzer/SKILL.md +795 -0
- package/skills/testing-handbook-skills/skills/ossfuzz/SKILL.md +426 -0
- package/skills/testing-handbook-skills/skills/ruzzy/SKILL.md +443 -0
- package/skills/testing-handbook-skills/skills/semgrep/SKILL.md +601 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/SKILL.md +372 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/agent-prompt.md +280 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/discovery.md +452 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/domain-skill.md +504 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/fuzzer-skill.md +454 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/technique-skill.md +527 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/tool-skill.md +366 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/testing.md +482 -0
- package/skills/testing-handbook-skills/skills/wycheproof/SKILL.md +533 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +135 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +95 -0
- package/skills/variant-analysis/.claude-plugin/plugin.json +8 -0
- package/skills/variant-analysis/README.md +41 -0
- package/skills/variant-analysis/commands/variants.md +23 -0
- package/skills/variant-analysis/skills/variant-analysis/METHODOLOGY.md +327 -0
- package/skills/variant-analysis/skills/variant-analysis/SKILL.md +142 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/cpp.ql +119 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/go.ql +69 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/java.ql +71 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/javascript.ql +63 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/python.ql +80 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/cpp.yaml +98 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/go.yaml +63 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/java.yaml +61 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/javascript.yaml +60 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/python.yaml +72 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/variant-report-template.md +75 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +54 -0
- package/skills/yara-authoring/.claude-plugin/plugin.json +9 -0
- package/skills/yara-authoring/README.md +131 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/SKILL.md +645 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/examples/MAL_Mac_ProtonRAT_Jan25.yar +99 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/examples/MAL_NPM_SupplyChain_Jan25.yar +170 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/examples/MAL_Win_Remcos_Jan25.yar +103 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/examples/SUSP_CRX_SuspiciousPermissions.yar +134 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/examples/SUSP_JS_Obfuscation_Jan25.yar +185 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/crx-module.md +214 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/dex-module.md +383 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/performance.md +333 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/strings.md +433 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/style-guide.md +257 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/references/testing.md +399 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/scripts/atom_analyzer.py +526 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/scripts/pyproject.toml +25 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/scripts/yara_lint.py +631 -0
- package/skills/yara-authoring/skills/yara-rule-authoring/workflows/rule-development.md +493 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Property-Based Testing Skill
|
|
2
|
+
|
|
3
|
+
A Claude Code skill that provides guidance for property-based testing (PBT) across multiple programming languages and smart contract development.
|
|
4
|
+
|
|
5
|
+
## What This Skill Does
|
|
6
|
+
|
|
7
|
+
When activated, this skill helps Claude:
|
|
8
|
+
|
|
9
|
+
- **Detect PBT opportunities** - Recognizes patterns like encode/decode pairs, validators, normalizers, pure functions, and smart contract invariants
|
|
10
|
+
- **Generate property-based tests** - Creates tests with appropriate strategies, properties, and edge cases
|
|
11
|
+
- **Review existing PBT tests** - Identifies issues like tautological properties, vacuous tests, and weak assertions
|
|
12
|
+
- **Design with properties** - Uses Property-Driven Development to define specifications before implementation
|
|
13
|
+
- **Refactor for testability** - Suggests code changes that enable stronger property testing
|
|
14
|
+
|
|
15
|
+
## Supported Languages
|
|
16
|
+
|
|
17
|
+
| Language | Library | Notes |
|
|
18
|
+
|----------|---------|-------|
|
|
19
|
+
| Python | Hypothesis | |
|
|
20
|
+
| JavaScript/TypeScript | fast-check | |
|
|
21
|
+
| Rust | proptest | Also: quickcheck |
|
|
22
|
+
| Go | rapid | Also: gopter |
|
|
23
|
+
| Java | jqwik | |
|
|
24
|
+
| Scala | ScalaCheck | |
|
|
25
|
+
| C# | FsCheck | |
|
|
26
|
+
| Elixir | StreamData | |
|
|
27
|
+
| Haskell | QuickCheck | Also: Hedgehog |
|
|
28
|
+
| Clojure | test.check | |
|
|
29
|
+
| Ruby | PropCheck | |
|
|
30
|
+
| Kotlin | Kotest | |
|
|
31
|
+
| Swift | SwiftCheck | Unmaintained |
|
|
32
|
+
| C++ | RapidCheck | |
|
|
33
|
+
|
|
34
|
+
### Smart Contract Testing
|
|
35
|
+
|
|
36
|
+
| Tool | Platform | Description |
|
|
37
|
+
|------|----------|-------------|
|
|
38
|
+
| Echidna | EVM/Solidity | Property-based fuzzer |
|
|
39
|
+
| Medusa | EVM/Solidity | Next-gen parallel fuzzer |
|
|
40
|
+
|
|
41
|
+
See [secure-contracts.com](https://secure-contracts.com) for tutorials.
|
|
42
|
+
|
|
43
|
+
## File Structure
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
property-based-testing/
|
|
47
|
+
├── SKILL.md # Entry point - detection patterns and routing
|
|
48
|
+
├── README.md # This file
|
|
49
|
+
└── references/
|
|
50
|
+
├── generating.md # How to write property-based tests
|
|
51
|
+
├── reviewing.md # How to evaluate test quality
|
|
52
|
+
├── strategies.md # Input generation reference
|
|
53
|
+
├── design.md # Property-Driven Development workflow
|
|
54
|
+
├── refactoring.md # Making code more testable
|
|
55
|
+
└── libraries.md # PBT library reference by language
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
The skill activates automatically when Claude detects relevant patterns:
|
|
61
|
+
|
|
62
|
+
- Serialization pairs (`encode`/`decode`, `serialize`/`deserialize`)
|
|
63
|
+
- Validators and normalizers
|
|
64
|
+
- Pure functions with clear input/output types
|
|
65
|
+
- Data structure operations
|
|
66
|
+
- Smart contracts (Solidity/Vyper)
|
|
67
|
+
|
|
68
|
+
You can also invoke it explicitly by asking Claude to use property-based testing.
|
|
69
|
+
|
|
70
|
+
### Example Prompts
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
"Write property-based tests for this JSON serializer"
|
|
74
|
+
"Review this Hypothesis test for quality issues"
|
|
75
|
+
"Help me design this feature using properties first"
|
|
76
|
+
"This function is hard to test - how can I refactor it?"
|
|
77
|
+
"Write Echidna invariants for this token contract"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Property Quick Reference
|
|
81
|
+
|
|
82
|
+
| Property | Pattern | Use Case |
|
|
83
|
+
|----------|---------|----------|
|
|
84
|
+
| Roundtrip | `decode(encode(x)) == x` | Serialization |
|
|
85
|
+
| Idempotence | `f(f(x)) == f(x)` | Normalization |
|
|
86
|
+
| Invariant | `property(f(x))` holds | Any transformation, smart contracts |
|
|
87
|
+
| Commutativity | `f(a,b) == f(b,a)` | Binary operations |
|
|
88
|
+
| Oracle | `new(x) == reference(x)` | Refactoring |
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: property-based-testing
|
|
3
|
+
description: Provides guidance for property-based testing across multiple languages and smart contracts. Use when writing tests, reviewing code with serialization/validation/parsing patterns, designing features, or when property-based testing would provide stronger coverage than example-based tests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Property-Based Testing Guide
|
|
7
|
+
|
|
8
|
+
Use this skill proactively during development when you encounter patterns where PBT provides stronger coverage than example-based tests.
|
|
9
|
+
|
|
10
|
+
## When to Invoke (Automatic Detection)
|
|
11
|
+
|
|
12
|
+
**Invoke this skill when you detect:**
|
|
13
|
+
|
|
14
|
+
- **Serialization pairs**: `encode`/`decode`, `serialize`/`deserialize`, `toJSON`/`fromJSON`, `pack`/`unpack`
|
|
15
|
+
- **Parsers**: URL parsing, config parsing, protocol parsing, string-to-structured-data
|
|
16
|
+
- **Normalization**: `normalize`, `sanitize`, `clean`, `canonicalize`, `format`
|
|
17
|
+
- **Validators**: `is_valid`, `validate`, `check_*` (especially with normalizers)
|
|
18
|
+
- **Data structures**: Custom collections with `add`/`remove`/`get` operations
|
|
19
|
+
- **Mathematical/algorithmic**: Pure functions, sorting, ordering, comparators
|
|
20
|
+
- **Smart contracts**: Solidity/Vyper contracts, token operations, state invariants, access control
|
|
21
|
+
|
|
22
|
+
**Priority by pattern:**
|
|
23
|
+
|
|
24
|
+
| Pattern | Property | Priority |
|
|
25
|
+
|---------|----------|----------|
|
|
26
|
+
| encode/decode pair | Roundtrip | HIGH |
|
|
27
|
+
| Pure function | Multiple | HIGH |
|
|
28
|
+
| Validator | Valid after normalize | MEDIUM |
|
|
29
|
+
| Sorting/ordering | Idempotence + ordering | MEDIUM |
|
|
30
|
+
| Normalization | Idempotence | MEDIUM |
|
|
31
|
+
| Builder/factory | Output invariants | LOW |
|
|
32
|
+
| Smart contract | State invariants | HIGH |
|
|
33
|
+
|
|
34
|
+
## When NOT to Use
|
|
35
|
+
|
|
36
|
+
Do NOT use this skill for:
|
|
37
|
+
- Simple CRUD operations without transformation logic
|
|
38
|
+
- One-off scripts or throwaway code
|
|
39
|
+
- Code with side effects that cannot be isolated (network calls, database writes)
|
|
40
|
+
- Tests where specific example cases are sufficient and edge cases are well-understood
|
|
41
|
+
- Integration or end-to-end testing (PBT is best for unit/component testing)
|
|
42
|
+
|
|
43
|
+
## Property Catalog (Quick Reference)
|
|
44
|
+
|
|
45
|
+
| Property | Formula | When to Use |
|
|
46
|
+
|----------|---------|-------------|
|
|
47
|
+
| **Roundtrip** | `decode(encode(x)) == x` | Serialization, conversion pairs |
|
|
48
|
+
| **Idempotence** | `f(f(x)) == f(x)` | Normalization, formatting, sorting |
|
|
49
|
+
| **Invariant** | Property holds before/after | Any transformation |
|
|
50
|
+
| **Commutativity** | `f(a, b) == f(b, a)` | Binary/set operations |
|
|
51
|
+
| **Associativity** | `f(f(a,b), c) == f(a, f(b,c))` | Combining operations |
|
|
52
|
+
| **Identity** | `f(x, identity) == x` | Operations with neutral element |
|
|
53
|
+
| **Inverse** | `f(g(x)) == x` | encrypt/decrypt, compress/decompress |
|
|
54
|
+
| **Oracle** | `new_impl(x) == reference(x)` | Optimization, refactoring |
|
|
55
|
+
| **Easy to Verify** | `is_sorted(sort(x))` | Complex algorithms |
|
|
56
|
+
| **No Exception** | No crash on valid input | Baseline property |
|
|
57
|
+
|
|
58
|
+
**Strength hierarchy** (weakest to strongest):
|
|
59
|
+
No Exception → Type Preservation → Invariant → Idempotence → Roundtrip
|
|
60
|
+
|
|
61
|
+
## Decision Tree
|
|
62
|
+
|
|
63
|
+
Based on the current task, read the appropriate section:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
TASK: Writing new tests
|
|
67
|
+
→ Read [{baseDir}/references/generating.md]({baseDir}/references/generating.md) (test generation patterns and examples)
|
|
68
|
+
→ Then [{baseDir}/references/strategies.md]({baseDir}/references/strategies.md) if input generation is complex
|
|
69
|
+
|
|
70
|
+
TASK: Designing a new feature
|
|
71
|
+
→ Read [{baseDir}/references/design.md]({baseDir}/references/design.md) (Property-Driven Development approach)
|
|
72
|
+
|
|
73
|
+
TASK: Code is difficult to test (mixed I/O, missing inverses)
|
|
74
|
+
→ Read [{baseDir}/references/refactoring.md]({baseDir}/references/refactoring.md) (refactoring patterns for testability)
|
|
75
|
+
|
|
76
|
+
TASK: Reviewing existing PBT tests
|
|
77
|
+
→ Read [{baseDir}/references/reviewing.md]({baseDir}/references/reviewing.md) (quality checklist and anti-patterns)
|
|
78
|
+
|
|
79
|
+
TASK: Need library reference
|
|
80
|
+
→ Read [{baseDir}/references/libraries.md]({baseDir}/references/libraries.md) (PBT libraries by language, includes smart contract tools)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## How to Suggest PBT
|
|
84
|
+
|
|
85
|
+
When you detect a high-value pattern while writing tests, **offer PBT as an option**:
|
|
86
|
+
|
|
87
|
+
> "I notice `encode_message`/`decode_message` is a serialization pair. Property-based testing with a roundtrip property would provide stronger coverage than example tests. Want me to use that approach?"
|
|
88
|
+
|
|
89
|
+
**If codebase already uses a PBT library** (Hypothesis, fast-check, proptest, Echidna), be more direct:
|
|
90
|
+
|
|
91
|
+
> "This codebase uses Hypothesis. I'll write property-based tests for this serialization pair using a roundtrip property."
|
|
92
|
+
|
|
93
|
+
**If user declines**, write good example-based tests without further prompting.
|
|
94
|
+
|
|
95
|
+
## When NOT to Use PBT
|
|
96
|
+
|
|
97
|
+
- Simple CRUD without complex validation
|
|
98
|
+
- UI/presentation logic
|
|
99
|
+
- Integration tests requiring complex external setup
|
|
100
|
+
- Prototyping where requirements are fluid
|
|
101
|
+
- User explicitly requests example-based tests only
|
|
102
|
+
|
|
103
|
+
## Red Flags
|
|
104
|
+
|
|
105
|
+
- Recommending trivial getters/setters
|
|
106
|
+
- Missing paired operations (encode without decode)
|
|
107
|
+
- Ignoring type hints (well-typed = easier to test)
|
|
108
|
+
- Overwhelming user with candidates (limit to top 5-10)
|
|
109
|
+
- Being pushy after user declines
|
package/skills/security-property-based-testing/skills/property-based-testing/references/design.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Property-Driven Development
|
|
2
|
+
|
|
3
|
+
Design features by defining properties upfront as executable specifications, before implementation.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Designing a new feature from scratch
|
|
8
|
+
- Building something with clear algebraic properties (serialization, validation, transformations)
|
|
9
|
+
- Complex domain where edge cases are likely
|
|
10
|
+
- User wants to think through requirements rigorously before coding
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
### Phase 1: Understand the Feature
|
|
15
|
+
|
|
16
|
+
Gather information:
|
|
17
|
+
- **Purpose**: What problem does this solve?
|
|
18
|
+
- **Inputs**: What data does it accept? What makes inputs valid?
|
|
19
|
+
- **Outputs**: What does it produce? What guarantees?
|
|
20
|
+
- **Constraints**: What must always be true?
|
|
21
|
+
- **Edge cases**: Boundary conditions?
|
|
22
|
+
- **Relationships**: Inverse operations? Compositions?
|
|
23
|
+
|
|
24
|
+
### Phase 2: Identify Candidate Properties
|
|
25
|
+
|
|
26
|
+
Work through these discovery questions:
|
|
27
|
+
|
|
28
|
+
| Question | Property Type | Example |
|
|
29
|
+
|----------|---------------|---------|
|
|
30
|
+
| Does it have an inverse operation? | Roundtrip | `decode(encode(x)) == x` |
|
|
31
|
+
| Is applying it twice the same as once? | Idempotence | `f(f(x)) == f(x)` |
|
|
32
|
+
| What quantities are preserved? | Invariants | Length, sum, count |
|
|
33
|
+
| Is order of arguments irrelevant? | Commutativity | `f(a, b) == f(b, a)` |
|
|
34
|
+
| Can operations be regrouped? | Associativity | `f(f(a,b), c) == f(a, f(b,c))` |
|
|
35
|
+
| Is there a neutral element? | Identity | `f(x, 0) == x` |
|
|
36
|
+
| Is there an oracle/reference impl? | Oracle | `new(x) == old(x)` |
|
|
37
|
+
| Can output be easily verified? | Hard/Easy | `is_sorted(sort(x))` |
|
|
38
|
+
|
|
39
|
+
### Phase 3: Define Input Domain
|
|
40
|
+
|
|
41
|
+
Specify valid inputs as strategies. The strategy IS the specification.
|
|
42
|
+
|
|
43
|
+
**Key principle**: Build constraints INTO the strategy, not via `assume()`.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
@st.composite
|
|
47
|
+
def valid_registration_requests(draw):
|
|
48
|
+
"""Generate valid registration requests - this documents the domain."""
|
|
49
|
+
username = draw(st.text(
|
|
50
|
+
min_size=3,
|
|
51
|
+
max_size=20,
|
|
52
|
+
alphabet=st.characters(whitelist_categories=('L', 'N'))
|
|
53
|
+
))
|
|
54
|
+
email = draw(st.emails())
|
|
55
|
+
password = draw(st.text(min_size=8, max_size=100))
|
|
56
|
+
age = draw(st.integers(min_value=13, max_value=150))
|
|
57
|
+
|
|
58
|
+
return RegistrationRequest(
|
|
59
|
+
username=username,
|
|
60
|
+
email=email,
|
|
61
|
+
password=password,
|
|
62
|
+
age=age
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Phase 4: Write Property Tests (Before Implementation)
|
|
67
|
+
|
|
68
|
+
Create tests that will fail initially:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
class TestFeatureSpec:
|
|
72
|
+
"""Property-based specification - should FAIL until implemented."""
|
|
73
|
+
|
|
74
|
+
@given(valid_inputs())
|
|
75
|
+
def test_core_property(self, x):
|
|
76
|
+
"""[What this guarantees]."""
|
|
77
|
+
result = feature(x)
|
|
78
|
+
assert property_holds(result)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Phase 5: Iterate on Design
|
|
82
|
+
|
|
83
|
+
Properties reveal design questions:
|
|
84
|
+
- "What about deleted users?"
|
|
85
|
+
- "Case-sensitive?"
|
|
86
|
+
- "Which algorithm?"
|
|
87
|
+
- "Stable sort or not?"
|
|
88
|
+
|
|
89
|
+
Surface these questions early, before implementation.
|
|
90
|
+
|
|
91
|
+
## Property Strength Hierarchy
|
|
92
|
+
|
|
93
|
+
Build properties incrementally from weak to strong:
|
|
94
|
+
|
|
95
|
+
### Level 1: Basic (Weak)
|
|
96
|
+
```python
|
|
97
|
+
@given(valid_inputs())
|
|
98
|
+
def test_no_crash(x):
|
|
99
|
+
process(x) # Just don't crash
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Level 2: Type Preservation
|
|
103
|
+
```python
|
|
104
|
+
@given(valid_inputs())
|
|
105
|
+
def test_returns_type(x):
|
|
106
|
+
assert isinstance(process(x), ExpectedType)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Level 3: Invariants
|
|
110
|
+
```python
|
|
111
|
+
@given(valid_inputs())
|
|
112
|
+
def test_invariant(x):
|
|
113
|
+
result = process(x)
|
|
114
|
+
assert invariant_holds(result)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Level 4: Full Specification (Strong)
|
|
118
|
+
```python
|
|
119
|
+
@given(valid_inputs())
|
|
120
|
+
def test_complete(x):
|
|
121
|
+
result = process(x)
|
|
122
|
+
assert satisfies_all_requirements(result)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Strategy Design Principles
|
|
126
|
+
|
|
127
|
+
### 1. Build Constraints Into Strategy
|
|
128
|
+
```python
|
|
129
|
+
# GOOD - constraints in strategy
|
|
130
|
+
@given(st.integers(min_value=1, max_value=100))
|
|
131
|
+
def test_with_valid_range(x): ...
|
|
132
|
+
|
|
133
|
+
# BAD - constraints via assume
|
|
134
|
+
@given(st.integers())
|
|
135
|
+
def test_with_assume(x):
|
|
136
|
+
assume(1 <= x <= 100) # High rejection rate
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 2. Match Real-World Constraints
|
|
140
|
+
```python
|
|
141
|
+
valid_users = st.builds(
|
|
142
|
+
User,
|
|
143
|
+
name=st.text(min_size=1, max_size=100),
|
|
144
|
+
age=st.integers(min_value=0, max_value=150),
|
|
145
|
+
email=st.emails(),
|
|
146
|
+
)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 3. Include Edge Cases Explicitly
|
|
150
|
+
```python
|
|
151
|
+
@given(valid_lists())
|
|
152
|
+
@example([]) # Empty
|
|
153
|
+
@example([1]) # Single element
|
|
154
|
+
@example([1, 1, 1]) # Duplicates
|
|
155
|
+
def test_with_edges(xs): ...
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Common Design Questions Raised
|
|
159
|
+
|
|
160
|
+
Properties often reveal design gaps:
|
|
161
|
+
|
|
162
|
+
| Property Attempt | Question Raised |
|
|
163
|
+
|------------------|-----------------|
|
|
164
|
+
| Roundtrip for users | What about deleted/deactivated users? |
|
|
165
|
+
| Duplicate rejection | Case-sensitive? Unicode normalization? |
|
|
166
|
+
| Password storage | Which algorithm? Salted? Configurable? |
|
|
167
|
+
| Ordering guarantee | Stable sort? Tie-breaking rules? |
|
|
168
|
+
|
|
169
|
+
## Red Flags
|
|
170
|
+
|
|
171
|
+
- **Writing tautological properties**: Don't reimplement the function logic in the test
|
|
172
|
+
```python
|
|
173
|
+
# BAD - tests nothing
|
|
174
|
+
assert add(a, b) == a + b
|
|
175
|
+
|
|
176
|
+
# GOOD - tests algebraic properties
|
|
177
|
+
assert add(a, 0) == a # identity
|
|
178
|
+
assert add(a, b) == add(b, a) # commutativity
|
|
179
|
+
```
|
|
180
|
+
- **Starting too strong**: Build from weak to strong properties
|
|
181
|
+
- **Ignoring design questions**: Properties that feel awkward often reveal design gaps
|
|
182
|
+
- **Overly complex strategies**: If your input strategy is 50 lines, the domain model might need simplification
|
|
183
|
+
- **Not involving the user**: Design questions should be discussed, not assumed
|
|
184
|
+
|
|
185
|
+
## Checklist
|
|
186
|
+
|
|
187
|
+
- [ ] Properties are not tautological
|
|
188
|
+
- [ ] At least one strong property defined
|
|
189
|
+
- [ ] Input strategy documents valid inputs
|
|
190
|
+
- [ ] Design questions have been surfaced
|
|
191
|
+
- [ ] Tests will actually FAIL without implementation
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Generating Property-Based Tests
|
|
2
|
+
|
|
3
|
+
How to create complete, runnable property-based tests.
|
|
4
|
+
|
|
5
|
+
## Process
|
|
6
|
+
|
|
7
|
+
### 1. Analyze Target Function
|
|
8
|
+
|
|
9
|
+
- Read function signature, types, and docstrings
|
|
10
|
+
- Understand input types and constraints
|
|
11
|
+
- Identify output type and expected behavior
|
|
12
|
+
- Note preconditions or invariants
|
|
13
|
+
- Check existing example-based tests as hints
|
|
14
|
+
|
|
15
|
+
### 2. Design Input Strategies
|
|
16
|
+
|
|
17
|
+
Create appropriate generator strategies for each input parameter.
|
|
18
|
+
|
|
19
|
+
**Principles**:
|
|
20
|
+
- Build constraints INTO the strategy, not via `assume()`
|
|
21
|
+
- Use realistic size limits to prevent slow tests
|
|
22
|
+
- Match real-world constraints
|
|
23
|
+
|
|
24
|
+
### 3. Identify Applicable Properties
|
|
25
|
+
|
|
26
|
+
| Property | When to Use | Test Pattern |
|
|
27
|
+
|----------|-------------|--------------|
|
|
28
|
+
| Roundtrip | encode/decode pairs | `assert decode(encode(x)) == x` |
|
|
29
|
+
| Idempotence | normalization, sorting | `assert f(f(x)) == f(x)` |
|
|
30
|
+
| Invariant | any transformation | `assert invariant(f(x))` |
|
|
31
|
+
| No exception | all functions (weak) | Function completes without raising |
|
|
32
|
+
| Type preservation | typed functions | `assert isinstance(f(x), ExpectedType)` |
|
|
33
|
+
| Length preservation | collections | `assert len(f(xs)) == len(xs)` |
|
|
34
|
+
| Element preservation | sorting, shuffling | `assert set(f(xs)) == set(xs)` |
|
|
35
|
+
| Ordering | sorting | `assert all(f(xs)[i] <= f(xs)[i+1] ...)` |
|
|
36
|
+
| Oracle | when reference exists | `assert f(x) == reference_impl(x)` |
|
|
37
|
+
| Commutativity | binary ops | `assert f(a, b) == f(b, a)` |
|
|
38
|
+
|
|
39
|
+
### 4. Generate Test Code
|
|
40
|
+
|
|
41
|
+
Create test functions with:
|
|
42
|
+
- Clear docstrings explaining what each property verifies
|
|
43
|
+
- Appropriate `@settings` for the context
|
|
44
|
+
- `@example` decorators for critical edge cases
|
|
45
|
+
|
|
46
|
+
### 5. Include Edge Cases
|
|
47
|
+
|
|
48
|
+
Always add explicit examples:
|
|
49
|
+
```python
|
|
50
|
+
@example([]) # Empty
|
|
51
|
+
@example([1]) # Single element
|
|
52
|
+
@example([1, 1, 1]) # Duplicates
|
|
53
|
+
@example("") # Empty string
|
|
54
|
+
@example(0) # Zero
|
|
55
|
+
@example(-1) # Negative
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Settings Recommendations
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
# Development (fast feedback)
|
|
62
|
+
@settings(max_examples=10)
|
|
63
|
+
|
|
64
|
+
# CI (thorough)
|
|
65
|
+
@settings(max_examples=200)
|
|
66
|
+
|
|
67
|
+
# Nightly/Release (exhaustive)
|
|
68
|
+
@settings(max_examples=1000, deadline=None)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Example Test Patterns
|
|
72
|
+
|
|
73
|
+
### Roundtrip (Encode/Decode)
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
@given(valid_messages())
|
|
77
|
+
def test_roundtrip(msg):
|
|
78
|
+
"""Encoding then decoding returns original."""
|
|
79
|
+
assert decode(encode(msg)) == msg
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Idempotence
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
@given(st.text())
|
|
86
|
+
def test_normalize_idempotent(s):
|
|
87
|
+
"""Normalizing twice equals normalizing once."""
|
|
88
|
+
assert normalize(normalize(s)) == normalize(s)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Sorting Properties
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
@given(st.lists(st.integers()))
|
|
95
|
+
@example([])
|
|
96
|
+
@example([1])
|
|
97
|
+
@example([1, 1, 1])
|
|
98
|
+
def test_sort(xs):
|
|
99
|
+
result = sort(xs)
|
|
100
|
+
# Length preserved
|
|
101
|
+
assert len(result) == len(xs)
|
|
102
|
+
# Elements preserved
|
|
103
|
+
assert sorted(result) == sorted(xs)
|
|
104
|
+
# Ordered
|
|
105
|
+
assert all(result[i] <= result[i+1] for i in range(len(result)-1))
|
|
106
|
+
# Idempotent
|
|
107
|
+
assert sort(result) == result
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Validator + Normalizer
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
@given(valid_inputs())
|
|
114
|
+
def test_normalized_is_valid(x):
|
|
115
|
+
"""Normalized inputs pass validation."""
|
|
116
|
+
assert is_valid(normalize(x))
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Complete Example (Python/Hypothesis)
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
"""Property-based tests for message_codec module."""
|
|
123
|
+
from hypothesis import given, strategies as st, settings, example
|
|
124
|
+
import pytest
|
|
125
|
+
|
|
126
|
+
from myapp.codec import encode_message, decode_message, Message, DecodeError
|
|
127
|
+
|
|
128
|
+
# Custom strategy for Message objects
|
|
129
|
+
messages = st.builds(
|
|
130
|
+
Message,
|
|
131
|
+
id=st.uuids(),
|
|
132
|
+
content=st.text(max_size=1000),
|
|
133
|
+
priority=st.integers(min_value=1, max_value=10),
|
|
134
|
+
tags=st.lists(st.text(max_size=50), max_size=20),
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class TestMessageCodecProperties:
|
|
139
|
+
"""Property-based tests for message encoding/decoding."""
|
|
140
|
+
|
|
141
|
+
@given(messages)
|
|
142
|
+
def test_roundtrip(self, msg: Message):
|
|
143
|
+
"""Encoding then decoding returns the original message."""
|
|
144
|
+
encoded = encode_message(msg)
|
|
145
|
+
decoded = decode_message(encoded)
|
|
146
|
+
assert decoded == msg
|
|
147
|
+
|
|
148
|
+
@given(messages)
|
|
149
|
+
def test_encode_deterministic(self, msg: Message):
|
|
150
|
+
"""Same message always encodes to same bytes."""
|
|
151
|
+
assert encode_message(msg) == encode_message(msg)
|
|
152
|
+
|
|
153
|
+
@given(messages)
|
|
154
|
+
def test_encoded_is_bytes(self, msg: Message):
|
|
155
|
+
"""Encoding produces bytes."""
|
|
156
|
+
assert isinstance(encode_message(msg), bytes)
|
|
157
|
+
|
|
158
|
+
@given(st.binary())
|
|
159
|
+
def test_decode_invalid_raises_or_succeeds(self, data: bytes):
|
|
160
|
+
"""Random bytes either decode or raise DecodeError."""
|
|
161
|
+
try:
|
|
162
|
+
decode_message(data)
|
|
163
|
+
except DecodeError:
|
|
164
|
+
pass # Expected for invalid input
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Running Tests
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Run all property tests
|
|
171
|
+
pytest test_file.py -v
|
|
172
|
+
|
|
173
|
+
# Run with more examples (CI)
|
|
174
|
+
pytest test_file.py --hypothesis-seed=0 -v
|
|
175
|
+
|
|
176
|
+
# Run with statistics
|
|
177
|
+
pytest test_file.py --hypothesis-show-statistics
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Checklist Before Finishing
|
|
181
|
+
|
|
182
|
+
- [ ] Tests are not tautological (don't reimplement the function)
|
|
183
|
+
- [ ] At least one strong property (not just "no crash")
|
|
184
|
+
- [ ] Edge cases covered with `@example` decorators
|
|
185
|
+
- [ ] Strategy constraints are realistic, not over-filtered
|
|
186
|
+
- [ ] Settings appropriate for context (dev vs CI)
|
|
187
|
+
- [ ] Docstrings explain what each property verifies
|
|
188
|
+
- [ ] Tests actually run and pass (or fail for expected reasons)
|
|
189
|
+
|
|
190
|
+
## Red Flags
|
|
191
|
+
|
|
192
|
+
- **Reimplementing the function**: If your assertion contains the same logic as the function under test, you've written a tautology
|
|
193
|
+
```python
|
|
194
|
+
# BAD - this tests nothing
|
|
195
|
+
assert add(a, b) == a + b
|
|
196
|
+
```
|
|
197
|
+
- **Only testing "no crash"**: This is the weakest property - always look for stronger ones first
|
|
198
|
+
- **Overly constrained strategies**: If you're using multiple `assume()` calls, redesign the strategy instead
|
|
199
|
+
- **Missing edge cases**: No `@example` decorators for empty, single-element, or boundary values
|
|
200
|
+
- **No settings**: Missing `@settings` for CI - tests may be too slow or not thorough enough
|