brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
rust-domain-boundariesUse 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.
Independent GitHub snapshot · Automated classification · Original documentation governs
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.
serde deserialize incoming
shapes, then convert DTO fields into validated domain values.pub fields or impl From<String> for fallible conversions.TryFrom<String>, TryFrom<&str>, or FromStr for fallible parsing.AsRef<str> or a named accessor for read-only exposure.Display only when the formatted value is safe to show in logs,
errors, and UI.Debug for secret-bearing values unless the debug output is
redacted.Deserialize into a request shape, then construct a command:
#[derive(serde::Deserialize)]
pub struct SubscribeRequest {
email: String,
name: String,
}
pub struct SubscribeCommand {
pub email: EmailAddress,
pub name: SubscriberName,
}
impl TryFrom<SubscribeRequest> for SubscribeCommand {
type Error = SubscribeValidationError;
fn try_from(value: SubscribeRequest) -> Result<Self, Self::Error> {
Ok(Self {
email: EmailAddress::parse(value.email)?,
name: SubscriberName::parse(value.name)?,
})
}
}
Handlers should reject invalid input before business logic or database code. If validation needs database state, keep pure parsing separate from uniqueness or authorization checks.
Read references/property-testing.md when invariants have many edge cases or
when an AI agent is likely to miss invalid inputs with example-only tests.
Minimum tests for a new domain type:
serde or SQL mapping when that type crosses those
boundaries.references/newtype-patterns.md: constructor, trait, serde, and persistence
patterns for Rust newtypes.references/property-testing.md: property-testing strategy for parsers and
domain constructors.