Token导航 LogoToken导航

Agent Skill · 研究检索

bknd-delete-entity(bknd 删除实体)

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

bknd-delete-entity 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 64,068。

总安装 306周安装 13GitHub Stars 3下载 107核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

bknd-delete-entity 用于安全移除数据库实体,适合在 Codex、Claude、Cursor、Gemini CLI 中清理废弃表结构或重构遗留系统。适用场景包括原型阶段快速清理、测试环境重置及重大版本升级前的 schema 裁剪。核心能力是自动检测依赖关系并提供警告提示,但仍需人工确认避免误删关键数据。

使用方式强烈建议在 code 模式下操作,UI 仅限开发环境试用,生产环境必须提前备份。删除操作不可逆,执行前应确保无活跃代码引用该实体,并评估对上下游系统的影响。

来源仓库内路径:skills/bknd-delete-entity

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

bknd-delete-entity 怎么安装?

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

bknd-delete-entity 支持哪些 AI 工具?

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

bknd-delete-entity 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

bknd-delete-entity 是免费的吗?

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

bknd-delete-entity 用的人多吗?

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

bknd-delete-entity 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

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

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

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

研究检索类 Skill 对比

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

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
bknd-delete-entity

bknd 删除实体 · 本页

3063操作浏览器未明确通过

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

SKILL.md 原文

Delete Entity

Safely remove an entity (table) from Bknd, handling dependencies and avoiding data loss.

Prerequisites

  • Existing Bknd app with entities (see bknd-create-entity)
  • For code mode: Access to bknd.config.ts
  • Critical: Backup database before deletion

Warning: Destructive Operation

Deleting an entity:

  • Permanently removes the table and ALL its data
  • Removes all relationships involving this entity
  • May break application code referencing this entity
  • Cannot be undone without database restore

When to Use UI vs Code

Use UI Mode When

  • Quick prototype cleanup
  • Development/testing environments
  • Exploring what dependencies exist

Use Code Mode When

  • Production changes
  • Version control needed
  • Team collaboration
  • Reproducible deployments

Pre-Deletion Checklist

Before deleting an entity, verify:

1. Check for Relationships

Entities may be referenced by other entities via:

  • Foreign keys (many-to-one)
  • Junction tables (many-to-many)
  • Self-references

2. Check for Data

const api = app.getApi();
const count = await api.data.count("entity_to_delete");
console.log(`Records to delete: ${count.data.count}`);

3. Check for Code References

Search codebase for:

  • Entity name in queries: "entity_name"
  • Type references: DB["entity_name"]
  • API calls: api.data.*("entity_name")

4. Backup Data (If Needed)

// Export data before deletion
const api = app.getApi();
const allRecords = await api.data.readMany("entity_to_delete", {
  limit: 100000,
});

// Save to file
import { writeFileSync } from "fs";
writeFileSync(
  "backup-entity_to_delete.json",
  JSON.stringify(allRecords.data, null, 2)
);

Code Approach

Step 1: Identify Dependencies

Check your schema for relationships:

// Look for relationships involving this entity
const schema = em(
  {
    users: entity("users", { email: text().required() }),
    posts: entity("posts", { title: text().required() }),
    comments: entity("comments", { body: text() }),
  },
  ({ relation }, { users, posts, comments }) => {
    // posts depends on users (foreign key)
    relation(posts).manyToOne(users);
    // comments depends on posts (foreign key)
    relation(comments).manyToOne(posts);
  }
);

Dependency order matters: Delete children before parents.

Step 2: Remove Relationships First

If entity is a target of relationships, update schema to remove them:

// BEFORE: posts references users
const schema = em(
  {
    users: entity("users", { email: text().required() }),
    posts: entity("posts", { title: text().required() }),
  },
  ({ relation }, { users, posts }) => {
    relation(posts).manyToOne(users);
  }
);

// AFTER: Remove relationship before deleting users
const schema = em({
  users: entity("users", { email: text().required() }),
  posts: entity("posts", { title: text().required() }),
});

Step 3: Remove Entity from Schema

Simply remove the entity definition from your bknd.config.ts:

// BEFORE
const schema = em({
  users: entity("users", { email: text().required() }),
  posts: entity("posts", { title: text().required() }),
  deprecated_entity: entity("deprecated_entity", { data: text() }),
});

// AFTER - entity removed
const schema = em({
  users: entity("users", { email: text().required() }),
  posts: entity("posts", { title: text().required() }),
});

Step 4: Preview Changes

# See what will be dropped (dry run)
npx bknd sync

Output shows:

Tables to drop: deprecated_entity
Columns affected: (none on other tables)

Step 5: Apply Deletion

# Apply with drop flag (destructive)
npx bknd sync --drop

Or with force (enables all destructive operations):

npx bknd sync --force

Step 6: Clean Up Code

Remove all references:

  • Delete type definitions
  • Remove API calls
  • Update imports

UI Approach

Step 1: Open Admin Panel

Navigate to http://localhost:1337 (or your configured URL).

Step 2: Go to Data Section

Click Data in the sidebar.

Step 3: Select Entity

Click on the entity you want to delete.

Step 4: Check Dependencies

Look for:

  • Relations tab/section showing connected entities
  • Warning messages about dependencies

Step 5: Export Data (Optional)

If you need the data:

  1. Go to entity's data view
  2. Export or manually copy records
  3. Save backup externally

Step 6: Delete Entity

  1. Open entity settings (gear icon or settings tab)
  2. Look for Delete Entity or Remove button
  3. Confirm deletion
  4. Entity and all data removed

Step 7: Sync Database

After deletion, ensure database is synced:

  • Click Sync Database if prompted
  • Or run npx bknd sync --drop from CLI

Handling Dependencies

Scenario: Entity Has Child Records

Problem: Deleting users when posts has users_id foreign key.

Solution 1: Delete Children First

// 1. Delete all posts referencing users
const api = app.getApi();
await api.data.deleteMany("posts", {});

// 2. Then delete users
// (via schema removal + sync)

Solution 2: Remove Relationship First

// 1. Remove relationship from schema
// 2. Sync to remove foreign key
// 3. Remove entity from schema
// 4. Sync again with --drop

Scenario: Entity is Junction Table Target

Problem: tags is used in posts_tags junction table.

Solution:

// 1. Remove many-to-many relationship
const schema = em(
  {
    posts: entity("posts", { title: text() }),
    tags: entity("tags", { name: text() }),
  }
  // Remove: ({ relation }, { posts, tags }) => { relation(posts).manyToMany(tags); }
);

// 2. Sync to drop junction table
// npx bknd sync --drop

// 3. Remove tags entity
const schema = em({
  posts: entity("posts", { title: text() }),
});

// 4. Sync again to drop tags table
// npx bknd sync --drop

Scenario: Self-Referencing Entity

Problem: categories references itself (parent/children).

Solution:

// 1. Remove self-reference relation
const schema = em({
  categories: entity("categories", { name: text() }),
  // Remove self-referencing relation definition
});

// 2. Sync to remove foreign key
// npx bknd sync --drop

// 3. Remove entity
// (then sync again)

Deleting Multiple Entities

Order matters. Delete in dependency order (children first):

// Dependency tree:
// users <- posts <- comments
//       <- likes

// Delete order:
// 1. comments (depends on posts)
// 2. likes (depends on posts)
// 3. posts (depends on users)
// 4. users (no dependencies)

Batch Deletion Script

// scripts/cleanup-entities.ts
import { App } from "bknd";

async function cleanup() {
  const app = new App({
    connection: { url: process.env.DB_URL! },
  });
  await app.build();
  const api = app.getApi();

  // Delete in order
  const entitiesToDelete = ["comments", "likes", "posts"];

  for (const entity of entitiesToDelete) {
    const count = await api.data.count(entity);
    console.log(`Deleting ${count.data.count} records from ${entity}...`);
    await api.data.deleteMany(entity, {});
    console.log(`Deleted all records from ${entity}`);
  }

  console.log("Data cleanup complete. Now remove from schema and sync.");
}

cleanup().catch(console.error);

Common Pitfalls

Foreign Key Constraint Error

Error: Cannot drop table: foreign key constraint

Cause: Another entity references this one.

Fix: Remove relationship first, sync, then remove entity.

Junction Table Not Dropped

Problem: After removing many-to-many relation, junction table remains.

Fix: Run npx bknd sync --drop to include destructive operations.

Entity Still Appears in UI

Problem: Deleted from code but still shows in admin panel.

Fix:

  • Ensure you ran npx bknd sync --drop
  • Restart the Bknd server
  • Clear browser cache

Application Crashes After Deletion

Problem: Code still references deleted entity.

Fix:

  • Search codebase: grep -r "entity_name" src/
  • Remove all API calls, types, imports
  • Fix TypeScript errors

Accidentally Deleted Wrong Entity

Problem: Deleted production data.

Fix:

  • If you have backup: Restore from backup
  • If no backup: Data is permanently lost
  • Prevention: Always backup before deletion

Verification

After Deletion

# 1. Check schema export (entity should be absent)
npx bknd schema --pretty | grep entity_name

# 2. Verify sync status
npx bknd sync
# Should show no pending changes

Via Code

const api = app.getApi();

// This should fail/return error for deleted entity
try {
  await api.data.readMany("deleted_entity", { limit: 1 });
  console.log("ERROR: Entity still exists!");
} catch (e) {
  console.log("Confirmed: Entity deleted successfully");
}

Via REST API

# Should return 404 or error
curl http://localhost:1337/api/data/deleted_entity

DOs and DON'Ts

DO:

  • Backup data before deletion
  • Check for dependencies first
  • Delete children before parents
  • Preview with npx bknd sync before --drop
  • Remove code references after deletion
  • Test in development before production

DON'T:

  • Delete entities with active foreign keys
  • Use --drop without previewing changes
  • Delete in production without backup
  • Assume UI deletion handles all cleanup
  • Forget to remove TypeScript types/code references

Related Skills

  • bknd-create-entity - Create new entities
  • bknd-modify-schema - Modify existing schema
  • bknd-define-relationship - Understand relationship dependencies
  • bknd-crud-delete - Delete individual records (not tables)
  • bknd-seed-data - Restore data from backup

平台分布

Codex

36.1%
按下载量换算39

Claude

30.9%
按下载量换算33

Cursor

19.94%
按下载量换算21

Gemini CLI

8.65%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

继续浏览同类 Skills