property-based-testing
Write, review, and triage property-based tests — Hypothesis, fast-check, proptest, and Echidna or Medusa for Solidity invariants
وصف مستورد لم يراجعه محرر بعد
جاء هذا العنصر من مستودعه الأصلي وفحصناه آلياً فقط، ولم يكتب له محرر وصفاً عربياً بعد. اقرأ محتواه بنفسك قبل أن تعتمد عليه. ولا تُفهرس هذه الصفحة في محركات البحث حتى تُراجَع.
التنزيل
اقرأ هذا قبل أن تنزّل
لا يشغّل تلقين أي شيء من هذا العنصر. لكن ما تنزّله يعمل على جهازك إن شغّلته أنت أو سمحت لكلود كود بتشغيله، فاقرأ الملفات أولاً.
- في العنصر ملفات سكربت.
التثبيت
تُثبَّت الإضافات من سوق الإضافات في كلود كود، لا بنسخ الملفات. نزّل الحزمة لتقرأ محتواها وترخيصها.
التعليمات
Property-Based Testing
Write, review, and triage property-based tests — Hypothesis, fast-check, proptest, and Echidna or Medusa for Solidity invariants.
Installation
This plugin is part of the Trail of Bits Skills marketplace.
Via Marketplace (Recommended)
/plugin marketplace add trailofbits/skills
/plugin menu
Then select the property-based-testing plugin to install.
Manual Installation
/plugin install trailofbits/skills/plugins/property-based-testing
What's Included
This plugin provides a skill covering three jobs: writing property tests, reviewing existing ones for tests that assert nothing, and triaging a shrunk counterexample into a wrong property, an ambiguous spec, or a real bug. It recognises these shapes:
- Serialization pairs: encode/decode, serialize/deserialize, toJSON/fromJSON
- Parsers: URL parsing, config parsing, protocol parsing
- Normalization: normalize, sanitize, clean, canonicalize
- Validators: is_valid, validate, check_*
- Data structures: Custom collections with add/remove/get operations
- Mathematical/algorithmic: Pure functions, sorting, ordering
- Smart contracts: Solidity/Vyper contracts, token operations, state invariants
Supported Languages
- Python (Hypothesis)
- JavaScript/TypeScript (fast-check)
- Rust (proptest, quickcheck)
- Go (rapid, gopter)
- Java (jqwik)
- Scala (ScalaCheck)
- Solidity/Vyper (Echidna, Medusa)
- And many more...
See skills/property-based-testing/references/libraries.md for the complete list.
Evals
The skill ships three evals, because "the skill fires" and "the skill helps" are different claims and only the second one matters to a user.
./evals-extra/run.sh # trigger rate against labelled queries
EFFORTS=low ./evals-extra/effectiveness.sh # does the generated suite catch a real bug?
Both spend real API budget — run.sh runs one session per query per run, 45 at its
defaults (measured at 51.9 min and $36.50 at JOBS=4), and effectiveness.sh is 3.
Neither runs in CI for that reason; they are what you run when you change the
description or the guidance. RUNS=1 ./evals-extra/run.sh is the cheap smoke test.
Both harnesses ship a --self-test that costs nothing and runs in make check, so a
harness that has stopped discriminating fails the build instead of reporting a green
skill forever. run.sh --self-test drives the classifier with a stub binary and
asserts, among other things, that a crashed session invalidates the sweep rather than
being absorbed by the pass threshold.
effectiveness.sh grades by running the generated tests against a fixture with a
known defect, not by reading what the model said about its own work. Both scripts
exit non-zero when they inspect nothing, so a broken harness fails loudly instead of
reporting a clean pass.
See skills/property-based-testing/README.md for what the queries cover and how to
run the no-skill baseline.
evals/ — the ablation suite
The third eval is not a shell harness. evals/ holds claude plugin eval cases, run
from the plugin root, and every case runs twice — once with the plugin loaded and once
without — so the number it reports is Δ against the unaided model rather than a raw
score. A skill that scores full marks in both arms is spending context and buying
nothing, and that is the failure this suite exists to catch.
claude plugin eval . --ablation with-without --judge-model sonnet --allow-tools Write
Two operational notes, both learned the hard way:
- It needs
ANTHROPIC_API_KEY. Each case runs in a sandboxed config dir, so an interactive login is not visible to it and a subscription OAuth token is ignored. Without the key every session dies instantly asNot logged in, costs a cent, and the judge then grades that string — which scores zero and looks like a real result. CheckapiKeySourcein a trace before believing any number. --allow-tools Writeis load-bearing, not convenience.03's strongest grader fires when the model creates arequirements.txt; denyWriteand it can never create one, so the grader passes for free.
Measured on opus, 3 runs per arm, ~$4.30 per full sweep:
| case | fires | with | without | Δ |
|---|---|---|---|---|
02-neg-cargo-fuzz-coverage | no | 1.00 | 1.00 | 0.00 |
03-dependency-is-users-call | yes | 0.50 | 0.00 | +0.50 |
02 is the over-trigger guard — coverage-guided fuzzing is on the description's
exclusion list, and the skill did not fire in any of the three with-plugin runs. Δ0 is
the correct result for a negative.
03 measures whether the skill leaves a new test dependency to the user. Unaided
opus wrote a requirements.txt in 3 of 3 runs; with the skill loaded it did so in 2
of 3, so the behaviour is improved and not fixed. The grader carrying that Δ is a regex
over the run's created-files list, so it cannot be talked round by a persuasive answer
the way an LLM judge can.
What this suite does not establish is that the skill helps you write better property
tests. Two cases is below the four-positive floor worth trusting, and three flows are
still unmeasured: reviewing existing tests (one 3-run sample suggested Δ+0.17, never
confirmed), declining PBT for code with no algebraic shape (three fixtures attempted,
opus found a legitimate property in all three — including a header-injection bug, so
it was right to), and triage, which is the gap skills/property-based-testing/README.md
already documents.
Costs real money per run, so like the harnesses above it is a manual check and does not
run in CI. evals/results/ is gitignored — those are run artifacts, not source.
الملفات
- مجلد.claude-plugin304 بايت
- plugin.json304 بايت
- مجلدevals5.3 ك.ب
- مجلد02-neg-cargo-fuzz-coverage3.1 ك.ب
- مجلدgraders2.7 ك.ب
- answers-on-its-own-terms.md1.4 ك.ب
- does-not-pivot-to-pbt.md1.3 ك.ب
- no-skill-invocation.md60 بايت
- prompt.md372 بايت
- مجلد03-dependency-is-users-call2.2 ك.ب
- مجلدgraders1.4 ك.ب
- dependency-left-to-user.md1.3 ك.ب
- no-dependency-file-written.md117 بايت
- skill-fired.md43 بايت
- prompt.md815 بايت
- مجلدevals-extra45 ك.بسكربت
- مجلدfixture1.4 ك.بسكربت
- مجلدcontracts355 بايت
- Staking.sol355 بايت
- مجلدsrc776 بايتسكربت
- codec.py527 بايتسكربت
- money.py249 بايتسكربت
- مجلدtests295 بايتسكربت
- test_parser.py295 بايتسكربت
- requirements.txt11 بايت
- 01-roundtrip-codec.md228 بايت
- 02-normalizer-idempotence.md118 بايت
- 03-hypothesis-existing.md122 بايت
- 04-echidna-invariant.md189 بايت
- 05-review-weak-tests.md181 بايت
- 07-fuzz-serializer-noname.md171 بايت
- 08-sort-comparator.md148 بايت
- 09-neg-libfuzzer-harness.md145 بايت
- 10-neg-mutation-campaign.md116 بايت
- 11-neg-flaky-ci.md132 بايت
- 12-neg-crud-unit-test.md126 بايت
- 13-neg-slither-scan.md130 بايت
- 14-neg-benchmark.md133 بايت
- 15-neg-pytest-setup.md114 بايت
- 16-neg-e2e-playwright.md116 بايت
- effectiveness.sh12 ك.بسكربت
- run.sh29 ك.بسكربت
- مجلدskills39 ك.ب
- مجلدproperty-based-testing39 ك.ب
- مجلدagents254 بايت
- openai.yaml254 بايت
- مجلدassets3 ك.ب
- trail-of-bits-mark.svg3 ك.ب
- مجلدreferences16 ك.ب
- generating.md2.6 ك.ب
- interpreting-failures.md3.3 ك.ب
- libraries.md2.9 ك.ب
- refactoring.md4.7 ك.ب
- reviewing.md2.8 ك.ب
- README.md15 ك.ب
- SKILL.md4.2 ك.ب
- LICENSE20 ك.ب
- README.md5.6 ك.ب
ما وجده الفحص الآلي
فحصنا الملفات آلياً وقت الاستيراد. هذا ما نبّه إليه الفحص، ولا يعني أن العنصر ضار ولا أنه سليم: اقرأه بنفسك.
- يحتاج مراجعةملف سكربت
في الملف plugins/property-based-testing/evals-extra/effectiveness.sh
- يحتاج مراجعةيحذف ملفات بالقوة وبالتكرار
في الملف plugins/property-based-testing/evals-extra/effectiveness.sh، السطر 187
- يحتاج مراجعةيحذف ملفات بالقوة وبالتكرار
في الملف plugins/property-based-testing/evals-extra/run.sh، السطر 111
التعليقات (0)
لا تعليقات بعد. كن أول من يعلّق.
سجّل الدخول لتعلّق. التعليق من المستوى 1 (عضو).