ukulele-companion: Command for Claude Code

.claude/commands/extract-to-shared.md

extract-to-shared is a command for Claude Code from baijum/ukulele-companion. It costs 14 tokens per session (447 once invoked), scanned A, original, MIT.

A test-first recipe for moving Android and iOS logic into a shared Kotlin Multiplatform module, a code module used by both platforms.

In plain words
What is it for?
Finding duplicated mobile logic, adding tests, moving pure Kotlin code into the shared module, handling platform-specific needs with expect/actual, and keeping existing callers working.
Why use it?
It preserves existing behavior during the move and prevents platform-specific code from leaking into shared code.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: mentions CLAUDE.md.

This is baijum/ukulele-companion's own configuration. It tells Claude Code how to work on ukulele-companion itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ukulele-companion configures →

Reuse

Borrowing it

Nothing to install: this file belongs to baijum/ukulele-companion. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/baijum/ukulele-companion/main/.claude/commands/extract-to-shared.md
Clone the repo
git clone --depth 1 https://github.com/baijum/ukulele-companion

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-to-shared

README.md
[![agentmods](https://agentmods.dev/badge/commands/baijum/ukulele-companion/extract-to-shared/github.svg)](https://agentmods.dev/commands/baijum/ukulele-companion/extract-to-shared)
Your own site
<a href="https://agentmods.dev/commands/baijum/ukulele-companion/extract-to-shared"><img src="https://agentmods.dev/badge/commands/baijum/ukulele-companion/extract-to-shared/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for extract-to-shared

Your own site · 80×15
<a href="https://agentmods.dev/commands/baijum/ukulele-companion/extract-to-shared"><img src="https://agentmods.dev/badge/commands/baijum/ukulele-companion/extract-to-shared.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 447 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00014 $0.00447
Opus 5 $0.00007 $0.00224
Sonnet 5 $0.00003 $0.00089
Haiku 4.5 $0.00001 $0.00045

Measured 12d ago against content hash 1d3d8c1d13a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

extract-to-shared 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 12d 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.

.claude/commands/extract-to-shared.md · 33 lines

What it actually says

Extract the following into the :shared KMP module: $ARGUMENTS

This is the project's most common refactor. Follow this order exactly — tests first, so behavior is pinned before the move:

  1. Locate the current logic and every caller (Android app/, and the iOS equivalent in iosApp/ if it was duplicated there).
  2. Pin behavior first. Add or port unit tests into shared/src/commonTest/ that cover the current behavior. Run them green against the existing implementation if it's already reachable, otherwise write them to describe the intended contract.
  3. Move the pure logic into shared/src/commonMain/kotlin/com/baijum/ukufretboard/ (domain/ for business logic, data/ for models/enums). It must be pure Kotlin: no java.*, android.*, androidx.*, or platform.* imports (enforced by scripts/hooks/guard-kmp-purity.py; see shared/src/commonMain/CLAUDE.md).
  4. Platform needs → expect/actual in the platform/ package, with Android impl in androidMain and iOS impl in iosMain.
  5. Keep callers working. Replace the original Android definition with a thin shim / typealias if it's still referenced, then migrate callers.
  6. Wire up iOS to consume the shared type (KMP Swift naming drops the Shared prefix, e.g. PitchDetector.shared).
  7. Verify: run scripts/preflight.sh. Build iOS separately (xcodebuild ... build) since preflight doesn't cover it.

Keep the change small and reviewable — one logical extraction per PR, matching the existing Refactor: extract … into shared KMP module commit style.

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. 12d ago First seen · 33 lines · 14 tokens per session scan A 1d3d8c1d13a9

Subscribe to this mod's changes

extract-to-shared is a command published in the GitHub repository baijum/ukulele-companion (14 stars, last pushed yesterday), licensed MIT. It adds 14 tokens to every session and 447 once invoked, about $0.0001 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-30.