Use when modeling, validating, refactoring, or reviewing Rust service domain boundaries, especially when replacing primitive String fields with newtypes, parse-don't-validate constructors, private invariants, TryFrom/FromStr parsers, request DTO boundaries, or property tests.
SkillScore91Maintained
Automatic
◆Coding pack
Last verified 8/16/2026
What it changes
Passed 20 of 22 test cases with the skill, and 19 of 22 without it.
Without skill86%
With skill91%
Checks it passed that the model alone missed
The duration wrapper uses a private field and a fallible parsing constructor like `TryFrom` or `FromStr`.
1 fixed19 passed either way2 still failing0 broke
Pass-rate lift
+5 pp
Tokens
+10%
Agent turns
0%
Response time
-21%
Model gemini-3.6-flashMeasured 8/16/2026v120 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
A test case the skill fixed. Same model, same prompt, with and without the skill.
Prompt
We pass duration strings like '30s' or '5m' from environment variables in Rust. How should this be wrapped as a strong domain type rather than passed as raw strings?
What was checked, without and with the skill
Checked
Without skill
With skill
The duration wrapper uses a private field and a fallible parsing constructor like `TryFrom` or `FromStr`.
Missed
Passed
case-22 · gemini-3.6-flash · 8/16/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md89 lines3 files
Rust Domain Boundaries
Use this skill to keep invalid states out of Rust service internals. Parse raw
input once at the boundary, store validated values in narrow domain types, and
make unchecked construction difficult.
Core Workflow
Find raw input boundaries: HTTP payloads, path/query parameters, config
files, environment variables, database rows, queues, and CLI flags.
Separate transport DTOs from domain types. Let serde deserialize incoming
shapes, then convert DTO fields into validated domain values.
Replace primitive strings with small types for ruled values: email addresses,
usernames, passwords, subscriber names, slugs, tenant IDs, idempotency keys,
and money-like or duration-like values.
Give domain types private fields and smart constructors. Avoid unchecked
pub fields or impl From<String> for fallible conversions.
Return typed validation errors that map to useful HTTP responses without
leaking internal details.
Keep database and external API mapping explicit. Convert to raw strings at
the final persistence or serialization edge.
Test invariants directly. Cover valid examples, malformed inputs, boundary
lengths, normalization rules, and round trips.
Type Design Rules
Prefer TryFrom<String>, TryFrom<&str>, or FromStr for fallible parsing.
Keep stored values owned unless profiling proves borrowing is necessary.
Implement AsRef<str> or a named accessor for read-only exposure.
Implement Display only when the formatted value is safe to show in logs,
errors, and UI.
Avoid deriving Debug for secret-bearing values unless the debug output is
redacted.
Make normalization visible in tests: trim, lowercase, Unicode handling, and
canonicalization.
Request Boundary Pattern
Deserialize into a request shape, then construct a command: