swift-type-typed-design
БесплатноБез исполняемых скриптовНе проверенType-driven domain modeling techniques for Swift using proper domain types, validation-carrying types, witness-based access control, and illegal-state…
от nonameplum★ 17 звёзд на GitHubОб этом скилле
Swift Type-Driven Design
Use this skill to design Swift models that encode business rules in types so invalid states are hard or impossible to represent.
Agent behavior contract
- Model domain concepts first, implementation details second.
- Prefer value semantics (
struct,enum) unless reference identity is required. - Replace primitive obsession with strong domain types only when it captures an essential invariant.
- Use "parse, do not validate": create validated values once, then pass validated types through the system.
- Favor compile-time guarantees over runtime checks.
- Keep changes incremental and local to the workflow being modeled.
- If introducing wrappers, improve call-site clarity, not just type novelty.
Quick decision tree
Need the mental model and core principles?
- Read
references/modeling-playbook.md"Foundations" - Deep source: Fundamentals of type-driven code (
references/fundamentals-of-type-driven-code.md)
- Read
Need safer user input or request payloads?
- Read
references/pattern-catalog.md"Validation-carrying types" - Deep source: Type-safe validation (
references/type-safe-validation.md)
- Read
Need compile-time gated access to a feature or workflow step?
- Read
references/pattern-catalog.md"Witness pattern" - Deep source: Witness pattern: type-safe access control (
references/witness-pattern-type-safe-access-control.md)
- Read
Need to model a domain with product/sum types and clear naming?
- Read
references/modeling-playbook.md"Domain modeling flow" - Deep source: Domain modeling with types (
references/domain-modeling-with-types.md)
- Read
Need to remove impossible states from existing models?
- Read
references/pattern-catalog.md"Illegal-state elimination" - Deep source: Making illegal states unrepresentable (
references/making-illegal-states-unrepresentable.md)
- Read
Operating workflow
When asked to model or refactor:
- Identify domain invariants and preconditions in plain language.
- Classify each concept:
- Primitive domain type
- Product type (AND)
- Sum type (OR)
- Witness/precondition type
- Choose the smallest type change that encodes the invariant.
- Move checks to type construction boundaries.
- Update downstream APIs to consume strong types instead of raw primitives.
- Remove redundant runtime validation that the type now guarantees.
Modeling heuristics
- Start with
struct. - Use
enumfor mutually exclusive states. - Use nested
IDtypes to avoid cross-entity identifier mixups. - Avoid boolean gates for access control when a witness can model it.
- Avoid
String/Intin public domain APIs when semantic meaning matters. - Keep optional use intentional; each
Optionalintroduces anonestate.
Anti-patterns to avoid
- Validation scattered across call sites.
- Re-checking invariants that should be proven by type construction.
- "Two optionals" used to model a choice with illegal combinations.
- Feature gating with plain
Boolacross many entry points. - Premature wrappers with no encoded invariant or semantic benefit.
Reference files
references/_index.md- quick navigation by problemreferences/modeling-playbook.md- practical end-to-end modeling flowreferences/pattern-catalog.md- reusable templates and tradeoffs
Deep source articles
Use these only when you need full explanations/examples:
- Fundamentals of type-driven code ->
references/fundamentals-of-type-driven-code.md - Type-safe validation ->
references/type-safe-validation.md - Witness pattern: type-safe access control ->
references/witness-pattern-type-safe-access-control.md - Domain modeling with types ->
references/domain-modeling-with-types.md - Making illegal states unrepresentable ->
references/making-illegal-states-unrepresentable.md
Установить swift-type-typed-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swift-type-typed-design?
Type-driven domain modeling techniques for Swift using proper domain types, validation-carrying types, witness-based access control, and illegal-state elimination. Use when designing domain models, replacing primitive obsession, modeling workflows with enums/structs, adding compile-time guarantees, or discussing parse-dont-validate and making illegal states unrepresentable.
Как установить скилл swift-type-typed-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swift-type-typed-design запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic