agentleFS
MicrosoftKnown publishermicrosoft/FSQ/.github/skills/python-architecture/SKILL.md

python-architecture

Skill23 starsChanged 3 months agoMITView on GitHub

Internal Python architecture rules loaded only when an explicitly invoked repository prompt directs the agent to this file.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. microsoft/apm★ 3.9ksame name
    2. IAbuElRuzz/AgentSkills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 11 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Start simple and escalate only with evidence.

    line 18
  2. Distinctive:

    Use for Python work involving:

    line 22
  3. Distinctive:

    Do not use for tiny one-off scripts unless the script is becoming a maintained module.

    line 31
  4. Distinctive:

    Prefer the lowest level that keeps the module understandable and testable.

    line 45
  5. Distinctive:

    Keep framework, transport, persistence, and CLI parsing details out of domain logic unless SPEC explicitly chooses a simple combined model.

    line 69
  6. Distinctive:

    Follow existing project packaging, test, formatting, and dependency patterns.

    line 77
  7. Distinctive:

    Write or update tests for public behavior before production code unless the user accepts a narrow exception.

    line 78
  8. Distinctive:

    Keep generated code scoped to confirmed SPEC items.

    line 79
  9. Distinctive:

    Do not add abstractions that only rename a call or pass data through unchanged.

    line 80
  10. Distinctive:

    Use dataclasses, attrs, pydantic, protocols, or ABCs only when they solve an actual boundary or validation problem.

    line 81
  11. Distinctive:

    Keep imports acyclic across project modules.

    line 82
  12. Very specific:

    No cross-module imports from _internal files.

    line 91
  13. Very specific:

    Use references/audit-checklist.md for Python domain checks within the consolidated project implementation audit.

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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 Architecture

This is the internal Python architecture rules layer for an explicitly invoked SDD workflow. It helps choose the simplest adequate architecture, write Python-aware SPEC.md sections, implement against those specs, and audit code/spec synchronization.

Invocation Gate

Load this skill only when an explicitly invoked repository prompt directs the agent to this file. Ordinary discussion, explanation, review, planning, natural-language edit requests, skill-name mentions, and prose approvals must not trigger it.

Core Principle

Start simple and escalate only with evidence. Architecture exists to clarify ownership, isolate change, and protect business rules; it is not a template to apply everywhere.

When To Use

Use for Python work involving:

  • New packages, modules, services, CLIs, workers, libraries, or data pipelines.
  • Public API design.
  • Module boundary changes.
  • Domain logic, business rules, persistence, external integrations, or framework boundaries.
  • Refactoring Python code with unclear ownership or tangled imports.
  • Python domain checks within consolidated project implementation audits.

Do not use for tiny one-off scripts unless the script is becoming a maintained module.

Architecture Level Decision

Choose one level and record the rationale in SPEC for non-trivial work:

LevelUse whenAvoid when
1. ScriptOne-off utility, no public API, little reuseIt has tests, users, or recurring changes
2. Simple packageSmall reusable code with clear functions/classesBusiness rules span multiple workflows
3. Layered applicationAPI/CLI/worker with orchestration and persistenceLayers only pass data through
4. Clean ArchitectureBusiness rules must outlive framework/database choicesCRUD is simple and stable
5. Light DDDRich domain behavior, invariants, bounded contextsDomain is mostly data entry/retrieval

Prefer the lowest level that keeps the module understandable and testable.

Python SPEC Requirements

For Python modules, include this section in module SPEC.md:

## Python Architecture
- Architecture level: {1-5 and name}
- Public API: {exports, commands, endpoints, events, or classes}
- Internal modules: {files not imported outside this module}
- Domain boundaries: {where business rules live}
- Boundary models: {Pydantic schemas, DTOs, ORM models, serializers}
- Dependency direction: {allowed imports and forbidden imports}
- Rationale: {why this level is sufficient}

See references/module-spec-template.md for a fuller template.

Boundary Rules

  • Export public API through __init__.py or the project-designated entry point.
  • Prefix internal implementation files with _ when the project has no other convention.
  • Other modules must not import another module's internal files.
  • Keep framework, transport, persistence, and CLI parsing details out of domain logic unless SPEC explicitly chooses a simple combined model.
  • Pydantic schemas, serializers, ORM models, and DTOs are boundary models by default.
  • Application services orchestrate use cases; domain objects enforce business invariants.
  • Repositories hide persistence only when that improves testing, transaction boundaries, or dependency direction.
  • Unit of Work is justified only when transaction consistency spans multiple repositories or operations.

Implementation Rules

  • Follow existing project packaging, test, formatting, and dependency patterns.
  • Write or update tests for public behavior before production code unless the user accepts a narrow exception.
  • Keep generated code scoped to confirmed SPEC items.
  • Do not add abstractions that only rename a call or pass data through unchanged.
  • Use dataclasses, attrs, pydantic, protocols, or ABCs only when they solve an actual boundary or validation problem.
  • Keep imports acyclic across project modules.

Audit Rules

Before completion, check:

  • Public Interface in SPEC matches __init__.py exports, CLI commands, endpoints, or documented public symbols.
  • Dependencies in SPEC match actual project imports.
  • Internal Structure in SPEC matches files in the module directory.
  • No cross-module imports from _internal files.
  • Domain/application/infrastructure boundaries match SPEC.
  • Tests cover public behavior promised by SPEC.

Use references/audit-checklist.md for Python domain checks within the consolidated project implementation audit. Do not start a separate synchronization scan or repair loop.

References

  • references/architecture-levels.md: detailed level selection guidance.
  • references/module-spec-template.md: Python module SPEC template.
  • references/implementation-rules.md: implementation patterns and anti-patterns.
  • references/audit-checklist.md: SPEC/code audit checklist.

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.