Skip to content
Back to skills

Python Architecture

ASecurity

No. A Python domain rule should not import `psycopg2` directly; that couples domain policy to the database adapter. Define a repository port in the domain/application layer, inject it into the rule or service, and implement it with a thin `psycopg2` adapter at the edge. Compose the dependency in startup/wiring code. ```python from typing import Protocol class TaskRepository(Protocol): def get_task(self, task_id: str) -> "Task": ... class StatusRule: def __init__(self, tasks: TaskRepository): ...

  • 584 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmentpythondatabase

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill python-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-python-architecture/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-python-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
No. A Python domain rule should not import `psycopg2` directly; that couples domain policy to the database adapter.

Define a repository port in the domain/application layer, inject it into the rule or service, and implement it with a thin `psycopg2` adapter at the edge. Compose the dependency in startup/wiring code.

```python
from typing import Protocol

class TaskRepository(Protocol):
    def get_task(self, task_id: str) -> "Task": ...

class StatusRule:
    def __init__(self, tasks: TaskRepository):
        self.tasks = tasks  # injected dependency

    def decide(self, task_id: str) -> str:
        task = self.tasks.get_task(task_id)
        return "done" if task.completed else "pending"
```

Keep DB imports out of domain policy, place workflow orchestration in a service, and add focused tests using an in-memory or mock repository.

Files in this skill

  • eval-1.baseline.md328 B
  • eval-1.with-skill.md849 B
  • eval-2.baseline.md2 KB
  • eval-2.with-skill.md2.3 KB
  • trigger-1.md188 B
  • trigger-2.md176 B
  • trigger-3.md181 B
  • trigger-4.md196 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.