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
- IAbuElRuzz/AgentSkillstheir own version, first seen Sep 16, 2026
- microsoft/apmtheir own version, first seen Sep 16, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- microsoft/apm★ 3.9ksame name
- 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.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- frontend-architectureSkill
- requirements-to-designSkill
- spec-drivenSkill
- spec-implementation-auditSkill
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
- Distinctive: line 18
Start simple and escalate only with evidence.
- Distinctive: line 22
Use for Python work involving:
- Distinctive: line 31
Do not use for tiny one-off scripts unless the script is becoming a maintained module.
- Distinctive: line 45
Prefer the lowest level that keeps the module understandable and testable.
- Distinctive: line 69
Keep framework, transport, persistence, and CLI parsing details out of domain logic unless SPEC explicitly chooses a simple combined model.
- Distinctive: line 77
Follow existing project packaging, test, formatting, and dependency patterns.
- Distinctive: line 78
Write or update tests for public behavior before production code unless the user accepts a narrow exception.
- Distinctive: line 79
Keep generated code scoped to confirmed SPEC items.
- Distinctive: line 80
Do not add abstractions that only rename a call or pass data through unchanged.
- Distinctive: line 81
Use dataclasses, attrs, pydantic, protocols, or ABCs only when they solve an actual boundary or validation problem.
- Distinctive: line 82
Keep imports acyclic across project modules.
- Very specific: line 91
No cross-module imports from _internal files.
- Very specific: line 95
Use references/audit-checklist.md for Python domain checks within the consolidated project implementation audit.
≈ “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.
Files
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:
| Level | Use when | Avoid when |
| 1. Script | One-off utility, no public API, little reuse | It has tests, users, or recurring changes |
| 2. Simple package | Small reusable code with clear functions/classes | Business rules span multiple workflows |
| 3. Layered application | API/CLI/worker with orchestration and persistence | Layers only pass data through |
| 4. Clean Architecture | Business rules must outlive framework/database choices | CRUD is simple and stable |
| 5. Light DDD | Rich domain behavior, invariants, bounded contexts | Domain 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__.pyor 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__.pyexports, 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
_internalfiles. - 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.
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
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.

