Token导航 LogoToken导航TokenDH.com
研究检索external-serviceclawhub未标认证来源可访问clear审计通过

bookforge-seam-type-selectorBookforge 接缝类型选择器

Agent Skill

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

总安装

1,346

周安装

55

GitHub Stars

公开资料未说明

下载量

431
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install bookforge-seam-type-selector

简介

用于查找、检索和筛选相关信息,适合在 OpenClaw 中快速定位候选结果。

  • 适用于选择正确的接缝类型(预处理器/链接/对象)以打破遗留代码依赖。
  • 可结合来源仓库和原始 README 核验具体用法,辅助代码解耦与维护。
  • 安装前需确认权限范围、维护状态,注意是否会触发联网、命令执行或文件读写。
  • 建议在使用前评估技能的实际输出边界,避免依赖其直接决策。

SKILL.md

name
seam-type-selector
description
Select the right seam type (Preprocessor / Link / Object) for breaking a dependency in legacy code. Use whenever a developer needs to substitute behavior for testing without editing in place, is choosing between dependency-injection strategies in an existing codebase, or asks 'how do I intercept this call in a test' / 'how do I fake this library' / 'how do I test around this hard-coded dependency'. Activates for 'seam', 'test seam', 'substitution point', 'dependency injection for legacy code', 'mock this without DI framework', 'C++ testing', 'linker-level fake', 'preprocessor substitution', 'polymorphic substitution', 'enabling point'.
version
1.0.0
homepage
https://github.com/bookforge-ai/bookforge-skills/tree/main/books/working-effectively-with-legacy-code/skills/seam-type-selector
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
[4]
domain
software-engineering
tags
[legacy-code, refactoring, testing, software-engineering, dependency-injection]
depends-on
[]
execution
tier
1
mode
hybrid
inputs
description
Source file containing the dependency to break + language + description of what needs to be substituted
tools-required
[Read, Grep]
tools-optional
[Edit]
mcps-required
[]
environment
A codebase in any language. Seam availability depends on language capabilities.
discovery
goal
Recommend the right seam type for a specific testing or substitution scenario.
tasks
audience
roles
[software-engineer, backend-developer, senior-developer]
experience
intermediate
when_to_use
triggers
prerequisites
[]
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
10
iterations_needed
null

Seam Type Selector

When to Use

Use this skill when a developer needs to substitute or intercept behavior in legacy code for testing, but cannot freely edit the code under test. Specifically:

  • The code has a hard-coded dependency (global function, library call, concrete class instantiation) that prevents running it in a test harness.
  • The developer asks: "How do I fake this?", "How do I test around this global?", "How do I intercept this call without a DI framework?", or "What's the right way to introduce a test double here?"
  • The developer is choosing between approaches (subclass override vs. classpath swap vs. macro replacement) and needs a principled recommendation.

Do not use for greenfield code where a dependency injection framework is already in place — the framework already manages enabling points.


Context and Input Gathering

Before recommending a seam type, gather:

  1. Language — Is this C or C++ (preprocessor available)? A compiled OO language like Java or C# (link and object seams)? A dynamic OO language like Python or Ruby (object seams, plus text redefinition)?
  2. Dependency type — What exactly needs to be substituted? Options: global function, static method, constructor call, third-party library, concrete class member.
  3. Pervasiveness — Is this dependency called in one or two places, or scattered across dozens of files and hundreds of call sites?
  4. Risk tolerance — Is modifying production class structure (adding a virtual method, adding a constructor parameter) acceptable? Some teams forbid structural changes to classes under test without prior test coverage.

Process

Step 1: Confirm a seam exists

A seam (Feathers' formal definition) is "a place where you can alter behavior in your program without editing in that place." Verify the target call site qualifies:

  • You want to substitute the behavior that runs at call site X.
  • You can make the substitution without modifying the source text at X itself.
  • There is an enabling point — a separate place where you decide which behavior to use.

If no enabling point can be identified, there is no seam. You will need to introduce one first (see dependency-breaking-technique-executor).

Step 2: Classify the dependency

ClassificationCharacteristicExamples
Localized1–5 call sites, within one class or moduleOne new DatabaseConnection() in a constructor
PervasiveMany call sites, spread across files50+ calls to getenv() throughout a C codebase; all files import a logging singleton

Pervasiveness is the primary override condition. If a dependency is pervasive, the cost of introducing object seams at every site may exceed the cost of a single link- or preprocessor-level substitution.

Step 3: Assess language capabilities

LanguagePreprocessor SeamLink SeamObject Seam
CYes (#define, #ifdef)Yes (object file swap)No (procedural)
C++YesYesYes
Java, KotlinNoYes (classpath)Yes
C#NoYes (assembly)Yes
Python, RubyNoLimitedYes (duck typing)
GoNoLimitedYes (interfaces)
TypeScript/JSNoLimited (module mock)Yes

Step 4: Apply the selection rule

Feathers states: "In general, object seams are the best choice in object-oriented languages. Preprocessing seams and link seams can be useful at times but they are not as explicit as object seams. Tests that depend on them can be hard to maintain. Reserve preprocessing seams and link seams for cases where dependencies are pervasive and there are no better alternatives."

Decision hierarchy:

1. Is the language OO and the dependency localized?
   → Use Object Seam

2. Is the language OO but the dependency is pervasive (many call sites)?
   → Prefer Link Seam (keeps source changes minimal)
   → Fall back to Preprocessor Seam only in C/C++

3. Is the language procedural C/C++ and the dependency is pervasive?
   → Link Seam first; Preprocessor Seam if link is not feasible

4. Is the language procedural C/C++ and the dependency is localized?
   → Preprocessor Seam (only option available)

Step 5: Identify the enabling point

Every seam has an enabling point — name it explicitly. Future readers (and the developer implementing the seam) must know where to flip the switch.

Seam TypeWhere the Enabling Point Lives
Object SeamWhere the object is constructed or injected — a constructor, factory method, parameter, or setter
Link SeamThe build configuration — classpath entry, Makefile rule, linker flag, or IDE project setting
Preprocessor SeamA preprocessor define — #define TESTING, a -DTESTING compiler flag, or an #include of a test-override header

Step 6: Produce the recommendation artifact

Output a seam-recommendation.md (template in Outputs section) with: seam type, enabling point location, rationale, language note, and a list of compatible Part III techniques the developer can apply next.


Inputs

InputRequiredDescription
Source file(s)RequiredThe file(s) containing the dependency to break
LanguageRequiredProgramming language of the codebase
Dependency descriptionRequiredWhat call/class/library needs to be substituted
Pervasiveness assessmentRecommendedNumber of call sites; single file vs. codebase-wide
Risk constraintsOptionalWhether structural changes to production classes are allowed

Outputs

seam-recommendation.md

## Seam Recommendation: [dependency name]

**Chosen Seam Type:** [Object / Link / Preprocessor]

**Enabling Point:**
[Exact location — e.g., "The constructor of OrderProcessor (line 42 of OrderProcessor.java)"
or "The classpath entry resolving com.example.PaymentGateway"
or "The TESTING preprocessor define passed via -DTESTING in the Makefile"]

**Rationale:**
[1–3 sentences: why this seam type for this language, dependency type, and pervasiveness level]

**Language Applicability:**
[Confirm the seam is available in the target language; note if a fallback was chosen]

**Compatible Part III Techniques:**
- [Technique name] — [one-line explanation of how it exploits this seam]
- [Technique name] — ...

**Next step:** See `dependency-breaking-technique-executor` to apply the selected technique.

Key Principles

  1. Prefer object seams for maintainability. Object seams are explicit — the substitution is visible in the source code at the enabling point. Link and preprocessor seams substitute behavior invisibly; future readers see nothing unusual at the call site.
  1. Every seam has an enabling point — name it explicitly. A seam without a named enabling point is incomplete. The enabling point is where the developer acts; without naming it, the recommendation cannot be implemented.
  1. Pervasive dependencies may justify link or preprocessor seams. When a global function is called in 80 places across 20 files, introducing a virtual dispatch at each site is high-risk surgery. A single build-level substitution is safer than 80 structural edits.
  1. Seams make the substitution point visible to future readers. The goal is not just to make tests pass today — it is to leave the codebase in a state where the next engineer can understand which behavior is being substituted and why.

Examples

Example A: Java class with a hard-coded dependency (Object Seam)

Situation: A UserService class has a constructor that directly instantiates UserRepository, which opens a database connection. No DI framework. Need to test UserService.findActiveUsers() without a real database.

Classification: Localized (one constructor site). Language: Java (OO).

Recommendation: Object Seam.

Enabling point: The UserService constructor. Introduce a second constructor that accepts a UserRepository parameter (Parameterize Constructor technique). Tests pass in a fake implementation; production code calls the original constructor.

Compatible techniques: Parameterize Constructor, Extract Interface (extract IUserRepository), Subclass and Override Method.


Example B: C++ with pervasive global calls (Link Seam)

Situation: A legacy C++ codebase has 60+ calls to log_event() (a global that writes to a syslog daemon) scattered across 15 files. Running tests triggers syslog writes and slows everything down.

Classification: Pervasive. Language: C++ (compiled, OO).

Recommendation: Link Seam.

Enabling point: The Makefile's link step. Create a test_log_event.o object file with a stub log_event() that records calls in memory. Swap it in via the Makefile for test builds. Source files are untouched.

Compatible techniques: Link-level substitution (Ch 19 procedural pattern), Encapsulate Global References (if later migration to OO is planned).


Example C: Legacy C with pervasive global calls (Preprocessor Seam)

Situation: A C codebase calls db_update(account_no, record) in 40 places across 8 files. There is no OO structure and no link-time substitution capability in the build environment.

Classification: Pervasive. Language: C (procedural — no object seam available).

Recommendation: Preprocessor Seam.

Enabling point: A #define TESTING flag passed to the C compiler (e.g., gcc -DTESTING). A localdefs.h header, included in each source file, defines a macro replacement for db_update under #ifdef TESTING that captures arguments without hitting the database.

Compatible techniques: Text Redefinition (C/C++ specific), C macro preprocessor pattern (Ch 19).


References

See references/seam-type-comparison.md for a full comparison matrix of all three seam types across language families, enabling point locations, and compatible Chapter 25 techniques.


License

CC-BY-SA-4.0 — derived from *Working Effectively with Legacy Code* by Michael C. Feathers (2004).


Related BookForge Skills

  • dependency-breaking-technique-executor — Takes a seam recommendation and applies a specific Chapter 25 technique step-by-step. This skill feeds directly into it.
  • legacy-code-change-algorithm — The outer 6-step procedure. Seam identification is Step 3 of that algorithm; use this skill to complete it.
  • library-seam-wrapper — Applies the link seam pattern specifically to third-party library dependencies, wrapping them in an interface.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

92%
按下载量换算397

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

external-service

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

安装前确认

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

来源信息

继续浏览同类 Skills