From lazycortex-python
Six-step Python code/style review — manually-invoked workflow that reads canon + overlay, identifies modified files, runs manual inspection categories, then dispatches chk-py + tst-py to gate.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lazycortex-python:lazy-python.check-styleThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Deep style + docstring review for modified Python files in the current change set. Invoke after a meaningful edit batch and before committing — the run pairs manual inspection (categories the automated checkers cannot see) with the full `chk-py` + `tst-py` gate, and ends with a re-verify pass. Reads canonical guidelines from `${CLAUDE_PLUGIN_ROOT}/references/` and the project overlay from `${CL...
Deep style + docstring review for modified Python files in the current change set. Invoke after a meaningful edit batch and before committing — the run pairs manual inspection (categories the automated checkers cannot see) with the full chk-py + tst-py gate, and ends with a re-verify pass. Reads canonical guidelines from ${CLAUDE_PLUGIN_ROOT}/references/ and the project overlay from ${CLAUDE_PROJECT_DIR}/docs/guidelines/ on every run — neither is cached across invocations.
This skill has 7 ordered steps. The executing agent MUST NOT skip, merge, reorder, or silently omit any step. To make dropped steps structurally impossible:
TaskCreate with exactly one task per step below — no merging, no abbreviation, no renaming. The canonical list (use these titles verbatim):
Step 1 — Read guidelinesStep 2 — Identify modified filesStep 3 — Manual reviewStep 4 — Automated checksStep 5 — Fix remaining issuesStep 6 — Re-verifyStep 7 — Log the runin_progress on enter and completed on exit. "Completed" means "I executed the step's logic AND produced a one-word outcome for it". A no-op step counts only if it emits an explicit outcome (manual-clean, chk-clean, no-fixes-needed, …).TaskList shows every prior task completed. A still-pending task is a bug — stop and execute it first.Read the canonical guidelines from the plugin (always — never skip on the assumption they are loaded):
${CLAUDE_PLUGIN_ROOT}/references/lazy-python.coding-guidelines.md${CLAUDE_PLUGIN_ROOT}/references/lazy-python.documenting-guidelines.mdThen read the project overlay if it exists (overlay overrides canon on conflict):
${CLAUDE_PROJECT_DIR}/docs/guidelines/coding_guidelines.md${CLAUDE_PROJECT_DIR}/docs/guidelines/documenting_guidelines.mdThen read the project's ${CLAUDE_PROJECT_DIR}/CLAUDE.md ## Style section if present — this is the third overlay layer for project-wide notes that don't belong to a single topic.
Why all three layers every run: dispatched skills do not inherit the main session's loaded rules, and the canon is too long to inline into this body. Re-reading is mandatory; do not skip even when "the rules feel familiar".
Outcome: guidelines-loaded.
Enumerate Python files in the current change set:
git diff --name-only HEAD
git diff --name-only HEAD --cached
Union the two lists, filter to *.py, deduplicate. If the user passed explicit file paths to the skill, use those instead and skip the git diff enumeration.
If the set is empty, emit outcome no-files-changed and exit cleanly — there is nothing to review.
Outcome: <N>-files-identified.
For each modified file, walk every category below. The categories cover rules the automated checkers (Step 4) cannot fully verify; the canon for each lives in lazy-python.coding-guidelines.md and lazy-python.documenting-guidelines.md.
""" and closing """ each on their own line; Summary / Scope describe external behaviour only (no implementation details, no algorithm narration, no private-internal references); TODO: / TMP: / DBG: / REF: / opt: / guard: / DOC(...) markers preserved verbatim.Args: / Returns: / Raises: sections; type hints accurately reflect declared behaviour; no drift between what the docstring promises and what the signature accepts.if (early-return for invalid state) has a # guard: comment on the preceding line.snake_case for functions, methods, and variables; _private prefix for non-public attributes; full words (no abbreviations like cfg, tmp_v, single-letter loop vars outside short comprehensions).typing.cast(); no bare Any in annotations (waiver required to exempt); __init__ parameters with defaults are keyword-only (after *).TODO:, TMP:, DBG:, REF:, opt:, guard:, DOC(...)) are untouched anywhere they appeared before the edit. Removing or rewording any of them is an issue regardless of whether the surrounding code looks cleaner without them.Track every violation found, by file and line. The manual pass is mandatory — do not assume Step 4 will catch these; the checkers are tuned for syntactic / type-level issues, not semantic ones.
Outcome: <N>-issues-found-manually or manual-clean.
Run the canonical aggregator. Path: <repo>/cli/chk-py (wrapper installed by /lazy-python.install).
chk-py all <file>.py -q for each modified file.chk-py all <dir>/ -q instead of looping per file — the aggregator deduplicates cross-file checks and is faster on a module-wide refactor.chk-py all -q to catch cross-file regressions (broken imports, removed public APIs, dangling type references).Always pass -q — without it, desktop notifications fire and per-file output overflows the context window.
Aggregate every violation reported by pcf / toi / pch / mypy / pylint. Group them by file for the fix pass.
Outcome: <N>-violations-from-chk or chk-clean.
For each issue identified in Step 3 or Step 4, apply a minimal targeted fix via Edit. One fix per violation; do not bundle unrelated changes (e.g. do not reorganise the file's imports while fixing a docstring line-length issue — the next checker pass will surface the import change as noise).
Test-edit guard: if a proposed fix would modify any file under tests/**, STOP and ask the user via AskUserQuestion before editing. Naming the specific test file in the question is mandatory — silently doctoring a test to keep things green hides the regression the test was meant to catch. See .claude/CLAUDE.md § "Test edits require explicit user permission".
If no issues were found in Steps 3 and 4, skip the fix loop and emit no-fixes-needed.
Outcome: <N>-issues-fixed or no-fixes-needed.
Confirm the fixes landed cleanly:
chk-py all <file>.py -q for each fixed file, or chk-py all <dir>/ -q for a multi-file refactor.chk-py all -q.tst-py <module> -q for each module the edits touched. Pass the bare module name (e.g. core, rpg), not a path and not .py.If any check still reports violations, do not loop back to Step 5 silently — escalate to the user with the remaining issue list and ask how to proceed.
Outcome: verified-clean or <N>-issues-remain.
Write a run log per lazy-log.logging:
./.logs/claude/lazy-python.check-style/YYYY-MM-DD_HH-MM-SS.md (timestamp via date -u +%Y-%m-%d_%H-%M-%S).Bash(mkdir -p ./.logs/claude/lazy-python.check-style) then a single Write to the file — never chain with &&.git_sha, git_branch, date (YYYY-MM-DD HH:MM:SS UTC), input (file list or none).# lazy-python.check-style heading; ## Actions with one bullet per step + its outcome word; ## Result with the final state (verified-clean / <N>-issues-remain / no-files-changed).Outcome: logged.
One line per task in the canonical list above, each with its outcome word. A missing line is a bug.
chk-py reports clean — the checkers do not enforce every canon rule (semantic docstring quality, contract consistency, comment preservation are out of their scope). The manual pass is mandatory; do not interpret a clean chk-py as evidence the file is review-complete.tests/** — STOP and ask the user via AskUserQuestion naming the specific test file. Never silently retune a test to keep the suite green; the failing test is signalling a regression in the code, not in itself.npx claudepluginhub mebius-san/lazy-cortex --plugin lazycortex-pythonProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.