Token导航 LogoToken导航

Agent Skill · 研究检索

bookforge-data-access-anti-pattern-auditor(bookforge 数据访问反模式审核员)

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

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

总安装 2,970周安装 125GitHub Stars 公开资料未说明下载 1,040核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install bookforge-data-access-anti-pattern-auditor

这个 Skill 是做什么的

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

检测持久层常见反模式如 N+1 查询、波纹加载等问题。输出优化建议改善系统性能与稳定性。覆盖 SQL、ORM 及缓存策略等多层面审查。

安装命令:openclaw skills install bookforge-data-access-anti-pattern-auditor 需授权访问数据库 schema 与查询日志进行分析。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

bookforge-data-access-anti-pattern-auditor 怎么安装?

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

bookforge-data-access-anti-pattern-auditor 支持哪些 AI 工具?

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

bookforge-data-access-anti-pattern-auditor 需要什么权限?

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

bookforge-data-access-anti-pattern-auditor 是免费的吗?

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

bookforge-data-access-anti-pattern-auditor 用的人多吗?

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

bookforge-data-access-anti-pattern-auditor 安全吗?

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

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

值得选的地方

  • 专注 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-access-anti-pattern-auditor

bookforge 数据访问反模式审核员 · 本页

2,970—调用外部服务MIT-0通过

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

SKILL.md 原文

name
data-access-anti-pattern-auditor
description
Audit a persistence layer and schema for data access anti-patterns: N+1 query
version
1.0.0
homepage
https://github.com/bookforge-ai/bookforge-skills/tree/main/books/patterns-of-enterprise-application-architecture/skills/data-access-anti-pattern-auditor
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, 11, 12]
domain
software-architecture
tags
depends-on
[]
execution
tier
2
mode
hybrid
inputs
description
Persistence layer source files (models, repositories, gateways, mappers) plus schema (SQL DDL or ORM model definitions). The fuller the snapshot, the more precise the findings.
description
ORM / framework in use (Rails/ActiveRecord, Hibernate/JPA, SQLAlchemy, EF Core, TypeORM, etc.) and language. Inferred from build files if not stated.
tools-required
tools-optional
mcps-required
[]
environment
Enterprise application codebase with persistence layer accessible. Minimum: schema DDL + one sample model/repository file. Optimal: full src/persistence/, src/domain/, schema.sql, and ORM config.
discovery
goal
Produce a prioritized anti-pattern inventory for a persistence layer, with code location, evidence, consequence, and remediation for each finding.
tasks
audience
roles
experience
intermediate
when_to_use
triggers
prerequisites
[]
not_for
environment
codebase_required
true
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 Access Anti-Pattern Auditor

An end-to-end persistence-layer audit that detects six classes of data access anti-pattern, grades each finding by severity, and produces remediation recommendations grounded in Fowler's Patterns of Enterprise Application Architecture.

When to Use

Run this audit when:

  • Pages or endpoints are inexplicably slow and the bottleneck is query count, not query duration.
  • A code review reveals ORM model files that feel "too smart" or "too tangled with schema concerns."
  • A migration is planned (new ORM, schema refactor, framework upgrade) and you need a

baseline of structural debt.

  • A new subsystem is being designed and you want to confirm the data-source pattern choice

before coding begins.

  • You have inherited a legacy codebase and need to map persistence risks before touching it.

Not for: concurrency/locking problems, web controller bloat, remote-call overhead, or choosing a pattern from scratch (those have dedicated skills).

Context and Input Gathering

Required:

  • Persistence layer source files: model classes, repository/gateway/mapper files, ORM config.
  • Schema: SQL DDL, migration files, or ORM model definitions that define table structure.

Observable / inferred:

  • ORM and language: detected from import/require statements, pom.xml, Gemfile,

requirements.txt, package.json. Ask if not determinable.

  • Application domain: inferred from table/class names. A brief description helps scope findings.

Defaults if not provided:

  • Assume modern ORM with lazy loading enabled by default (the common case in Hibernate,

Rails, SQLAlchemy, EF Core).

  • Assume new system unless file timestamps or comments indicate otherwise.

Sufficiency check: You need at least one model/entity file and the schema to produce findings. Without both, produce a "what to look for" checklist and ask for the missing piece.

Process

Step 1 — Discover the persistence layer

WHY: Anti-patterns live in specific file types. Locating them before analysis avoids missing findings buried in unusual directory structures.

1a. Glob for ORM model/entity/gateway files:

src/persistence/**   src/models/**   src/domain/**
**/models.py         **/*.entity.ts  **/*Gateway.*  **/*Mapper.*  **/*Repository.*
schema.sql           db/schema.rb     migrations/

1b. Read the build file (pom.xml, Gemfile, requirements.txt, package.json) to confirm ORM. 1c. Read config/database.yml or equivalent for connection pool and isolation level context.

Step 2 — Scan for N+1 / ripple loading

WHY: Fowler warns that "ripple loading" — filling a collection with individually lazy-loaded objects then examining them one at a time — is the most common ORM performance killer. Each object triggers a separate SQL round-trip, making N parent entities produce 1+N queries.

2a. Grep for loop constructs: forEach, each, for...in, for...of, .map(, .stream(. 2b. Inside each loop body, check whether a navigation property or finder is accessed: .line_items, .getRelated(), .find(, .query(. 2c. Confirm no eager-load option at the query site: Rails .includes, JPA JOIN FETCH, SQLAlchemy joinedload, EF Core .Include, Prisma include. 2d. Check ORM model definitions for lazy=True, FetchType.LAZY, virtual ICollection — these are the seed of N+1 when accessed in a loop.

Record: file path, line range, loop shape, the lazy field accessed, evidence snippet.

Step 3 — Scan for ghost / proxy identity trap

WHY: Virtual proxies for lazy loading carry a different object identity than the real object. Two proxies for the same DB row compare as unequal. Fowler calls this "a nasty identity problem." Without an Identity Map, the same row can produce multiple conflicting instances in one transaction — causing double-writes and broken version checks.

3a. Check if the ORM is configured to use a session / Unit of Work / first-level cache. 3b. Grep for multiple session/context creation within one request: new Session(, new DbContext(, sessionFactory.openSession(). 3c. Check entity equals() / __eq__ — if not overridden, comparison is reference equality, which will fail for proxies of the same row. 3d. Look for detached entity access after session close (JPA LazyInitializationException stack traces in logs; SQLAlchemy DetachedInstanceError).

Record: whether single-session discipline is enforced, any violations found.

Step 4 — Scan for Active Record / Data Mapper mismatch

WHY: Fowler states Active Record "works well only if the objects correspond directly to the database tables: an isomorphic schema." When the domain has inheritance hierarchies, value objects, or systematic naming divergence, AR fights the ORM constantly — every method involves manual conversion. Conversely, a full Data Mapper for a simple CRUD app adds ceremony without benefit.

4a. Identify the data-source pattern in use: ActiveRecord base class, explicit mapper classes, or repository classes that load domain objects. 4b. If AR: check for isomorphism failure signals — - to_domain / from_record / to_entity methods inside the AR class. - Inheritance hierarchy in domain mapped to a flat AR class (STI or manual type column). - Value objects (Money, Address) stored as AR fields with multi-column mapping. - Systematic column/field name mismatch beyond convention (e.g., bill_addr_l1 ↔ billing_address_line1). 4c. If Data Mapper: check for over-engineering signals — - Mapper classes that are pure field-for-field copies with no structural transformation. - Domain objects with no behavior (all data, no methods) — anemic domain model.

Record: pattern identified, isomorphism verdict, specific mismatch evidence.

Step 5 — Scan for Serialized LOB overuse

WHY: Fowler warns that the primary disadvantage of Serialized LOB is "you can't query the structure using SQL." When teams query inside a LOB using LIKE, JSON operators, or secondary indexes, they have chosen the wrong pattern — the data needed real columns from the start. The versioning risk is equally serious: changing the serialized class definition can break deserialization of old rows.

5a. Grep schema for TEXT/BLOB/JSONB/CLOB/XML columns: BLOB|CLOB|JSONB|JSON\b|TEXT. 5b. For each LOB column found: check whether it appears in a WHERE, ORDER BY, or JOIN in SQL queries or ORM filter expressions. 5c. Grep application code for deserialization + post-filtering: json.loads(, JSON.parse(, deserialize( followed by list comprehension / filter. 5d. Check for GIN indexes or expression indexes on LOB columns. 5e. Grep migration history for changes to LOB content structure (adding/renaming JSON fields via UPDATE queries or migration helpers).

Record: column name, query-pattern found, whether content is ever filtered/joined.

Step 6 — Scan for meaningful primary key leakage

WHY: Fowler states "meaningful keys should be distrusted." Business values used as PKs are supposed to be unique and immutable, but human error makes them neither. A PK cascade required by a business-rule change (new order number format, SSN correction) touches every child table — expensive and error-prone.

6a. Inspect schema PKs: flag any that are VARCHAR, CHAR, or named after business concepts (email, ssn, order_number, sku, username, code). 6b. Flag composite PKs where both columns carry business meaning. 6c. Check FK references: if child tables reference a meaningful PK, the cascade risk is live. 6d. Check domain objects: if the PK field is exposed as a stable business identifier (getId() used as orderNumber in UI or external API), the business key is leaking.

Record: table, PK definition, FK references, cascade risk assessment.

Step 7 — Scan for business logic in Gateway classes

WHY: A Table Data Gateway (DAO returning result sets / recordsets) or Row Data Gateway (per-row accessor) has a single contract: data access — find, insert, update, delete. When validation, calculation, or workflow logic accumulates in Gateway methods, the Gateway has drifted toward Active Record without the design intent. Testing requires a live DB even for logic that has nothing to do with persistence.

7a. Identify Gateway / DAO classes from naming: *Gateway, *DAO, *Dao, *DataAccess. 7b. Enumerate public methods. Flag any that are not CRUD verbs: find*, insert, update, delete, save, get*. 7c. For non-CRUD methods: read the body — is it a business rule, calculation, or validation? 7d. Check for SQL WHERE clauses that encode business policy (discount eligibility, status transitions) rather than just structural filtering.

Record: class, method name, evidence of non-CRUD logic, suggested move-to target.

Step 8 — Prioritize and produce the audit report

WHY: Not all findings are equal. Data-integrity risks (double-writes, lost updates from missing Identity Map) must be fixed before performance issues, which must be fixed before maintainability issues. Prioritizing prevents "fixing smells while the building is on fire."

8a. Rank all findings by severity tier: 1. Critical — Missing Identity Map / proxy identity trap (data integrity) 2. High — N+1 / ripple loading (performance), AR/DM mismatch (correctness) 3. Medium-High — Serialized LOB overuse (query loss + versioning) 4. Medium — Meaningful key leakage (stability), Business logic in Gateway (maintainability)

8b. Write the audit report (see Outputs section). 8c. For each finding, cross-reference the family skill that handles the fix: - N+1 → lazy-load-strategy-implementer - AR/DM mismatch → data-source-pattern-selector - Serialized LOB / meaningful key → object-relational-structural-mapping-guide - Business logic in Gateway → data-source-pattern-selector

Inputs

InputRequiredDescription
Persistence layer sourceYesModel, gateway, mapper, repository files
Schema / DDLYesSQL CREATE TABLE statements or ORM model definitions
ORM / frameworkInferredDetected from imports/build files; ask if ambiguous
Domain descriptionOptionalHelps scope findings; inferred from naming if absent

Outputs

Primary artifact: Anti-Pattern Audit Report

# Data Access Anti-Pattern Audit — [System / Subsystem Name]

**Stack:** [language, ORM, database]
**Date:** [date]
**Scope:** [files reviewed]

---

## Critical Findings

### [AP-ID]: [Anti-Pattern Name]
- **Location:** `path/to/file.py`, line XX–YY
- **Evidence:**

[code snippet showing the problem]

- **Consequence:** [what goes wrong, how badly]
- **Remediation:** [specific fix; cross-ref skill if pattern choice is involved]

---

## High Findings
[same structure]

## Medium-High Findings
[same structure]

## Medium Findings
[same structure]

---

## Summary Table

| Finding | Anti-Pattern | Severity | File | Remediation Skill |
|---|---|---|---|---|
| AP-01 | N+1: Order.line_items | High | orders_controller.rb:42 | lazy-load-strategy-implementer |
| ... | | | | |

---

## Recommended Action Order

1. [Critical findings first, with rationale]
2. [High findings]
3. [Medium findings]

Key Principles

1. Ripple loading is detectable statically — it doesn't require profiling. The shape is always a loop over N entities with an inner DB access. Grep finds it before the system is ever under load. Do not wait for slow-query logs; find it in the code.

2. The proxy identity trap is silent until it causes data loss. Two proxies for the same row compare as not-equal. There's no exception, no log message — just incorrect equality checks, phantom dirty-tracking, and version-check failures. An Identity Map check (single-session discipline, equals() override) is a correctness audit, not a performance audit.

3. "Isomorphic schema" is the only condition under which Active Record is correct. Active Record works when every domain field maps 1:1 to a column, every domain class maps 1:1 to a table, and the domain has no inheritance or value objects. Any deviation from this — even a single to_domain() helper — signals that Data Mapper is the correct pattern.

4. A Serialized LOB is correct only when the content will never be queried independently. Fowler's test: "Think of a LOB as a way to take a bunch of objects that aren't likely to be queried from any SQL route outside the application." If a WHERE clause or application-side filter ever touches the content, the content needs real columns.

5. Meaningful keys should be distrusted by default. Keys need to be unique AND immutable to function correctly. Business values fail both properties under human error. The cost of a PK cascade far exceeds the cost of adding a surrogate column early.

6. Prioritize by data-integrity risk, not by visibility. N+1 queries are loud and visible in slow query logs. Missing Identity Map bugs are silent and only surface as "phantom data" in production. Audit for the silent killers first.

7. Gateway classes have a single contract: data access. A method on a Gateway that is not find, insert, update, or delete is a smell. Business logic in a Gateway is hidden domain behavior that cannot be tested without a live database — a compound failure of the persistence/domain separation.

Examples

Scenario A: Rails E-Commerce App with N+1 on Order Items

Trigger: Engineer reports that the orders index page takes 3–8 seconds for 100+ orders.

Process:

  1. Glob app/controllers/orders_controller.rb and app/views/orders/index.html.erb.
  2. Grep for .each in the view; find order.line_items.count inside the loop.
  3. Confirm Order.all in the controller has no .includes(:line_items).
  4. Grep app/models/order.rb for has_many :line_items — default lazy.
  5. Severity: High (performance; 1+100 queries for 100 orders).

Output snippet:

### AP-01: N+1 — Order.line_items in orders#index
- **Location:** `app/views/orders/index.html.erb`, line 14
- **Evidence:** `<%= order.line_items.count %>` inside `orders.each` loop;
  controller: `@orders = Order.all` (no `.includes`).
- **Consequence:** 1 + N SQL queries (1 for orders + 1 per order for line_items).
  With 200 orders: 201 queries per page load.
- **Remediation:** `Order.includes(:line_items)` in controller. Or `.eager_load(:line_items)`.
  Cross-ref: `lazy-load-strategy-implementer`.

Scenario B: Hibernate App — Domain Has Inheritance, AR-Style Mapping

Trigger: "Our User entity has a to_domain() method and the mapper is constantly wrong."

Process:

  1. Read User.java — finds User extends BaseEntity (AR style) with toUserDomain() method.
  2. Read schema — users table has a type discriminator column; subtypes AdminUser,

GuestUser have different behavior.

  1. Confirm @Entity on User with @Inheritance(strategy = SINGLE_TABLE) — STI, not AR.
  2. The toUserDomain() method converts User to a separate UserDomain POJO — isomorphism broken.
  3. Severity: High (mismatch: domain has inheritance + behavior; AR fighting the ORM).

Output snippet:

### AP-02: AR/DM Mismatch — User domain inheritance vs flat ActiveRecord
- **Location:** `src/persistence/User.java`, `toUserDomain()` at line 87
- **Evidence:** `User` uses AR-style `@Entity` but contains `toUserDomain()` conversion;
  schema has `type` discriminator for AdminUser/GuestUser subtypes.
- **Consequence:** Every domain operation requires manual conversion; schema changes force
  dual updates to entity and domain class; tests require DB for all domain logic.
- **Remediation:** Replace with proper Data Mapper (JPA Mapper or manual Mapper class) that
  maps User table → AdminUser/GuestUser domain objects. Cross-ref: `data-source-pattern-selector`.

Scenario C: PostgreSQL System — Customer Preferences in JSONB, Queried Frequently

Trigger: "We're adding a filter UI for customer preferences and it's slow."

Process:

  1. Read schema — customers.preferences column is JSONB.
  2. Grep SQL files — find WHERE preferences->>'theme' = 'dark' and WHERE preferences->>'notifications' = 'email'.
  3. Grep migrations — find a migration that renames a JSON key inside preferences.
  4. Severity: Medium-High (query-loss: querying inside LOB; versioning trap evident).

Output snippet:

### AP-03: Serialized LOB Overuse — customers.preferences
- **Location:** `db/migrations/20240301_create_customers.sql` (column def),
  `src/queries/customer_filters.sql` (WHERE clause at line 12)
- **Evidence:** `customers.preferences JSONB` column filtered via `->>'theme'` and
  `->>'notifications'` operators; migration 20240512 renames `notif_type` → `notifications`.
- **Consequence:** SQL cannot efficiently filter JSONB without expression index; adding
  expression indexes is schema-within-schema churn; past migration renamed a JSON key
  (versioning trap confirmed).
- **Remediation:** Extract `theme VARCHAR(20)`, `notifications_channel VARCHAR(20)` as
  real columns; retain `preferences JSONB` only for content never filtered directly.
  Cross-ref: `object-relational-structural-mapping-guide`.

References

  • references/anti-pattern-detection-cheatsheets.md — Per-stack grep patterns, evidence

classification tables, and diagnostic tests for all six anti-pattern types.

  • Fowler, *PEAA* Chapter 3: "Reading in Data" — N+1 avoidance rules; finder method placement.
  • Fowler, *PEAA* Chapter 11: "Lazy Load" — Ripple loading definition; proxy identity trap.
  • Fowler, *PEAA* Chapter 11: "Identity Map" — Single-instance guarantee; first-level cache.
  • Fowler, *PEAA* Chapter 10: "Active Record", "Data Mapper" — Isomorphism requirement;

When to Use It sections.

  • Fowler, *PEAA* Chapter 12: "Identity Field" — Meaningful vs meaningless keys.
  • Fowler, *PEAA* Chapter 12: "Serialized LOB" — Queryability loss; versioning trap.

License

This skill is licensed under CC-BY-SA-4.0. Source: BookForge — Patterns of Enterprise Application Architecture by Martin Fowler, David Rice, Matthew Foemmel, Edward Hieatt, Robert Mee, Randy Stafford.

Related BookForge Skills

Install related skills from ClawhHub:

  • clawhub install bookforge-data-source-pattern-selector
  • clawhub install bookforge-lazy-load-strategy-implementer
  • clawhub install bookforge-object-relational-structural-mapping-guide

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

平台分布

OpenClaw

82.49%
按下载量换算858

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

调用外部服务

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

安装前确认

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

继续浏览同类 Skills