skills/lean-code/SKILL.md
For early development phases. Prevent excessive fallbacks, backward compatibility code, and duplication during code generation. Use when generating, modifying, or refactoring code.
npx skillsauth add mullzhang/skills lean-codeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply this skill whenever you generate, modify, or refactor code.
If you are about to write any of the following patterns, stop and remove them first.
# NG: Fallback to a legacy format that does not exist
if hasattr(obj, 'new_method'):
obj.new_method()
else:
obj.old_method() # old_method does not exist
# NG: Defensive default value "just in case"
value = config.get('key', some_complex_fallback_logic())
# NG: Same validation duplicated in two places
def create_user(name):
if not name or len(name) > 100: # Use validate_name()
raise ValueError()
# NG: Optional arguments nobody uses
def process(data, legacy_mode=False, compat_version=None):
...
# OK: Write directly
obj.new_method()
# OK: Raise an error when config is missing (do not hide issues)
value = config['key']
# OK: Keep validation in one place
def validate_name(name):
if not name or len(name) > 100:
raise ValueError()
# OK: Keep only arguments needed now
def process(data):
...
Before outputting code, ask yourself:
development
Create a finite Markdown questionnaire file that contains grouped questions, recommended options, answer fields, and optional rationale fields, then read the completed file and continue from the user's answers. Use when Codex needs to ask multiple questions for requirements, specifications, acceptance criteria, product decisions, design choices, implementation tradeoffs, or any situation where conversational back-and-forth would fatigue the user or make the remaining question count unclear.
development
Detect Python dead-code candidates that are referenced only from tests by running Vulture twice and diffing results (production paths vs production+test paths). Use when auditing cleanup targets, reviewing unused-code reports, or validating whether symbols are reachable only through tests.
testing
Generate synthetic data with SDV (Synthetic Data Vault). Learn patterns from real data with machine learning and produce privacy-preserving synthetic data. Use cases: (1) single-table synthetic data generation, (2) multi-table (relational DB) synthetic data generation, (3) time-series synthetic data generation, (4) synthetic data quality evaluation, and (5) metadata and constraint setup
development
Parse PuLP and solver logs (CBC, HiGHS, Gurobi, CPLEX) to diagnose infeasible/unbounded/time-limit/execution failures, extract key metrics, and propose prioritized next debugging actions. Use when given optimization run logs, solver stdout/stderr, or LP/MPS export errors and you need root-cause clues that generalize across optimization problems. When LP/MPS/log artifacts exist, include all of them in the analysis.