clean-codejs-functions

Function design patterns emphasizing single responsibility and clarity.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "clean-codejs-functions" with this command: npx skills add damianwrooby/javascript-clean-code-skills/damianwrooby-javascript-clean-code-skills-clean-codejs-functions

Clean Code JavaScript – Function Patterns

Table of Contents

  • Single Responsibility
  • Function Size
  • Parameters
  • Side Effects

Single Responsibility

// ❌ Bad
function handleUser(user) {
  saveUser(user);
  sendEmail(user);
}

// ✅ Good
function saveUser(user) {}
function notifyUser(user) {}

Function Size

Keep functions small (ideally < 20 lines).

Parameters

// ❌ Bad
function createUser(name, age, city, zip) {}

// ✅ Good
function createUser({ name, age, address }) {}

Side Effects

// ❌ Bad
let total = 0;
function add(value) {
  total += value;
}

// ✅ Good
function add(total, value) {
  return total + value;
}

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

clean-codejs-modules

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

clean-codejs-objects

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

clean-codejs-naming

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

clean-codejs-comments

No summary provided by upstream source.

Repository SourceNeeds Review