extract

extract is a command for Claude Code from obiwancenobi/klamben. It costs 30 tokens per session (530 once invoked), scanned A, original, Apache-2.0.

A command for finding repeated interface pieces in existing screens and moving them into shared components, theme settings, and design tokens. Design tokens are named values for things like colors, spacing, and text styles.

In plain words
What is it for?
Use it after several screens have been built to extract repeated colors, spacing, text styles, widgets, padding patterns, loading states, error handling, and form layouts.
Why use it?
It reduces duplicated code and makes repeated visual patterns easier to change consistently.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/obiwancenobi/klamben/extract
Clone the repo
git clone --depth 1 https://github.com/obiwancenobi/klamben

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for extract

README.md
[![agentmods](https://agentmods.dev/badge/commands/obiwancenobi/klamben/extract.svg)](https://agentmods.dev/commands/obiwancenobi/klamben/extract)
Your own site
<a href="https://agentmods.dev/commands/obiwancenobi/klamben/extract"><img src="https://agentmods.dev/badge/commands/obiwancenobi/klamben/extract.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 530 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00530
Opus 5 $0.00015 $0.00265
Sonnet 5 $0.00006 $0.00106
Haiku 4.5 $0.00003 $0.00053

Measured 5d ago against content hash dc703df1a561, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

extract scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/commands/extract.md · 53 lines

What it actually says

/extract

Mine existing screens for reusable design system pieces. The opposite of building top-down — this works bottom-up from what already exists.

When to use

  • After building 3+ screens and seeing repeated patterns
  • Before a design system formalization effort
  • User says "we keep building the same thing" / "extract a component"

Process

  1. Check design context: If .klamben.md exists in the project root, read it first. Apply the project's brand, platform targets, accessibility tier, and existing patterns to your work below.
  2. Scan for repetition — Walk the target path looking for:
    • Repeated color literals → extract to ColorScheme extensions
    • Repeated spacing values → extract to Spacing theme extension
    • Repeated TextStyle patterns → map to textTheme roles
    • Repeated widget subtrees (3+ occurrences) → extract to shared widgets
    • Repeated padding/margin patterns → extract to spacing tokens
  3. Group findings by type:
    • Tokens (colors, spacing, typography, durations)
    • Components (buttons, cards, list items, headers)
    • Patterns (loading states, error handling, form layouts)
  4. Propose extractions to the user:
    Found 3 reusable patterns:
    1. UserAvatar widget (used in 4 screens) → lib/widgets/user_avatar.dart
    2. Spacing tokens (8, 16, 24 used 47 times) → lib/theme/spacing.dart
    3. SectionHeader widget (used in 3 screens) → lib/widgets/section_header.dart
    
  5. Ask for approval before creating files
  6. Create shared files in lib/widgets/ or lib/theme/
  7. Replace inline usage with the new shared references
  8. Show the diff — before/after for each screen touched

Do NOT

  • Extract one-off patterns (YAGNI)
  • Create a shared widget library without user approval
  • Move files without showing the plan first
  • Break existing functionality
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 53 lines · 30 tokens per session scan A dc703df1a561

Subscribe to this mod's changes

extract is a command published in the GitHub repository obiwancenobi/klamben (2 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 30 tokens to every session and 530 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories