split-monolith — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited split-monolith (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A file split done wrong breaks every caller. Follow this procedure exactly — it is reversible at every step.
wc -l app/services/<file>.py| Lines | Action |
|---|---|
| < 400 | Do not split — you're solving a non-problem |
| 400–600 | Plan the split now, execute when convenient |
| > 600 | Split immediately (Principle A7 hard cap) |
Also ask: does this file mix multiple concerns? A file that is long but cohesive is better than a premature split.
Do NOT split by size. Split by type of responsibility.
Good splits (by domain):
wallet_service.py (1200 LOC) →
wallet/user.py ← user-facing operations (charge, refund)
wallet/admin.py ← admin operations (top-up, override)
wallet/history.py ← read-only queriesGood splits (by layer):
generation_service.py (1000 LOC) →
generation/orchestrator.py ← coordinates the flow
generation/cost.py ← cost calculation logic
generation/storage.py ← result persistenceBad splits (by size only — don't do this):
big_service.py →
big_service_part1.py ← meaningless
big_service_part2.py ← meaninglessWrite the target structure before touching any file.
mkdir app/services/<domain>/Do NOT move any code yet.
For each sub-file, copy (not move) the relevant functions:
# Create the new file with the relevant subset
touch app/services/<domain>/user.py
# Copy relevant classes/functions from the originalEach sub-file must:
* imports)__init__.py with ALL old names re-exportedThis is the most important step. Every name that existed in the original file must still be importable from the same path.
# app/services/<domain>/__init__.py
# Principle A8: re-export everything so callers don't change.
from app.services.<domain>.user import CreditsUserService
from app.services.<domain>.admin import CreditsAdminService
from app.services.<domain>.user import get_credits_user_service
# Backward-compat alias if the old class had a different name
CreditsService = CreditsUserService # old name → new class
__all__ = [
"CreditsUserService",
"CreditsAdminService",
"CreditsService", # backward compat
"get_credits_user_service",
]# Check every file that imported from the old module still works
python3 -c "from app.services.<domain> import <OldClassName>"
python3 -c "from app.services.<domain> import <AnotherClass>"
# Run the full test suite
pytest tests/ -x -qAll tests must be GREEN before deleting the original file.
Only after Step 5 passes:
rm app/services/<original_file>.pyRun tests again:
pytest tests/ -x -q
bash scripts/lint-architecture.shBoth must pass.
| Mistake | Consequence | Prevention |
|---|---|---|
Split before writing __init__.py | Import errors everywhere | Always create __init__.py first |
| Split by size, not responsibility | Sub-files still coupled | Ask: "what is the single job of this file?" |
| Forget to re-export old names | Callers break silently | List every public name before splitting |
| Move code instead of copy+verify | Can't roll back | Copy first, delete only after tests pass |
| Split and refactor at same time | Impossible to debug | One PR = one split. No logic changes. |
The split was done correctly when:
__init__.py re-exports every name that existed beforepython3 -c "from app.services.<domain> import <OldName>" workspytest tests/ -x -q is greenbash scripts/lint-architecture.sh exits 0~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.