clean-codejs-functions
1
总安装量
1
周安装量
#45575
全站排名
安装命令
npx skills add https://github.com/damianwrooby/javascript-clean-code-skills --skill clean-codejs-functions
Agent 安装分布
amp
1
opencode
1
kimi-cli
1
github-copilot
1
claude-code
1
Skill 文档
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;
}