python-patterns

python-patterns is a skill for Claude Code, Codex from omnigentx/jarvis. It costs 35 tokens per session (484 once invoked), scanned A, original, MIT.

A guide to common Python coding patterns for the Jarvis backend, including asynchronous network calls, type hints, FastAPI routes, and pytest tests.

In plain words
What is it for?
Use it when building Jarvis backend features, defining FastAPI endpoints, adding type information, handling input/output work, or writing pytest tests.
Why use it?
It helps keep Python code consistent and avoids problems such as blocking an asynchronous program or writing unclear, weakly tested code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building Jarvis backend features, defining FastAPI endpoints, adding type information, handling input/output work, or writing pytest tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/omnigentx/jarvis/python-patterns
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 omnigentx/jarvis --skill python-patterns
Clone the repo
git clone --depth 1 https://github.com/omnigentx/jarvis

Made for: Claude Code, Codex.

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/omnigentx/jarvis/python-patterns.svg)](https://agentmods.dev/skills/omnigentx/jarvis/python-patterns)
Your own site
<a href="https://agentmods.dev/skills/omnigentx/jarvis/python-patterns"><img src="https://agentmods.dev/badge/skills/omnigentx/jarvis/python-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 484 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00035 $0.00484
Opus 5 $0.00017 $0.00242
Sonnet 5 $0.00007 $0.00097
Haiku 4.5 $0.00003 $0.00048

Measured 7d ago against content hash fcbfad1a99c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

python-patterns scanned grade A with 1 finding 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 7d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

return requests.get(url).json() # BLOCKS the event loop!
backend/.fast-agent/skills/python-patterns/SKILL.md · 84 lines

What it actually says

PYTHON PATTERNS FOR JARVIS

Async / await

# ✅ Correct: use async for I/O operations
async def fetch_data(url: str) -> dict:
    async with httpx.AsyncClient() as client:
        response = await client.get(url)
        return response.json()

# ❌ Wrong: blocking I/O inside an async context
def fetch_data(url: str) -> dict:
    return requests.get(url).json()  # BLOCKS the event loop!

Type hints

# ✅ Always use type hints
from typing import Optional
from pydantic import BaseModel

class AgentConfig(BaseModel):
    name: str
    instruction: str
    skills: list[str] = []
    model: Optional[str] = None

FastAPI Patterns

# Router pattern
from fastapi import APIRouter, HTTPException

router = APIRouter(prefix="/api/v1/agents", tags=["agents"])

@router.get("/{agent_id}")
async def get_agent(agent_id: str) -> AgentResponse:
    agent = await agent_service.get(agent_id)
    if not agent:
        raise HTTPException(404, f"Agent {agent_id} not found")
    return agent

Pytest

# ✅ Fixture-based, descriptive names
import pytest

@pytest.fixture
def sample_skill():
    return {"name": "test", "description": "Test skill"}

def test_skill_loads_correct_description(sample_skill):
    assert sample_skill["description"] == "Test skill"

# ✅ Parametrize for multiple cases
@pytest.mark.parametrize("input,expected", [
    ("hello", "HELLO"),
    ("", ""),
])
def test_uppercase(input, expected):
    assert input.upper() == expected

Error Handling

# ✅ Specific exceptions, logging
import logging
logger = logging.getLogger(__name__)

try:
    result = await risky_operation()
except SpecificError as e:
    logger.error(f"Operation failed: {e}")
    raise HTTPException(500, str(e))
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. 7d ago First seen · 84 lines · 35 tokens per session scan A fcbfad1a99c3

Subscribe to this mod's changes

python-patterns is a skill published in the GitHub repository omnigentx/jarvis (36 stars, last pushed 11d ago), licensed MIT. It adds 35 tokens to every session and 484 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.