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
- 01Single-responsibility functions
- 02Guidance on function size
- 03Object-based parameter grouping
- 04Side-effect reduction
Use cases
- 01Splitting functions with multiple responsibilities
- 02Keeping JavaScript functions small
- 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-functionsAfter installing, type/clean-codejs-functionsin Claude Code to confirm it loaded.
Details
From the project READMEClean 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