Python Patterns

A set of Python coding conventions and design patterns for an MCP project. Python is a programming language, and MCP is a standard for connecting tools to AI assistants.

In plain words
What is it for?
Writing new Python code, reviewing existing code, choosing program structures, and organizing modules and classes.
Why use it?
It gives developers shared rules for structuring, typing, documenting, and logging Python code.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/vasallo94/obsidian-mcp-server/python-patterns
Any agent
npx skills add Vasallo94/obsidian-mcp-server --skill python-patterns
Clone the repo
git clone --depth 1 https://github.com/Vasallo94/obsidian-mcp-server

Made for: Claude Code, Codex.

Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,833 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00029 $0.01833
Opus 5 $0.00015 $0.00916
Sonnet 5 $0.00006 $0.00367
Haiku 4.5 $0.00003 $0.00183

Measured 2d ago against content hash 15a4aae9d67a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Python Patterns 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 2d 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.

.agents/skills/python-patterns/SKILL.md · 332 lines

How it starts

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

Python Patterns Skill

Cuándo usar esta skill

  • Al escribir nuevo código Python.
  • Al revisar código existente.
  • Cuando necesites decidir patrones de diseño.
  • Al estructurar módulos y clases.

Patrones Core del Proyecto

1. Estructura de Módulos

"""
Descripción breve del módulo.

Descripción más detallada si es necesario.
"""

# 1. Imports de stdlib primero
from datetime import datetime
from pathlib import Path
from typing import Optional, Tuple, Dict, List

# 2. Imports de terceros
from fastmcp import FastMCP
from pydantic import BaseModel

# 3. Imports locales (relativos)
from ..config import get_vault_path
from ..utils import get_logger

# 4. Logger al inicio
logger = get_logger(__name__)


# 5. Funciones helper (privadas) primero
def _helper_function(data: str) -> str:
    """Helper interno del módulo."""
    return data.strip()


# 6. Funciones/clases públicas después
def public_function(param: str) -> str:
    """
    Función pública del módulo.

    Args:
        param: Descripción del parámetro.

    Returns:
        Descripción del retorno.
    """
    return _helper_function(param)

2. Type Hints (Obligatorio)

# ✅ CORRECTO: Todo tipado
def process_note(
    path: Path,
    options: Optional[Dict[str, Any]] = None,
) -> Tuple[bool, str]:
    ...

# ❌ INCORRECTO: Sin tipos
def process_note(path, options=None):
    ...

Tipos comunes en el proyecto:

from pathlib import Path
from typing import Optional, Tuple, Dict, List, Any, Literal

# Para retornos con error
def operation() -> Tuple[bool, str]:
    """Retorna (success, message)."""
    if error:
        return False, "Error message"
    return True, "Success"

# Para configuración opcional
TransportType = Literal["stdio", "http", "sse"]

3. Patrón de Resultado (Success/Error)

# Patrón estándar del proyecto para operaciones
def operation(param: str) -> str:
    """
    Realiza operación.

    Returns:
        Mensaje con emoji indicando resultado.
    """
    try:
        # Validación temprana
        if not param:
            return "❌ Error: Parámetro requerido"

        vault_path = get_vault_path()
        if not vault_path:
            return "❌ Error: La ruta del vault no está configurada."

        # Lógica principal
        result = do_something(param)

        # Éxito
        return f"✅ Operación completada: {result}"

    except SpecificError as e:
        return f"❌ Error específico: {e}"
    except Exception as e:
        return f"❌ Error inesperado: {e}"

Read the full file on GitHub · 332 lines

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. 2d ago First seen · 332 lines · 29 tokens per session scan A 15a4aae9d67a

Subscribe to this mod's changes

Python Patterns is a skill published in the GitHub repository Vasallo94/obsidian-mcp-server (9 stars, last pushed 24d ago), licensed MIT. It adds 29 tokens to every session and 1,833 once invoked, about $0.0001 per session on Opus 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-31.

Related

Other skills, from other repositories

design-mcp-server

Design the tool surface, resources, and service layer for a new MCP server. Use when starting a new server, planning a major feature expansion, or when the user describes a domain/API they want to expose via MCP. Produces a design doc at docs/design.md that drives implementation.

cyanheads/obsidian-mcp-server · 62 tokens

api-canvas

DataCanvas primitive reference — a Tier 3 SQL/analytical workspace for tabular MCP servers, backed by DuckDB. Use when registering tables from upstream APIs, running ad-hoc SQL across them, and exporting results. Covers the acquire → register → query → export flow, per-table TTL, the token-sharing pattern for…

cyanheads/obsidian-mcp-server · 85 tokens

maintenance

Investigate, adopt, and verify dependency updates — with special handling for @cyanheads/mcp-ts-core. Captures what changed, understands why, cross-references against the codebase, adopts framework improvements, syncs project skills, and runs final checks. Supports two entry modes: run the full flow end-to-end, or…

cyanheads/obsidian-mcp-server · 75 tokens

api-telemetry

Catalog of OpenTelemetry instrumentation built into framework @cyanheads/mcp-ts-core — spans, metrics, completion logs, env config, runtime caveats, custom instrumentation patterns, and cardinality rules. Use when enabling OTel export, adding custom spans or metrics in services, debugging missing telemetry, looking up…

cyanheads/obsidian-mcp-server · 85 tokens

polish-docs-meta

Finalize documentation and project metadata for a ship-ready MCP server. Use after implementation is complete, tests pass, and devcheck is clean. Safe to run at any stage — each step checks current state and only acts on what still needs work.

cyanheads/obsidian-mcp-server · 54 tokens

add-test

Scaffold a test file for an existing tool, resource, or service. Use when the user asks to add tests, improve coverage, or when a definition exists without a matching test file.

cyanheads/obsidian-mcp-server · 41 tokens