| name | port |
| description | Port a Python Hypothesis module to idiomatic C# for the Conjecture project. Use this skill whenever the user wants to translate, adapt, or port code from the Python Hypothesis library into C# — even if they don't say "port" explicitly. Triggers on phrases like "port X from hypothesis", "translate this Python module", "implement X based on hypothesis", "bring over the hypothesis shrinking logic", or when referencing a specific Python Hypothesis file or module to add to Conjecture.
|
Port a Python Hypothesis module to idiomatic C#.
Input
Path or module name from the Python Hypothesis repo (e.g., hypothesis/strategies/numbers.py or conjecture/engine).
Steps
- Fetch or read the Python source from https://github.com/HypothesisWorks/hypothesis. Use the
hypothesis-python/src/hypothesis/ subtree.
- Analyze the module: identify public API, internal helpers, dependencies on other Hypothesis modules, and Python-specific idioms.
- Design the C# equivalent:
- Map Python decorators → attributes or fluent API
- Map generators/yield →
IEnumerable<T>, Span<T>, or custom iterators
- Map Python's dynamic typing → generics with constraints
- Map coroutine-based shrinking → iterative or callback-based approach
- Use .NET naming conventions (PascalCase methods,
camelCase fields)
- Use file-scoped namespaces
- Prefer
readonly struct where appropriate
- Flag any areas requiring a design decision (e.g., no direct .NET equivalent exists). Suggest options with trade-offs.
- Add the standard project header plus Hypothesis attribution at the top of every C# file derived from Hypothesis source (see ADR-0032):
- Write the C# file(s) into the appropriate location under
src/.
- Write corresponding unit tests.
- Summarize what was ported, what diverged from Python, and any open design questions.
Guidelines
- Prioritize idiomatic .NET over 1:1 translation — the API should feel native to C# developers.
- All source files are MPL-2.0 (ADR-0031). Files derived from Hypothesis must additionally include the attribution comment (ADR-0032).
- Reference
Directory.Packages.props for any new NuGet dependencies.
- Check
docs/decisions/ for prior ADRs that constrain the design.
- Keep the port minimal — don't add features the Python version doesn't have.