From 214d307dc59949e98fc9e051d55babee2922c795 Mon Sep 17 00:00:00 2001 From: "Matt (via Claude Code)" Date: Sun, 19 Apr 2026 13:33:38 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20wave=206=20=E2=80=94=20ratchet=20my?= =?UTF-8?q?py=20coverage,=20link=20clean-code=20standard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Polish pass closing out the refactor series. pyproject.toml -------------- - Drop skillforge/engine/scorer.py from the mypy exclusion list. After Wave 2's logging cleanup it now type-checks clean at the default level. Mypy now covers 65 source files (up from 64). CLAUDE.md --------- - Add docs/clean-code.md to the Key Reference Documents list. - Expand the Code Style TL;DR with the five load-bearing rules the refactor waves actually enforced (no bare except, no print in library code, no mutable module globals, no raw fetch in React components, file-size ceilings) so the standard is discoverable from the project root. QA -- ruff check skillforge - clean mypy skillforge - 65 files pass pytest tests/ - 403 passed, 2 skipped frontend build/lint/test - all green Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 9 ++++++++- pyproject.toml | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c8d930f..014c43c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,6 +54,7 @@ Core loop: `skillforge/engine/evolution.py` (molecular) + `skillforge/engine/var ## Key Reference Documents - `docs/how-skld-works.md` — **start here**: full system overview for first-time readers. +- `docs/clean-code.md` — the review rubric every PR is held to (naming, functions, errors, data, async, functional idioms, React/TS, testing, comments, checklist). - `plans/SPEC-V2.0.md` — v2.0 architecture spec (taxonomy, agents, variants, evaluation, data model). - `plans/PLAN-V2.0.md` — v2.0 implementation plan (5 phases, 15 waves, file-by-file). - `plans/SPEC-V2.1.md` — v2.1 architecture spec (controlled evaluation environments, tiered challenge pools, train/test separation). @@ -181,11 +182,17 @@ When running autonomously (overnight work, no active user): - **On hard block**: document in Progress Tracker with `[BLOCKED: reason]` marker, write a journal entry explaining what was tried, skip to any independent work, stop cleanly if no independent work remains. ## Code Style +Full rubric: **`docs/clean-code.md`**. TL;DR: - Type hints everywhere. Dataclasses for internal models, Pydantic only at API boundary. - Async throughout — evolution engine is fully async. - No classes where functions suffice. -- Short functions, clear names, minimal comments. +- Short functions (≤50 lines), clear names, minimal comments. - Prefer composition over inheritance. +- No bare `except Exception` — typed exceptions from `skillforge/errors.py`. +- No `print` in library code — `logging` module with `logger.exception` inside excepts. +- No mutable module globals — use `skillforge/engine/run_registry.py` or similar injected state. +- No raw `fetch()` in React components — typed hooks from `frontend/src/api/hooks/`. +- File ceilings: 500 LOC (Python), 400 LOC (TSX). Split into packages when they grow. ## Testing - Unit tests mock the Agent SDK. diff --git a/pyproject.toml b/pyproject.toml index bc8f111..cd59a4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,6 @@ exclude = [ "^skillforge/engine/evolution\\.py$", "^skillforge/engine/export\\.py$", "^skillforge/engine/sandbox\\.py$", - "^skillforge/engine/scorer\\.py$", "^skillforge/main\\.py$", "^skillforge/models/run\\.py$", ]