Agent skill

Python Patterns

by xenitV1 in xenitV1/Antigravity-Workflows

Python development principles and decision-making. An agent skill from xenitV1/Antigravity-Workflows.

MITAuto-check passedBackend & APIs

Install Python Patterns

skills CLI
$ npx skills add xenitV1/Antigravity-Workflows --skill python-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install xenitV1/Antigravity-Workflows python-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/xenitV1/Antigravity-Workflows.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/python-patterns .claude/skills/python-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-patterns
GitHub stars
130
Used in
7 other repos
Token cost
~2.2k tokens
SKILL.md length
384 words
Files
1
Skills in repo
42
Repo updated
First seen
Licence
MIT

At a glance

Python development principles and decision-making. An agent skill from xenitV1/Antigravity-Workflows.

  • Works in 11 steps: Framework Selection (2025) → Async vs Sync Decision → Type Hints Strategy → …
  • Tasks that involve Backend development
  • SKILL.md covers ⚠️ How to Use This Skill, 1. Framework Selection (2025), 2. Async vs Sync Decision and 3. Type Hints Strategy, plus 5 more sections
  • Calls fastapi

What it does

Python Patterns is an agent skill from xenitV1/Antigravity-Workflows. Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Backend development and Type safety. It works with Python, Django, FastAPI and Redis. The licence is MIT.

When your agent uses it

  • Tasks that involve Backend development
  • Tasks that involve Type safety

Example prompts

  • “/python-patterns”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep

Workflow steps

11 steps, taken from the step headings in SKILL.md.

  1. Framework Selection (2025)
  2. Async vs Sync Decision
  3. Type Hints Strategy
  4. Project Structure Principles
  5. Django Principles (2025)
  6. FastAPI Principles
  7. Background Tasks
  8. Error Handling Principles
  9. Testing Principles
  10. Decision Checklist
  11. Anti-Patterns to Avoid

What it can do on your machine

Read from SKILL.md and the folder at commit f0a1fa7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • fastapi

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Patterns loads about 2.2k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 384 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from xenitV1/Antigravity-Workflows at commit f0a1fa7, republished under its MIT licence (© xenitV1). 384 words, ~2,159 tokens.

Download SKILL.mdSave it as .claude/skills/python-patterns/SKILL.md (or your agent's skills folder).
name
python-patterns
description
Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.
allowed-tools
Read, Write, Edit, Glob, Grep

Python Patterns

Python development principles and decision-making for 2025. Learn to THINK, not memorize patterns.


⚠️ How to Use This Skill

This skill teaches decision-making principles, not fixed code to copy.

  • ASK user for framework preference when unclear
  • Choose async vs sync based on CONTEXT
  • Don't default to same framework every time

1. Framework Selection (2025)

Decision Tree
What are you building?
│
├── API-first / Microservices
│   └── FastAPI (async, modern, fast)
│
├── Full-stack web / CMS / Admin
│   └── Django (batteries-included)
│
├── Simple / Script / Learning
│   └── Flask (minimal, flexible)
│
├── AI/ML API serving
│   └── FastAPI (Pydantic, async, uvicorn)
│
└── Background workers
    └── Celery + any framework
Comparison Principles
FactorFastAPIDjangoFlask
Best forAPIs, microservicesFull-stack, CMSSimple, learning
AsyncNativeDjango 5.0+Via extensions
AdminManualBuilt-inVia extensions
ORMChoose your ownDjango ORMChoose your own
Learning curveLowMediumLow
Selection Questions to Ask:
  1. Is this API-only or full-stack?
  2. Need admin interface?
  3. Team familiar with async?
  4. Existing infrastructure?

2. Async vs Sync Decision

When to Use Async
async def is better when:
├── I/O-bound operations (database, HTTP, file)
├── Many concurrent connections
├── Real-time features
├── Microservices communication
└── FastAPI/Starlette/Django ASGI

def (sync) is better when:
├── CPU-bound operations
├── Simple scripts
├── Legacy codebase
├── Team unfamiliar with async
└── Blocking libraries (no async version)
The Golden Rule
I/O-bound → async (waiting for external)
CPU-bound → sync + multiprocessing (computing)

Don't:
├── Mix sync and async carelessly
├── Use sync libraries in async code
└── Force async for CPU work
Async Library Selection
NeedAsync Library
HTTP clienthttpx
PostgreSQLasyncpg
Redisaioredis / redis-py async
File I/Oaiofiles
Database ORMSQLAlchemy 2.0 async, Tortoise

3. Type Hints Strategy

When to Type
Always type:
├── Function parameters
├── Return types
├── Class attributes
├── Public APIs

Can skip:
├── Local variables (let inference work)
├── One-off scripts
├── Tests (usually)
Common Type Patterns
python
# These are patterns, understand them:

# Optional → might be None
from typing import Optional
def find_user(id: int) -> Optional[User]: ...

# Union → one of multiple types
def process(data: str | dict) -> None: ...

# Generic collections
def get_items() -> list[Item]: ...
def get_mapping() -> dict[str, int]: ...

# Callable
from typing import Callable
def apply(fn: Callable[[int], str]) -> str: ...
Pydantic for Validation
When to use Pydantic:
├── API request/response models
├── Configuration/settings
├── Data validation
├── Serialization

Benefits:
├── Runtime validation
├── Auto-generated JSON schema
├── Works with FastAPI natively
└── Clear error messages

4. Project Structure Principles

Structure Selection
Small project / Script:
├── main.py
├── utils.py
└── requirements.txt

Medium API:
├── app/
│   ├── __init__.py
│   ├── main.py
│   ├── models/
│   ├── routes/
│   ├── services/
│   └── schemas/
├── tests/
└── pyproject.toml

Large application:
├── src/
│   └── myapp/
│       ├── core/
│       ├── api/
│       ├── services/
│       ├── models/
│       └── ...
├── tests/
└── pyproject.toml
FastAPI Structure Principles
Organize by feature or layer:

By layer:
├── routes/ (API endpoints)
├── services/ (business logic)
├── models/ (database models)
├── schemas/ (Pydantic models)
└── dependencies/ (shared deps)

By feature:
├── users/
│   ├── routes.py
│   ├── service.py
│   └── schemas.py
└── products/
    └── ...

5. Django Principles (2025)

Django Async (Django 5.0+)
Django supports async:
├── Async views
├── Async middleware
├── Async ORM (limited)
└── ASGI deployment

When to use async in Django:
├── External API calls
├── WebSocket (Channels)
├── High-concurrency views
└── Background task triggering
Django Best Practices
Model design:
├── Fat models, thin views
├── Use managers for common queries
├── Abstract base classes for shared fields

Views:
├── Class-based for complex CRUD
├── Function-based for simple endpoints
├── Use viewsets with DRF

Queries:
├── select_related() for FKs
├── prefetch_related() for M2M
├── Avoid N+1 queries
└── Use .only() for specific fields

6. FastAPI Principles

async def vs def in FastAPI
Use async def when:
├── Using async database drivers
├── Making async HTTP calls
├── I/O-bound operations
└── Want to handle concurrency

Use def when:
├── Blocking operations
├── Sync database drivers
├── CPU-bound work
└── FastAPI runs in threadpool automatically
Dependency Injection
Use dependencies for:
├── Database sessions
├── Current user / Auth
├── Configuration
├── Shared resources

Benefits:
├── Testability (mock dependencies)
├── Clean separation
├── Automatic cleanup (yield)
Pydantic v2 Integration
python
# FastAPI + Pydantic are tightly integrated:

# Request validation
@app.post("/users")
async def create(user: UserCreate) -> UserResponse:
    # user is already validated
    ...

# Response serialization
# Return type becomes response schema

7. Background Tasks

Selection Guide
SolutionBest For
BackgroundTasksSimple, in-process tasks
CeleryDistributed, complex workflows
ARQAsync, Redis-based
RQSimple Redis queue
DramatiqActor-based, simpler than Celery
Show full SKILL.md (155 more words)Show less
When to Use Each
FastAPI BackgroundTasks:
├── Quick operations
├── No persistence needed
├── Fire-and-forget
└── Same process

Celery/ARQ:
├── Long-running tasks
├── Need retry logic
├── Distributed workers
├── Persistent queue
└── Complex workflows

8. Error Handling Principles

Exception Strategy
In FastAPI:
├── Create custom exception classes
├── Register exception handlers
├── Return consistent error format
└── Log without exposing internals

Pattern:
├── Raise domain exceptions in services
├── Catch and transform in handlers
└── Client gets clean error response
Error Response Philosophy
Include:
├── Error code (programmatic)
├── Message (human readable)
├── Details (field-level when applicable)
└── NOT stack traces (security)

9. Testing Principles

Testing Strategy
TypePurposeTools
UnitBusiness logicpytest
IntegrationAPI endpointspytest + httpx/TestClient
E2EFull workflowspytest + DB
Async Testing
python
# Use pytest-asyncio for async tests

import pytest
from httpx import AsyncClient

@pytest.mark.asyncio
async def test_endpoint():
    async with AsyncClient(app=app, base_url="http://test") as client:
        response = await client.get("/users")
        assert response.status_code == 200
Fixtures Strategy
Common fixtures:
├── db_session → Database connection
├── client → Test client
├── authenticated_user → User with token
└── sample_data → Test data setup

10. Decision Checklist

Before implementing:

  • Asked user about framework preference?
  • Chosen framework for THIS context? (not just default)
  • Decided async vs sync?
  • Planned type hint strategy?
  • Defined project structure?
  • Planned error handling?
  • Considered background tasks?

11. Anti-Patterns to Avoid

❌ DON'T:
  • Default to Django for simple APIs (FastAPI may be better)
  • Use sync libraries in async code
  • Skip type hints for public APIs
  • Put business logic in routes/views
  • Ignore N+1 queries
  • Mix async and sync carelessly
✅ DO:
  • Choose framework based on context
  • Ask about async requirements
  • Use Pydantic for validation
  • Separate concerns (routes → services → repos)
  • Test critical paths

Remember: Python patterns are about decision-making for YOUR specific context. Don't copy code—think about what serves your application best.

© xenitV1, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/python-patterns of xenitV1/Antigravity-Workflows.

Open the folder on GitHubat commit f0a1fa7

Used in 7 other repositories

We found 22 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 7 other GitHub owners. This page covers the copy in xenitV1/Antigravity-Workflows, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Python Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Patterns this skillxenitV1/Antigravity-Workflows1307 repos~2.2kAutomated safety check: PassMIT
Python Rulessoftspark/ai-toolkit179—~2.9kAutomated safety check: PassApache-2.0
Python Developmentsickn33/agentic-awesome-skills47k1 repos~477Automated safety check: PassMIT
Python Development Python Scaffoldaiskillstore/marketplace4306 repos~1.9kAutomated safety check: PassNone
Python Devdoccker/cc-use-exp1.1k—~790Automated safety check: PassCustom licence
Pythonericrisco/rsc-harness156—~3.8kAutomated safety check: PassMIT

Similar skills

  • Python Rules

    softspark/ai-toolkit

    Python coding rules: style, patterns, security, testing. An agent skill from softspark/ai-toolkit.

    179 GitHub stars~2.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Python Development

    sickn33/agentic-awesome-skills

    You are a Python project architecture expert specializing in scaffolding production-ready Python applications.

    47k GitHub starsUsed in 1 repo~477 tokens
    Backend & APIsAuto-check passed
  • Python Development Python Scaffold

    aiskillstore/marketplace

    You are a Python project architecture expert specializing in scaffolding production-ready Python applications.

    430 GitHub starsUsed in 6 repos~1.9k tokens
    Backend & APIsAuto-check passed
  • Python Dev

    doccker/cc-use-exp

    Python 开发规范。当用户操作 .py、pyproject.toml、requirements.txt、setup.py 文件, 或涉及 FastAPI、Django、Flask、pytest、asyncio 开发时触发。

    1.1k GitHub stars~790 tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Python

    ericrisco/rsc-harness

    A skill your agent uses when the task is Python itself, in any framework or none: PEP 695 generics, mypy --strict typing, dataclass/Protocol/TypedDict/Enum choices, asyncio.TaskGroup, stdlib idioms…

    156 GitHub stars~3.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Backend Analysis Skill

    jiushiwon/wg-skills

    后端项目静态分析技能。不运行项目,直接扫描源码,为 Java(Spring Boot/Spring Cloud)、Go(Gin/Echo)、Python(FastAPI/Django/Flask)、Node.js(Express/NestJS) 项目产出 4 份报告:① 接口报告(全部 API 清单:方法/路径/入参/出参/鉴权)② 技术报告(语言/框架版本、中间件如…

    110 GitHub stars~1k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed

More from xenitV1/Antigravity-Workflows

All 42 skills in this repo
  • Parallel Agents

    xenitV1/Antigravity-Workflows

    Native multi-agent orchestration using Claude Code's Agent Tool.

    130 GitHub starsUsed in 9 repos~1.3k tokens
    Auto-check passed
  • Mobile Design

    xenitV1/Antigravity-Workflows

    Mobile-first design thinking and decision-making for iOS and Android apps.

    130 GitHub starsUsed in 2 repos~3.7k tokens
    Auto-check: notes
  • Bash Linux

    xenitV1/Antigravity-Workflows

    Bash/Linux terminal patterns. An agent skill from xenitV1/Antigravity-Workflows.

    130 GitHub starsUsed in 8 repos~1k tokens
    Auto-check: notes
  • Behavioral Modes

    xenitV1/Antigravity-Workflows

    AI operational modes (brainstorm, implement, debug, review, teach, ship, orchestrate).

    130 GitHub starsUsed in 8 repos~1.3k tokens
    Auto-check passed
  • Plan Writing

    xenitV1/Antigravity-Workflows

    Structured task planning with clear breakdowns, dependencies, and verification criteria.

    130 GitHub starsUsed in 8 repos~994 tokens
    Auto-check passed
  • I18n Localization

    xenitV1/Antigravity-Workflows

    Internationalization and localization patterns. An agent skill from xenitV1/Antigravity-Workflows.

    130 GitHub starsUsed in 7 repos~758 tokens
    Auto-check passed

Categories

Questions about Python Patterns

What does Python Patterns do?

Python development principles and decision-making. An agent skill from xenitV1/Antigravity-Workflows. Python Patterns is an agent skill from xenitV1/Antigravity-Workflows. Python development principles and decision-making.

When should I use Python Patterns?

Python Patterns fits situations like: tasks that involve Backend development; tasks that involve Type safety.

How do I install Python Patterns in Claude Code?

Run `npx skills add xenitV1/Antigravity-Workflows --skill python-patterns -a claude-code`. Or copy the skill folder (skills/python-patterns in xenitV1/Antigravity-Workflows) into .claude/skills/python-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Python Patterns in Codex?

Run `npx skills add xenitV1/Antigravity-Workflows --skill python-patterns -a codex`. Or copy the skill folder (skills/python-patterns in xenitV1/Antigravity-Workflows) into .agents/skills/python-patterns in your project. Codex loads it when a task matches its description.

Can I use Python Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add xenitV1/Antigravity-Workflows --skill python-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-patterns, .gemini/skills/python-patterns, .github/skills/python-patterns and .opencode/skills/python-patterns in your project.

What does Python Patterns need to run?

Going by SKILL.md and its folder, Python Patterns needs the command-line tools its instructions call (fastapi). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep.

Does Python Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Python Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Python Patterns use?

Python Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Patterns use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python Patterns?

Skills that share tags, products or a category with Python Patterns: Python Rules (softspark/ai-toolkit, 179 stars), Python Development (sickn33/agentic-awesome-skills, 47k stars), Python Development Python Scaffold (aiskillstore/marketplace, 430 stars) and Python Dev (doccker/cc-use-exp, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Patterns?

xenitV1 (a GitHub user) maintains it in xenitV1/Antigravity-Workflows, which has 130 GitHub stars. The repository holds 42 skills in this directory. The repository was last updated on January 14, 2026.

Source: xenitV1/Antigravity-Workflows on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.