python-project-structure

Organizes Python projects with module boundaries, public APIs, and directory layouts.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/iJosueeh/itera-workspace --skill python-project-structure-ijosueeh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-project-structure
Source: https://github.com/iJosueeh/itera-workspace/tree/main/.agents/skills/python-project-structure
Command: npx skills add https://github.com/iJosueeh/itera-workspace --skill python-project-structure-ijosueeh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Python codebases often grow into tangled collections of files with unclear boundaries, hidden dependencies, and ambiguous public interfaces. This Skill provides concrete patterns for organizing modules, defining explicit public APIs, and structuring directories so code stays discoverable and maintainable as projects scale. ## Core Features & Use Cases - Module Architecture Patterns: Apply one-concept-per-file organization, flat directory structures, and layered or domain-driven layouts for services, models, and repositories. - Explicit Public Interfaces: Define what consumers can import using __all__ in __init__.py files, keeping internal helpers private by omission. - Test Organization Strategies: Choose between colocated tests and parallel test directories with consistent conventions. - Use Case: When starting a new FastAPI service, use this Skill to lay out api/, services/, repositories/, and models/ layers with clean package initialization so teammates can import from myapp import UserService without knowing internal file structure. ## Quick Start Ask the AI to design a directory structure and public API layout for a new Python project using the python-project-structure skill.

Frequently Asked Questions about python-project-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Python project for a new application?

Use a src layout with your package containing subdirectories like services, models, and api, plus a top-level tests directory and pyproject.toml. Keep the structure flat and add nesting only for genuine sub-domains.

How do I define a public API for a Python package?

Define __all__ in your package's __init__.py listing exactly which classes and functions consumers may import. Anything not listed is treated as an internal implementation detail and stays private by omission.

Should Python tests be colocated with source files or in a separate directory?

Both approaches work; colocated tests make coverage gaps visible next to the code, while a parallel tests directory cleanly separates production and test code. Pick one convention and apply it consistently across the project.

Should I use absolute or relative imports in Python packages?

Prefer absolute imports like 'from myproject.services import UserService' because they are clearer and survive module moves. Relative imports can break when modules are reorganized.

When should I split a Python file into multiple modules?

Split a file when it handles multiple unrelated responsibilities, grows beyond roughly 300-500 lines, or contains classes that change for different reasons. Each file should focus on a single concept.

When is a deep directory hierarchy justified in Python projects?

Deep nesting is justified only for genuine sub-domains requiring isolation. Flat structures are preferred because deep hierarchies make imports verbose and navigation difficult.