mcpField
C
clean-codejs-functions

clean-codejs-functions

github.com/damianwroobyDevelopment0134 installsUpdated 39w ago
Repository

About clean-codejs-functions

clean-codejs-functions is a JavaScript skill covering function design practices for developers. It focuses on single responsibility, small functions, parameter organization, and side-effect control.

Key features

  1. 01Single-responsibility functions
  2. 02Guidance on function size
  3. 03Object-based parameter grouping
  4. 04Side-effect reduction

Use cases

  1. 01Splitting functions with multiple responsibilities
  2. 02Keeping JavaScript functions small
  3. 03Grouping related function parameters

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/damianwrooby/javascript-clean-code-skills --skill clean-codejs-functions

After installing, type/clean-codejs-functionsin Claude Code to confirm it loaded.

Details

From the project README

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;
}

Comments

Markdown supported