About clean-codejs-objects
A JavaScript coding skill covering object and class patterns, intended for developers seeking guidance on encapsulation, immutability, and cohesion.
Key features
- 01Encapsulation through methods
- 02Immutable update patterns
- 03Cohesion in class design
Use cases
- 01Avoiding direct mutation of object fields
- 02Designing cohesive classes
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ damianwrooby/ javascript-clean-code-skills --skill clean-codejs-objectsAfter installing, type/clean-codejs-objectsin Claude Code to confirm it loaded.
Details
From the project READMEClean 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) {}
}
Comments
Markdown supported