general-best-practiceslisted
Install: claude install-skill Mindrally/skills
# General Best Practices
A comprehensive collection of software development best practices applicable across various technology stacks and project types.
## Code Quality
### Readability and Maintainability
Write short, focused functions with a single responsibility.
Use clear, descriptive names for variables, functions, and classes.
Avoid deep nesting; prefer early returns and guard clauses.
Keep functions and methods to a reasonable length (typically under 30 lines).
### Error Handling
Always handle errors explicitly rather than silently ignoring them.
Use wrapped errors for traceability and context.
Provide meaningful error messages that help with debugging.
Fail fast and fail loudly during development.
### Code Organization
Organize code into logical modules and packages.
Separate concerns: keep business logic separate from infrastructure code.
Use consistent file and folder naming conventions.
Follow the principle of least surprise in API design.
## Architecture
### Clean Architecture Principles
Structure code into distinct layers:
- **Presentation/Handlers**: Handle external requests and responses
- **Application/Services**: Orchestrate business operations
- **Domain**: Core business logic and entities
- **Infrastructure**: External systems, databases, and frameworks
### Design Principles
Prefer composition over inheritance.
Program to interfaces, not implementations.
Use dependency injection for testability and flexibility.
Design for change: i