Agent skill

Python Project Structure

by wshobson in wshobson/agents

Python project organization, module architecture, and public API design.

MITAuto-check passedBackend & APIs

Install Python Project Structure

skills CLI
$ npx skills add wshobson/agents --skill python-project-structure -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wshobson/agents python-project-structure --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wshobson/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/python-development/skills/python-project-structure .claude/skills/python-project-structure && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-project-structure
GitHub stars
40k
Token cost
~1.6k tokens
SKILL.md length
472 words
Files
1
Skills in repo
142
Repo updated
First seen
Licence
MIT

At a glance

Python project organization, module architecture, and public API design.

  • Works in 4 steps: Module Cohesion → Explicit Interfaces → Flat Hierarchies → …
  • Setting up new projects
  • SKILL.md covers When to Use This Skill, Core Concepts, Quick Start and Fundamental Patterns, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Python Project Structure is an agent skill from wshobson/agents. Python project organization, module architecture, and public API design. Use when setting up new projects, organizing modules, defining public interfaces with all, or planning directory layouts.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering API design. It works with Python. The repository describes itself as: Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi. The licence is MIT.

When your agent uses it

  • Setting up new projects
  • Organizing modules
  • Defining public interfaces with all
  • Planning directory layouts

Example prompts

  • “/python-project-structure”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Module Cohesion
  2. Explicit Interfaces
  3. Flat Hierarchies
  4. Consistent Conventions

What it can do on your machine

Read from SKILL.md and the folder at commit 46891e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Project Structure loads about 1.6k tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 472 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wshobson/agents at commit 46891e7, republished under its MIT licence (© wshobson). 472 words, ~1,593 tokens.

Download SKILL.mdSave it as .claude/skills/python-project-structure/SKILL.md (or your agent's skills folder).
name
python-project-structure
description
Python project organization, module architecture, and public API design. Use when setting up new projects, organizing modules, defining public interfaces with __all__, or planning directory layouts.

Python Project Structure & Module Architecture

Design well-organized Python projects with clear module boundaries, explicit public interfaces, and maintainable directory structures. Good organization makes code discoverable and changes predictable.

When to Use This Skill

  • Starting a new Python project from scratch
  • Reorganizing an existing codebase for clarity
  • Defining module public APIs with __all__
  • Deciding between flat and nested directory structures
  • Determining test file placement strategies
  • Creating reusable library packages

Core Concepts

1. Module Cohesion

Group related code that changes together. A module should have a single, clear purpose.

2. Explicit Interfaces

Define what's public with __all__. Everything not listed is an internal implementation detail.

3. Flat Hierarchies

Prefer shallow directory structures. Add depth only for genuine sub-domains.

4. Consistent Conventions

Apply naming and organization patterns uniformly across the project.

Quick Start

myproject/
├── src/
│   └── myproject/
│       ├── __init__.py
│       ├── services/
│       ├── models/
│       └── api/
├── tests/
├── pyproject.toml
└── README.md

Fundamental Patterns

Pattern 1: One Concept Per File

Each file should focus on a single concept or closely related set of functions. Consider splitting when a file:

  • Handles multiple unrelated responsibilities
  • Grows beyond 300-500 lines (varies by complexity)
  • Contains classes that change for different reasons
python
# Good: Focused files
# user_service.py - User business logic
# user_repository.py - User data access
# user_models.py - User data structures

# Avoid: Kitchen sink files
# user.py - Contains service, repository, models, utilities...
Pattern 2: Explicit Public APIs with __all__

Define the public interface for every module. Unlisted members are internal implementation details.

python
# mypackage/services/__init__.py
from .user_service import UserService
from .order_service import OrderService
from .exceptions import ServiceError, ValidationError

__all__ = [
    "UserService",
    "OrderService",
    "ServiceError",
    "ValidationError",
]

# Internal helpers remain private by omission
# from .internal_helpers import _validate_input  # Not exported
Pattern 3: Flat Directory Structure

Prefer minimal nesting. Deep hierarchies make imports verbose and navigation difficult.

# Preferred: Flat structure
project/
├── api/
│   ├── routes.py
│   └── middleware.py
├── services/
│   ├── user_service.py
│   └── order_service.py
├── models/
│   ├── user.py
│   └── order.py
└── utils/
    └── validation.py

# Avoid: Deep nesting
project/core/internal/services/impl/user/

Add sub-packages only when there's a genuine sub-domain requiring isolation.

Pattern 4: Test File Organization

Choose one approach and apply it consistently throughout the project.

Option A: Colocated Tests

src/
├── user_service.py
├── test_user_service.py
├── order_service.py
└── test_order_service.py

Benefits: Tests live next to the code they verify. Easy to see coverage gaps.

Option B: Parallel Test Directory

src/
├── services/
│   ├── user_service.py
│   └── order_service.py
tests/
├── services/
│   ├── test_user_service.py
│   └── test_order_service.py

Benefits: Clean separation between production and test code. Standard for larger projects.

Advanced Patterns

Show full SKILL.md (199 more words)Show less
Pattern 5: Package Initialization

Use __init__.py to provide a clean public interface for package consumers.

python
# mypackage/__init__.py
"""MyPackage - A library for doing useful things."""

from .core import MainClass, HelperClass
from .exceptions import PackageError, ConfigError
from .config import Settings

__all__ = [
    "MainClass",
    "HelperClass",
    "PackageError",
    "ConfigError",
    "Settings",
]

__version__ = "1.0.0"

Consumers can then import directly from the package:

python
from mypackage import MainClass, Settings
Pattern 6: Layered Architecture

Organize code by architectural layer for clear separation of concerns.

myapp/
├── api/           # HTTP handlers, request/response
│   ├── routes/
│   └── middleware/
├── services/      # Business logic
├── repositories/  # Data access
├── models/        # Domain entities
├── schemas/       # API schemas (Pydantic)
└── config/        # Configuration

Each layer should only depend on layers below it, never above.

Pattern 7: Domain-Driven Structure

For complex applications, organize by business domain rather than technical layer.

ecommerce/
├── users/
│   ├── models.py
│   ├── services.py
│   ├── repository.py
│   └── api.py
├── orders/
│   ├── models.py
│   ├── services.py
│   ├── repository.py
│   └── api.py
└── shared/
    ├── database.py
    └── exceptions.py

File and Module Naming

Conventions
  • Use snake_case for all file and module names: user_repository.py
  • Avoid abbreviations that obscure meaning: user_repository.py not usr_repo.py
  • Match class names to file names: UserService in user_service.py
Import Style

Use absolute imports for clarity and reliability:

python
# Preferred: Absolute imports
from myproject.services import UserService
from myproject.models import User

# Avoid: Relative imports
from ..services import UserService
from . import models

Relative imports can break when modules are moved or reorganized.

Best Practices Summary

  1. Keep files focused - One concept per file, consider splitting at 300-500 lines (varies by complexity)
  2. Define __all__ explicitly - Make public interfaces clear
  3. Prefer flat structures - Add depth only for genuine sub-domains
  4. Use absolute imports - More reliable and clearer
  5. Be consistent - Apply patterns uniformly across the project
  6. Match names to content - File names should describe their purpose
  7. Separate concerns - Keep layers distinct and dependencies flowing one direction
  8. Document your structure - Include a README explaining the organization

© wshobson, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/python-development/skills/python-project-structure of wshobson/agents.

Open the folder on GitHubat commit 46891e7

Compare with similar skills

Python Project Structure next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Project Structure compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Project Structure this skillwshobson/agents40k—~1.6kAutomated safety check: PassMIT
Operator Migrationvipshop/cache-dit1.3k—~3.8kAutomated safety check: PassApache-2.0
Domodomo Backend Fastapidarknecrocities/DomoDomo---All-in-one-Tool240—~17kAutomated safety check: PassNone
Python API Designjohnku2011/boilerplates-with-ai-skills240—~449Automated safety check: PassMIT
Fastapiericrisco/rsc-harness156—~5kAutomated safety check: NotesMIT
API Contract Testingsecondsky/claude-skills227—~977Automated safety check: PassMIT

Similar skills

  • Operator Migration

    vipshop/cache-dit

    A skill your agent uses when doing operator migration or kernel migration for CUDA, Triton, or custom ops in cache-dit; porting kernels from nunchaku, deepcompressor, or other repos; designing…

    1.3k GitHub stars~3.8k tokensUpdated 9 days ago
    Backend & APIsAuto-check passed
  • Domodomo Backend Fastapi

    darknecrocities/DomoDomo---All-in-one-Tool

    Maintain DomoDomo’s local FastAPI application, routers, SQLite models, local services, and Python utilities.

    240 GitHub stars~17k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Python API Design

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.

    240 GitHub stars~449 tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Fastapi

    ericrisco/rsc-harness

    A skill your agent uses when building, reviewing, testing, securing or shipping a FastAPI / async Python service — routers, Pydantic v2 schemas, dependency injection, async SQLAlchemy 2.0…

    156 GitHub stars~5k tokensUpdated yesterday
    Backend & APIsAuto-check: notes
  • API Contract Testing

    secondsky/claude-skills

    Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact.

    227 GitHub stars~977 tokensUpdated 9 days ago
    Backend & APIsAuto-check passed
  • LangBot Core Development

    langbot-app/LangBot

    Covers developing the LangBot core backend and web UI: dev setup, repo layout, API auth types, adding endpoints, migrations and keeping the MCP server in step.

    18k GitHub stars~1.4k tokensUpdated yesterday
    DevelopmentAuto-check: notes

More from wshobson/agents

All 142 skills in this repo
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 13 repos~1.7k tokens
    Auto-check passed
  • Billing Automation

    wshobson/agents

    Covers building subscription billing: billing cycles, subscription states, invoice generation, proration, tax handling and dunning for failed payments.

    40k GitHub starsUsed in 12 repos~473 tokens
    Auto-check passed
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 12 repos~814 tokens
    Auto-check passed
  • Portfolio Risk Metrics

    wshobson/agents

    Covers portfolio risk measurement with VaR, CVaR, Sharpe, Sortino and drawdown, plus guidance on limits, stress tests and tail risk.

    40k GitHub starsUsed in 12 repos~502 tokens
    Auto-check passed
  • Plans memory headroom, works through out-of-memory failures and watches temperature and power during long ML training jobs on NVIDIA DGX Spark.

    40k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 11 repos~1.3k tokens
    Auto-check passed

Works with

Categories

Questions about Python Project Structure

What does Python Project Structure do?

Python project organization, module architecture, and public API design. Python Project Structure is an agent skill from wshobson/agents. Python project organization, module architecture, and public API design.

When should I use Python Project Structure?

Python Project Structure fits situations like: setting up new projects; organizing modules; defining public interfaces with all; planning directory layouts.

How do I install Python Project Structure in Claude Code?

Run `npx skills add wshobson/agents --skill python-project-structure -a claude-code`. Or copy the skill folder (plugins/python-development/skills/python-project-structure in wshobson/agents) into .claude/skills/python-project-structure in your project. Claude Code loads it when a task matches its description.

How do I install Python Project Structure in Codex?

Run `npx skills add wshobson/agents --skill python-project-structure -a codex`. Or copy the skill folder (plugins/python-development/skills/python-project-structure in wshobson/agents) into .agents/skills/python-project-structure in your project. Codex loads it when a task matches its description.

Can I use Python Project Structure in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wshobson/agents --skill python-project-structure -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-project-structure, .gemini/skills/python-project-structure, .github/skills/python-project-structure and .opencode/skills/python-project-structure in your project.

What does Python Project Structure need to run?

SKILL.md names no scripts, command-line tools or credentials: Python Project Structure is instructions for the agent only. Our summary lists: Python 3.

Does Python Project Structure access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Python Project Structure safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Python Project Structure use?

Python Project Structure is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Project Structure use?

About 1.6k tokens (SKILL.md is roughly 6.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python Project Structure?

Skills that share tags, products or a category with Python Project Structure: Operator Migration (vipshop/cache-dit, 1.3k stars), Domodomo Backend Fastapi (darknecrocities/DomoDomo---All-in-one-Tool, 240 stars), Python API Design (johnku2011/boilerplates-with-ai-skills, 240 stars) and Fastapi (ericrisco/rsc-harness, 156 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Project Structure?

wshobson (a GitHub user) maintains it in wshobson/agents, which has 40,254 GitHub stars. The repository holds 142 skills in this directory. The repository was last updated on October 5, 2026.

Source: wshobson/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.