Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

bknd-add-fieldbknd 添加字段

Agent Skill

bknd-add-field 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

303

周安装

13

GitHub Stars

3

下载量

106
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-add-field

简介

bknd-add-field 用于向现有实体添加新字段,适合在 Codex、Claude、Cursor、Gemini CLI 中进行数据库 schema 迭代和数据模型扩展。

  • 适用场景包括快速原型字段试验、非技术人员临时添加属性及正式部署前的字段配置验证。
  • 核心能力是支持 UI 模式可视化操作与 Code 模式 TypeScript 配置两种灵活方式。
  • 使用方式建议先用 UI 模式探索,确定无误后再转为 Code 模式纳入版本控制。
  • UI 模式下可直接在 Admin Panel 的数据区域点击实体添加字段,Code 模式则需编辑 schema 文件。

SKILL.md

Add Field to Entity

Add a new field (column) to an existing entity in Bknd.

Prerequisites

  • Existing Bknd entity (see bknd-create-entity)
  • For code mode: Access to your schema file

When to Use UI vs Code

Use UI Mode When

  • Quick iteration/prototyping
  • Non-developer adding fields
  • Testing field configurations before coding

Use Code Mode When

  • Version control needed
  • Reproducible schema changes
  • Type safety required
  • Team collaboration

UI Approach

Step 1: Access Entity

  1. Start server: npx bknd run
  2. Open http://localhost:1337
  3. Navigate to Data section
  4. Click on the target entity (e.g., posts)

Step 2: Add Field

  1. Click + Add Field
  2. Select field type from dropdown:

- Text: Strings, emails, URLs - Number: Integers, decimals - Boolean: True/false - Date: Timestamps - Enum: Fixed set of values - JSON: Unstructured data

  1. Enter field name (snake_case: first_name, created_at)

Step 3: Configure Options

Based on field type, configure:

All Types:

  • Required: Toggle on if field cannot be null
  • Default Value: Set a default

Text:

  • Min/Max Length
  • Pattern (regex validation)

Number:

  • Minimum/Maximum values
  • Multiple Of (for integers)

Enum:

  • Add enum values (one per line)

Step 4: Save and Sync

  1. Click Save Field
  2. Click Sync Database to apply changes

Code Approach

Step 1: Locate Entity Definition

Find your entity in the schema:

const schema = em({
  posts: entity("posts", {
    title: text().required(),
    // Add new fields here
  }),
});

Step 2: Add Field

Add the new field to the entity's field object:

const schema = em({
  posts: entity("posts", {
    title: text().required(),
    subtitle: text(),           // NEW: optional text field
    view_count: number(),       // NEW: optional number field
  }),
});

Step 3: Restart Server

Bknd auto-syncs schema on startup. Restart your server to apply changes.

Field Types Reference

Text Field

import { text } from "bknd";

entity("users", {
  // Basic optional text
  bio: text(),

  // Required text
  email: text().required(),

  // Unique constraint
  username: text().unique(),

  // With validation
  slug: text({
    minLength: 3,
    maxLength: 100,
    pattern: "^[a-z0-9-]+$",
  }).required(),

  // With default value
  status: text({ default_value: "active" }),
})

Number Field

import { number } from "bknd";

entity("products", {
  // Basic number
  quantity: number(),

  // Required with validation
  price: number({
    minimum: 0,
    maximum: 99999.99,
  }).required(),

  // Integer only (multipleOf: 1)
  rating: number({
    minimum: 1,
    maximum: 5,
    multipleOf: 1,
  }),
})

Boolean Field

import { boolean } from "bknd";

entity("posts", {
  // Defaults to false
  published: boolean(),

  // Default true
  active: boolean({ default_value: true }),
})

Date Field

import { date } from "bknd";

entity("events", {
  // Basic date
  start_date: date().required(),

  // Auto-set to current time
  created_at: date({ default_value: "now" }),
})

Enum Field

Note: Import is enumm (double 'm') to avoid JS reserved word.

import { enumm } from "bknd";

entity("posts", {
  // Array syntax
  status: enumm({
    enum: ["draft", "published", "archived"],
    default_value: "draft",
  }).required(),

  // Object syntax (key-value)
  priority: enumm({
    enum: {
      LOW: "low",
      MEDIUM: "medium",
      HIGH: "high",
    },
    default_value: "MEDIUM",
  }),
})

JSON Field

import { json } from "bknd";

entity("users", {
  // Untyped JSON
  metadata: json(),

  // Typed JSON (TypeScript only, no runtime validation)
  preferences: json<{
    theme: "light" | "dark";
    notifications: boolean;
  }>(),

  // With default
  tags: json<string[]>({ default_value: [] }),
})

JSON Schema Field

For runtime-validated JSON:

import { jsonschema } from "bknd";

entity("webhooks", {
  payload: jsonschema({
    type: "object",
    properties: {
      event: { type: "string" },
      timestamp: { type: "number" },
    },
    required: ["event", "timestamp"],
  }),
})

Media Field

For file attachments:

import { media } from "bknd";

entity("posts", {
  // Single file
  cover_image: media({ entity: "posts" }),

  // Multiple files with constraints
  gallery: media({
    entity: "posts",
    min_items: 1,
    max_items: 10,
    mime_types: ["image/jpeg", "image/png", "image/webp"],
  }),
})

Field Modifiers

Chain modifiers after field type:

ModifierDescriptionExample
.required()Cannot be nulltext().required()
.unique()Unique constrainttext().unique()
.default(value)Default valuetext().default("pending")
.references(target)Foreign keynumber().references("users.id")

Chaining example:

entity("users", {
  email: text().required().unique(),
  role: text().default("user"),
  org_id: number().references("organizations.id"),
})

Field Naming Conventions

ConventionExampleNotes
snake_casefirst_nameNOT firstName
Lowercasecreated_atNOT CreatedAt
Descriptivepublished_atNOT pub

Common Pitfalls

Field Already Exists

Error: Field "title" already exists on entity "posts"

Fix: Each field name must be unique within an entity. Choose a different name.

Invalid Field Name

Error: Invalid field name

Fix: Use lowercase letters, numbers, and underscores. Must start with letter.

// Valid
title: text()
first_name: text()
item_2: text()

// Invalid
Title: text()        // No uppercase
2_item: text()       // Can't start with number
first-name: text()   // No hyphens

Enum Import Mistake

Error: enum is a reserved word

Fix: Import and use enumm (double 'm'):

// Wrong
import { enum } from "bknd";

// Correct
import { enumm } from "bknd";

status: enumm({ enum: ["a", "b"] })

Missing Required Modifier on Existing Data

Problem: Adding .required() to field on entity with existing null values.

Fix: Either:

  1. Update existing records to have non-null values first
  2. Add a default value: text({default_value: "N/A"}).required()
  3. Keep field optional

Field Changes Not Reflecting

Problem: Added field in code but not appearing.

Fixes:

  1. Restart the server (schema syncs on startup)
  2. Verify field is in the correct entity definition
  3. Check for syntax errors in schema

Verification

UI Mode

  1. Click on entity in Data section
  2. Verify new field appears in field list
  3. Create a test record with the new field

Code Mode

const api = app.getApi();

// Create record with new field
const result = await api.data.createOne("posts", {
  title: "Test",
  subtitle: "New field test",  // Your new field
});
console.log(result);

CLI Check

npx bknd debug paths
# Check entity fields in output

DOs and DON'Ts

DO:

  • Use snake_case for field names
  • Start with optional fields; make required later if needed
  • Add default values for required fields on existing data
  • Use appropriate field types (don't store numbers as text)

DON'T:

  • Use enum import (use enumm)
  • Add .required() to existing entities without defaults
  • Use camelCase or PascalCase for field names
  • Create redundant fields (e.g., id is auto-generated)

Related Skills

  • bknd-create-entity - Create a new entity first
  • bknd-define-relationship - Add relationships between entities
  • bknd-modify-schema - Rename or change field types
  • bknd-crud-create - Insert data using new fields

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.67%
按下载量换算41

Claude

27.82%
按下载量换算29

Cursor

19.51%
按下载量换算21

Gemini CLI

9.2%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills