Skip to content
Agentmart
Submit a tool

trove-python

Python/FastAPI coding conventions and best practices.

Skill by bravew

IndexedMIT★ 10
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/bravew-trove-python-a61cbb

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Python/FastAPI coding conventions and best practices. Auto-activates when working with Python files. Covers async patterns, type hints, SQLAlchemy, Pydantic, logging, and error handling. Use when: python conventions; fastapi patterns; async python; pydantic models.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/trove-python

What's inside

Skill name
trove-python
Description
Python/FastAPI coding conventions and best practices. Auto-activates when working with Python files. Covers async patterns, type hints, SQLAlchemy, Pydantic, logging, and error handling. Use when: python conventions; fastapi patterns; async python; pydantic models.
License
MIT
Instructions
99 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
<!-- Regenerate: bun run build:skills -->

## Session Init

This skill ships Trove conventions. Prefer existing project patterns over generic best practices when they conflict.

# Python / FastAPI Conventions

## Imports

- **Top-level imports only** — never inline imports inside functions
- Organization: stdlib → third-party → local (isort-compatible)
- Use `from __future__ import annotations` when needed for forward refs

## Type Hints

- All function signatures must have type hints (params + return)
- Use `from typing import` for complex types (`Optional`, `Union`, etc.)
- Pydantic models for all request/response schemas
- Prefer `X | None` over `Optional[X]` (Python 3.10+)

## Async Patterns (CRITICAL)

Never call blocking I/O in async functions:

```python
# BAD — blocks the event loop
async def get_user(user_id: str):
    response = requests.get(f"/users/{user_id}")  # BLOCKING!
    time.sleep(1)  # BLOCKING!

# GOOD — non-blocking
async def get_user(user_id: str):
    async with httpx.AsyncClient() as client:
        response = await client.get(f"/users/{user_id}")
    await asyncio.sleep(1)
```

- Use `httpx.AsyncClient` for HTTP (not `requests`)
- Use `asyncio.sleep` for delays (not `time.sleep`)
- Use `async with` for context managers (DB sessions, HTTP clients)

## Logging

```python
# INFO/DEBUG — f-strings are fine (fast path, no Sentry indexing needed)
logger.info(f"Processing user {user_id}")

# WARNING/ERROR — static message + extra dict (enables Sentry grouping)
logger.warning("Payment failed", extra={"user_id": user_id, "amount": amount})

# EXCEPTION — use in except blocks (auto-captures stack trace)
try:
    await process()
except Exception:
    logger.exception("Processing failed", extra={"user_id": user_id})
```

Never use `sentry_sdk.capture_exception()` — use `logger.exception()` instead.

## SQLAlchemy Async

```python
# Always use async session context manager
async with get_async_session() as session:
    result = await session.execute(select(User).where(User.id == user_id))
    user = result.scalar_one_or_none()

# Eager loading to avoid N+1
stmt = select(User).options(selectinload(User.posts)).where(User.id == user_id)
```

## Error Handling

- Use specific exception types, not bare `except:`
- FastAPI: raise `HTTPException` with appropriate status codes
- Service layer: raise domain-specific exceptions
- Never silently swallow exceptions

## Pydantic Models

```python
class UserResponse(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: str
    name: str
    email: str | None = None
    created_at: datetime
```

## AI Gotchas

- **httpx vs requests**: Always use `httpx.AsyncClient` in async code
- **datetime**: Use `datetime.now(tz=UTC)` not `datetime.utcnow()` (deprecated)
- **Pydantic v2**: Use `model_config = ConfigDict(...)` not `class Config:`
- **SQLAlchemy 2.0**: Use `select()` not `session.query()`

From bravew/trove, MIT.

More from bravew/trove

Signals

Stars
10
Forks
1
Open issues
0
Last commit (this folder)
Sep 10, 2026 (1 month ago)
Last release
Oct 8, 2026 (22 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from bravew

Cite this page

trove-python skill. Agent Mart. https://agentmart.dev/skills/bravew-trove-python-a61cbb (last updated 2026-10-24)