superpowers-python-automation

2
2
Source

Implements reliable automations in Python for REST APIs: httpx/requests patterns, retries, timeouts, pagination, typing, config, logging, and tests. Use when writing Python scripts/services that call external APIs.

Install

mkdir -p .claude/skills/superpowers-python-automation && curl -L -o skill.zip "https://mcp.directory/api/skills/download/6109" && unzip -o skill.zip -d .claude/skills/superpowers-python-automation && rm skill.zip

Installs to .claude/skills/superpowers-python-automation

About this skill

Python Automation Skill

This skill provides concrete Python patterns to implement robust REST API automations.

When to use this skill

  • Python scripts that call one or more REST APIs
  • ETL jobs, sync tools, webhook handlers
  • CLI tools or small services that integrate external systems

Preferred stack (defaults)

  • HTTP client: httpx (preferred) or requests
  • Config: env vars + .env (optional) with pydantic-settings if appropriate
  • Logging: stdlib logging with structured-ish fields
  • Testing: pytest (+ respx for httpx mocking when useful)

If the project already uses different tools, follow project conventions.


Reference architecture (small but scalable)

  • client.py: API client wrapper (auth headers, retries, pagination helpers)
  • models.py: typed payload models (dataclasses or pydantic)
  • sync.py: orchestration logic (fetch -> transform -> upsert)
  • main.py: CLI entrypoint
  • tests/: unit tests for transform + client behavior

HTTP rules (mandatory)

  • Always set timeouts (connect + read)
  • Centralize request sending in one function so retries/logging are consistent
  • Never log secrets (Authorization headers, tokens)

Retry policy guidance

Retry on:

  • network errors/timeouts
  • 429 (respect Retry-After when present)
  • 500–599 Optional: 408, and 409 only if operation is safe and semantics known

Do NOT retry on:

  • most 400–499 (unless explicitly safe)

Timeouts

  • Set explicit timeouts; do not rely on defaults.
  • Use smaller connect timeout; moderate read timeout.

Pagination patterns

Support at least one helper that can handle:

  • next URL in response
  • cursor token in response
  • page/limit parameters

Add a hard stop:

  • max pages OR max items OR max elapsed time

Idempotency patterns (Python)

Choose and document:

  • Use an Idempotency-Key header when supported
  • Upsert using a stable external_id
  • Persist a lightweight state store:
    • simplest: SQLite file (recommended for OSS)
    • alternative: JSONL log + compaction

Minimum: ensure repeated runs don’t create duplicates.


Observability (Python)

Minimum logs should include:

  • run_id
  • request: method, url/path, status_code, elapsed_ms, attempt
  • record counts: processed/created/updated/skipped/failed

Also include a final summary log line.


Verification requirements

For non-trivial work, add:

  • unit tests for mapping/transform logic
  • at least one test for pagination or retry behavior (mocked)
  • a “dry-run” CLI flag (prints intended writes)

Output format when writing code

  • Provide a small directory layout
  • Explain how to configure env vars
  • Include exact commands to run (and test)

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

641968

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

590705

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

338397

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318395

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

450339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.