Skip to content

[WIP] Refactor skills module structure to align with shadcn-ui#1129

Merged
hotlong merged 3 commits intomainfrom
claude/refactor-skills-module-structure
Apr 14, 2026
Merged

[WIP] Refactor skills module structure to align with shadcn-ui#1129
hotlong merged 3 commits intomainfrom
claude/refactor-skills-module-structure

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 14, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>Skills 模块结构重构(对齐 shadcn-ui 精细化分层,但保持技能独立)</issue_title>
<issue_description>## 背景
当前 repo 下的 skills 以每个领域独立子目录呈现,如 objectstack-data, objectstack-api, objectstack-ui 等,每个 skill 的 SKILL.md 内容庞杂,所有细则几乎全部内联,扩展性、可测试性和 AI 理解友好性均有待提升。

https://github.com/shadcn-ui/ui/tree/main/skills/shadcn

shadcn-ui/ui 的 skills/shadcn 目录采用了精细化分层的结构:主控 SKILL.md 只写摘要与用例,其它规则、CLI、定制内容拆分成 rules/、cli.md、customization.md 等子文件,且具备 evals/ 目录用于测试。shadcn 此模式极大增强了易维护性、AI 消化能力和用例复用。

但本项目领域远超 shadcn,直接合并所有 skill 为单 skill 或用"全局路由 skill"不可行(会影响 plugin/slill 的独立分发与兼容性)。

目标

  • 为每个 objectstack-* skill 参考 shadcn 的分层模式(而非将所有技能合并为一个),并将主干内容与规则、用例、测试解耦。
  • 保证每个 skill 保持独立、可单独安装/引用,不需要 skill 之间显式"路由"。

具体方案(建议)

  • 以 objectstack-data 举例,skill 目录重构如下:
    skills/objectstack-data/
    ├── SKILL.md          # 精炼主控(摘要/决策树+规则/案例索引+引用)
    ├── rules/
    │   ├── naming.md         # 命名规范 error/correct 对比
    │   ├── relationships.md  # 关系类型/模式最佳实践
    │   ├── validation.md     # 校验规则(可直接移自现有SKILL.md)
    │   └── indexing.md       # 索引策略等
    ├── evals/                # 测试用例(可后续补充)
    └── references/           # 现有 schema 参考
    
  • 其它 skills(如 objectstack-kernel, objectstack-ui, objectstack-api, objectstack-automation 等)同样进行 rules/ 与 evals/ 结构补全和拆分
  • SKILL.md 文件保持"主控索引"与"快速案例/规则小节",细节与代码对比、多层场景拆分等内容全部放入 rules/ 或其它子文件,AI 可通过相对路径引导定位详细判据
  • 不设置全局 skill 路由或统一 skill 入口——repo 保持每个 skill 自包含,分发 & 选择灵活
  • 推荐 hooks skill 内容整合到 objectstack-data/rules/hooks.md,减少冗余与领域重叠
  • 测试用例与 evals/ 内容为可选,可逐步补充

验收标准

  • 每个 skill 的 SKILL.md 都高度聚焦/短小,rules/ 文件内具备 Incorrect/Correct 对比案例
  • skills 无显式路由依赖,单 skill 安装仍可获得全部原本能力
  • 结构优化后,AI(Copilot/Cursor/Chatbot)能更精确理解各 skill 使用场景与区别

  • 变更需同步 CHANGELOG.md 并补充/核对测试用例,如有较大重构应更新 ROADMAP.md</issue_description>

Comments on the Issue (you are @claude[agent] in this section)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Apr 14, 2026 3:47am
spec Ready Ready Preview, Comment Apr 14, 2026 3:47am

Request Review

@github-actions github-actions bot added documentation Improvements or additions to documentation size/xl and removed size/xs labels Apr 14, 2026
@Claude Claude AI requested a review from hotlong April 14, 2026 03:46
@hotlong hotlong marked this pull request as ready for review April 14, 2026 03:57
Copilot AI review requested due to automatic review settings April 14, 2026 03:57
@hotlong hotlong merged commit 3efac6b into main Apr 14, 2026
15 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the skills/ documentation modules into a shadcn-ui–style layered structure (concise SKILL.md + detailed rules/ + evals/) while keeping each skill independently usable, and deprecates objectstack-hooks by moving its content into objectstack-data.

Changes:

  • Added layered rules/ + evals/ scaffolding across multiple skills, with new rule documents.
  • Refactored objectstack-data and objectstack-kernel skills into shorter SKILL.md files that link to detailed rules.
  • Deprecated skills/objectstack-hooks and redirected readers to objectstack-data/rules/hooks.md; updated CHANGELOG.md.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
skills/objectstack-ui/rules/view-types.md New UI view-type guidance and examples
skills/objectstack-ui/evals/README.md Placeholder evals structure doc
skills/objectstack-quickstart/rules/bootstrap-patterns.md New project bootstrap guidance/examples
skills/objectstack-quickstart/evals/README.md Placeholder evals structure doc
skills/objectstack-kernel/rules/service-registry.md New kernel DI/service registry guidance
skills/objectstack-kernel/rules/plugin-lifecycle.md New plugin lifecycle guidance
skills/objectstack-kernel/rules/hooks-events.md New kernel hooks/events guidance
skills/objectstack-kernel/evals/README.md Placeholder evals structure doc
skills/objectstack-kernel/SKILL.md Kernel skill condensed + links to rules
skills/objectstack-i18n/rules/translation-bundles.md New i18n bundle guidance
skills/objectstack-i18n/evals/README.md Placeholder evals structure doc
skills/objectstack-hooks/SKILL.md Deprecated + redirected to data hooks docs
skills/objectstack-data/rules/*.md New data rules (naming/relationships/validation/indexing/field-types/hooks)
skills/objectstack-data/evals/README.md Placeholder evals structure doc
skills/objectstack-data/SKILL.md Data skill condensed + links to rules; hooks included
skills/objectstack-automation/rules/flow-patterns.md New automation flow patterns
skills/objectstack-automation/evals/README.md Placeholder evals structure doc
skills/objectstack-api/rules/rest-patterns.md New REST patterns doc
skills/objectstack-api/evals/README.md Placeholder evals structure doc
skills/objectstack-ai/rules/agent-patterns.md New AI agent patterns doc
skills/objectstack-ai/evals/README.md Placeholder evals structure doc
CHANGELOG.md Added Unreleased note describing the skills refactor

Comment on lines +26 to +27
filters: { status: 'active' },
sort: [{ field: 'created_at', order: 'desc' }],
Comment on lines +10 to +14
GET /api/v1/objects/{object} # List records
GET /api/v1/objects/{object}/{id} # Get single record
POST /api/v1/objects/{object} # Create record
PATCH /api/v1/objects/{object}/{id} # Update record
DELETE /api/v1/objects/{object}/{id} # Delete record
Comment on lines +35 to +37
| `SQLiteDriver` | Local development, small deployments |
| `TursoDriver` | Production (edge database) |
| `PostgreSQLDriver` | Production (full-featured) |
Comment on lines +78 to +93
async init(ctx: PluginContext) {
ctx.hook('analytics:pageview', async (data) => {
console.log('Page viewed:', data.path);
});
}
```

## Hook Handler Patterns

### Simple Handler

```typescript
ctx.hook('kernel:ready', async () => {
console.log('System ready');
});
```
Comment on lines +1 to +19
---
name: objectstack-hooks
description: >
Write ObjectStack data lifecycle hooks for third-party plugins and applications.
Use when implementing business logic, validation, side effects, or data transformations
during CRUD operations. Covers hook registration, handler patterns, context API,
error handling, async execution, and integration with the ObjectQL engine.
license: Apache-2.0
compatibility: Requires @objectstack/spec v4+, @objectstack/objectql v4+
metadata:
author: objectstack-ai
version: "1.0"
domain: hooks
tags: hooks, lifecycle, validation, business-logic, side-effects, data-enrichment
---

# Writing Hooks — ObjectStack Data Lifecycle

Expert instructions for third-party developers to write data lifecycle hooks in ObjectStack.
Comment on lines +271 to +281
// Engine access
ql: IDataEngine; // ObjectQL engine instance
api?: ScopedContext; // Cross-object CRUD API

// User info shortcut
user?: {
id?: string;
name?: string;
email?: string;
};
}
Comment on lines +37 to +38
groupBy: 'stage',
cardFields: ['name', 'amount', 'close_date'],
Comment on lines +230 to +235
### ❌ Incorrect — Duplicate Registration

```typescript
async init(ctx: PluginContext) {
ctx.registerService('cache', new MemoryCache());
ctx.registerService('cache', new RedisCache()); // ❌ Overwrites silently
Comment on lines +96 to +106
// Register hook handlers
ctx.hook('kernel:ready', async () => {
ctx.logger.info('System ready');
});

// Register data hooks
ctx.hook('data:beforeInsert', async (objectName, record) => {
if (objectName === 'task') {
record.created_at = new Date().toISOString();
}
});
Comment on lines +62 to +67
```typescript
export default defineStack({
manifest: { /* ... */ },
driver: new DriverPlugin(new InMemoryDriver()), // ✅ Driver specified
objects: [/* ... */],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skills 模块结构重构(对齐 shadcn-ui 精细化分层,但保持技能独立)

3 participants