extract

Extract duplicated logic into a named module when two real callers exist.

Updated Apr 27, 2026
One-click install
npx skills add https://github.com/nokusukun/sublime --skill extract-nokusukun
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract
Source: https://github.com/nokusukun/sublime/tree/main/extract
Command: npx skills add https://github.com/nokusukun/sublime --skill extract-nokusukun

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicated logic across endpoints, components, or modules leads to higher maintenance costs and bug surfaces. This skill ensures a disciplined approach: only extract a shared module when a second real caller exists today, avoiding speculative DRY.

Core Features & Use Cases

  • Enforces the second-caller rule to prevent premature abstractions.
  • Names the shared concept in domain terms and places it in an appropriate module.
  • Updates call sites and reduces duplication when two real callers exist.

Quick Start

Identify two real callers, name the shared concept, create a module, move the shared logic there, and update all call sites.

Frequently Asked Questions about extract

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I refactor duplicate logic into a shared module?

You should refactor duplicate logic into a shared module only when a second real caller exists today. This enforces the second-caller rule to prevent premature abstractions and speculative DRY, reducing maintenance costs and bug surfaces.

How do I extract a shared concept from duplicate code across components?

To extract a shared concept, identify two real callers of similar logic, name the concept in domain terms, create an appropriate home module, move the shared logic there, and update all call sites to preserve behavior.

What is the second-caller rule in code refactoring?

The second-caller rule in code refactoring requires a second real caller of similar logic to exist today before extracting a shared module. This prevents speculative DRY and ensures you only consolidate genuine duplication across endpoints or modules.

Does extracting duplicate logic require a specific domain concept name?

Yes, extracting duplicate logic requires naming the shared concept in domain terms and selecting a proper home module that matches that concept. This ensures the consolidated logic stays maintainable and discoverable across the codebase.

Why does premature abstraction increase maintenance costs?

Premature abstraction increases maintenance costs by consolidating logic before a second real caller exists. Extracting a shared module speculatively creates rigid couplings across endpoints or components, expanding bug surfaces rather than reducing genuine duplicate code.