Install
npx skillscat add damianwrooby/javascript-clean-code-skills/clean-codejs-objects Install via the SkillsCat registry.
SKILL.md
Clean Code JavaScript – Object & Class Patterns
Table of Contents
- Encapsulation
- Immutability
- Cohesion
Encapsulation
// ❌ Bad
user.name = 'John';
// ✅ Good
user.rename('John');Immutability
// ❌ Bad
user.age++;
// ✅ Good
const updatedUser = user.withAge(user.age + 1);Cohesion
// ❌ Bad
class User {
calculateTax() {}
}
// ✅ Good
class TaxCalculator {
calculate(user) {}
}