All authors

Claude Skills by proteanhq
github.com/proteanhq39 skills0 installs67 views
- Protean OverviewOrient a coding agent to a Protean domain before it writes code. Explains the core building blocks (aggregates, entities, value objects, events, commands, handlers) and the rules that hold across them. Use when starting work in a Protean project, when unsure which element to reach for, or when the user asks "how is a Protean domain put together".Votes: 0GitHub stars: 46
- Add CommandAdd a complete command flow to an existing aggregate - creates a command class, a FastAPI API endpoint, and a command handler with repository logic. This is the primary workflow for adding write operations to a Protean domain. Use when the user wants to "add a command", "add an action", "add an operation", "expose a write endpoint", "create a command flow", "wire up a POST endpoint", "add a new operation to an aggregate", or describes an action like "I want users to be able to [verb] a [thing...Votes: 0GitHub stars: 46
- Add Domain Service FlowBuild a domain service flow in Protean for business logic that spans two or more aggregates. Domain services are stateless, encapsulate cross-aggregate business rules, and run pre/post invariants for validation. They are used when business logic doesn't naturally belong to a single aggregate. Wire them into command handlers or application services for persistence. Use when the user asks to "add a domain service", "implement cross-aggregate logic", "coordinate multiple aggregates", "add a busi...Votes: 0GitHub stars: 46
- Add EventAdd a complete event flow to an existing aggregate - creates a domain event, adds or updates an aggregate method that raises the event via self.raise_(), and wires an event handler that processes the event and performs specified side effects (such as syncing state across aggregates, sending notifications, or triggering downstream processes). This is the primary workflow for adding reactive, event-driven behavior to a Protean domain. Use when the user wants to "add an event", "add a domain eve...Votes: 0GitHub stars: 46
- Add FieldAdd fields to Protean domain elements (aggregates, entities, value objects). Guides you through selecting the right field type, configuring validations, and placing fields correctly. Use when the user asks to "add a field", "add an attribute", "add a property", "I need to store [data]", "add a new field to [aggregate/entity]", or describes data that needs to be tracked. Covers simple fields, association fields (HasOne, HasMany, ValueObject), field validation, custom validators, and choosing b...Votes: 0GitHub stars: 46
- Add Read ModelBuild a complete read model in Protean - a projection populated by a projector that reacts to domain events. Covers single-aggregate projections (flattened view of one aggregate), cross-aggregate projections (combining data from multiple aggregates), and choosing between database-backed and cache-backed storage. Use when the user asks to "add a read model", "create a projection with projector", "build a query view", "add a CQRS read side", "create a denormalized view", "build a reporting view...Votes: 0GitHub stars: 46
- Add Subscriber FlowBuild a complete external integration flow in Protean using subscribers. Subscribers consume messages from external systems via broker streams and translate them into domain actions using the anti-corruption layer (ACL) pattern. Use when the user asks to "add an external integration", "consume external events", "handle webhook events", "integrate with an external system", "add a subscriber flow", "build an anti-corruption layer", "translate external messages", "process broker messages", or wh...Votes: 0GitHub stars: 46
- Add Use CaseBuild a complete vertical slice in Protean - the full command flow from command definition through handler, aggregate mutation, event raising, and event handler reaction. This is the most common workflow for adding a new feature. Use when the user asks to "add a use case", "add a feature", "create a command flow", "implement a vertical slice", "add a new action", "build an end-to-end flow", "add command processing", or when they describe actions like "users should be able to place orders", "a...Votes: 0GitHub stars: 46
- Add ValidationImplement validation in Protean domain elements at the correct layer. Protean has 4 validation layers - Layer 1 (field constraints like required, max_length, min_value, choices), Layer 2 (value object invariants via @invariant.post for concept-level rules), Layer 3 (aggregate invariants via @invariant.pre and @invariant.post for business rules and state guards), Layer 4 (handler/service guards for authorization and context-dependent checks). Use when the user asks to "add validation", "add a ...Votes: 0GitHub stars: 46
- AggregateDefine a Protean aggregate - the root entity of a cluster of domain objects treated as a single unit for data changes. Aggregates are fundamental building blocks that encapsulate business logic, enforce invariants, and define transaction boundaries. Use when creating domain entities with identity that change over time, when modeling business concepts that need to enforce consistency rules, when the user asks to "create an aggregate", "add a domain model", "define a root entity", or when they ...Votes: 0GitHub stars: 46
- Api EndpointDefine FastAPI API endpoints for a Protean application. Endpoints are thin adapters at the domain boundary that translate HTTP requests into domain commands and hand them off via domain.process(). They contain NO business logic. Use when you need to create an API endpoint, define a route, add a REST endpoint, expose a command via HTTP, build a FastAPI handler, connect HTTP to the domain, create a POST/PUT/DELETE endpoint, or wire an HTTP request to a domain command.Votes: 0GitHub stars: 46
- Application ServiceDefine a Protean application service - a stateless orchestration layer that coordinates use cases between external callers (API controllers, CLI handlers, background jobs) and the domain model. Application services load aggregates, invoke domain methods, and persist results without containing business logic themselves. They are always associated with one aggregate via part_of and use the @use_case decorator for automatic UnitOfWork wrapping. Unlike command handlers, application services are i...Votes: 0GitHub stars: 46
- Audit DomainRun a comprehensive design-quality audit on a Protean domain codebase. Scans for anti-patterns, modeling smells, and convention violations — then produces a prioritized report with links to refactoring skills. Use when the user says "audit my domain", "check domain quality", "find anti-patterns", "review my code", "domain health check", "what should I refactor", "code review my domain", "find design issues", or when onboarding to an unfamiliar Protean codebase and wanting a quick quality asse...Votes: 0GitHub stars: 46
- Command HandlerDefine a Protean command handler - a class responsible for receiving domain commands and orchestrating state changes in aggregates. Command handlers extract data from commands, load or create aggregates, invoke aggregate methods, and persist state changes. They are always associated with one aggregate via part_of and use the @handle decorator to process specific command types. Use when you need to process a command, handle a domain action, write a command handler, implement the handler for a ...Votes: 0GitHub stars: 46
- CommandDefine a Protean command - an immutable DTO representing an intent to change aggregate state. Commands encapsulate the data necessary to perform a specific action and are processed by command handlers. Commands are always associated with aggregates and are named with imperative verbs (PlaceOrder, RegisterUser, CancelReservation). Use when you need to define an action or operation that changes domain state, when the user asks to "create a command", "define a command", "add a command", when imp...Votes: 0GitHub stars: 46
- Coverage AnalysisAnalyze Protean domain code to identify untested code paths and generate missing tests. Catalogs all testable elements (aggregate methods, invariants, events, handlers, value object operations, entity management) from domain definitions, compares against existing tests, produces a gap report with severity classification, and generates missing tests using generate-test-scaffold patterns. Use when the user asks to "find untested code", "analyze test coverage", "check what's missing tests", "ide...Votes: 0GitHub stars: 46
- Custom ValidatorBuild custom field validators for Protean domain elements — callable classes that validate individual field values. Covers format validation (email, phone, URL, SKU, credit card, etc.), using Protean's built-in RegexValidator, creating parameterized/configurable validators, composing multiple validators on a single field, and customizing error messages. Use when the user asks to "create a validator", "add custom validation", "validate email format", "validate phone number", "build a format ch...Votes: 0GitHub stars: 46
- Domain ServiceDefine a Protean domain service - a stateless orchestrator that encapsulates complex business logic spanning multiple aggregates. Domain services centralize cross-aggregate operations that don't naturally fit within any single aggregate, while keeping aggregates focused on their core state and behavior. Use when you need to coordinate logic across two or more aggregates, implement a cross-aggregate business rule, orchestrate a domain operation that mutates multiple aggregates in a single tran...Votes: 0GitHub stars: 46
- EntityDefine a Protean entity - a domain object with unique identity that is part of an aggregate. Entities are similar to aggregates but don't manage their own persistence - they're always accessed through their parent aggregate. Use when adding objects with identity to an existing aggregate, when modeling concepts that have identity but are not standalone (like LineItem in Order, Comment in Post), when the user asks to "add an entity", "create a child object", or when they describe a concept that...Votes: 0GitHub stars: 46
- Event HandlerDefine a Protean event handler - a class that consumes domain events raised by aggregates and orchestrates side effects such as syncing state across aggregates, sending notifications, or triggering downstream processes. Event handlers are always associated with an aggregate via part_of and use the @handle decorator to process specific event types. They follow a fire-and-forget pattern and do NOT return values. Also covers cross-aggregate synchronization - coordinating state between aggregates...Votes: 0GitHub stars: 46
- Event Sourced AggregateBuild event-sourced aggregates in Protean where state is derived by replaying domain events instead of stored as snapshots. Covers the @apply decorator for event application, raising events from business methods, state reconstruction via from_events(), event-sourced repositories, version tracking for optimistic concurrency, and fact events. Use when the user asks to 'create an event-sourced aggregate', 'add event sourcing', 'use event sourcing', 'store events instead of state', 'add an @apply...Votes: 0GitHub stars: 46
- EventDefine a Protean domain event - an immutable fact representing a state change in the business domain. Events capture meaningful changes to aggregates and enable decoupled communication between system components. Events are always associated with aggregates and are named in past-tense (OrderPlaced, CustomerRegistered). Use when you need to record what happened in your domain, when you want to communicate state changes to other parts of the system, when the user asks to "create an event", "defi...Votes: 0GitHub stars: 46
- Generate Test ScaffoldGenerate test scaffolds from Protean domain definitions. Analyzes existing aggregates, commands, events, handlers, value objects, and entities to produce focused pytest test stubs for user-written business logic - aggregate behavior, state transitions, invariants, event raising, handler orchestration, and end-to-end flows. Follows Protean's testing pyramid (domain unit tests as majority). Does NOT generate tests for framework-guaranteed behavior (VO immutability, field validation, registratio...Votes: 0GitHub stars: 46
- Message EnrichmentEnrich Protean commands and events with cross-cutting metadata using command enrichers and event enrichers. Enrichers are domain-level functions that return a dict merged into a message's metadata.extensions - useful for tenant ids, request/correlation context, actor info, and audit data that should ride along with every command or event without polluting the payload. Use @domain.command_enricher for commands and @domain.event_enricher for events. Use when you need to attach context to messag...Votes: 0GitHub stars: 46
- Process ManagerDefine a Protean process manager - a stateful, event-driven coordinator that manages multi-step business processes spanning multiple aggregates. Process managers maintain their own event-sourced state, correlate related events to the same running instance via correlation keys, have a defined lifecycle (start, intermediate, end), and issue commands to drive other aggregates forward. Unlike stateless event handlers, process managers remember what has happened and decide what to do next. Use whe...Votes: 0GitHub stars: 46
- ProjectionDefine a Protean projection (read model) - a denormalized, query-optimized data structure used on the read side of CQRS. Projections are closer to the database than domain aggregates and can be stored in either a database (provider) or cache (e.g., Redis). They support basic field types (String, Integer, Float, Identifier, DateTime, etc.) and ValueObject fields (stored as flattened shadow fields) - but not References or Associations. Every projection must have at least one identifier field. P...Votes: 0GitHub stars: 46
- ProjectorDefine a Protean projector - a specialized event handler that maintains read-optimized projections (read models) by listening to domain events from one or more aggregates. Projectors are always associated with a projection via projector_for and use the @on decorator (alias for @handle) to process specific event types. Unlike generic event handlers, projectors explicitly target a projection and can listen to multiple stream categories or aggregates. Use when you need to build a read model, mai...Votes: 0GitHub stars: 46
- Query HandlerDefine a Protean query handler - a class that answers queries by reading from projections and returning results. Query handlers are the read-side counterpart to command handlers: they use the @read decorator (not @handle), are dispatched via domain.dispatch(), and RETURN values. They run with no Unit of Work and no side effects. A handler is associated with a projection via part_of and reads through current_domain.view_for(Projection). Use when you need to answer a query, implement the read s...Votes: 0GitHub stars: 46
- QueryDefine a Protean query - an immutable DTO representing a read intent against a projection (read model). Queries carry the parameters needed to fetch data on the read side of CQRS and are answered by query handlers via domain.dispatch(). Queries are associated with a projection (not an aggregate) and are named for what they fetch (GetOrderById, SearchOrders, ListActiveUsers). Use when you need to define a read request, model a query parameter object, build the read side of CQRS, or when the us...Votes: 0GitHub stars: 46
- Refactor Extract Value ObjectExtract value objects from primitive fields in Protean aggregates, entities, and commands. Detects primitive obsession — raw String/Float/Integer fields representing domain concepts that deserve their own type — and refactors them into proper value objects. Use when the user says "extract value object", "create a value object from these fields", "fix primitive obsession", "these fields should be a VO", "refactor money fields", "extract address", or when an audit identifies primitive obsession...Votes: 0GitHub stars: 46
- Refactor Introduce EventsIntroduce domain events to replace direct cross-aggregate calls, tight coupling, and synchronous side effects. Detects transaction boundary violations — handlers that modify multiple aggregates — and refactors them into event-driven flows with proper aggregate isolation. Use when the user says "introduce events", "add events", "decouple aggregates", "fix transaction boundary", "two aggregates in one handler", "make it event-driven", "break the coupling", or when an audit identifies transactio...Votes: 0GitHub stars: 46
- Refactor Move Logic To AggregateMove business logic from handlers, services, or endpoints into aggregate methods where it belongs. Detects "logic leak" — validation, calculations, state transitions, and business rules scattered outside the domain model — and refactors them into rich aggregate methods with proper invariants. Use when the user says "move logic to aggregate", "handler is too fat", "fix logic leak", "enrich my aggregate", "make aggregate rich", "handler has too much logic", "anemic domain model", or when an aud...Votes: 0GitHub stars: 46
- RepositoryDefine a Protean repository - the persistence abstraction for aggregates in Domain-Driven Design. Repositories provide a collection-oriented interface to load and persist aggregates, hiding database details behind a clean domain API. Protean provides a default repository automatically for every aggregate; custom repositories add domain-specific queries or database-specific optimizations. Use when you need to persist an aggregate, load an aggregate, write a custom repository, add a custom quer...Votes: 0GitHub stars: 46
- SubscriberDefine a Protean subscriber - a domain element that consumes messages from external message brokers and acts as an anti-corruption layer at the domain boundary. Subscribers listen to named broker streams, receive raw dict payloads (not typed domain events), and translate external data into domain operations. Unlike event handlers which react to internal domain events, subscribers react to messages arriving from outside the bounded context via external message brokers. Use when you need to con...Votes: 0GitHub stars: 46
- UpcasterDefine a Protean event upcaster — a class that transforms old event payloads to match the current schema version, enabling event schema evolution without breaking stored events. Upcasters extend BaseUpcaster, implement an upcast(data) method, and are registered with @domain.upcaster(event_type=EventClass, from_version=1, to_version=2). The framework automatically chains individual upcasters and applies them lazily during deserialization. Use when the user asks to 'create an upcaster', 'handle...Votes: 0GitHub stars: 46
- Value ObjectDefine a Protean value object - an immutable domain element without identity, defined by its attributes. Value objects represent descriptive concepts like Money, Email, Address, or Coordinates. Use when modeling concepts where identity doesn't matter, only the values do. Use when the user asks to "create a value object", "add a VO", "model money/email/address", or describes something that measures or describes (amounts, locations, contact info). Value objects are always embedded in aggregates...Votes: 0GitHub stars: 46
- Add Saga FlowBuild a complete saga in Protean using a process manager that coordinates a multi-step flow across several aggregates. The saga reacts to domain events, issues commands to drive each aggregate forward, tracks its own state, and closes on a terminal handler with a compensating path for failures. Use when the user asks to "add a saga", "coordinate a multi-step process", "orchestrate a workflow across aggregates", "manage order fulfillment", "add a process manager flow", "compensate on failure",...Votes: 0GitHub stars: 46
- Extract Bounded ContextExtract a set of aggregates out of one Protean Domain into a second Domain and wire the two contexts by domain events across the boundary. Split a domain that has grown to hold two languages, break a circular cluster dependency, or remove cross-aggregate references that reach across a seam. The owning context publishes an event; the other consumes it through a subscriber and an anti-corruption layer, holding the far side by identity. Use when the user asks to "extract a bounded context", "spl...Votes: 0GitHub stars: 46
- Split AggregateSplit an oversized aggregate into two along its consistency boundary. Detects an aggregate that has grown two concerns and too many entities, extracts the second concern into its own aggregate, links the two by identity, and carries the cross-aggregate step with a domain event. Use when the user says "split this aggregate", "my aggregate is too big", "extract an aggregate", "aggregate has too many entities", "AGGREGATE_TOO_LARGE", "CROSS_AGGREGATE_REFERENCE", "one aggregate two concerns", "br...Votes: 0GitHub stars: 46