Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

core-engineering核心工程

Agent Skill

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

总安装

392

周安装

16

GitHub Stars

1

下载量

127
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:core-engineering(核心工程)
来源仓库:https://github.com/justinedevs/collection
仓库路径:skills/core-engineering
安装命令:
npx skills add https://github.com/justinedevs/collection --skill core-engineering
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/justinedevs/collection --skill core-engineering

简介

定义面向对象编程的核心原则,包括 OOP 四支柱与 SOLID 原则。

  • 适用于需要统一团队编码风格与设计模式的长期项目。
  • 提供抽象、封装、继承与多态的具体实现示例。
  • 安装方式:GitHub,命令为 npx skills add https://github.com/justinedevs/collection --skill core-engineering。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Object-Oriented Design Skill

This skill defines Core Engineering: Object-Oriented Programming (OOP), SOLID, clean-code principles, and relationship types with concrete examples so an AI agent or developer can apply them consistently.


1. Four Pillars of OOP

1.1 Abstraction

What it is: Focus on what an object does, not how. Hide complex details and expose only essential behavior.

How it looks: Public methods define the contract; internals are private or hidden.

// Abstraction: caller uses start() and stop() without knowing engine details
class Car {
  private engine: Engine;

  start(): void {
    this.engine.ignite();
  }
  stop(): void {
    this.engine.shutOff();
  }
}

Types of abstraction:

  • Data abstraction: Hide how data is stored (e.g. use getters instead of raw fields).
  • Control abstraction: Hide how a process is implemented (e.g. save() instead of open/write/close).
// Data abstraction: storage details hidden
class UserRepo {
  private store: Map<string, User>;
  getById(id: string): User | undefined {
    return this.store.get(id);
  }
}

1.2 Encapsulation

What it is: Bundle data and methods that act on that data in one unit (class). Restrict direct access to internal state to avoid accidental misuse.

How it looks: Private fields, public accessors or methods; no direct property access from outside.

// Encapsulation: balance is protected; changes only through deposit/withdraw
class BankAccount {
  private balance: number = 0;

  deposit(amount: number): void {
    if (amount > 0) this.balance += amount;
  }
  withdraw(amount: number): boolean {
    if (amount > 0 && amount <= this.balance) {
      this.balance -= amount;
      return true;
    }
    return false;
  }
  getBalance(): number {
    return this.balance;
  }
}

1.3 Inheritance

What it is: A child class gets properties and behavior from a parent class to reuse code and model "is-a" relationships.

How it looks: Child extends parent and can override methods or add new ones.

// Inheritance: SportsCar is-a Vehicle with extra behavior
class Vehicle {
  move(): void {
    console.log("Moving");
  }
}
class SportsCar extends Vehicle {
  turboBoost(): void {
    console.log("Turbo engaged");
  }
}

1.4 Polymorphism

What it is: Different classes can be used through the same interface; the same method name can behave differently per type.

How it looks: Parent reference, child instances; overridden methods or shared interface.

// Polymorphism: same call, different behavior per type
abstract class Shape {
  abstract draw(): void;
}
class Circle extends Shape {
  draw(): void {
    console.log("Drawing circle");
  }
}
class Square extends Shape {
  draw(): void {
    console.log("Drawing square");
  }
}
function render(s: Shape): void {
  s.draw();
}
render(new Circle());
render(new Square());

2. SOLID Principles

2.1 Single Responsibility Principle (SRP)

What it is: A class should have only one reason to change (one responsibility).

How it looks: One class does one job; split reporting, persistence, and validation into separate types.

// SRP: each class has one job
class Order {
  constructor(
    public id: string,
    public total: number
  ) {}
}
class OrderRepository {
  save(order: Order): void {
    // persist only
  }
}
class OrderReport {
  format(order: Order): string {
    return `Order ${order.id}: ${order.total}`;
  }
}

2.2 Open/Closed Principle (OCP)

What it is: Open for extension, closed for modification. Add behavior via new code (e.g. new classes), not by changing existing code.

How it looks: Use abstractions and new implementations instead of editing existing classes.

// OCP: extend via new class, not by changing Discount
interface Discount {
  apply(amount: number): number;
}
class PercentDiscount implements Discount {
  constructor(private percent: number) {}
  apply(amount: number): number {
    return amount * (1 - this.percent / 100);
  }
}
class FixedDiscount implements Discount {
  constructor(private fixed: number) {}
  apply(amount: number): number {
    return Math.max(0, amount - this.fixed);
  }
}

2.3 Liskov Substitution Principle (LSP)

What it is: Subclasses must be substitutable for their base class without breaking callers.

How it looks: Overrides preserve contracts (same preconditions/postconditions); no throwing new errors or weakening guarantees.

// LSP: Rectangle subclass can replace Shape without breaking callers
class Shape {
  area(): number {
    return 0;
  }
}
class Rectangle extends Shape {
  constructor(private w: number, private h: number) {
    super();
  }
  area(): number {
    return this.w * this.h;
  }
}
function printArea(s: Shape): void {
  console.log(s.area());
}
printArea(new Rectangle(3, 4));

2.4 Interface Segregation Principle (ISP)

What it is: Clients should not depend on methods they do not use. Prefer small, focused interfaces.

How it looks: Many small interfaces instead of one large one; classes implement only what they need.

// ISP: split fat interface into small ones
interface Readable {
  read(): string;
}
interface Writable {
  write(data: string): void;
}
class FileReader implements Readable {
  read(): string {
    return "data";
  }
}
class FileWriter implements Writable {
  write(data: string): void {}
}
// Client that only reads depends only on Readable
function consume(r: Readable): void {
  r.read();
}

2.5 Dependency Inversion Principle (DIP)

What it is: Depend on abstractions (interfaces), not concrete classes. High-level logic should not import low-level details.

How it looks: Inject interfaces; concrete implementations passed in or provided by composition root.

// DIP: OrderService depends on abstraction, not concrete Logger
interface Logger {
  log(msg: string): void;
}
class OrderService {
  constructor(private logger: Logger) {}
  placeOrder(): void {
    this.logger.log("Order placed");
  }
}
class ConsoleLogger implements Logger {
  log(msg: string): void {
    console.log(msg);
  }
}
const service = new OrderService(new ConsoleLogger());

3. Composition Over Inheritance

What it is: Favor composing objects (has-a) over deep inheritance (is-a) to reduce coupling and increase flexibility.

How it looks: Classes hold references to other types instead of extending them; behavior is delegated.

// Composition: Engine is a component, not a parent
class Engine {
  start(): void {
    console.log("Engine started");
  }
}
class Car {
  private engine: Engine;
  constructor() {
    this.engine = new Engine();
  }
  start(): void {
    this.engine.start();
  }
}

4. Clean Code Principles

4.1 DRY (Don't Repeat Yourself)

What it is: Avoid duplicating logic; centralize in one place.

// DRY: single function for validation
function isValidEmail(s: string): boolean {
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);
}
// Reuse everywhere instead of copying the regex

4.2 KISS (Keep It Simple, Stupid)

What it is: Avoid unnecessary complexity; prefer straightforward solutions.

// KISS: simple condition instead of over-engineered pattern
function isEligible(age: number): boolean {
  return age >= 18;
}

4.3 YAGNI (You Aren't Gonna Need It)

What it is: Do not add functionality until it is required.

How it looks: No speculative features or "might need later" code; implement when the need exists.


4.4 Law of Demeter (LoD)

What it is: An object should only talk to its immediate neighbors (its own attributes, method arguments, or objects it creates). Avoid long chains like a.getB().getC().doSomething().

How it looks: Delegate to a neighbor so the caller uses one dot.

// LoD violation: client knows internal structure
// client.getAddress().getStreet().toUpperCase()

// Better: one level of indirection
class Client {
  getStreetUpperCase(): string {
    return this.address.getStreet().toUpperCase();
  }
}

5. Advanced Relationship Types

5.1 Association

What it is: General link between two objects; they can interact but are not necessarily owned.

// Association: Teacher and Student know each other
class Teacher {
  constructor(public students: Student[]) {}
}
class Student {
  constructor(public teacher: Teacher) {}
}

5.2 Aggregation (has-a; child can outlive parent)

What it is: Whole has parts; parts can exist without the whole (e.g. department has employees; employees can exist without the department).

// Aggregation: Department has Employees; employees can exist independently
class Department {
  constructor(public employees: Employee[] = []) {}
  add(e: Employee): void {
    this.employees.push(e);
  }
}
class Employee {
  constructor(public name: string) {}
}

5.3 Composition (part-of; child cannot outlive parent)

What it is: Strong ownership; the part does not exist without the whole (e.g. Engine cannot exist without the Car in the same lifecycle).

// Composition: Engine is created and owned by Car; lifecycle bound
class Car {
  private engine: Engine;
  constructor() {
    this.engine = new Engine();
  }
}
class Engine {}

Quick Reference

ConceptOne-line
AbstractionExpose what, hide how
EncapsulationBundle data + methods; restrict direct access
InheritanceChild reuses parent behavior (is-a)
PolymorphismSame interface, different behavior per type
SRPOne reason to change per class
OCPExtend via new code, don't modify existing
LSPSubtypes substitutable for base type
ISPSmall interfaces; no unused methods
DIPDepend on abstractions, not concretions
CompositionPrefer has-a over deep inheritance
DRYOne place for each piece of logic
KISSPrefer simple design
YAGNIBuild only what is needed now
LoDTalk only to immediate neighbors
AssociationGeneral link between objects
AggregationHas-a; part can outlive whole
CompositionPart-of; part bound to whole lifecycle

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

32.8%
按下载量换算42

Claude

29.81%
按下载量换算38

Cursor

19%
按下载量换算24

Gemini CLI

9.77%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

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

来源信息

继续浏览同类 Skills