devs:python-core
Comprehensive Python development expertise covering modern best practices, type hints, FastAPI web development, async/await, testing, and performance optimization. Use when working on Python projects requiring guidance on: (1) Modern Python features and best practices, (2) Type hints and static typing with mypy, (3) FastAPI web development, (4) Async/await and asyncio patterns, (5) Testing with pytest, (6) Data validation with Pydantic, (7) Database integration (SQLAlchemy), (8) Project structure and dependencies, (9) Performance optimization, (10) Logging and observability, or (11) Code reviews and common errors.
What this skill does
# Python Core Development
Comprehensive guidance for modern Python development with focus on FastAPI, type safety, and best practices.
## Quick Reference Guide
### By Task Type
**Getting Started**
- **New Project**: Use `scripts/init_python_project.sh` for FastAPI or package projects
- **Core Principles**: See [references/principles.md](references/principles.md) for PEP 8 and Python philosophy
- **Common Errors**: See [references/common-errors.md](references/common-errors.md) for solutions
**Writing Code**
- **Type Hints**: See [references/type-hints.md](references/type-hints.md) for annotations and mypy
- **Async Programming**: See [references/async-patterns.md](references/async-patterns.md) for asyncio patterns
- **Testing**: See [references/testing.md](references/testing.md) for pytest strategies
**Web Development (FastAPI)**
- **FastAPI Guide**: See [references/fastapi-guide.md](references/fastapi-guide.md) for comprehensive tutorial
- **Essential Libraries**: See [references/common-libraries.md](references/common-libraries.md)
**Code Quality**
- **Code Review**: See [references/code-review.md](references/code-review.md) for checklist
- **Performance**: See [references/performance.md](references/performance.md) for optimization
**Project Management**
- **Dependencies**: See [references/dependencies.md](references/dependencies.md) for pip, poetry, uv
- **Project Structure**: See [references/project-structure.md](references/project-structure.md)
### By Question Type
| Question | Reference |
|----------|-----------|
| "How do I build a FastAPI app?" | [fastapi-guide.md](references/fastapi-guide.md) |
| "How do I add type hints?" | [type-hints.md](references/type-hints.md) |
| "How do I use async/await?" | [async-patterns.md](references/async-patterns.md) |
| "How do I test this?" | [testing.md](references/testing.md) |
| "What are Python best practices?" | [principles.md](references/principles.md) |
| "How do I structure my project?" | [project-structure.md](references/project-structure.md) |
| "What libraries should I use?" | [common-libraries.md](references/common-libraries.md) |
| "How do I manage dependencies?" | [dependencies.md](references/dependencies.md) |
| "How do I improve performance?" | [performance.md](references/performance.md) |
| "Why am I getting this error?" | [common-errors.md](references/common-errors.md) |
## Core Workflows
### 1. Starting a FastAPI Project
1. **Initialize Project**
```bash
./scripts/init_python_project.sh my-api fastapi
cd my-api
```
2. **Set Up Environment**
```bash
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
pip install fastapi uvicorn[standard] sqlalchemy pydantic
pip install pytest mypy ruff --dev
```
3. **Configure Tools**
- Copy `assets/configs/ruff.toml` for linting
- Copy `assets/configs/mypy.ini` for type checking
- Copy `assets/configs/pytest.ini` for testing
4. **Start Development**
```bash
uvicorn app.main:app --reload
```
Visit `http://localhost:8000/docs` for automatic API documentation
### 2. Building a FastAPI Endpoint
1. **Define Pydantic Models**
```python
from pydantic import BaseModel, EmailStr
class UserCreate(BaseModel):
username: str
email: EmailStr
password: str
class User(BaseModel):
id: int
username: str
email: EmailStr
is_active: bool = True
```
2. **Create Endpoint**
```python
from fastapi import FastAPI, Depends, HTTPException
from sqlalchemy.orm import Session
app = FastAPI()
@app.post("/users/", response_model=User)
async def create_user(
user: UserCreate,
db: Session = Depends(get_db)
):
db_user = crud.create_user(db, user)
return db_user
```
3. **Add Tests**
```python
from fastapi.testclient import TestClient
def test_create_user():
response = client.post(
"/users/",
json={"username": "test", "email": "[email protected]", "password": "secret"}
)
assert response.status_code == 200
assert response.json()["username"] == "test"
```
### 3. Code Quality Workflow
1. **Type Check**
```bash
mypy app/
```
2. **Lint and Format**
```bash
ruff check app/
ruff format app/
```
3. **Run Tests**
```bash
pytest --cov=app
```
4. **Security Audit**
```bash
./scripts/audit_dependencies.sh
```
## Decision Guides
### When to Use FastAPI vs Django vs Flask
**Use FastAPI when:**
- Building modern REST APIs
- Need automatic OpenAPI/Swagger docs
- Want async/await support
- Type safety is important
- Performance is critical
**Use Django when:**
- Building full-stack web applications
- Need admin interface out of the box
- Want ORM with migrations
- Building monolithic applications
**Use Flask when:**
- Need maximum flexibility
- Building small to medium APIs
- Want lightweight framework
- Learning web development
See [fastapi-guide.md](references/fastapi-guide.md) for comprehensive FastAPI patterns.
### Type Hints Strategy
**Always use type hints for:**
- Public function signatures
- Class attributes
- Function return types
- Complex data structures
**Example:**
```python
from typing import Optional
def process_data(
items: list[str],
filter_fn: Optional[callable] = None
) -> dict[str, int]:
"""Process items and return counts."""
return {item: len(item) for item in items}
```
See [type-hints.md](references/type-hints.md) for advanced patterns.
### Async vs Sync
**Use async when:**
- I/O-bound operations (HTTP requests, database queries)
- Need high concurrency
- Using FastAPI (built for async)
- Working with async libraries (httpx, asyncpg)
**Use sync when:**
- CPU-bound operations
- Simple scripts
- Libraries don't support async
- Complexity isn't justified
See [async-patterns.md](references/async-patterns.md) for asyncio patterns.
## Automation Scripts
### `scripts/init_python_project.sh`
Initialize a new Python project with best practices:
- FastAPI or package structure
- pyproject.toml with modern config
- Development dependencies (pytest, mypy, ruff)
- Proper .gitignore
Usage: `./scripts/init_python_project.sh my-project [package|fastapi]`
### `scripts/audit_dependencies.sh`
Audit dependencies for security vulnerabilities:
- Runs pip-audit for known CVEs
- Checks for outdated packages
Usage: `./scripts/audit_dependencies.sh`
### `scripts/setup_logging.sh`
Set up structured logging with structlog:
- Installs structlog
- Creates configuration file
- JSON logging for production
Usage: `./scripts/setup_logging.sh`
## Configuration Templates
### `assets/configs/ruff.toml`
Modern Python linter and formatter configuration:
- 100 character line length
- Comprehensive rule selection
- Import sorting
### `assets/configs/mypy.ini`
Static type checker configuration:
- Strict mode enabled
- Python 3.11+ features
- Comprehensive warnings
### `assets/configs/pytest.ini`
Testing framework configuration:
- Coverage reporting
- Async test support
- HTML coverage reports
### `assets/configs/pyproject.toml`
Complete project configuration template:
- FastAPI dependencies
- Development tools
- Tool configurations
## Reference Documentation
### Core Python
- **[principles.md](references/principles.md)** - PEP 8, Zen of Python, best practices
- **[type-hints.md](references/type-hints.md)** - Type annotations, mypy, protocols
- **[async-patterns.md](references/async-patterns.md)** - asyncio, async/await, concurrency
### Development
- **[testing.md](references/testing.md)** - pytest, fixtures, mocking, coverage
- **[project-structure.md](references/project-structure.md)** - Package layout, src/ pattern
- **[dependencies.md](references/dependencies.md)** - pip, poetry, uv, pyproject.toml
- **[performance.md](references/performance.md)** - Profiling, optimization strategies
- **[code-review.md](references/code-review.md)** - Review checklist, antRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.