clean-codejs-objects

Object and class design patterns following Clean Code JavaScript.

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI

Agent Skills format with YAML frontmatter. Claude Code reads it as-is.

---
name: "clean-codejs-objects"
description: "Object and class design patterns following Clean Code JavaScript."
license: "MIT"
---

# Clean Code JavaScript – Object & Class Patterns

## Table of Contents
- Encapsulation
- Immutability
- Cohesion

## Encapsulation

```js
// ❌ Bad
user.name = 'John';

// ✅ Good
user.rename('John');
```

## Immutability

```js
// ❌ Bad
user.age++;

// ✅ Good
const updatedUser = user.withAge(user.age + 1);
```

## Cohesion

```js
// ❌ Bad
class User {
  calculateTax() {}
}

// ✅ Good
class TaxCalculator {
  calculate(user) {}
}
```

More General & Other skills

← All General & Other skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY