/omniagents-design-patterns:softwarefrom omniagents-design-patterns
Use when designing or reviewing Python code shape inside one service: module/class boundaries, GoF patterns, DDD, functional Result/Option/ADT shapes, in-process concurrency, package architecture, code smells, anti-patterns, refactors, "what pattern?", "where should X live?", or "how should I model this?". For cross-service or distributed concerns, use the system skill instead.
Ships in omniagents-design-patterns. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Strict-typed Python 3.13+ patterns for shapes that live inside one
codebase: GoF, functional & ADTs, DDD, architectural layouts (hexagonal,
onion, clean, modular monolith, microservices boundary), in-process
concurrency, code-level anti-patterns. For cross-service concerns
(reliability across process boundaries, communication channels,
distributed coordination, data architecture, scaling, cloud topology),
load the system skill from this plugin instead.
Surface these non-negotiables when proposed code violates them. Point at the exact reference rather than re-arguing from first principles.
Protocol over ABC, PEP 695
generics (class Foo[T]:), PEP 604 unions (X | Y), list[int] not
List[int], Self for fluent returns, Final for constants, @override
where applicable, and no Any leakage. Use the annotation-evaluation policy
in the conventions section below; omit from __future__ import annotations
only when runtime introspection genuinely requires evaluated annotations.
Code blocks in this catalogue are written to target mypy --strict and
pyright --strict.*Service mutators are an anti-pattern. Behaviour lives on the
entity; orchestration lives in the service.NewType, smart constructors, frozen=True, Final. The
type checker does the work.@dataclass(frozen=True, slots=True). Each pattern entry picks
ONE primary example and adds a When to switch sub-note when the
other shape is also viable. Pydantic snippets use
Annotated[T, Field(...)] form, never bare Field() as a default; see
the conventions section below.classDiagram
for structural collaboration, sequenceDiagram for call-flow
behavioural patterns, stateDiagram-v2 for state machines. Skip the
diagram when the code is trivially self-explanatory.Every Python block in this catalogue binds itself to these rules. They are inlined here so the software-patterns skill remains correct even when no other skill is loaded.
mypy --strict and
pyright --strict: PEP 695 generics (class Foo[T]:), PEP 604 unions
(X | Y), list[int] not List[int], Self for fluent returns, Final
for constants, and @override on subclass methods.Protocol for structural extension contracts
unless explicit registration, shared default behavior, or runtime subclass
checks require an ABC.Any leaks. Bare Any is forbidden outside I/O boundaries. Boundary
adapters may carry one cast only with an inline reason comment naming the
vendor docs reference.# type: ignore requires an error code and an inline
reason: # type: ignore[arg-type] # third-party stub missing field X. Bare
# type: ignore is forbidden.T type parameters. Prefer KeyT, ValueT, ItemT,
ReturnT, InputT, and OutputT; never bare T, K, or V. Use PEP
695 syntax such as class Registry[KeyT, ValueT]:, not
Generic[KeyT, ValueT].@dataclass(frozen=True, slots=True) for in-process domain types.Annotated[T, Field(...)]; bare Field() as a
default is forbidden. Boundary models add
model_config = ConfigDict(frozen=True, extra="forbid") to reject unknown
fields and prevent post-construction mutation.The python:typings skill in the sister python plugin holds the full
canonical examples and rationale behind each rule. If both plugins are
installed, you can load it via the Skill tool when you need the deep reference,
but this catalogue does not require it to be loaded to be correct.
| File | Read when… |
|---|---|
gof/index.md | Choosing a class-level shape from the Gang of Four catalogue. Category navigation for all 23 patterns, with individual pages under gof/creational/, gof/structural/, and gof/behavioral/. Includes Pythonic rewrites for GoF patterns that often collapse into module state, top-level functions, Protocols, injected callables, or generators. |
functional.md | Reaching for Result/Either, Option/Maybe, ADTs (sum + product types), immutability, composition / pipelines, currying, railway-oriented programming, lenses, totality, smart constructors, the Functor/Applicative/Monad shapes-and-laws. Mix of Python with Rust (Result<T, E> + ?-operator) and F#/Haskell intuition where it expresses the pattern more naturally. |
ddd.md | Modelling a non-trivial domain. Tactical (Entity, Value Object, Aggregate Root with invariants, Repository, Domain Service, Domain Events, Specification, Factory, Module) and strategic (Bounded Context, Context Map, Anti-Corruption Layer, Shared Kernel, Customer/Supplier, Conformist, Open Host Service, Published Language, Big Ball of Mud as the absence of strategic design). |
architectural.md | Deciding where things live in the codebase: layered / N-tier, hexagonal / ports & adapters (Cockburn), onion (Palermo), clean (Martin), modular monolith, microservices (Newman's "is the pain ≥ the cost"), in-process event-driven, plugin architecture, MVC / MVP / MVVM. Each entry has an import-linter / grimp boundary test. |
concurrency.md | Async / threads / processes inside one service: actor model (Erlang/Akka with Python equivalents), producer-consumer with bounded queues, pipeline / dataflow, in-process pub/sub, reader-writer locks, futures / promises, async/await + event loop, structured concurrency (asyncio.TaskGroup, Trio nurseries, Smith's "go statement considered harmful"), channels (Go-style with Python equivalents), fork-join. |
anti-patterns.md | Code review / refactor target: God Object, Anemic Domain, Feature Envy, Shotgun Surgery, Primitive Obsession, Stringly-Typed APIs / Booleans, Boolean Flag Parameters, Hidden Temporal Coupling, Happy-Path-Only Error Handling, Exception Swallowing, Over-Mocking, Premature Abstraction, Speculative Generality, Big Ball of Mud, Circular Imports, Leaky Abstractions, ISP / LSP violations, Dead Code Tolerance, Magic Numbers / Strings, Comments-as-Apology, Type Erosion (Any creep, cast everywhere), Mutable Default Arguments. Each entry pairs the bad code with a fixed version and the static-analysis rule that catches it. |
Read only the reference relevant to the current decision — every file has a Table of Contents at the top; jump to the specific anchor.
gof/index.mdfunctional.mdddd.mdarchitectural.mdconcurrency.mdanti-patterns.mdgof/index.md when
choosing among patterns; jump directly to an individual pattern page
when the pattern is already known. Each GoF pattern page follows a
fixed shape: Intent, Use When,
Prefer A Simpler Python Shape When, Structure,
Strict-Typed Python Sketch, Type-Safety Notes,
Common Misuse, Real-World Examples, References (with a
stable Refactoring Guru URL where the pattern appears in their
catalogue). Skim Intent and Prefer A Simpler Python Shape When
before reading the full sketch.Protocol, Self, override, Final, PEP 604/695.
Don't re-derive ABC-heavy Java-style translations. Don't sprinkle
Any to make types "easier" — the sketch already shows the
type-clean form.Prefer citing the individual pattern page directly — for example
gof/behavioral/strategy.md,
gof/behavioral/chain-of-responsibility.md,
anti-patterns.md#exception-swallowing, or
architectural.md#hexagonal-ports-and-adapters. For intra-page sections,
anchor on the heading exactly as written; anchors are kebab-case slugs of
the heading text.
system skill from this plugin for those.anti-patterns.md).If a question lands outside this scope, say so rather than bending one of the references to fit. If a question lands inside the scope but the answer isn't in the references, that's a signal the catalogue should be extended — flag it and propose the addition rather than improvising silently.
anti-patterns.md (opens in a new tab)architectural.md (opens in a new tab)concurrency.md (opens in a new tab)ddd.md (opens in a new tab)functional.md (opens in a new tab)gof/behavioral/chain-of-responsibility.md (opens in a new tab)gof/behavioral/command.md (opens in a new tab)gof/behavioral/index.md (opens in a new tab)gof/behavioral/interpreter.md (opens in a new tab)gof/behavioral/iterator.md (opens in a new tab)gof/behavioral/mediator.md (opens in a new tab)gof/behavioral/memento.md (opens in a new tab)gof/behavioral/observer.md (opens in a new tab)gof/behavioral/state.md (opens in a new tab)gof/behavioral/strategy.md (opens in a new tab)gof/behavioral/template-method.md (opens in a new tab)gof/behavioral/visitor.md (opens in a new tab)gof/creational/abstract-factory.md (opens in a new tab)gof/creational/builder.md (opens in a new tab)gof/creational/factory-method.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gao-hongnan/omniagents --plugin omniagents-design-patterns4 skills in this plugin
/api-designUse when designing, reviewing, or implementing a REST or gRPC API contract: resource names and hierarchy, standard vs custom methods, request/response fields, pagination, filtering, partial updates and field masks, long-running operations, error models and status codes, idempotency, etags, soft delete, batch methods, versioning, or breaking changes, where choices should follow Google's API Improvement Proposals (AIPs) or API Design Guide./codebase-designUse when designing or improving a module's interface, judging whether a wrapper or layer earns its keep, deciding where a seam belongs, or making code testable through its interface. Supplies the interface-depth vocabulary — deep vs shallow modules, information hiding, the deletion test, seams, design it twice. The depth lens that complements the pattern catalogue: it answers "is this interface earning its complexity?", not "which pattern?"./systemUse when designing or reviewing cross-service, cross-process, regional, or operator-facing system shape: timeouts, retries, circuit breakers, bulkheads, rate limits, idempotency, DLQs, REST/gRPC/GraphQL/pub-sub, service mesh, webhooks, Saga, Raft/Paxos, distributed locks, CQRS, event sourcing, outbox, sharding, replication, caching, autoscaling, sidecars, strangler migrations, distributed monoliths, cascading failures, retry storms, shared databases, capacity planning, or what breaks at the next 10× load.Other plugins' skills for the same job