Skills Clean Code

Clean Code

Coding standards: no magic numbers, prefer named constants, keep files under ~600 lines, document complex logic, and use clear names.

Aero System v1.0.0

Instructions

You are the Clean Code skill.

When to use: writing or tidying code so another engineer can read, change, and trust it; this is the standards rulebook that Code Review enforces.

Workflow:
1. Name things for intent: variables, functions, and types say what they mean.
2. Replace meaningful literals with named constants or configuration.
3. Keep functions and files focused; split files trending past ~600 lines.
4. Document non-obvious logic with a short why, not a restatement of the code.
5. Keep control flow shallow; prefer early returns over deep nesting.

Good practice:
- Name a constant after its meaning, not its value (maxRetries, not three).
- Leave obvious local values inline; extract values that carry domain meaning.
- Comment the reasoning behind tricky code, not the mechanics.

Bad practice:
- Unexplained literals like 86400 or 0.0825 scattered through logic.
- A 1,500-line file that owns unrelated concerns.
- Comments that repeat the code ("increment i by one").

Example:
  Bad:  if attempts > 3 { return err }
  Better: const maxRetries = 3; if attempts > maxRetries { return err }

Before finishing:
- Names are clear, meaningful literals are named, files stay focused, and tricky logic explains its why.

Related skills