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

entityentity 命令行

Agent Skill

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

总安装

356

周安装

15

GitHub Stars

公开资料未说明

下载量

125
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/efesto-cloud/skills --skill entity

简介

entity 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 它帮助创建符合六边形架构约定的领域实体类和 DTO 接口。
  • 可通过 npx skills add 命令从指定仓库安装,需先阅读现有代码基作为参考。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • entity 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Entity Skill

This skill helps you create or modify domain entities following the hexagonal architecture conventions using the @efesto-cloud/entity package. Scope: entity class + DTO interface only — persistence (repository, mapper, MongoDB document) is a separate concern handled elsewhere.

Installation: If not already installed, add the package with pnpm add @efesto-cloud/entity (peer dependency: luxon).

Before You Write Anything

Read the existing codebase before generating code:

  1. Locate the entity directory (typically packages/core/src/entity/) and read a similar existing entity as a reference
  2. Locate the DTO directory (typically packages/core/src/dto/) and read a similar DTO
  3. Check for a CLAUDE.md inside the entity directory — it may have project-specific conventions

If the project is new or the entity/dto directories are empty, use the reference files in this skill's references/ directory as your canonical examples instead:

  • references/entity-example.ts — fully annotated entity covering every pattern
  • references/dto-example.ts — fully annotated DTO covering every pattern
  • references/entity-union.ts — entity union pattern: abstract base + multiple concrete subtypes discriminated by a type literal
  • references/dto-union.ts — DTO union pattern: base interface + concrete sub-interfaces each carrying a type literal discriminant

These reference files cover all the patterns described below. Read them before generating code on a fresh project — they contain inline comments explaining the *why* behind each convention.


File Structure

For a new entity you'll create two files:

  • src/dto/IEntityName.ts — the public data contract (DTO interface)
  • src/entity/EntityName.ts — the domain entity class

Then export both from their respective index files.

For modifying an existing entity, read the files first, then apply changes consistently across both.


DTO Interface

The DTO is the public serialization contract. It has no methods — pure native data types.

// src/dto/IEntityName.ts
export default interface IEntityName {
    _id: string;            // always string (serialized from ObjectId or UUID)
    name: string;
    description: string;
    slug?: string;
    deleted_at: string | null;  // DateTime serialized as ISO string
    // foreign keys end with _id: string
    parent_id: string | null;
}

Rules:

  • All properties snake_case
  • Primary key: _id: string
  • Foreign keys: parent_id, elemento_id, etc.
  • DateTimestring (ISO); nullable → string | null
  • No methods, no business logic
  • Only native types (string, number, boolean, arrays, nested DTOs) — no domain types or value objects here (use their DTO representation instead if needed)
  • 1 entity = 1 DTO interface;

Entity Class

// src/entity/EntityName.ts
import { Entity, IEntity } from "@efesto-cloud/entity";
import { DateTime } from "luxon";
import { ObjectId } from "mongodb";  // or UUID — check what the project uses
import { Result } from "@efesto-cloud/result";
import { Maybe } from "@efesto-cloud/maybe";
import IEntityName from "~/dto/IEntityName.js";

type EntityNameProps = {
    name: string;
    description: string;
    deleted_at: DateTime<true> | null;
    // Use domain types, not primitives for complex concepts
    // e.g. email: EmailAddress  (not string)
};

export default class EntityName extends Entity<EntityNameProps, ObjectId> implements IEntity<ObjectId> {
    constructor(props: EntityNameProps, id?: ObjectId) {
        super(props, new ObjectId(id));  // always wrap in ID constructor
    }

    // Getters — one per prop, no setters unless business-justified
    get name(): string { return this.props.name; }
    get description(): string { return this.props.description; }

    // Business methods — describe intent, not data access
    // Return Result<T, Error> for fallible operations
    // Return void for infallible mutations
    someOperation(input: string): Result<void, Error> {
        if (!input) return Result.err(new Error("Invalid input"));
        this.props.name = input;
        return Result.ok(undefined);
    }

    toDTO(): IEntityName {
        return {
            _id: this._id.toHexString(),      // ObjectId → string
            // _id: this._id.toString(),       // UUID → string
            name: this.props.name,
            description: this.props.description,
            deleted_at: this.deleted_at?.toISO() ?? null,
            // nested entity: this.props.nested?.toDTO() ?? null
            // array: this.props.items.map(i => i.toDTO())
        };
    }

    static create(props: {
        name?: string;
        description?: string;
        deleted_at?: DateTime<true> | null;
        // all props optional — use ?? to apply defaults
    }, id?: ObjectId) {
        return new EntityName({
            name: props.name ?? "",
            description: props.description ?? "",
            deleted_at: props.deleted_at ?? null,
        }, id);
    }
}

Key rules:

  • Constructor: super(props, new ObjectId(id)) — wraps id even if already the right type
  • Never instantiate directly from outside — always go through static create()
  • The majority of create() props are optional with ?? defaults, required fields are the ones strictly necessary (usually dictated by business rules, not technical ones)
  • Getters for everything; only add setters when the operation has business meaning
  • deleted_at pattern: DateTime<true> | null for soft deletes

Inheritance

When extending a base entity class:

type EntityNameProps = BaseProps & { extraField: string; };

class EntityName extends BaseClass<EntityNameProps, ObjectId> {
    override toDTO(): IEntityName {
        return { ...super.toDTO(), extraField: this.props.extraField };
    }
}

For the union + abstract base pattern (multiple concrete subtypes distinguished by a type literal), read references/entity-union.ts (entities) and references/dto-union.ts (DTOs). Both files use matching type names and discriminants so you can see the entity↔DTO correspondence directly.


Audit trail pattern

For entities that track who changed what:

// In props:
created_at: DateTime;
updated_at: DateTime;
updated_by: Operator | null;  // import the Operator entity

// In business methods that mutate state:
this.props.updated_at = DateTime.now();
this.props.updated_by = operator;

Value objects

Prefer value objects for complex domain concepts rather than raw primitives. Check the project's src/value_object/ directory for what's available before defaulting to string. Common ones:

  • Email → EmailAddress
  • Password → Password
  • If the concept doesn't have an existing value object, use a plain type for now and note that it could become one.

Exports

Add to src/entity/index.ts:

export { default as EntityName } from "./EntityName.js";

Add to src/dto/index.ts:

export type { default as IEntityName } from "./IEntityName.js";

Checklist — New Entity

  • Read a comparable existing entity first
  • DTO created in src/dto/IEntityName.ts with _id: string
  • Entity class in src/entity/EntityName.ts with create() factory
  • All props have getters; create() has optional props with ?? defaults
  • toDTO() maps every DTO field; ID converted to string
  • Both exported from their index files
  • Run typecheck

Checklist — Modifying Existing Entity

  • Read the entity file and DTO file first
  • New prop added to EntityNameProps type
  • Getter added
  • create() updated with optional prop + default
  • toDTO() updated to include new field
  • DTO interface updated
  • Run typecheck

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

32.93%
按下载量换算41

Claude

30.43%
按下载量换算38

Cursor

19.54%
按下载量换算24

Gemini CLI

8.72%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

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

来源信息

继续浏览同类 Skills