Token导航 LogoToken导航

Agent Skill · 开发

typeorm-seeding(类型播种)

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

typeorm-seeding 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 18,175。

总安装 353周安装 15GitHub Stars 公开资料未说明下载 124核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/kage0x3b/typeorm-seeding --skill typeorm-seeding

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,辅助项目协作管理。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕代码变更和协作事项进行整理。

通过 GitHub 安装,使用 npx skills add 命令从 kage0x3b/typeorm-seeding 仓库添加技能。安装前需确认权限范围和维护状态,避免触发不必要的联网或文件操作。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/typeorm-seeding

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/kage0x3b/typeorm-seeding --skill typeorm-seedi…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

typeorm-seeding 怎么安装?

在终端执行 npx skills add https://github.com/kage0x3b/typeorm-seeding --skill typeorm-seeding。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

typeorm-seeding 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

typeorm-seeding 需要什么权限?

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

typeorm-seeding 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

typeorm-seeding 用的人多吗?

公开数据是累计安装 353 次,近一周安装 15 次,下载 124 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

typeorm-seeding 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
typeorm-seeding

类型播种 · 本页

353—只读未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

typeorm-seeding

Library for creating and seeding TypeORM entities using a factory/seeder pattern. ESM-only, TypeScript.

Four components: Factory (defines how to build entities), SeedingContext (manages factories, sequences, cleanup), Descriptors (relationship/value helpers), Seeder (orchestrates factory calls).

Creating a Factory

import { Factory, sequence, type Faker, type FactorySchema } from '@kage0x3b/typeorm-seeding';
import { UserEntity } from './entities/UserEntity.js';

export class UserFactory extends Factory<UserEntity> {
    readonly model = UserEntity;

    define(faker: Faker): FactorySchema<UserEntity> {
        return {
            firstName: faker.person.firstName(),
            lastName: faker.person.lastName(),
            email: sequence((n) => `user${n}@test.com`),
            role: faker.helpers.arrayElement(['user', 'editor', 'viewer']),
        };
    }
}

Rules:

  • model = the TypeORM entity class
  • define(faker) returns FactorySchema<T> — plain values and/or descriptors for each data property
  • FactorySchema<T> excludes functions and symbols; only covers persistable properties
  • Entity must have no required constructor args (created via new Model() + Object.assign)
  • Source imports use .js extensions (Node16 module resolution)

Factory with relationships

import { Factory, belongsTo, type Faker, type FactorySchema } from '@kage0x3b/typeorm-seeding';
import { PetEntity } from './entities/PetEntity.js';
import { UserFactory } from './UserFactory.js';

export class PetFactory extends Factory<PetEntity> {
    readonly model = PetEntity;

    define(faker: Faker): FactorySchema<PetEntity> {
        return {
            name: faker.animal.petName(),
            species: faker.helpers.arrayElement(['dog', 'cat', 'bird']),
            owner: belongsTo(UserFactory),
        };
    }
}

Descriptors

All descriptors are imported from @kage0x3b/typeorm-seeding.

belongsTo(factoryRef, overridesOrEntity?, variant?)

ManyToOne or owning-side OneToOne. Creates (or references) a parent entity and sets the FK.

owner: belongsTo(UserFactory)                                    // auto-create parent
owner: belongsTo(UserFactory, { role: 'admin' })                 // with overrides
owner: belongsTo(UserFactory, existingUser)                      // existing entity (has PK)
owner: belongsTo(UserFactory, undefined, 'admin')                // with variant
owner: belongsTo(UserFactory, { email: 'a@b.com' }, ['admin', 'inactive'])  // variant + overrides

Disambiguation: if the second arg has a non-nullish primary key (detected via TypeORM metadata), it's an existing entity; otherwise it's overrides.

Each entity gets its own parent. 5 pets with belongsTo(UserFactory) = 5 separate users.

hasMany(factoryRef, count, overrides?, variant?)

OneToMany. Creates count children referencing back to the parent. Resolved after the parent is saved.

pets: hasMany(PetFactory, 3)
pets: hasMany(PetFactory, 2, { species: 'dog' })
pets: hasMany(PetFactory, 3, undefined, 'dog')

hasOne(factoryRef, overrides?, variant?)

Non-owning OneToOne. Creates a single child referencing back to the parent.

profile: hasOne(ProfileFactory)
profile: hasOne(ProfileFactory, { bio: 'Custom bio' })

sequence(callback)

Auto-incrementing counter scoped per factory class, starts at 1.

orderIndex: sequence((n) => n)
email: sequence((n) => `user${n}@test.com`)

ref(label)

Resolves to a previously labeled entity (via .as(label)). Throws if label not registered.

company: ref('acmeCorp')

Variants

Override variants(faker) to define named variations layered on top of define(). The faker instance is passed as an argument, allowing variants to generate dynamic fake data.

export class UserFactory extends Factory<UserEntity> {
    readonly model = UserEntity;

    define(faker: Faker): FactorySchema<UserEntity> {
        return {
            firstName: faker.person.firstName(),
            email: sequence((n) => `user${n}@test.com`),
            role: 'user',
            isActive: true,
        };
    }

    variants(faker: Faker) {
        return {
            admin: {
                role: 'admin',
                email: sequence((n) => `admin${n}@test.com`),
            },
            inactive: { isActive: false },
            withPets: { pets: hasMany(PetFactory, 3) },
        };
    }
}

Usage:

await userFactory.variant('admin').persistOne();
await userFactory.variant('admin', 'inactive').persistOne();  // combine variants

Variants can contain any descriptor. Throws if variant name doesn't exist.

Descriptors in overrides

Overrides accept descriptors, not just plain values. The type is FactoryOverrides<T>.

// sequence in override — unique email per entity
const users = await userFactory.build(5, {
    email: sequence((n) => `batch-${n}@test.com`),
});

// belongsTo in override — create a specific parent
const pet = await petFactory.persistOne({
    owner: belongsTo(UserFactory, { role: 'admin' }),
});

// ref in override — reference a labeled entity
await userFactory.persistOne().as('manager');
const report = await reportFactory.buildOne({
    assignedTo: ref('manager'),
});

Variant in relationship descriptors:

user: belongsTo(UserFactory, undefined, 'admin')   // parent created with admin variant
pets: hasMany(PetFactory, 2, undefined, 'dog')      // children created with dog variant

Creating a Seeder

import { Seeder } from '@kage0x3b/typeorm-seeding';

export class DatabaseSeeder extends Seeder {
    async run(): Promise<void> {
        const admin = await this.factory(UserFactory)
            .variant('admin')
            .persistOne()
            .as('adminUser');

        await this.factory(PetFactory).persist(3, { owner: admin });
        await this.factory(UserFactory).persist(10);
    }
}
  • Extend Seeder, implement run()
  • this.factory(FactoryClass) returns the factory instance (same as this.ctx.getFactory())
  • this.ctx accesses the SeedingContext for refs, store, etc.
  • .as(label) registers the entity for later lookup via ref('label') or ctx.ref<T>('label')
  • .as() only works on persistOne()/buildOne(), not on persist(n)/build(n)

Run seeders: await ctx.runSeeders([SetupSeeder, DataSeeder]); — runs in order, shares context.

Test Setup

Cleanup-per-test pattern

import { DataSource } from 'typeorm';
import { createSeedingContext, SeedingContext } from '@kage0x3b/typeorm-seeding';

let dataSource: DataSource;
let ctx: SeedingContext;

beforeAll(async () => {
    dataSource = new DataSource({
        type: 'better-sqlite3',
        database: ':memory:',
        entities: [UserEntity, PetEntity],
        synchronize: true,
    });
    await dataSource.initialize();
});

beforeEach(() => {
    ctx = createSeedingContext(dataSource);
    // Or with a custom faker instance for deterministic output:
    // ctx = createSeedingContext(dataSource, { faker: seededFaker });
});

afterEach(async () => {
    await ctx.cleanup();   // deletes all created entities in reverse order
});

afterAll(async () => {
    await dataSource.destroy();
});

Transaction-per-test pattern

Each test runs in a transaction that rolls back — no cleanup needed.

let ctx: SeedingContext;
let txCtx: SeedingContext;
let queryRunner: QueryRunner;

beforeAll(async () => {
    // ... dataSource setup ...
    ctx = createSeedingContext(dataSource);
});

beforeEach(async () => {
    ctx.reset();   // resets sequences, refs, and creation log
    queryRunner = dataSource.createQueryRunner();
    await queryRunner.startTransaction();
    txCtx = ctx.withTransaction(queryRunner.manager);
});

afterEach(async () => {
    await queryRunner.rollbackTransaction();
    await queryRunner.release();
});

// In tests, use txCtx instead of ctx:
const user = await txCtx.getFactory(UserFactory).variant('withPets').persistOne();

Common Pitfalls

  • No constructor args: Entities must work with new Entity() + Object.assign. No required constructor parameters.
  • Overrides accept descriptors: Override parameters (FactoryOverrides<T>) accept plain values, null, or any descriptor (belongsTo, hasMany, hasOne, sequence, ref).
  • Overrides replace descriptors: Passing {owner: existingUser} replaces the entire belongsTo descriptor. The factory won't create a new parent.
  • Separate parents per belongsTo: Each entity gets its own parent by default. To share a parent, pass it explicitly as an override.
  • Sequence scoping: Sequences are scoped per factory class, not per variant. UserFactory and UserFactory.variant('admin') share the same counter.
  • .as() on single-entity methods only: .as(label) is only available on persistOne()/buildOne(), not persist(n)/build(n).
  • Enum values in variants: When using TypeScript enums in variants, you may need as any cast due to Partial<FactorySchema<T>> typing: role: UserRole.ADMIN as any.

Advanced

  • Context store: Typed shared state via ctx.store with module augmentation. See docs/public-api.md for details.
  • Labeled refs: .as(label) + ref('label') for ad-hoc entity references across factories/seeders.
  • Transaction support: ctx.withTransaction(em) creates a child context scoped to a transaction.
  • Resolution internals: 7-phase schema resolution. See docs/internal-implementation.md for SchemaResolver phases.
  • Full API reference: See docs/public-api.md for all methods on Factory, SeedingContext, and Seeder.

平台分布

Codex

33.82%
按下载量换算42

Claude

32.78%
按下载量换算41

Cursor

17.55%
按下载量换算22

Gemini CLI

10.09%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

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

继续浏览同类 Skills