api-pattern-python

api-pattern-python is a skill for Claude Code from MCKRUZ/claude-code-sdlc. It costs 106 tokens per session (953 once invoked), scanned A, original, MIT.

A guide for adding Python modules, command-line commands, services, loaders, and validators by following the project’s existing structure. It is intended for Python projects managed with uv, a Python package and environment tool.

In plain words
What is it for?
Use it when adding a public module, CLI command, data loader, parser, validator, service function, exception, or package entry point to a Python project.
Why use it?
It prevents new code from using a different module layout, error style, or command setup than the rest of the project. It helps the developer locate a tested example before implementing similar work.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the claude-code-sdlc plugin — 10 skills, 32 commands, 21 agents, 1 hook shipped together

Good fit Use it when adding a public module, CLI command, data loader, parser, validator, service function, exception, or package entry point to a Python project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mckruz/claude-code-sdlc/api-pattern-python
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 MCKRUZ/claude-code-sdlc --skill api-pattern-python
Clone the repo
git clone --depth 1 https://github.com/MCKRUZ/claude-code-sdlc

Made for: Claude Code.

Or install claude-code-sdlc, the plugin that ships this one along with the rest of its 10 skills, 32 commands, 21 agents, 1 hook.

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 api-pattern-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/mckruz/claude-code-sdlc/api-pattern-python/github.svg)](https://agentmods.dev/skills/mckruz/claude-code-sdlc/api-pattern-python)
Your own site
<a href="https://agentmods.dev/skills/mckruz/claude-code-sdlc/api-pattern-python"><img src="https://agentmods.dev/badge/skills/mckruz/claude-code-sdlc/api-pattern-python/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 api-pattern-python

Your own site · 80×15
<a href="https://agentmods.dev/skills/mckruz/claude-code-sdlc/api-pattern-python"><img src="https://agentmods.dev/badge/skills/mckruz/claude-code-sdlc/api-pattern-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 953 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.
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.00106 $0.00953
Opus 5.5 $0.00042 $0.00381
Sonnet 5.5 $0.00021 $0.00191
Haiku 4.5 $0.00011 $0.00095

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

Security

Grade A, and why

api-pattern-python 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 3mo 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.

harness/packs/stacks/python/skills/api-pattern-python/SKILL.md · 63 lines

How it starts

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

API pattern — Python

Consistency is the point: the same kind of work looks the same everywhere, so the reviewer and the next agent read it without re-learning. You do not invent structure — you locate the codebase's canonical example and replicate it. The depth is in .claude/rules/project-structure.md.

Procedure

  1. Find the canonical example. If the spec names one under "Reuse this pattern," read it. Otherwise Grep for the nearest sibling of the same shape and pick the most recent, most-tested one — not the oldest. Useful anchors:

    • the package's public surface: src/*/__init__.py (what the codebase chooses to export)
    • a CLI command: Grep for argparse, add_parser(, @click.command, or @app.command
    • a loader/parser of the same input kind: Grep for yaml.safe_load, json.load, Path(
    • the project's exception base: Grep for class .*Error\( / Exception\)
    • the entry-point wiring: [project.scripts] in pyproject.toml
  2. Extract the pattern, don't paraphrase it. Note, from the example:

    • Layering — CLI/entry point (parses args, prints, sets the exit code) → service function (pure logic, returns values, raises domain errors) → I/O or client. Human output lives at the CLI layer only; the layer below it logs and returns.
    • The signature — fully annotated params and return. What typed object it returns (dataclass / TypedDict / model), not a raw dict[str, Any].
    • Validation — where external input is parsed into that typed object, at the boundary, once.
    • Error model — which domain exception it raises and from which base; what it deliberately does not catch. Confirm it never swallows (except: pass) and never bare-excepts.
    • Logging — logging.getLogger(__name__), structured, on failure paths.
    • Naming and placement — snake_case module under the right package, one concern per module.
    • The test shape — tests/test_<module>.py, test_scenario_expected_result names, fixtures (tmp_path, monkeypatch) over setup methods, @pytest.mark.parametrize for variant cases.

Read the full file on GitHub · 63 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. 3mo ago First seen · 63 lines · 106 tokens per session scan A 7182a1c40d8d

Subscribe to this mod's changes

api-pattern-python is a skill published in the GitHub repository MCKRUZ/claude-code-sdlc (8 stars, last pushed 1mo ago), licensed MIT. It adds 106 tokens to every session and 953 once invoked, about $0.0004 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-31.

Related

api-pattern-python compared with skills from other repositories

api-pattern-python next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
api-pattern-pythonMCKRUZ/claude-code-sdlcSkill81mo agoMITA106Claude Code
matlabK-Dense-AI/scientific-agent-skillsSkill59k2d agoMITA44Claude Code
pennylaneK-Dense-AI/scientific-agent-skillsSkill59k2d agoMITA74Claude Code
holoscan-install-wheelNVIDIA/skillsSkill4.3ktodayApache-2.0A34Claude Code, Codex
python-engineering-guidelinesanywhere-labs/Agents-AnywhereSkill3.9ktodayApache-2.0A75Codex
future-self-liteTHU-MAIC/OpenMAICSkill46ktodayMITA20Claude Code, Codex
rocm-kernelshuggingface/kernelsSkill799todayApache-2.0A93Claude Code