Token导航 LogoToken导航

Agent Skill · 研究检索

bookforge-big-class-responsibility-extraction(Bookforge 大类责任提取)

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

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

总安装 28,301周安装 757GitHub Stars 公开资料未说明下载 4,870核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:bookforge-big-class-responsibility-extraction(Bookforge 大类责任提取)
来源仓库:https://github.com/quochungto/bookforge-big-class-responsibility-extraction
安装命令:
openclaw skills install bookforge-big-class-responsibility-extraction
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

ClawHubOpenClaw
openclaw skills install bookforge-big-class-responsibility-extraction

这个 Skill 是做什么的

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

用于从超大类中识别并提取不合理职责。应用 Feathers 7 种启发法和特征草图进行分析。帮助拆分复杂类以改善代码结构。使用时需提供类名或代码片段。bookforge-big-class-responsibility-extraction 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

建议结合重构计划逐步实施拆分。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

bookforge-big-class-responsibility-extraction 怎么安装?

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

bookforge-big-class-responsibility-extraction 支持哪些 AI 工具?

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

bookforge-big-class-responsibility-extraction 需要什么权限?

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

bookforge-big-class-responsibility-extraction 是免费的吗?

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

bookforge-big-class-responsibility-extraction 用的人多吗?

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

bookforge-big-class-responsibility-extraction 安全吗?

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

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

值得选的地方

  • 专注 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-big-class-responsibility-extraction

Bookforge 大类责任提取 · 本页

28,301—调用外部服务MIT-0通过

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

SKILL.md 原文

name
big-class-responsibility-extraction
description
Identify and extract responsibilities from an oversized class using Feathers' 7 heuristics + feature sketches. Use whenever a developer faces 'this class is too big', 'god class', 'monster class', '500-line class', 'class with 50+ methods', 'class with too many responsibilities', 'SRP violation', 'hard to test because class does too much', 'team keeps editing same class', 'merge conflicts on one class'. Activates for 'single responsibility', 'extract class', 'class decomposition', 'responsibility split', 'interface segregation', 'class bloat', 'swamp class', 'god object', 'feature sketch', 'class too big'.
version
1.0.0
homepage
https://github.com/bookforge-ai/bookforge-skills/tree/main/books/working-effectively-with-legacy-code/skills/big-class-responsibility-extraction
metadata
{"openclaw":{"emoji":"📚","homepage":"https://github.com/bookforge-ai/bookforge-skills"}}
status
draft
source-books
title
Working Effectively with Legacy Code
authors
["Michael C. Feathers"]
chapters
[20]
domain
software-engineering
tags
[legacy-code, refactoring, software-engineering, code-quality, srp, interface-segregation]
depends-on
execution
tier
2
mode
hybrid
inputs
description
Oversized class source file + optional change history + current change triggering the refactor
tools-required
[Read, Grep]
tools-optional
[Bash, Edit]
mcps-required
[]
environment
Codebase; git log access improves H7 (focus on current work) accuracy.
discovery
goal
Produce a responsibility map and incremental extraction plan for a big class — act only when a change triggers the work.
tasks
audience
roles
[software-engineer, backend-developer, tech-lead]
experience
intermediate-advanced
when_to_use
triggers
prerequisites
why
Before extracting, know the blast radius of proposed changes
not_for
environment
codebase_required
true
codebase_helpful
true
works_offline
true
quality
scores
{with_skill: null, baseline: null, delta: null}
tested_at
null
eval_count
null
assertion_count
13
iterations_needed
null

Big Class Responsibility Extraction

When to Use

Apply this skill when you encounter a class that has become a "swamp" — one that has accumulated so many responsibilities that changing it is slow, risky, and conflict-prone. The immediate trigger signal is any of:

  • The class has 50+ methods or a large number of instance variables
  • Multiple developers are colliding on edits in the same iteration
  • You cannot describe what the class does in a single sentence without using "and"
  • Adding a test requires understanding the entire class
  • Merge conflicts cluster on one file repeatedly

What this skill does NOT do: it does not prescribe a full rewrite schedule. The output is a responsibility map and an incremental extraction plan that you act on only when a change touches a responsibility area.

Context and Input Gathering

Before starting, collect:

  1. Class source path — the full file for the oversized class
  2. Method inventory — a complete list of all methods and their access modifiers (public, private, protected)
  3. Instance variable list — all fields and their types
  4. Current change — the specific ticket, feature, or bug fix that brought you here today
  5. Change history (optional) — git log --follow -p <file> reveals who edits what, and how often multiple responsibilities change together

Process

Step 1: Confirm the Big Class Pattern

Verify the class meets the threshold for this skill. A big class has two or more of:

  • 50+ methods (or 20+ public methods)
  • 10+ instance variables
  • Multiple developers modifying it in the same sprint
  • Inability to write a test for a single method without setting up the entire class
  • Methods that require reading through large blocks of unrelated code to understand

If the class is borderline, check git history: if the same file appears in commits for unrelated features (login, notifications, billing), the bloat is confirmed.

Step 2: Name the Anti-Pattern — Incremental Class Bloat

Before doing any analysis, name what happened. The class became a swamp through Incremental Class Bloat: each new feature added a few lines or a method because "the data I need is already here." No single commit was catastrophic. Thirty small decisions compounded into a structural problem.

Naming this matters because it prevents the team from repeating it. The rule going forward: when you reach for data in an existing class to add new behavior, ask whether that behavior *belongs* to this class or whether it should live in a class that *uses* this class.

Step 3: Apply the 7 Heuristics to Find Responsibility Candidates

Work through each heuristic. Not all will fire — stop when you have enough candidates to drive the current change.

H1 — Group Methods: Write down every method with its access modifier. Look for naming clusters — groups of methods that share a common noun or verb prefix. For example: authenticate(), validateToken(), refreshSession() form one cluster; sendWelcomeEmail(), sendResetEmail() form another. Each distinct cluster is a candidate responsibility.

*Why:* Method names are the developer's primary signal about what a method is for. Clusters that share a purpose usually share a responsibility.

H2 — Look at Hidden Methods: Count the private and protected methods. If there are far more private methods than public ones, a hidden class is trying to emerge. The test: if you made a private method public, would it feel odd on this class? If yes, it belongs on a different class.

*Why:* The RuleParser example (see Examples section) has 2 public methods and many private ones. The private cluster around nextTerm and hasMoreTerms is a TermTokenizer in disguise.

H3 — Look for Decisions That Can Change: Identify hard-coded assumptions — a specific database, a fixed API endpoint, a particular algorithm. These are not just implementation details; they are responsibilities. If the decision could change independently of everything else the class does, it can be extracted.

*Why:* A change to the hard-coded decision would ripple through methods that have no other reason to change together. Extraction creates a seam.

H4 — Look for Internal Relationships (Feature Sketches): Draw a rough diagram — circles for each instance variable, circles for each method. Draw an arrow from each method to every instance variable or other method it reads or modifies. Look for clusters: groups of methods and variables with dense internal connections but few lines crossing to the rest of the diagram.

The connection between clusters — a thin set of lines linking two otherwise independent groups — is a pinch point. The pinch point defines the interface a new class would present.

*Why:* Feature sketches make latent structure visible without requiring you to read all the code. Clusters with pinch points are extractable with low risk.

H5 — The Primary Responsibility Sentence Test: Try to describe the class in one sentence. Each time you add an "and" or "also" clause, you have identified a secondary responsibility. Example: "UserManager handles authentication and stores preferences and sends notifications" — three distinct responsibilities.

*Why:* The Single Responsibility Principle says a class should have one reason to change. Each "and" clause in your sentence is a separate reason to change.

H6 — Scratch Refactoring: If heuristics H1–H5 do not give you clear candidates, do a scratch refactoring. Spend 20–30 minutes extracting classes and methods freely, ignoring test coverage and production risk. The goal is not to produce working code — it is to reveal what structure is latent in the class. Throw away the scratch work; keep the insights.

*Why:* Sometimes the structure is only visible once you start moving things. Scratch refactoring is an exploration tool, not a commitment.

H7 — Focus on the Current Work: Look at the specific change you need to make today. The code you are adding or modifying is in a particular responsibility area. That area — and only that area — is a candidate for extraction right now.

*Why:* The current change is telling you what the software needs to evolve. Recognizing that a new capability represents a separable responsibility is enough to justify extracting it. You do not need to refactor the whole class — only the responsibility the change touches.

Step 4: Build a Feature Sketch for the Top Candidate

For the responsibility cluster that H4 or H7 identified as most relevant to your current change:

  1. List all methods and instance variables on paper or in a text file
  2. For each method, note which instance variables and other methods it reads or writes
  3. Draw arrows: method → variable/method it uses
  4. Circle groups that have dense internal arrows and thin external connections
  5. Identify the pinch point: the crossing lines between the candidate cluster and the rest of the class

The feature sketch does not need to be precise. It is a disposable tool — make it in 10 minutes, use it, discard it.

Step 5: SRP Sentence Test and Two-Level Check

Write the one-sentence description of the class. Then check two levels:

Interface-level SRP: Does the class *appear* to have too many responsibilities based on its public API? If so, consider adding per-client interfaces (Interface Segregation Principle). Clients that only need a subset of the class's behavior can depend on the interface rather than the full class.

Implementation-level SRP: Does the class *actually do* the work, or does it delegate to helper classes? If it already delegates, the violation is only at the interface level — less urgent. If it actually does everything itself, extraction is urgent.

Always address implementation-level SRP first. Introducing delegation is safer and sets the stage for interface-level cleanup later.

Step 6: Produce the Responsibility Map

Summarize findings from H1–H5 into a responsibility map. Format:

Class: <ClassName>
Primary responsibility: <one sentence>

Identified responsibilities:
  R1: <name> — methods: [...], variables: [...]
  R2: <name> — methods: [...], variables: [...]
  R3: <name> — methods: [...], variables: [...]

Pinch points:
  R1 ↔ R2: <method that connects them>
  R2 ↔ R3: <method that connects them>

Current change touches: R<N>

Step 7: Produce the Incremental Extraction Plan

Strategy: Do not schedule a refactoring week. Identify all responsibilities, share the map with the team, then extract on an as-needed basis. When a change touches a responsibility, extract that responsibility at that time.

Tactics for the current change:

  1. Identify the responsibility area the current change touches (from the map)
  2. List all methods and instance variables belonging to that responsibility
  3. If tests exist for those methods, use Extract Class with full delegation. Feathers' safe extraction steps when tests are absent:

a. Separate the target instance variables into a distinct block in the class declaration b. Extract the bodies of target methods to new methods, prefixed MOVING_ c. Verify — by text search, not just compile — that no moved variables are accessed outside the moved methods d. Create the new class; move the MOVING_-prefixed methods and variables into it e. Create an instance of the new class in the old class and delegate f. Remove the MOVING_ prefix from all moved methods

  1. The old class now delegates to the new class for that responsibility — SRP at the implementation level
  2. If client code must also change, that work is deferred until you have tests around those clients

What to defer: All other responsibilities in the map stay in the class for now. The map is a shared record — the team knows the direction, and each change moves one step toward it.

Inputs

InputRequiredSource
Class source fileYesCodebase
Method + variable listYesRead/Grep the source file
Current change descriptionYesTicket, PR, or developer context
Git log for the fileOptionalgit log --follow -p <file>

Outputs

responsibility-map.md — The results of H1–H5 analysis: method clusters, hidden method findings, decision candidates, feature sketch clusters, sentence test result, two-level SRP assessment.

extraction-plan.md — Incremental extraction steps tied to the current change: which responsibility to extract now, which methods and variables move, the safe step-by-step procedure, and what is deferred.

Key Principles

  • Don't binge-refactor. Extract only what the current change requires. The rest of the map informs future changes; it does not mandate immediate action.
  • SRP has two levels. A class can violate SRP at the interface (looks too big) without violating it at the implementation (actually delegates). Always fix implementation-level first.
  • Private-method clusters are hidden classes trying to emerge. Many private methods on a class is a signal, not a coincidence.
  • Feature sketches are disposable. Rough, fast, and thrown away after use. They are not UML diagrams and should not be maintained.
  • The sentence test is the fastest signal. If you need "and" to describe the class, you have found at least two responsibilities in under a minute.
  • Scratch refactoring is exploration, not commitment. Code produced in scratch refactoring is thrown away. Insights from it are kept.
  • The current change is your guide. The change tells you what the software is being asked to do. That is the area to clean up.

Examples

Example 1: RuleParser — Method Grouping Reveals 4 Responsibilities

RuleParser has 2 public methods (evaluate, addVariable) and many private methods (nextTerm, hasMoreTerms, several *Expression methods).

Apply H1 (group methods): the *Expression methods cluster together (evaluation); nextTerm and hasMoreTerms cluster together (tokenization); addVariable stands alone with the variables field (variable management); evaluate anchors parsing.

Apply H2 (hidden methods): the private nextTerm/hasMoreTerms group would not feel odd as public methods — but only on a class called TermTokenizer, not on RuleParser.

Responsibility map: Parsing, Expression evaluation, Term tokenization, Variable management.

Extraction plan: When the next change touches tokenization (e.g., new term syntax), extract TermTokenizer with nextTerm, hasMoreTerms, and the currentPosition field. Delegate from RuleParser. Leave the other responsibilities in place until a change triggers them.


Example 2: UserService — Feature Sketch Reveals 3 Clusters

UserService has 82 methods and 30+ instance variables. Four developers modify it in every sprint and hit merge conflicts weekly.

Apply H4 (feature sketch): draw method-to-variable arrows. Three dense clusters emerge with thin connections between them:

  • Cluster A: authenticate(), validateToken(), refreshSession() + sessionStore, tokenSecret
  • Cluster B: getPreferences(), updatePreferences(), resetPreferences() + preferenceStore, defaultPrefs
  • Cluster C: sendWelcomeEmail(), sendResetEmail(), queueNotification() + emailClient, notificationQueue

Apply H5 (sentence test): "UserService authenticates users and manages preferences and sends notifications" — three clauses, three responsibilities.

Extraction plan for the current sprint's social login feature: The feature touches authentication. Extract AuthenticationService with Cluster A methods and variables. Delegate from UserService. Cluster B and C remain until a change touches them.


Example 3: Change-Triggered Extraction for a Pricing Ticket

A ticket arrives: "Change the pricing calculation to support volume discounts." PricingEngine has 60 methods covering pricing, tax calculation, invoice formatting, and coupon redemption.

Apply H7 (focus on current work): the volume discount change touches the pricing calculation methods. Apply H4 to find the pricing cluster: calculateBasePrice(), applyDiscount(), computeTotal() + priceTable, discountRules.

Extraction plan: Extract PriceCalculator with the pricing cluster. The calculateBasePrice() and applyDiscount() methods become public on PriceCalculator; PricingEngine delegates to it. Add the volume discount logic to PriceCalculator. Tax, formatting, and coupons remain in PricingEngine for now.

This is change-triggered extraction: the ticket forced you to touch pricing, and that is the right time to clean it up.

References

  • Working Effectively with Legacy Code, Michael C. Feathers (2004), Chapter 20: This Class Is Too Big and I Don't Want It to Get Any Bigger
  • Refactoring: Improving the Design of Existing Code, Martin Fowler — Extract Class technique
  • Single Responsibility Principle: Robert C. Martin, Agile Software Development (2002)
  • Interface Segregation Principle: Robert C. Martin

License

CC-BY-SA 4.0 — BookForge Skills contributors. Source book content is copyright Michael C. Feathers / Prentice Hall. This skill distills techniques into executable guidance; it does not reproduce substantial portions of the text.

Related BookForge Skills

Dependencies (run these first):

  • change-effect-analysis — trace the blast radius of a change before extracting
  • dependency-breaking-technique-executor — break dependencies that block extraction

Cross-references (apply alongside):

  • scratch-refactoring-for-code-understanding — the H6 heuristic in standalone form
  • monster-method-decomposition — the method-level analog of this skill
  • dependency-breaking-technique-executor — when extraction is blocked by deep coupling

平台分布

OpenClaw

74.86%
按下载量换算3,646

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

调用外部服务

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

安装前确认

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

继续浏览同类 Skills