python-design-pattern

python-design-pattern is a skill for Claude Code from AI-Riksarkivet/ra-mcp. It costs 51 tokens per session (3,754 once invoked), scanned A, original, Apache-2.0.

A guide to Python design patterns and anti-patterns, which are reusable approaches and common structural mistakes in code.

In plain words
What is it for?
Use it when designing or refactoring Python components, reviewing pull requests, or evaluating inheritance, composition, error handling, and complexity.
Why use it?
It helps you choose simpler abstractions, reduce coupling between components, and avoid designs that are difficult to test or change.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Good fit Use it when designing or refactoring Python components, reviewing pull requests, or evaluating inheritance, composition, error handling, and complexity.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ai-riksarkivet/ra-mcp/python-design-pattern
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add AI-Riksarkivet/ra-mcp --skill python-design-pattern
Clone the repo
git clone --depth 1 https://github.com/AI-Riksarkivet/ra-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-design-pattern

README.md
[![agentmods](https://agentmods.dev/badge/skills/ai-riksarkivet/ra-mcp/python-design-pattern/github.svg)](https://agentmods.dev/skills/ai-riksarkivet/ra-mcp/python-design-pattern)
Your own site
<a href="https://agentmods.dev/skills/ai-riksarkivet/ra-mcp/python-design-pattern"><img src="https://agentmods.dev/badge/skills/ai-riksarkivet/ra-mcp/python-design-pattern/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-design-pattern

Your own site · 80×15
<a href="https://agentmods.dev/skills/ai-riksarkivet/ra-mcp/python-design-pattern"><img src="https://agentmods.dev/badge/skills/ai-riksarkivet/ra-mcp/python-design-pattern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,754 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.03754
Opus 5.5 $0.00020 $0.01502
Sonnet 5.5 $0.00010 $0.00751
Haiku 4.5 $0.00005 $0.00375

Measured 1mo ago against content hash b5fd2853ec5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-design-pattern scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/mcps/viewer-mcp/.claude/skills/python-design-pattern/SKILL.md · 524 lines

How it starts

The opening of the file, as written. The whole thing — 524 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Design Patterns

Write maintainable Python code using fundamental design principles. These patterns help you build systems that are easy to understand, test, and modify.

When to Use This Skill

  • Designing new components or services
  • Refactoring complex or tangled code
  • Deciding whether to create an abstraction
  • Choosing between inheritance and composition
  • Evaluating code complexity and coupling
  • Planning modular architectures
  • Reviewing code before merge (anti-patterns checklist)
  • Debugging issues that might stem from known bad practices

Core Concepts

  1. KISS — simplest solution that works; complexity must be justified
  2. Single Responsibility — each unit has one reason to change
  3. Composition over Inheritance — combine objects, don't extend classes
  4. High Cohesion, Low Coupling — modules do one thing well; changes don't ripple
  5. Rule of Three — wait for three instances before abstracting

Fundamental Patterns

Pattern 1: KISS - Keep It Simple

Before adding complexity, ask: does a simpler solution work?

# Over-engineered: Factory with registration
class OutputFormatterFactory:
    _formatters: dict[str, type[Formatter]] = {}

    @classmethod
    def register(cls, name: str):
        def decorator(formatter_cls):
            cls._formatters[name] = formatter_cls
            return formatter_cls
        return decorator

    @classmethod
    def create(cls, name: str) -> Formatter:
        return cls._formatters[name]()

@OutputFormatterFactory.register("json")
class JsonFormatter(Formatter):
    ...

# Simple: Just use a dictionary
FORMATTERS = {
    "json": JsonFormatter,
    "csv": CsvFormatter,
    "xml": XmlFormatter,
}

def get_formatter(name: str) -> Formatter:
    """Get formatter by name."""
    if name not in FORMATTERS:
        raise ValueError(f"Unknown format: {name}")
    return FORMATTERS[name]()

The factory pattern adds code without adding value here. Save patterns for when they solve real problems.

Read the full file on GitHub · 524 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 524 lines · 51 tokens per session scan A b5fd2853ec5c

Subscribe to this mod's changes

python-design-pattern is a skill published in the GitHub repository AI-Riksarkivet/ra-mcp (27 stars, last pushed 2d ago), licensed Apache-2.0. It adds 51 tokens to every session and 3,754 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

python-engineering-guidelines

General Python engineering standards for writing, reviewing, and refactoring maintainable code. Use when Codex works on Python code, especially in medium/large projects, runtime adapters, APIs, SDK integrations, async services, stateful systems, or refactors where readability, explicit typing, module boundaries, side…

anywhere-labs/Agents-Anywhere · 75 tokens

ha-dev-workflow-apply

Applies and validates the HA code-style / strict-typing / validation workflow (spec/ha/dev-workflow) against an existing HA Custom Integration — Ruff format, ordered imports, f-strings (logging excepted), file-header docstrings, full type annotations, a local mypy-strict profile as the platinum strict-typing bridge…

nolte/claude-home-assistant · 212 tokens

coding-guidance-python

Python implementation and review skill. Use when writing, modifying, refactoring, or reviewing Python code, especially production Python that needs clear contracts, type safety, testability, and maintainable module boundaries. Portable across Python repos and tooling stacks.

n-n-code/n-n-code-skills · 53 tokens

architecture-review

Use when auditing how a Python codebase's architectural conventions diverge — "review the architecture", "audit conventions", "where does this code disagree with itself", "find inconsistent error-handling/layering/validation patterns", "is this package internally consistent". Surfaces a ranked queue of "here are N…

okeefeco/pyeye-mcp · 96 tokens

python-anti-patterns

Use this skill when reviewing Python code for common anti-patterns to avoid. Use as a checklist when reviewing code, before finalizing implementations, or when debugging issues that might stem from known bad practices.

FluxonLab/Skillry · 46 tokens

python-code-style

Python code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.

FluxonLab/Skillry · 42 tokens