Skip to main content
skill CX Codex

superpowers-python-automation — Claude Code skill

superpowers-python-automation guides your agent to write dependable Python REST API integrations with timeouts, retries, pagination, and tests. It helps when building sync jobs or external service clients.

MIT 1 installs ★ 852 updated 2026-01-18

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add anthonylee991/gemini-superpowers-antigravity --skill superpowers-python-automation -a claude-code
Open on GitHub

What superpowers-python-automation does

This skill establishes clear standards for Python scripts that interact with remote REST services. The baseline setup relies on httpx for network calls and pytest with respx for unit tests. Environment settings load through pydantic-settings. Code is split into focused modules: client.py for API calls, models.py for payload schemas, sync.py for orchestration, and main.py as the entrypoint.

Requests must include explicit connection and read timeouts to prevent silent hanging. Retries handle network disconnects and rate limits with retry delay headers. Client error responses fail fast. For consistent execution across repeated runs, the skill applies idempotency through an request header or local storage such as SQLite.

Authorization tokens are never logged. The skill enforces a dry-run flag on command line scripts so you can inspect planned actions before writing changes.

What it helps with

  • Configure an httpx client with explicit connection and read timeouts
  • Implement cursor or link pagination with a hard limit on fetched items
  • Prevent duplicate writes across runs using an idempotency key or SQLite
  • Write mock tests for API failure handling using pytest and respx

Example prompts for the agent

  • Create an API client in client.py using httpx with retries for rate limits
  • Write a data sync script in sync.py that stores state in SQLite and supports dry-run
  • Add unit tests in pytest with respx to verify pagination limits

How to install superpowers-python-automation

1Skills CLI (Vercel)

npx skills add anthonylee991/gemini-superpowers-antigravity --skill superpowers-python-automation -a claude-code

2Manually: put the files in place

~/.claude/skills/superpowers-python-automation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/superpowers-python-automation/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about superpowers-python-automation

How do I install superpowers-python-automation in Claude Code?

Run npx skills add anthonylee991/gemini-superpowers-antigravity --skill superpowers-python-automation -a claude-code. The file will be placed in ~/.claude/skills/superpowers-python-automation/SKILL.md.

What does superpowers-python-automation do?

It provides patterns for building Python API automations, enforcing timeouts, safe retry rules, structured logs, and tests.

Which HTTP library does the skill use by default?

It defaults to httpx, but you can also use requests if your project already requires it.

Source text

SKILL.md · MIT
---
name: superpowers-python-automation
description: 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.
---

# 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)

© anthonylee991 · MIT · anthonylee991/gemini-superpowers-antigravity

Similar skills

All skills for Backend and APIs →

From the same set2

Project sponsors

Companies that keep this analytics open