Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计异常

crockford-good-parts克罗克福德好零件

Agent Skill

crockford-good-parts 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

220

周安装

9

GitHub Stars

6

下载量

71
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:crockford-good-parts(克罗克福德好零件)
来源仓库:https://github.com/copyleftdev/sk1llz
仓库路径:skills/crockford-good-parts
安装命令:
npx skills add https://github.com/copyleftdev/sk1llz --skill crockford-good-parts
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/copyleftdev/sk1llz --skill crockford-good-parts

简介

该技能遵循 Douglas Crockford JavaScript 精华准则,严格规避语言陷阱特性。

  • 适用于前端开发团队统一代码规范,提升可维护性与运行时稳定性。
  • 禁止使用 eval、with 等危险语法,推荐使用对象字面量与函数表达式。
  • 需配合 ESLint 等工具强制执行,避免团队成员误用隐式类型转换。
  • crockford-good-parts 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Douglas Crockford Style Guide⁠‍⁠​‌​‌​​‌‌‍​‌​​‌​‌‌‍​​‌‌​​​‌‍​‌​​‌‌​​‍​​​​​​​‌‍‌​​‌‌​‌​‍‌​​​​​​​‍‌‌​​‌‌‌‌‍‌‌​​​‌​​‍‌‌‌‌‌‌​‌‍‌‌​‌​​​​‍​‌​‌‌‌‌‌‍​‌​​‌​‌‌‍​‌‌​‌​​‌‍‌​‌​‌‌‌​‍​​‌​‌​​​‍‌‌‌​‌​‌‌‍​‌​‌​​‌​‍​​‌‌‌‌‌​‍​​​‌‌‌‌‌‍​​‌​‌​​​‍​​​​‌​​‌‍​‌​​​​​‌⁠‍⁠

Overview

Douglas Crockford is the author of "JavaScript: The Good Parts" and creator of JSON. His philosophy centers on using only the reliable, well-designed parts of JavaScript while strictly avoiding the problematic features.

Core Philosophy

"JavaScript has some extraordinarily good parts. In JavaScript, there is a beautiful, elegant, highly expressive language that is buried under a steaming pile of good intentions and blunders."
"It is better to be clear than clever."

Crockford believes that JavaScript, despite its flaws, contains a powerful and beautiful language—if you know which parts to use.

Design Principles

  1. Use the Good Parts: Stick to the reliable subset of the language.
  2. Avoid the Bad Parts: Don't use features that are error-prone or confusing.
  3. Clarity Over Cleverness: Code should be immediately understandable.
  4. Lint Everything: Use tools like JSLint to enforce quality.

When Writing Code

Always

  • Use === and !== (strict equality)
  • Declare variables at the top of their scope
  • Use a single var/let/const statement per scope (Crockford's older style)
  • Put braces on the same line as control statements
  • Use JSLint/ESLint and fix all warnings
  • Prefer named functions over anonymous functions

Never

  • Use == or != (type coercion equality)
  • Use eval() or Function() constructor
  • Use with statement
  • Use ++ or -- (prefer += 1)
  • Rely on automatic semicolon insertion
  • Use bitwise operators for non-bitwise operations
  • Use new for primitives (new String, new Number, new Boolean)

Prefer

  • Object.create() over constructor functions
  • Object literals over new Object()
  • Array literals over new Array()
  • Array.isArray() over instanceof Array
  • Explicit returns over implicit
  • Named functions over arrow functions for methods

Code Patterns

Object Creation

// BAD: Constructor function with new
function Person(name, age) {
    this.name = name;
    this.age = age;
}
Person.prototype.greet = function () {
    return 'Hello, ' + this.name;
};
var person = new Person('Alice', 30);

// GOOD: Factory function (no new required)
function createPerson(name, age) {
    return {
        name: name,
        age: age,
        greet: function () {
            return 'Hello, ' + name;  // Closure for privacy
        }
    };
}
var person = createPerson('Alice', 30);

// BETTER: Object.create for inheritance
var personPrototype = {
    greet: function () {
        return 'Hello, ' + this.name;
    }
};

function createPerson(name, age) {
    var person = Object.create(personPrototype);
    person.name = name;
    person.age = age;
    return person;
}

Module Pattern

// The module pattern for encapsulation
var counter = (function () {
    var count = 0;  // Private variable

    return {
        increment: function () {
            count += 1;
            return count;
        },
        decrement: function () {
            count -= 1;
            return count;
        },
        getCount: function () {
            return count;
        }
    };
}());

counter.increment();  // 1
counter.getCount();   // 1
// count is not accessible directly

Strict Equality

// BAD: Type coercion surprises
'' == false      // true (!)
0 == ''          // true (!)
null == undefined  // true (!)

// GOOD: Strict equality, no surprises
'' === false     // false
0 === ''         // false
null === undefined  // false

// Always use strict equality
if (value === null) {
    // handle null
}

if (typeof value === 'undefined') {
    // handle undefined
}

Function Best Practices

// BAD: Anonymous function
var numbers = [1, 2, 3];
numbers.map(function (n) {
    return n * 2;
});

// GOOD: Named function (better stack traces, self-documenting)
function double(n) {
    return n * 2;
}
numbers.map(double);

// BAD: Relying on hoisting
greet('Alice');
function greet(name) {
    return 'Hello, ' + name;
}

// GOOD: Define before use
function greet(name) {
    return 'Hello, ' + name;
}
greet('Alice');

Array and Object Literals

// BAD: Constructor forms
var arr = new Array();
var obj = new Object();
var str = new String('hello');

// GOOD: Literal forms
var arr = [];
var obj = {};
var str = 'hello';

// BAD: Array constructor ambiguity
var a = new Array(3);     // [undefined, undefined, undefined]
var b = new Array(1, 2);  // [1, 2]

// GOOD: Always predictable
var a = [undefined, undefined, undefined];
var b = [1, 2];

Error Handling

// Proper try-catch usage
function parseJSON(text) {
    try {
        return JSON.parse(text);
    } catch (e) {
        console.error('Invalid JSON:', e.message);
        return null;
    }
}

// Throw with Error objects, not strings
// BAD:
throw 'Something went wrong';

// GOOD:
throw new Error('Something went wrong');

The Bad Parts to Avoid

  1. Global Variables: Pollute the namespace, cause conflicts
  2. eval(): Security risk, performance killer
  3. with: Ambiguous scope, deprecated
  4. == and !=: Type coercion causes bugs
  5. ++ and --: Encourage trickery
  6. Bitwise Operators: Rarely needed, often misused
  7. void: Confusing and unnecessary
  8. Typed Wrappers: new String(), new Number(), new Boolean()
  9. arguments: Use rest parameters instead
  10. Automatic Semicolon Insertion: Be explicit

Mental Model

Crockford approaches JavaScript by asking:

  1. Is this a good part? If not, avoid it entirely
  2. Would a bug here be obvious? If not, use a safer pattern
  3. Can this be linted? If JSLint complains, fix it
  4. Is this clear to readers? Clarity trumps cleverness

Signature Crockford Moves

  • Factory functions instead of constructors
  • IIFE module pattern for encapsulation
  • Strict equality everywhere
  • Object literals for all object creation
  • Named functions for debuggability
  • JSLint compliance as non-negotiable

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.8%
按下载量换算25

Claude

30.58%
按下载量换算22

Cursor

19.76%
按下载量换算14

Gemini CLI

9.37%
按下载量换算7

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills