cosmic-python

Implement four-layer Python architecture with models, adapters, services, and entrypoints.

2|1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/meaningfy-ws/agent-skills --skill cosmic-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cosmic-python
Source: https://github.com/meaningfy-ws/agent-skills/tree/main/skills/cosmic-python
Command: npx skills add https://github.com/meaningfy-ws/agent-skills --skill cosmic-python

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cosmic Python provides a disciplined blueprint for building Python services with a four-layer architecture (models, adapters, services, entrypoints). It emphasizes clean separation of concerns, SOLID adherence, and testability to reduce maintenance headaches and WTFs per minute during code reviews.

Core Features & Use Cases

  • Four-layer architecture: models (domain), adapters (infrastructure), services (use-cases), entrypoints (APIs/CLI).
  • Dependency Direction Principle (DIP) enforced to prevent high-level policies from depending on low-level implementations.
  • Layered testing guidance: unit tests for models, mocks for adapters, orchestrated service tests, and contract tests for entrypoints.
  • Observability and CI/CD guidance integrated to maintain architectural discipline over time.
  • Relevant for teams adopting Clean Code and Clean Architecture practices to scale Python systems.

Quick Start

Initialize a new Python project with a four-folder skeleton (models/, adapters/, services/, entrypoints/), add a SKILL.md frontmatter, and start with a minimal domain model in models/. Then implement a small service that orchestrates a mock adapter and expose a basic entrypoint, followed by CI/testing configuration.

Frequently Asked Questions about cosmic-python

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

FAQPage Schema
What is clean architecture in Python and how does the four-layer structure work?

Clean architecture in Python organizes code into four layers: models for domain logic, adapters for infrastructure, services for use-cases, and entrypoints for APIs or CLIs. This enforces dependency direction so high-level policies never depend on low-level implementations.

How do I structure a Python project to enforce clean architecture and dependency injection?

Start by creating a four-folder skeleton with models, adapters, services, and entrypoints directories. Implement a minimal domain model first, then build a service orchestrating a mock adapter, expose an entrypoint, and configure CI and testing tools to enforce boundaries.

What testing discipline should I use for a layered Python architecture?

Use unit tests for domain models, mocks for adapters, orchestrated tests for services, and contract tests for entrypoints. This layered testing strategy maintains architectural boundaries and ensures high-level use-case logic remains isolated from infrastructure changes.

Can I apply clean architecture patterns to an existing Python codebase with standard testing tools?

Yes, applying clean architecture requires only a Python-friendly toolchain with standard testing tooling and no exotic dependencies. You can incrementally refactor existing systems by introducing the four-layer structure and dependency injection to improve maintainability.

When should I not use clean architecture for a Python service?

You should avoid clean architecture for small, simple Python scripts or prototypes where strict layered boundaries, dependency injection, and rigorous testing discipline introduce unnecessary overhead and reduce development speed.