Agent skill

Design Patterns

by waybarrios in waybarrios/opencode-power-pack

Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing…

MITAuto-check passedDevelopment

Install Design Patterns

skills CLI
$ npx skills add waybarrios/opencode-power-pack --skill design-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install waybarrios/opencode-power-pack design-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/waybarrios/opencode-power-pack.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/design-patterns .claude/skills/design-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
design-patterns
GitHub stars
533
Token cost
~2.2k tokens
SKILL.md length
779 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
MIT

At a glance

Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing…

  • Works in 4 steps: Identify the problem: What design… → Consider the context: What language?… → Evaluate options: 2-3 candidate patterns… → …
  • Tasks that involve Design patterns
  • SKILL.md covers Quick Start, Rust Patterns, TypeScript / React Patterns and Django / Python Patterns, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Design Patterns is an agent skill from waybarrios/opencode-power-pack. Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing implementation approaches in Rust, TypeScript/React, or Django/Python.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Design patterns and Backend development. It works with Django, Python, Rust and TypeScript. The repository describes itself as: 54 rigorous skills for Codex, OpenCode, and Pi: code review, security audit, feature development, frontend design, MCP tools, Hugging Face ML/training, and more. The licence is MIT.

When your agent uses it

  • Tasks that involve Design patterns
  • Tasks that involve Backend development

Example prompts

  • “Use the design-patterns skill to agent should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction…”
  • “/design-patterns”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Identify the problem: What design challenge are you solving?
  2. Consider the context: What language? What scale? How often will this change?
  3. Evaluate options: 2-3 candidate patterns with trade-offs
  4. Recommend: The best fit for this specific context (not the "best pattern in general")

What it can do on your machine

Read from SKILL.md and the folder at commit 9dccb6d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are rust, typescript and python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Design Patterns loads about 2.2k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 779 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from waybarrios/opencode-power-pack at commit 9dccb6d, republished under its MIT licence (© waybarrios). 779 words, ~2,180 tokens.

Download SKILL.mdSave it as .claude/skills/design-patterns/SKILL.md (or your agent's skills folder).
name
design-patterns
description
Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing implementation approaches in Rust, TypeScript/React, or Django/Python.
license
MIT (modified; see UPSTREAMS.json)

Design Patterns

Pattern recommendations tailored to common tech stacks. Every pattern recommendation includes when to use it, when to avoid it, and the trade-offs.

Quick Start

Choose a Pattern
  1. Identify the problem: What design challenge are you solving?
  2. Consider the context: What language? What scale? How often will this change?
  3. Evaluate options: 2-3 candidate patterns with trade-offs
  4. Recommend: The best fit for this specific context (not the "best pattern in general")

The golden rule: Patterns are tools, not goals. Use the simplest pattern that solves the problem. If no pattern fits, a plain function or struct is fine.


Rust Patterns

Newtype Pattern

Wrap a primitive to add type safety and domain meaning.

rust
struct UserId(u64);
struct OrderId(u64);

// Now the compiler prevents mixing up UserId and OrderId
fn get_order(user: UserId, order: OrderId) -> Order { ... }

When to use: When two values have the same underlying type but different meanings. When to skip: One-off uses where a type alias suffices.

Builder Pattern

Construct complex objects step by step.

rust
let config = ServerConfig::builder()
    .host("localhost")
    .port(8080)
    .max_connections(100)
    .build()?;

When to use: Structs with many optional fields, complex construction logic. When to skip: Structs with 1-3 required fields — just use new().

Typestate Pattern

Encode state transitions in the type system so invalid states are unrepresentable.

rust
struct Connection<S: State> { /* ... */ state: PhantomData<S> }
struct Disconnected;
struct Connected;
struct Authenticated;

impl Connection<Disconnected> {
    fn connect(self) -> Result<Connection<Connected>> { ... }
}
impl Connection<Connected> {
    fn authenticate(self, creds: &Credentials) -> Result<Connection<Authenticated>> { ... }
}
impl Connection<Authenticated> {
    fn query(&self, sql: &str) -> Result<Rows> { ... }
}
// Can't call query() on a Disconnected connection — compile error

When to use: Protocols with clear state transitions (connections, workflows, parsing stages). When to skip: Simple on/off states — a boolean or enum is clearer.

Trait Objects vs Generics
ApproachDispatchBinary SizeFlexibility
impl Trait (generics)Static (monomorphized)Larger (one copy per type)Known at compile time
dyn Trait (trait objects)Dynamic (vtable)Smaller (one copy)Extensible at runtime

Use generics when: Performance matters, types are known at compile time, you want zero-cost abstraction. Use trait objects when: You need heterogeneous collections, plugin systems, or the set of types is open-ended.

Error Handling Patterns
PatternWhenCrate
thiserrorLibrary errors — structured, specific variantsthiserror
anyhowApplication errors — context-rich, propagate quicklyanyhow
Custom enumWhen you need exhaustive matching by callersstd only

Rule of thumb: Libraries use thiserror (callers need to match). Applications use anyhow (callers need context).


TypeScript / React Patterns

Compound Components

Components that work together implicitly via shared context.

tsx
<Select>
  <Select.Trigger>Choose a fruit</Select.Trigger>
  <Select.Options>
    <Select.Option value="apple">Apple</Select.Option>
    <Select.Option value="banana">Banana</Select.Option>
  </Select.Options>
</Select>

When to use: Complex UI components with multiple related parts (menus, accordions, tabs). When to skip: Simple components with 1-2 elements.

Custom Hook Composition

Extract and compose behavior into reusable hooks.

tsx
function useDebounce<T>(value: T, delay: number): T { ... }
function usePagination(items: Item[], pageSize: number) { ... }
function useLocalStorage<T>(key: string, initial: T) { ... }

When to use: Shared stateful logic across components, complex state management within a component. When to skip: One-off logic that doesn't repeat.

Discriminated Unions

Type-safe state modeling using TypeScript's union types.

typescript
type AsyncState<T> =
  | { status: "idle" }
  | { status: "loading" }
  | { status: "success"; data: T }
  | { status: "error"; error: Error };

// Exhaustive switch — TypeScript ensures all cases handled
function render(state: AsyncState<User>) {
  switch (state.status) {
    case "idle": return <Placeholder />;
    case "loading": return <Spinner />;
    case "success": return <UserCard user={state.data} />;
    case "error": return <ErrorBanner error={state.error} />;
  }
}

When to use: State machines, API response states, form states, anything with distinct modes. When to skip: Boolean flags are fine for simple on/off states.

State Management Decision Tree
  1. UI-local state? -> useState / useReducer
  2. Shared between siblings? -> Lift state to common parent
  3. Shared across distant components? -> React Context
  4. Complex state logic? -> useReducer + Context
  5. Server state (API data)? -> TanStack Query / SWR
  6. Global app state? -> Zustand / Jotai (prefer over Redux for new projects)

Show full SKILL.md (306 more words)Show less

Django / Python Patterns

Service Layer

Separate business logic from views and models.

python
# services/order_service.py
class OrderService:
    @staticmethod
    def create_order(user: User, items: list[CartItem]) -> Order:
        """Business logic lives here, not in the view."""
        order = Order.objects.create(user=user, total=calculate_total(items))
        OrderItem.objects.bulk_create([...])
        send_confirmation_email(user, order)
        return order

When to use: Business logic that involves multiple models, external calls, or complex validation. When to skip: Simple CRUD with no business rules beyond Django's built-in validation.

Repository Pattern (QuerySet Abstraction)

Custom managers and querysets to encapsulate query logic.

python
class PublishedManager(models.Manager):
    def get_queryset(self):
        return super().get_queryset().filter(status="published")

class Article(models.Model):
    objects = models.Manager()  # Default
    published = PublishedManager()  # Article.published.all()

When to use: Complex or reusable query logic, domain-specific filtering. When to skip: One-off queries or simple filters.

Signals vs Explicit Calls
ApproachProsCons
Django signalsDecoupled, works across appsHidden control flow, hard to debug, ordering issues
Explicit callsVisible, debuggable, testableCoupling between modules

Rule of thumb: Use signals for truly cross-cutting concerns (audit logging, cache invalidation). Use explicit calls for business-critical logic where you need to understand and test the flow.


Anti-Patterns (All Stacks)

Anti-PatternProblemFix
Premature abstractionAbstracting before seeing the pattern repeatWait for 3 instances before extracting
Inheritance over compositionDeep inheritance hierarchies, fragile base classPrefer composition (traits, hooks, mixins)
God objectOne class/module that does everythingSplit by responsibility (SRP)
Shotgun surgeryOne change requires editing many filesGroup related code together
Feature envyA function uses another class's data more than its ownMove the function to the class it envies
Speculative generalityBuilding for use cases that may never comeYAGNI — build for now, refactor when needed
Golden hammerUsing the same pattern/tool for everythingChoose the right tool for the job

Pattern Selection Guide

When asked "which pattern should I use?":

  1. Describe the problem (not the pattern you think fits)
  2. Identify constraints (performance, extensibility, team size, timeline)
  3. Present 2-3 options with trade-offs
  4. Recommend one with clear justification
  5. Note when to revisit — "If X changes, reconsider Y"

Integration

Cross-reference this pack's code-architect skill for structural/architecture assessment and code-quality for the complexity thresholds that motivate refactoring toward a pattern.

© waybarrios, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/design-patterns of waybarrios/opencode-power-pack.

Open the folder on GitHubat commit 9dccb6d

Compare with similar skills

Design Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Design Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Design Patterns this skillwaybarrios/opencode-power-pack533—~2.2kAutomated safety check: PassMIT
Developing Softwaretelagod/code-abyss243—~410Automated safety check: PassMIT
Deprecated API UpdaterArabelaTso/Skills-4-SE253—~2.8kAutomated safety check: PassApache-2.0
Code Review SkillRain-kl/OpenFlare288—~2.3kAutomated safety check: NotesMIT
New Pattern Authoring WorkflowTotoro-jam/battle-tested-patterns344—~1.5kAutomated safety check: PassMIT
Full Stack ScaffoldDokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI507—~548Automated safety check: PassCustom licence

Similar skills

  • Developing Software

    telagod/code-abyss

    Software development knowledge reference covering Python, Go, Rust, TypeScript, Java, C++, and Shell.

    243 GitHub stars~410 tokensUpdated 2 mo ago
    Backend & APIsAuto-check passed
  • Deprecated API Updater

    ArabelaTso/Skills-4-SE

    Identify and replace deprecated API usage in source code with modern alternatives.

    253 GitHub stars~2.8k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Code Review Skill

    Rain-kl/OpenFlare

    Provides comprehensive code review guidance for React 19, Vue 3, Angular 17+, Svelte 5, Rust, TypeScript, Java, PHP, Python, Django, Go, C/.NET, Kotlin, Swift, NestJS, C/C++, and more.

    288 GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check: notes
  • New Pattern Authoring Workflow

    Totoro-jam/battle-tested-patterns

    Step-by-step workflow for adding a new pattern to the battle-tested-patterns repo: validate the topic, verify sources, write the doc, code and exercises.

    344 GitHub stars~1.5k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Full Stack Scaffold

    Dokhacgiakhoa/Agent-Skills-4-Vibe-Coding-CLI

    Unified project scaffolding for Node.js, Python, Rust, and Mobile.

    507 GitHub stars~548 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from waybarrios/opencode-power-pack

All 32 skills in this repo
  • Hf Cloud Sagemaker Iam Preflight

    waybarrios/opencode-power-pack

    Verify or select a SageMaker execution role before creating models, endpoints, or training jobs.

    533 GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed
  • Huggingface LLM Trainer

    waybarrios/opencode-power-pack

    Train or fine-tune language models with TRL or Unsloth on Hugging Face Jobs, including SFT, DPO, GRPO, reward models, and GGUF conversion.

    533 GitHub stars~3k tokensUpdated 2 days ago
    Auto-check passed
  • Huggingface Vision Trainer

    waybarrios/opencode-power-pack

    Train object-detection, image-classification, or SAM segmentation models on Hugging Face Jobs.

    533 GitHub stars~2.7k tokensUpdated 2 days ago
    Auto-check passed
  • Codeql

    waybarrios/opencode-power-pack

    Run CodeQL database creation and security queries, add data-extension models, or process CodeQL SARIF.

    533 GitHub starsUsed in 2 repos~3.7k tokens
    Auto-check passed
  • Semgrep

    waybarrios/opencode-power-pack

    Run Semgrep static analysis across a codebase, optionally using Semgrep Pro for cross-file taint analysis.

    533 GitHub stars~2.4k tokensUpdated 2 days ago
    Auto-check passed
  • Insecure Defaults

    waybarrios/opencode-power-pack

    Detects fail-open insecure defaults (hardcoded secrets, weak auth, permissive security) that allow apps to run insecurely in production.

    533 GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check passed

Categories

Questions about Design Patterns

What does Design Patterns do?

Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing…. Design Patterns is an agent skill from waybarrios/opencode-power-pack. Agents should invoke this skill when choosing patterns, designing traits/interfaces/components, deciding abstraction boundaries, evaluating dependency injection/callbacks, or comparing implementation approaches in Rust, TypeScript/React, or Django/Python.

When should I use Design Patterns?

Design Patterns fits situations like: tasks that involve Design patterns; tasks that involve Backend development.

How do I install Design Patterns in Claude Code?

Run `npx skills add waybarrios/opencode-power-pack --skill design-patterns -a claude-code`. Or copy the skill folder (skills/design-patterns in waybarrios/opencode-power-pack) into .claude/skills/design-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Design Patterns in Codex?

Run `npx skills add waybarrios/opencode-power-pack --skill design-patterns -a codex`. Or copy the skill folder (skills/design-patterns in waybarrios/opencode-power-pack) into .agents/skills/design-patterns in your project. Codex loads it when a task matches its description.

Can I use Design Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add waybarrios/opencode-power-pack --skill design-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/design-patterns, .gemini/skills/design-patterns, .github/skills/design-patterns and .opencode/skills/design-patterns in your project.

What does Design Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Design Patterns is instructions for the agent only. Our summary lists: Python 3.

Does Design Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Design Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Design Patterns use?

Design Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Design Patterns use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Design Patterns?

Skills that share tags, products or a category with Design Patterns: Developing Software (telagod/code-abyss, 243 stars), Deprecated API Updater (ArabelaTso/Skills-4-SE, 253 stars), Code Review Skill (Rain-kl/OpenFlare, 288 stars) and New Pattern Authoring Workflow (Totoro-jam/battle-tested-patterns, 344 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Design Patterns?

waybarrios (a GitHub user) maintains it in waybarrios/opencode-power-pack, which has 533 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 6, 2026.

Source: waybarrios/opencode-power-pack on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.