Skip to content
Back to skills

Python Architecture

ASecurity

from typing import Protocol from app.domain.models import ReportFacts class ReportRepository(Protocol): def fetch_facts(self) -> ReportFacts: ... class ReportRenderer(Protocol): def render(self, report: object) -> str: ... class Notifier(Protocol): def send(self, message: str) -> None: ... ``` ```python from app.domain.models import ReportFacts def compute_policy(facts: ReportFacts) -> object: ... ``` ```python from .ports import Notifier, ReportRenderer, ReportRepository from app.domain.poli...

  • 584 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
developmentpythonapi

Works with

  • api

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-agent-skills-standard/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-python-architecture-agent-skills-standard)

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
Assume a synchronous application. Separate policy, fact gathering, rendering, and notification behind ports.

```text
app/
  domain/
    models.py          # Row/report facts
    policy.py          # Pure policy decisions
  application/
    ports.py           # Repository, renderer, notifier protocols
    report_service.py  # Workflow orchestration
  adapters/
    db_repository.py
    markdown_renderer.py
    telegram_notifier.py
  bootstrap.py          # Runtime dependency composition
```

```python
# application/ports.py
from typing import Protocol
from app.domain.models import ReportFacts


class ReportRepository(Protocol):
    def fetch_facts(self) -> ReportFacts: ...


class ReportRenderer(Protocol):
    def render(self, report: object) -> str: ...


class Notifier(Protocol):
    def send(self, message: str) -> None: ...
```

```python
# domain/policy.py
from app.domain.models import ReportFacts


def compute_policy(facts: ReportFacts) -> object:
    # Pure decisions only: no DB, Telegram, env, or HTTP imports.
    ...
```

```python
# application/report_service.py
from .ports import Notifier, ReportRenderer, ReportRepository
from app.domain.policy import compute_policy


class ReportService:
    def __init__(
        self,
        repository: ReportRepository,
        renderer: ReportRenderer,
        notifier: Notifier,
    ) -> None:
        self.repository = repository
        self.renderer = renderer
        self.notifier = notifier

    def run(self) -> None:
        facts = self.repository.fetch_facts()
        decision = compute_policy(facts)
        markdown = self.renderer.render(decision)
        self.notifier.send(markdown)
```

Keep `db_repository.py` and `telegram_notifier.py` thin: they translate external APIs into the ports. Keep Markdown formatting in `markdown_renderer.py`, separate from fact gathering.

Compose dependencies only at startup:

```python
# bootstrap.py
def build_report_service() -> ReportService:
    repository = PostgresReportRepository(...)
    renderer = MarkdownReportRenderer(...)
    notifier = TelegramNotifier(...)
    return ReportService(
        repository=repository,
        renderer=renderer,
        notifier=notifier,
    )
```

Add focused regression tests for `compute_policy`, renderer output, and `ReportService` orchestration using injected fakes.

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.