Agent skill

Universal Patterns

by MadAppGang in MadAppGang/claude-code

A skill your agent uses when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack.

MITAuto-check passedDevelopment

Install Universal Patterns

skills CLI
$ npx skills add MadAppGang/claude-code --skill universal-patterns -a claude-code

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

GitHub CLI
$ gh skill install MadAppGang/claude-code universal-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/MadAppGang/claude-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dev/skills/core/universal-patterns .claude/skills/universal-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
universal-patterns
GitHub stars
284
Token cost
~2k tokens
SKILL.md length
440 words
Files
1
Skills in repo
69
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack.

  • Works in 6 steps: Measure First: Profile before optimizing → Lazy Loading: Load resources only when… → Caching: Cache expensive computations… → …
  • Implementing language-agnostic patterns like layered architecture
  • SKILL.md covers Overview, Architecture Patterns, Code Organization Principles and Error Handling Patterns, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Universal Patterns is an agent skill from MadAppGang/claude-code. Use when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack.

Its SKILL.md is about 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 Error handling. The repository describes itself as: claude code plugins marketplace. The licence is MIT.

When your agent uses it

  • Implementing language-agnostic patterns like layered architecture
  • Dependency injection
  • Code organization principles across any technology stack

Example prompts

  • “/universal-patterns”

Workflow steps

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

  1. Measure First: Profile before optimizing
  2. Lazy Loading: Load resources only when needed
  3. Caching: Cache expensive computations and API calls
  4. Pagination: Don't load everything at once
  5. Batch Operations: Combine multiple operations when possible
  6. Async/Parallel: Use concurrency for independent operations

What it can do on your machine

Read from SKILL.md and the folder at commit 6097ad4. 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 typescript).

    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

Universal Patterns loads about 2k tokens when it runs. Until then it costs about 48 tokens; SKILL.md has 440 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~48
When it runs · the whole SKILL.md, loaded when a task matches
~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 MadAppGang/claude-code at commit 6097ad4, republished under its MIT licence (© MadAppGang). 440 words, ~2,025 tokens.

Download SKILL.mdSave it as .claude/skills/universal-patterns/SKILL.md (or your agent's skills folder).
name
universal-patterns
description
Use when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack.
version
1.0.0
keywords
architecture, design patterns, clean code, SOLID principles, error handling, best practices, code organization
plugin
dev
updated
2026-01-20

Universal Development Patterns

Overview

Language-agnostic development patterns and best practices applicable across all technology stacks.

Architecture Patterns

Layered Architecture
┌─────────────────────────────┐
│     Presentation Layer      │  UI, API handlers, CLI
├─────────────────────────────┤
│     Application Layer       │  Use cases, services
├─────────────────────────────┤
│       Domain Layer          │  Business logic, entities
├─────────────────────────────┤
│    Infrastructure Layer     │  DB, cache, external APIs
└─────────────────────────────┘

When to Use: Most applications benefit from clear separation of concerns.

Clean Architecture
         ┌─────────────────┐
         │   Frameworks    │  (outermost)
         │   & Drivers     │
     ┌───┴─────────────────┴───┐
     │    Interface Adapters    │
     │   (Controllers, Gateways)│
 ┌───┴─────────────────────────┴───┐
 │        Application Business      │
 │           Rules (Use Cases)      │
 ┌─────────────────────────────────┐
 │    Enterprise Business Rules     │  (innermost)
 │         (Entities)               │
 └─────────────────────────────────┘

Dependency Rule: Dependencies point inward. Inner layers don't know about outer layers.

Component-Based Architecture (Frontend)
src/
├── components/
│   ├── common/         # Shared UI components
│   ├── layout/         # Layout components
│   └── features/       # Feature-specific components
├── hooks/              # Custom hooks
├── stores/             # State management
├── services/           # API services
└── utils/              # Utilities

Code Organization Principles

Single Responsibility

Each module/function should do ONE thing well.

// BAD: Multiple responsibilities
function processUser(user) {
  validateUser(user);
  saveToDatabase(user);
  sendEmail(user);
  logAnalytics(user);
}

// GOOD: Single responsibility
function validateUser(user) { /* validation only */ }
function saveUser(user) { /* persistence only */ }
function notifyUser(user) { /* notification only */ }
Dependency Injection

Inject dependencies rather than creating them internally.

// BAD: Hard dependency
class UserService {
  constructor() {
    this.db = new Database(); // Hard-coded
  }
}

// GOOD: Injected dependency
class UserService {
  constructor(db) {
    this.db = db; // Injected
  }
}
Interface Segregation

Prefer many specific interfaces over one general interface.

// BAD: Fat interface
interface Worker {
  work();
  eat();
  sleep();
}

// GOOD: Segregated interfaces
interface Workable { work(); }
interface Eatable { eat(); }
interface Sleepable { sleep(); }

Error Handling Patterns

Fail Fast

Validate inputs early and fail immediately on invalid data.

function processOrder(order) {
  // Validate early
  if (!order) throw new Error('Order required');
  if (!order.items?.length) throw new Error('Order must have items');
  if (!order.customerId) throw new Error('Customer ID required');

  // Process only after validation passes
  return executeOrder(order);
}
Error Boundaries

Contain errors at appropriate boundaries.

// API boundary - catch and format errors
async function apiHandler(req, res) {
  try {
    const result = await processRequest(req);
    res.json({ success: true, data: result });
  } catch (error) {
    res.status(error.statusCode || 500).json({
      success: false,
      error: error.message
    });
  }
}
Result Types (Where Supported)

Use Result/Either types instead of exceptions for expected failures.

typescript
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };

function parseConfig(input: string): Result<Config, ParseError> {
  try {
    return { ok: true, value: JSON.parse(input) };
  } catch (e) {
    return { ok: false, error: new ParseError(e.message) };
  }
}

Data Flow Patterns

Unidirectional Data Flow

Data flows in one direction through the application.

Action → Dispatcher → Store → View → Action
Event-Driven Architecture

Decouple components through events.

// Publisher
eventBus.emit('user.created', { userId: '123' });

// Subscriber
eventBus.on('user.created', async (event) => {
  await sendWelcomeEmail(event.userId);
});
Command Query Separation (CQS)

Separate commands (mutations) from queries (reads).

// Query - returns data, no side effects
function getUser(id) { return db.users.find(id); }

// Command - mutates data, returns void/status
function updateUser(id, data) { db.users.update(id, data); }

Naming Conventions

Functions
TypeConventionExamples
Actionsverb + nouncreateUser, deleteOrder, validateInput
Queriesget/find/is/has + noungetUser, findOrders, isValid, hasPermission
Handlershandle + eventhandleClick, handleSubmit, handleError
Callbackson + eventonSuccess, onError, onChange
Variables
TypeConventionExamples
Booleansis/has/can/shouldisActive, hasAccess, canEdit, shouldRefresh
Collectionspluralusers, orders, items
Countscount/num/totaluserCount, numItems, totalPrice
Files
TypeConventionExamples
ComponentsPascalCaseUserProfile.tsx, OrderList.vue
UtilitiescamelCase/kebabformatDate.ts, string-utils.ts
ConstantsSCREAMING_SNAKEAPI_ENDPOINTS.ts, ERROR_CODES.ts
Testsname.test/specuser.test.ts, order.spec.ts

Code Quality Checklist

Before committing code, verify:

  • Single responsibility - each function does one thing
  • Clear naming - intent is obvious from names
  • Error handling - failures are handled gracefully
  • No magic numbers - constants are named and documented
  • DRY - no unnecessary duplication (but don't over-abstract)
  • Tests - critical paths are tested
  • Documentation - complex logic is explained
Show full SKILL.md (175 more words)Show less

Anti-Patterns to Avoid

God Objects

Objects that know too much or do too much. Split into focused components.

Premature Optimization

Don't optimize before measuring. Write clear code first, optimize proven bottlenecks.

Stringly Typed

Using strings where enums/types would be safer. Use type systems.

Copy-Paste Programming

Duplicating code instead of abstracting. But: prefer duplication over wrong abstraction.

Boolean Parameters

Functions with boolean flags that change behavior. Split into explicit functions.

// BAD
function process(data, isAdmin) { /* behaves differently based on flag */ }

// GOOD
function processUserData(data) { /* user logic */ }
function processAdminData(data) { /* admin logic */ }

Performance Principles

  1. Measure First: Profile before optimizing
  2. Lazy Loading: Load resources only when needed
  3. Caching: Cache expensive computations and API calls
  4. Pagination: Don't load everything at once
  5. Batch Operations: Combine multiple operations when possible
  6. Async/Parallel: Use concurrency for independent operations

Security Principles

  1. Input Validation: Never trust user input
  2. Output Encoding: Encode data for its context (HTML, SQL, etc.)
  3. Least Privilege: Request minimum permissions needed
  4. Defense in Depth: Multiple layers of security
  5. Fail Secure: Default to denying access on errors
  6. Secrets Management: Never hardcode secrets, use environment variables

Universal patterns applicable to all technology stacks

© MadAppGang, 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 plugins/dev/skills/core/universal-patterns of MadAppGang/claude-code.

Open the folder on GitHubat commit 6097ad4

Compare with similar skills

Universal 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.

Universal Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Universal Patterns this skillMadAppGang/claude-code284—~2kAutomated safety check: PassMIT
Idiomatic Elixirgeorgeguimaraes/elixir-agent-tools184—~2.1kAutomated safety check: PassApache-2.0
Clean Codejd-solanki/slidev-theme-dracula1611 repos~3.8kAutomated safety check: PassMIT
Robotics Design Patternsarpitg1304/robotics-agent-skills368—~5.4kAutomated safety check: PassApache-2.0
fp-go Functional Programming for GoIBM/fp-go2k—~8.5kAutomated safety check: PassApache-2.0
Android Data Layer and Room in KMPrcosteira79/android-skills151—~1.2kAutomated safety check: PassMIT

Similar skills

  • Idiomatic Elixir

    georgeguimaraes/elixir-agent-tools

    Writes and refactors idiomatic Elixir modules and functions, with rules for pattern matching, error handling, protocols and when a process is really needed.

    184 GitHub stars~2.1k tokensUpdated 18 days ago
    DevelopmentAuto-check passed
  • Clean Code

    jd-solanki/slidev-theme-dracula

    Write readable, maintainable code through disciplined naming, small functions, and clean error handling.

    161 GitHub starsUsed in 1 repo~3.8k tokens
    DevelopmentAuto-check passed
  • Robotics Design Patterns

    arpitg1304/robotics-agent-skills

    Architecture patterns, design principles, and proven recipes for building robust robotics software.

    368 GitHub stars~5.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Entry point for writing and reviewing Go code with the fp-go v2 library: core monad types, data-last composition, type parameter order and import conventions.

    2k GitHub stars~8.5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Android Data Layer and Room in KMP

    rcosteira79/android-skills

    Sets out the repository pattern's error-propagation model for Android and Kotlin Multiplatform, plus the Room setup for commonMain.

    151 GitHub stars~1.2k tokensUpdated 19 days ago
    MobileAuto-check passed
  • Node Backend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Sets layered architecture and coding rules for Node.js, Express and TypeScript microservices, covering routes, controllers, services, repositories, Prisma, Sentry and Zod.

    10k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed

More from MadAppGang/claude-code

All 69 skills in this repo
  • API Spec Analyzer

    MadAppGang/claude-code

    Analyzes API documentation from OpenAPI specs to provide TypeScript interfaces, request/response formats, and implementation guidance.

    284 GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed
  • Content Brief

    MadAppGang/claude-code

    Content brief template and creation methodology for SEO-optimized content.

    284 GitHub starsUsed in 1 repo~959 tokens
    Auto-check passed
  • Context Detection

    MadAppGang/claude-code

    A skill your agent uses when detecting project technology stack from files/configs/directory structure, auto-loading framework-specific skills, or analyzing multi-stack fullstack projects (e.g…

    284 GitHub stars~5.4k tokensUpdated 6 mo ago
    Auto-check passed
  • Content Optimizer

    MadAppGang/claude-code

    On-page SEO optimization techniques including keyword density, meta tags, heading structure, and readability.

    284 GitHub starsUsed in 1 repo~694 tokens
    Auto-check passed
  • Keyword Cluster Builder

    MadAppGang/claude-code

    Techniques for expanding seed keywords and clustering by topic and intent.

    284 GitHub starsUsed in 1 repo~674 tokens
    Auto-check passed
  • Serp Analysis

    MadAppGang/claude-code

    SERP analysis techniques for intent classification, feature identification, and competitive intelligence.

    284 GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Categories

Questions about Universal Patterns

What does Universal Patterns do?

A skill your agent uses when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack. Universal Patterns is an agent skill from MadAppGang/claude-code. Use when implementing language-agnostic patterns like layered architecture, dependency injection, error handling, or code organization principles across any technology stack.

When should I use Universal Patterns?

Universal Patterns fits situations like: implementing language-agnostic patterns like layered architecture; dependency injection; code organization principles across any technology stack.

How do I install Universal Patterns in Claude Code?

Run `npx skills add MadAppGang/claude-code --skill universal-patterns -a claude-code`. Or copy the skill folder (plugins/dev/skills/core/universal-patterns in MadAppGang/claude-code) into .claude/skills/universal-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Universal Patterns in Codex?

Run `npx skills add MadAppGang/claude-code --skill universal-patterns -a codex`. Or copy the skill folder (plugins/dev/skills/core/universal-patterns in MadAppGang/claude-code) into .agents/skills/universal-patterns in your project. Codex loads it when a task matches its description.

Can I use Universal 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 MadAppGang/claude-code --skill universal-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/universal-patterns, .gemini/skills/universal-patterns, .github/skills/universal-patterns and .opencode/skills/universal-patterns in your project.

What does Universal Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Universal Patterns is instructions for the agent only.

Does Universal 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 Universal 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 Universal Patterns use?

Universal Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Universal Patterns use?

About 2k tokens (SKILL.md is roughly 8.1k 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 Universal Patterns?

Skills that share tags, products or a category with Universal Patterns: Idiomatic Elixir (georgeguimaraes/elixir-agent-tools, 184 stars), Clean Code (jd-solanki/slidev-theme-dracula, 161 stars), Robotics Design Patterns (arpitg1304/robotics-agent-skills, 368 stars) and fp-go Functional Programming for Go (IBM/fp-go, 2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Universal Patterns?

MadAppGang (a GitHub organization) maintains it in MadAppGang/claude-code, which has 284 GitHub stars. The repository holds 69 skills in this directory. The repository was last updated on March 15, 2026.

Source: MadAppGang/claude-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.