programming
Always use this skill when writing or editing code of any sort!
When & Why to Use This Skill
This Claude skill optimizes the software development lifecycle by enforcing rigorous coding standards and modern best practices. It focuses on producing clean, maintainable, and testable code by prioritizing functional programming patterns, minimizing technical debt through efficient documentation, and ensuring mandatory code execution for immediate verification.
Use Cases
- Architecting robust applications using the 'Functional Core, Imperative Shell' pattern to isolate business logic from side effects.
- Refactoring legacy codebases to improve maintainability by replacing stale comments with intention-revealing naming conventions.
- Automating the verification of new code snippets through mandatory execution to ensure logic accuracy and prevent regressions.
- Streamlining complex functions into short, stateless, and pure components that are easier to unit test and reason about.
- Enhancing code readability and flow by implementing early return patterns and maintaining high vertical density in source files.
| name | programming |
|---|---|
| description | Always use this skill when writing or editing code of any sort! |
programming
- Avoid adding comments to code; they usually clutter the code and get stale easily.
- Only use them to explain difficult to read behavior and other out-of-band info.
- Actively remove stale comments and docstrings that don't add value.
- Use intention-revealing names instead and maintain a consistent vocabulary across the codebase.
- Functions
- Prefer stateless/pure functions, as they're easier to test and reason about.
- Separate I/O operations from business logic (Functional Core, Imperative Shell pattern).
- Googleblog source
- Extract decision logic into pure functions.
- Keep side effects (database calls, API requests, file I/O) in the outer shell layer.
- This makes core logic testable without mocking and reusable across features.
- Aim for one level of abstraction per function.
- Try to keep them short.
- If a function needs many arguments, consider using an object or splitting it into multiple functions.
- Run code that you write unless explicitly told not to.
- It is imperative that you verify the code you write works as intended.
- Avoid mutable global state; it leads to unintended side effects.
- Prefer reusing and extending things.
- e.g.: if fixtures exist, use them or generalize them.
- But beware: existing code might be broken; build on top of it, but always test it.
- Avoid unnecessary breaklines in the code; they make the file needlessly longer.
- Keep related code vertically dense.
- Declare variables close to usage.
- Place functions that are dependent on one another close together to make it easier to follow the flow of logic.
- Place functions in a downward direction, with higher-level functions appearing before lower-level ones.
- Keep related code vertically dense.
- When writing validation logic, prefer early returns on errors.