clean-naming-and-logging
Use when writing or refactoring functions, variables, or logs. Enforces short descriptive names, readable beginner-friendly flow, and useful logs without decorative noise.
Why it scored this
named +4 · described +6 · substantial +6 · examples +5 · active +5 · unseen-before +8 · specific-vocabulary +8
The file
---
name: clean-naming-and-logging
description: Use when writing or refactoring functions, variables, or logs. Enforces short descriptive names, readable beginner-friendly flow, and useful logs without decorative noise.
---
# Clean Naming and Logging
Agents often write cryptic single-letter variables (`d`, `x2`) or 40-character names, nest logic too deeply, and either log nothing on failures or print noisy star/dash banners.
## Rules
- Use short, crisp, descriptive variable and function names that clearly show what data they hold. Avoid single-letter names (outside simple loop indexes) and overly long names.
- Keep logic shallow and readable. Use early returns and small helper functions instead of deeply nested `if`/`for` blocks or clever one-liners.
- Explain what each function does and what its parameters expect in a concise comment or docstring.
- Add clear logs at key steps (startup, API calls, important calculations, and error paths) so failures are easy to trace.
- Never print noisy decorative banner lines (like `print("--- Starting ---")` or `======`).
- Never use emojis in code, logs, comments, or UI text unless the user explicitly asks for them (use an icon library like Lucide for UI icons).
## Example
Bad:
Using `def proc(d, f):` with four nested `if` blocks, no parameter comments, and `print("***** DONE *****")`.
Good:
Using `def filter_active_users(users, min_days):` with a short parameter comment, an early return for empty input, and `print(f"Filtered {len(active)} active users")`.