Token导航 LogoToken导航

Agent Skill · 研究检索

bookforge-data-source-pattern-selector(bookforge 数据源模式选择器)

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

bookforge-data-source-pattern-selector 是研究检索类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为调用外部服务;许可证为 MIT-0,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 28,907。

总安装 3,139周安装 127GitHub Stars 公开资料未说明下载 986核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:bookforge-data-source-pattern-selector(bookforge 数据源模式选择器)
来源仓库:https://github.com/quochungto/bookforge-data-source-pattern-selector
安装命令:
openclaw skills install bookforge-data-source-pattern-selector
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

ClawHubOpenClaw
openclaw skills install bookforge-data-source-pattern-selector

这个 Skill 是做什么的

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

为持久层选择合适的数据访问模式,提升数据操作效率。支持表数据网关、行数据网关、Active Record 等主流模式。根据事务需求、对象映射复杂度和性能要求给出选型建议。实施前需评估现有 ORM 框架兼容性,避免引入技术债务。应结合团队熟悉度选择模式,降低后续维护成本。

bookforge-data-source-pattern-selector 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install bookforge-data-source-pattern-selector;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

bookforge-data-source-pattern-selector 怎么安装?

在终端执行 openclaw skills install bookforge-data-source-pattern-selector。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

bookforge-data-source-pattern-selector 支持哪些 AI 工具?

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

bookforge-data-source-pattern-selector 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

bookforge-data-source-pattern-selector 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

bookforge-data-source-pattern-selector 用的人多吗?

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

bookforge-data-source-pattern-selector 安全吗?

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

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

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
bookforge-data-source-pattern-selector

bookforge 数据源模式选择器 · 本页

3,139—调用外部服务MIT-0通过

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

SKILL.md 原文

name
data-source-pattern-selector
description
|
version
1.0.0
homepage
https://github.com/bookforge-ai/bookforge-skills/tree/main/books/patterns-of-enterprise-application-architecture/skills/data-source-pattern-selector
metadata
{"openclaw":{"emoji":"📚","homepage":"https://github.com/bookforge-ai/bookforge-skills"}}
status
draft
source-books
title
Patterns of Enterprise Application Architecture
authors
["Martin Fowler", "David Rice", "Matthew Foemmel", "Edward Hieatt", "Robert Mee", "Randy Stafford"]
chapters
[3, 10]
tags
["data-access", "persistence", "orm", "database", "design-patterns", "software-architecture", "active-record", "data-mapper", "table-data-gateway", "row-data-gateway", "fowler-peaa", "object-relational-mapping", "enterprise-patterns"]
depends-on
[]
execution
tier
2
mode
hybrid
inputs
description
System description including: the chosen (or candidate) domain-logic pattern, schema shape, language and ORM framework, whether the schema is owned by this team or external, team sophistication, and any current pain points with data access.
tools-required
[Read, Write]
tools-optional
[Grep]
mcps-required
[]
environment
Any agent environment. Works with codebase analysis, architecture documents, schema files, or a written project description.
discovery
goal
Produce a concrete data-source pattern recommendation with rationale, framework mapping, anti-pattern warnings, and migration path.
tasks
audience
roles
["software-architect", "senior-backend-engineer", "tech-lead", "framework-designer"]
experience
intermediate-to-advanced
when_to_use
triggers
prerequisites
not_for
environment
codebase_required
false
codebase_helpful
true
works_offline
true
quality
scores
with_skill
{filled by tester}
baseline
{filled by tester}
delta
{filled by tester}
tested_at
{filled by tester}
eval_count
{filled by tester}
assertion_count
14
iterations_needed
{filled by tester}

Data Source Pattern Selector

When to Use

You are designing or refactoring the persistence layer of an enterprise application and need to choose *how* objects talk to the database. The four canonical options — Table Data Gateway, Row Data Gateway, Active Record, Data Mapper — differ not just in complexity but in what they assume about domain object structure and business logic placement.

This skill applies when:

  • You are choosing a data-access approach before — or alongside — selecting an ORM framework
  • Your Active Record classes have started accumulating complex inheritance, collections, or non-trivial business logic and things feel messy
  • You suspect your full Data Mapper layer is overkill for a largely CRUD application
  • You want to document a persistence architecture decision with clear rationale

If the domain-logic pattern (Table Module, Transaction Script, Domain Model) has not yet been chosen, the data-source pattern cannot be selected reliably. Invoke domain-logic-pattern-selector first, or ask the user to describe their domain-logic approach before proceeding.


Context & Input Gathering

Required

  • Domain-logic pattern in use or planned: Table Module / Transaction Script / Domain Model — this is the primary routing axis.
  • Schema shape: Is the database schema closely aligned with how you model objects in code, or does it differ significantly? Are there inheritance hierarchies, embedded collections, or many-to-many associations that don't map neatly to tables?
  • Business logic weight: Do domain objects carry significant behavior (validation, calculations, policies), or is the application largely CRUD?
  • Language and framework: What language and ORM/database library are in use or being evaluated? (Rails, Hibernate, Django, SQLAlchemy, EF Core, Laravel, etc.)

Helpful

  • Schema ownership: Does your team control the schema, or is it a legacy/external schema you must conform to? (External schemas often push toward Data Mapper for isolation.)
  • Team sophistication: Larger or more complex mapping layers (Data Mapper) require more experience to implement and maintain.
  • Existing code artifacts: Any domain classes, repository interfaces, or gateway classes already in the codebase signal where the current approach sits.

Defaults if not specified

  • Unknown domain-logic pattern → ask before proceeding (this is a hard prerequisite)
  • Unknown schema shape → assume moderate complexity; flag isomorphism check as required
  • Unknown framework → provide pattern-level recommendation; offer framework mapping as a separate step

Process

Step 1 — Identify the domain-logic pattern.

WHY: The domain-logic pattern is the primary determinant of which data-source pattern fits. Fowler is explicit: Table Module pairs with Table Data Gateway; Domain Model pairs with Active Record or Data Mapper. Choosing a data-source pattern independently from domain-logic pattern creates structural mismatches that compound over time.

  • Table Module → go directly to Table Data Gateway (Step 5). No further analysis needed.
  • Transaction Script → go to Step 2 to pick TDG vs RDG.
  • Domain Model → go to Step 3 to pick AR vs DM.
  • Unknown → invoke domain-logic-pattern-selector or ask the user to describe domain-logic approach.

Step 2 — Transaction Script: choose TDG vs RDG.

WHY: Both Gateway patterns separate SQL from application logic, but they differ in their result shape. The choice is about what is more convenient for the Transaction Script to work with — a result set / record set, or a per-row object.

  • Prefer Table Data Gateway when: the environment has good Record Set support (.NET ADO.NET DataSet, JDBC ResultSet consumed directly), when scripts prefer to iterate over result sets rather than object collections, or when stored procedures are the access mechanism (stored procs naturally map to TDG).
  • Prefer Row Data Gateway when: the environment favors per-row objects, when you want object-oriented field access in scripts, or when you anticipate logic accumulating on the gateway and want a natural refactoring path toward Active Record.
  • Note: If you observe business logic creeping into either gateway class, that is the signal to refactor toward Active Record (Step 5a).

Step 3 — Domain Model: assess schema isomorphism.

WHY: Active Record works well only when the schema is isomorphic with domain objects — one table per class, fields map one-to-one to columns. The moment inheritance hierarchies, embedded value objects, rich collections, or divergent naming appear, Active Record mapping becomes patchwork. Isomorphism is the primary AR/DM split criterion.

Evaluate isomorphism:

  • HIGH (AR-friendly): Each domain class corresponds to one table. No inheritance in the domain. Field names map cleanly to column names. No complex associations beyond simple foreign keys.
  • LOW (DM territory): Inheritance hierarchies in the domain. Collections mapped across multiple tables. Domain objects named and shaped for business concepts, schema named for normalization. External/legacy schema that the domain must adapt to.

Step 4 — Domain Model: assess business logic weight.

WHY: Data Mapper is justified by domain model complexity. If the domain model is simple (validations, derivations, single-record logic), Active Record carries that complexity at low cost with no extra layer. If the domain model has complex policies, multi-object calculations, or needs to be testable without a database, Data Mapper's isolation pays off.

  • Simple business logic (CRUD + validations + single-record derivations) → lean toward Active Record.
  • Complex business logic (multi-entity rules, domain events, complex state machines, aggregate roots, test isolation needed) → lean toward Data Mapper.

Step 5 — Apply the routing matrix and select pattern.

WHY: Combines Steps 1–4 into a single recommendation. Mixing patterns at the primary persistence level is a known anti-pattern — it creates confusion about where persistence logic lives and where domain logic lives.

Domain-Logic PatternSchema IsomorphismBusiness Logic Weight→ Data-Source Pattern
Table Module——Table Data Gateway
Transaction Script——TDG (result-set style) or RDG (object style)
Domain ModelHighLowActive Record
Domain ModelHighGrowing / complexActive Record → plan migration to DM
Domain ModelLowAnyData Mapper
Domain ModelAnyHeavy / test-isolatedData Mapper

Step 6 — Map to framework idiom.

WHY: Pattern selection is only useful if it connects to the team's actual tooling. Each major ORM embodies one of the four patterns; choosing the pattern misaligned with the framework requires fighting the framework's defaults.

  • Active Record pattern: Rails ActiveRecord (naming intentional), Django ORM model classes, Laravel Eloquent, Grails GORM.
  • Data Mapper pattern: Hibernate (Java), Spring Data JPA (via Hibernate), Entity Framework Core (especially with separate repository layer), SQLAlchemy ORM (with Session and mapped classes), TypeORM (repository mode), Doctrine ORM (PHP).
  • Table Data Gateway: ADO.NET DataSet/TableAdapter (.NET classic), stored-procedure wrappers, SQLAlchemy Core (execute + handle result sets directly), JDBC direct usage.
  • Row Data Gateway: Less common in modern frameworks; often hand-rolled or generated from metadata. Appears in legacy Java/C# codebases before frameworks matured.

Step 7 — Check for anti-patterns.

WHY: Even the correct pattern recommendation fails if common misuses are not flagged upfront. These are the most frequent failure modes Fowler identifies.

Check each:

  • [ ] AR with non-isomorphic schema: Using Active Record when the domain has inheritance hierarchies, value object collections, or complex associations that don't map 1:1 to tables. Symptom: lots of has_many :through, STI workarounds, or manual column overrides. Fix: migrate to Data Mapper.
  • [ ] Premature Data Mapper: Full mapping layer (Hibernate, hand-rolled mappers) for a largely CRUD application with simple domain. Symptom: enormous mapper configuration, trivial domain classes. Fix: evaluate whether Active Record would suffice.
  • [ ] Business logic in Gateway classes: TDG or RDG methods that contain validation, calculation, or domain rules. This is Active Record by another name — but without intent. Fix: either commit to Active Record or strip the logic out.
  • [ ] Mixed primary persistence patterns: Using both Active Record and Data Mapper for different parts of the same domain model. Fowler: "you don't want to mix them because that ends up getting very messy."

Step 8 — Produce the decision record.

WHY: Pattern selection without documented rationale gets revisited and second-guessed. A one-page decision record captures the reasoning, making future refactoring decisions faster.

Output: See Outputs section below.


Inputs

  • Domain-logic pattern name (Table Module / Transaction Script / Domain Model)
  • Schema shape description (isomorphic vs. divergent, presence of inheritance/collections)
  • Business logic weight (CRUD-only vs. complex policies)
  • Language and ORM framework
  • Optional: existing codebase, schema files, architecture docs

Outputs

Pattern Decision Record (written to a markdown file or returned inline):

# Data Source Pattern Decision Record

## Context
- Domain-logic pattern: [Table Module | Transaction Script | Domain Model]
- Schema isomorphism: [High | Medium | Low]
- Business logic weight: [Low | Moderate | Heavy]
- Language / framework: [e.g., Java / Hibernate]

## Recommended Pattern
**[Table Data Gateway | Row Data Gateway | Active Record | Data Mapper]**

## Rationale
[2-4 sentences connecting domain-logic pattern + isomorphism + logic weight to the recommendation]

## Framework Mapping
- This project uses [framework], which implements the [pattern] style natively.
- [Any idiomatic notes or configuration guidance]

## Migration Path (if applicable)
[e.g., "Currently using RDG; as business logic accumulates on row objects, refactor to AR by
moving Transaction Script logic into the gateway class, renaming to domain classes."]

## Anti-Patterns to Watch
- [AR/DM mismatch warning if applicable]
- [Business-logic-in-gateway warning if applicable]

## Related Patterns Triggered
- Unit of Work: [needed / not needed] — [reason]
- Identity Map: [needed / not needed]
- Lazy Load: [consider / not applicable]

Key Principles

1. Domain-logic pattern is the primary routing axis, not a preference. The data-source pattern is constrained by domain-logic choice, not independent of it. Table Module cannot work without Table Data Gateway. Domain Model with complex logic cannot sustain Active Record cleanly. This is why domain-logic-pattern-selector must run first.

2. Schema isomorphism is the Active Record / Data Mapper split criterion. Active Record requires one-to-one correspondence between class and table structure. When domain objects diverge from the schema — through inheritance, value objects, or separate evolution — Data Mapper becomes necessary. Trying to force AR onto a non-isomorphic schema produces layered hacks.

3. The four patterns form a progression, not a menu. TDG → RDG → AR → DM is a progression of increasing capability and increasing complexity. The appropriate pattern is the simplest one that handles the domain-logic complexity. Over-engineering (premature DM) is as damaging as under-engineering (AR for complex domain).

4. Business logic in a Gateway class is a smell, not a feature. If logic accumulates in a TDG or RDG, the class is evolving into an Active Record. That evolution is fine if intentional; it is an anti-pattern if unintentional, because it violates the Gateway's contract of pure data access.

5. Data Mapper buys independent evolution, at a cost. DM lets the database schema and object model evolve independently — you can rename a table without touching domain code, or add a collection without altering the schema. The cost is the mapping layer itself: more code, more configuration, more tooling. Only justified when that independence is actually needed.

6. Framework choice reflects pattern choice — fight the framework at your peril. Rails assumes Active Record pattern. Hibernate assumes Data Mapper. Using Hibernate like Active Record (loading everything into rich entities for simple CRUD) is as problematic as using Rails AR for a rich domain with complex inheritance. Choose the framework whose default pattern matches the one this skill recommends.

7. Do not mix primary persistence patterns in the same domain. Mixing AR and DM for different domain classes creates two parallel mental models for how persistence works. Fowler is explicit: pick one primary pattern and apply it consistently. DM can call TDG internally (as a layering technique), but that is a deliberate architectural choice, not mixing.


Examples

Scenario A: Ruby on Rails e-commerce app with standard domain

Trigger: "We're building an online store with Rails. Products, Orders, Users — standard stuff. Should we use ActiveRecord or something like Trailblazer's Data Mapper approach?"

Process:

  1. Domain-logic pattern: Transaction Script evolving toward Domain Model — validation and simple calculation on models. Standard Rails.
  2. Schema isomorphism: HIGH — each model maps to one table, no unusual inheritance.
  3. Business logic weight: LOW to MODERATE — discount calculations, order state transitions, nothing requiring test isolation from DB.
  4. Routing matrix: Domain Model (simple) + High isomorphism + Low-moderate logic → Active Record.
  5. Framework mapping: Rails ActiveRecord implements this natively.
  6. Anti-pattern check: Flag that AR will strain if the domain grows to include complex pricing rules, product hierarchies, or external pricing APIs. Plan for that threshold and document it.

Output: Recommend Active Record. Use Rails ActiveRecord natively. Add a note: "When Product becomes a polymorphic hierarchy with >3 types and complex pricing rules, reassess toward Data Mapper using a separate service/repository layer."


Scenario B: Java enterprise app with complex domain, legacy schema

Trigger: "We have a Java application with a complex insurance policy domain — policies, coverages, endorsements, riders, pricing rules. Legacy Oracle schema from 2003 that doesn't match how we model policies in code. Team of 20, using Spring."

Process:

  1. Domain-logic pattern: Domain Model — clear from the description (policies, endorsements, pricing rules).
  2. Schema isomorphism: LOW — legacy schema with 2003 naming, coverage modeled differently than in code, likely separate pricing tables.
  3. Business logic weight: HEAVY — pricing rules, endorsements, riders all suggest complex domain behavior.
  4. Routing matrix: Domain Model + Low isomorphism + Heavy logic → Data Mapper.
  5. Framework mapping: Spring + Hibernate = Data Mapper pattern implemented. Use JPA @Entity with @Column mapping to isolate domain names from schema names. Repository interfaces provide finder behavior.
  6. Anti-pattern check: Warn against "anemic domain model" — putting all logic in service classes while entities are DTOs. That removes DM's benefit. Domain logic should live in domain classes, not in Spring @Service beans.

Output: Recommend Data Mapper via Hibernate/JPA. Domain classes in src/domain/, repository interfaces in src/persistence/. Isolate schema column names in @Column(name="POLICY_COVG_AMT") mappings. Plan Unit of Work via JPA EntityManager + transaction boundaries.


Scenario C: .NET WinForms reporting app with data grids

Trigger: "We're building an internal reporting tool in C# .NET. Lots of data grids, editable tables, CRUD screens that mirror database tables. Using DataSets and DataGridViews."

Process:

  1. Domain-logic pattern: Table Module — screens correspond to tables, data grids bind to record sets.
  2. No need to assess isomorphism or business logic weight — Table Module mandates TDG.
  3. Framework mapping: ADO.NET DataSet + DataAdapter + DataGridView is the canonical .NET Table Data Gateway implementation. TableAdapter in the Visual Studio dataset designer IS a TDG.
  4. Anti-pattern check: Do not add business logic to gateway classes. Validation that spans multiple tables belongs in a separate validation layer, not in the TableAdapter.

Output: Confirm Table Data Gateway. Use ADO.NET DataAdapter/DataSet pattern or TableAdapter. Return DataSet from gateway methods to bind to DataGridView controls. Keep gateway classes free of business logic.


References

  • references/pattern-routing-matrix.md — Complete routing table with all branching conditions
  • references/anti-pattern-catalog.md — Detailed descriptions of each anti-pattern with detection criteria and remediation steps
  • references/framework-pattern-map.md — Extended framework mapping (20+ ORM frameworks) organized by pattern
  • references/migration-paths.md — Step-by-step migration guides: TDG→RDG, RDG→AR, AR→DM

Downstream skills triggered by this skill's output:

  • If Data Mapper selected → unit-of-work-implementer (commit sequencing, dirty tracking)
  • If Lazy Load needed → lazy-load-strategy-implementer
  • If audit of existing persistence code → data-access-anti-pattern-auditor

License

This skill is licensed under CC-BY-SA-4.0. Source: BookForge — Patterns of Enterprise Application Architecture by Martin Fowler et al.


Related BookForge Skills

Install related skills from ClawhHub:

  • clawhub install bookforge-patterns-of-enterprise-application-architecture

Or install the full book set from GitHub: bookforge-skills

平台分布

OpenClaw

91.2%
按下载量换算899

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

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

继续浏览同类 Skills