agentleFS
jaansokkjaansokk/cursor_tools/.claude/skills/python-dev/SKILL.md

python-dev

Skill1 starsChanged 9 months agoMITView on GitHub

Python backend conventions for this project. Use when implementing or modifying API endpoints, database models/migrations, services, schemas, or backend tests.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Depends() for sessions, config, auth, services

    line 30
  2. Very specific:

    Use lazy="selectin" or explicit eager loading to avoid N+1 queries

    line 32
  3. Distinctive:

    Test behavior: inputs, outputs, status codes, side effects

    line 37
  4. Very specific:

    Use fixtures for shared setup — organize conftest.py by scope

    line 38
  5. Distinctive:

    Write tests alongside implementation — new endpoints and services should ship with tests

    line 46
  6. Distinctive:

    If you change database models, create a new Alembic migration revision

    line 48
  7. Distinctive:

    Speak up: If you spot code that contradicts conventions, has a latent bug, unnecessary complexity, or a missed optimization — flag it.

    line 52
  8. Distinctive:

    Verify against documentation: Use the context7 MCP to check documentation of libraries when needed.

    line 53
  9. Distinctive:

    Ask, don't assume: If requirements are ambiguous or you face a non-obvious architectural choice, ask for clarification before proceeding.

    line 54
  10. Distinctive:

    Stay scoped: If you discover an issue outside your current task, report it instead of silently fixing it.

    line 55

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Conventions

Stack choices

  • FastAPI — async endpoints, dependency injection via Depends(), lifespan events
  • Pydantic v2 — schemas at all boundaries, ConfigDict(from_attributes=True) for ORM models
  • SQLAlchemy 2.0 — select() style, Mapped[], mapped_column(). No legacy 1.x Query API
  • Alembic — async migrations, always review autogenerated output
  • pytest + pytest-asyncio + httpx AsyncClient for testing

Coding standards

  • Async-first — all I/O (DB, HTTP, LLM) must be async. No blocking calls in async paths
  • Type hints everywhere — modern Python syntax (PEP 604 unions, generics)
  • Pydantic at all boundaries — no raw dicts across module boundaries
  • Separate request and response models — don't reuse the same schema for both
  • Structured logging — use the project's logging setup, not bare print()
  • Meaningful errors — HTTPException with correct status codes and clear messages
  • Small, focused functions — single responsibility

Architecture

  • Business logic lives in service modules, not in endpoint functions
  • Endpoints: validate input, call services, return responses
  • Use Depends() for sessions, config, auth, services
  • Group by feature/domain when the project grows, not by layer
  • Use lazy="selectin" or explicit eager loading to avoid N+1 queries
  • One session per request via dependency injection

Testing

  • Test behavior: inputs, outputs, status codes, side effects
  • Use fixtures for shared setup — organize conftest.py by scope
  • Mock external dependencies (LLM calls, external HTTP). Never hit real services in tests
  • Cover: happy path, validation errors (422), auth failures (401/403), not-found (404)

Workflow

  • Orient before coding — read existing code in the area, match patterns and naming conventions
  • Small, focused changes — stay within scope, don't refactor unrelated code
  • Write tests alongside implementation — new endpoints and services should ship with tests
  • Validate after edits — run type checker and linter, run tests if they exist in the area
  • If you change database models, create a new Alembic migration revision

Principles

  • Speak up. If you spot code that contradicts conventions, has a latent bug, unnecessary complexity, or a missed optimization — flag it. Don't silently work around issues.
  • Verify against documentation Use the context7 MCP to check documentation of libraries when needed.
  • Ask, don't assume. If requirements are ambiguous or you face a non-obvious architectural choice, ask for clarification before proceeding.
  • Stay scoped. If you discover an issue outside your current task, report it instead of silently fixing it. Exception: trivial fixes (typos, obvious off-by-one) that take seconds.
  • Leave code better than you found it — but only in the files you're already touching.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.