agentleFS
MatthiasEgMatthiasEg/python-hexagonal-architecture-template/.claude/skills/add-feature/SKILL.md

add-feature

Skill0 starsChanged 5 months agoMITView on GitHub

Use when adding a new resource or use case to this FastAPI hexagonal template. Drives the domain-outward runbook that mirrors the Task slice and ends at a green validation loop.

27 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

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

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 0

    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:

    Add a new resource (or use case) by mirroring the canonical Task slice, building from the domain outward so each layer compiles against the …

    line 8
  2. Very specific:

    Follow docs/adding-a-feature.md in order.

    line 13
  3. Very specific:

    Run the check-fix skill (or uv run poe check directly) and iterate until green.

    line 35

“Common” is measured: kept by at least 6 in 10 of the 24 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

Add a feature

Add a new resource (or use case) by mirroring the canonical Task slice, building from the domain outward so each layer compiles against the one beneath it.

Steps

Follow docs/adding-a-feature.md in order. Do not skip ahead a layer; each depends on the one before it.

  1. Domain (src/app/domain/<name>.py): entity (extend Entity) and any state machine or invariants. Pure: no framework imports. Add domain exceptions in src/app/domain/exceptions.py. Write the unit test for the invariants first.
  2. Output port (src/app/application/ports/output/<name>_repository.py): the driven contract the use cases need. Add an in-memory fake in tests/support/ and a contract test asserting adapters satisfy the port.
  3. Input ports + use cases (ports/input/<name>_ports.py, use_cases/<name>_use_cases.py): one use case per operation. Mutating use cases take (repository, uow, logger) and call await uow.commit(). Unit-test each with the in-memory repo, no mocks.
  4. Persistence (db/models/<name>.py + Alembic migration via the add-migration skill; db/repositories/<name>_repository.py).
  5. API edge (web/schemas/<name>.py DTOs, web/controllers/<name>.py router). Bound DTO fields to the DB column limits so bad input is rejected at the edge, not in the database. Wire the router in web/app.py.
  6. Tests: integration (repository against Postgres via testcontainers; API via ASGI).

Definition of done

Run the check-fix skill (or uv run poe check directly) and iterate until green. The feature is not done until the full loop passes and coverage stays above the floor. Commit with a Conventional Commit message (feat(<layer>): ...).

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.