Agent skill

Codewhale Predecessor Finder

by codewhale-hq in codewhale-hq/Codewhale

Searches a codebase for the existing module that already owns a behavior before any new code is written, so a feature request edits that owner instead of shipping a second implementation.

MITAuto-check passedDevelopment

Install Codewhale Predecessor Finder

skills CLI
$ npx skills add codewhale-hq/Codewhale --skill cw-slice -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install codewhale-hq/Codewhale cw-slice --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/codewhale-hq/Codewhale.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/skills/cw-slice .claude/skills/cw-slice && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cw-slice
GitHub stars
41k
Token cost
~1.6k tokens
SKILL.md length
807 words
Files
1
Skills in repo
63
Repo updated
First seen
Licence
MIT

At a glance

Searches a codebase for the existing module that already owns a behavior before any new code is written, so a feature request edits that owner instead of shipping a second implementation.

  • Works in 7 steps: Walk the ladder before opening an editor… → Grep for the predecessor. This is the… → Check the contracts you are about to… → …
  • Starting a new feature, upgrade or refactor in the Codewhale codebase
  • SKILL.md covers When to use, Workflow, Red flags / don't and Output
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

This skill names the repository's most expensive mistake as not a bad implementation but a second one: a new model_*, *_config, provider_* or bridge module built beside one that already does the job, leaving two systems and a comment that is no longer true. It is stage 2 of a six-stage loop, used before writing code for any feature, upgrade or refactor, before creating a new module, trait, config struct or command, and whenever a plan or issue says to build something that has not yet been confirmed absent from the codebase.

The step most often skipped, and the one that costs the most when it is, is grepping for the predecessor using the concept in the words the code would actually use, not just filenames, together with a pattern search across common naming conventions like model_, _config and provider_. If an owner is found, it gets edited directly; if a new layer is still justified, its module documentation must name the predecessor it replaces.

Before any of that, the skill applies the ponytail reuse ladder from the project's own AGENTS.md, run after reading the code and tracing real call sites, never as a substitute for reading them. It also names specific guard-tested contracts to move carefully, such as the single turn loop guarded by a dedicated test file, and lists the agent tool as the one surface for subagents, noting that older names like agent_open and delegate_to_agent have been removed.

When your agent uses it

  • Starting a new feature, upgrade or refactor in the Codewhale codebase
  • Deciding whether to create a new module, trait, config struct or command
  • Checking whether behavior a plan asks for already exists somewhere in the crates
  • Avoiding a second implementation of something the codebase already does

Example prompts

  • “Before I add a new provider_ module, check whether one already handles this.”
  • “Grep the codebase for anything that already resembles this bridge concept.”
  • “This issue asks to build X. Confirm it doesn't already exist before I start.”
  • “I need to touch the turn loop. Which guard test protects it?”

Requirements

  • A Codewhale checkout with the crates directory and its AGENTS.md files

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Walk the ladder before opening an editor (AGENTS.md, "The ponytail
  2. Grep for the predecessor. This is the step that gets skipped and the one
  3. Check the contracts you are about to walk into. One of these is
  4. Read the scoped guidance for the files you will touch. crates/tui/AGENTS.md
  5. Bound the slice. One coherent change, reviewable in one sitting, that
  6. Fix the evidence bar now, not after. Decide before writing code what will
  7. Write the implementation, then prove it runs. No new tests or code

What it can do on your machine

Read from SKILL.md and the folder at commit 8d2fb45. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Codewhale Predecessor Finder loads about 1.6k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 807 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from codewhale-hq/Codewhale at commit 8d2fb45, republished under its MIT licence (© codewhale-hq). 807 words, ~1,550 tokens.

Download SKILL.mdSave it as .claude/skills/cw-slice/SKILL.md (or your agent's skills folder).
name
cw-slice
description
Use before writing code for any Codewhale feature, upgrade, or refactor: find the existing owner of the behavior, bound the change to one reviewable slice, and fix the evidence bar before you start.

cw-slice

The expensive mistake in this repo is not a bad implementation — it is a second implementation. A new model_*, *_config, provider_*, or "bridge" module beside the one that already does the job ships two systems and a comment that is no longer true. This skill is the ponytail ladder's rung 2 with commands attached: find the thing that already exists, then edit it.

Stage 2 of the loop: cw-orient → slice → cw-gates → cw-dogfood → cw-land → cw-handoff.

When to use

  • Any feature, upgrade, refactor, or "make X work like Y" request.
  • Before creating a new module, trait, config struct, or command.
  • When a plan or issue tells you to build something and you have not yet confirmed it does not already exist.

Workflow

  1. Walk the ladder before opening an editor (AGENTS.md, "The ponytail method" — not restated here, since a second copy is what rung 2 forbids). Stop at the first rung that answers. The ladder runs after reading the code, never instead of it: a short diff written without reading the call sites is a guess, not a small change. State the rung only when the choice isn't obvious from the diff itself.

  2. Grep for the predecessor. This is the step that gets skipped and the one that costs the most:

    bash
    grep -rn "<the concept, in the words the code would use>" crates --include='*.rs' | head -40
    ls crates
    grep -rln 'model_\|_config\|provider_' crates/*/src --include='*.rs' | head -30

    Search behavior and symbols, not just filenames. If you find an owner, edit it. If you are still adding a new layer, its commit message must name the predecessor it replaces — otherwise you are editing the wrong file.

  3. Check the contracts you are about to walk into. One of these is guard-tested, the rest are convention — either way, move them with their code, not around it:

    • One turn loop: crates/tui/src/core/engine/turn_loop.rs, guarded by crates/core/tests/single_turn_loop.rs. A second loop fails the guard; changing the shape means changing the guard with it.
    • One base prompt: BASE_PROMPT in crates/tui/src/prompts/text.rs.
    • The subagent tool is agent; agent_open / agent_eval / agent_close / delegate_to_agent are removed surfaces. If the shape must move, move the code and add the guard test that judges the new shape — the convention is not a fence around the area.
    • The system prompt + tool catalog are a session-pinned KV-cache prefix (docs/CACHE.md). Any new session-context contributor must state its cache effect — frozen prefix vs. append-only history. Never splice a volatile fact into the prefix.
    • crates/tui/src/core/ is a module inside the TUI crate. crates/core is a different crate that runs no turns. Do not confuse them.
    • Repeatedly misidentified as dead, verify consumers before removing: runtime/src/context_budget.rs, tui/src/model_registry.rs, runtime/src/prompt_zones.rs, tui/src/tools/remember.rs, config/src/route/.
  4. Read the scoped guidance for the files you will touch. crates/tui/AGENTS.md owns the UI contracts (one owner per fact, codewhale_palette::grammar semantics, typed state enums, toast routing, tr(locale, MessageId::...) for user prose). crates/localization/locales/AGENTS.md owns string changes. web/AGENTS.md owns the site. docs/MOTION_CONTRACT.md owns motion. Design law lives in docs/design/, not in a prototype file someone left in a sibling directory.

  5. Bound the slice. One coherent change, reviewable in one sitting, that leaves the tree building and green. AGENTS.md's two corollaries keep slices honest: an abstraction must delete caller code, and a migration ships its last consumer or does not start.

  6. Fix the evidence bar now, not after. Decide before writing code what will prove this works, and write it into your plan:

    • the focused test or existing check that covers the behavior (scripts/dev-test.sh --list maps an area to its fastest invocation);
    • whether the change is visible enough to need cw-dogfood;
    • whether it is cross-cutting enough to need the full sweep in cw-gates.
  7. Write the implementation, then prove it runs. No new tests or code comments unless explicitly asked (AGENTS.md); update or delete existing tests the change makes wrong.

Show full SKILL.md (205 more words)Show less

Red flags / don't

  • Don't add a module that "bridges", "mirrors", "stages", or "wraps" something that already exists without naming that thing in the commit message.
  • Don't fork a singleton (turn loop, base prompt, delegation axis, lifecycle system) without moving its guard test and consumers with it. The repo has one of each on purpose; a silent second one is the failure mode, not the refactor.
  • Don't write new tests unless explicitly asked, and never first. Don't add new code comments.
  • Don't contort production code to keep a brittle assertion green. A test that only encodes old behavior is evidence, not a veto: change it with the code.
  • Don't cut trust-boundary validation, data-loss handling, security, or accessibility to make a diff shorter. Brevity is never a reason to drop a guard.
  • Don't leave a #[allow(dead_code)] behind as the cost of an incomplete migration — scripts/check-dead-code-budget.py is the running receipt.

Output

Default shape before the first edit — compress when trivial (a one-line change gets a one-line note, not four bullets):

  • which rung of the ladder you stopped at and why;
  • the existing owner you found (path/to/file.rs:line), or the predecessor your new module names;
  • the bounded slice, in one sentence;
  • the evidence bar you will meet, chosen in advance.

© codewhale-hq, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/skills/cw-slice of codewhale-hq/Codewhale.

Open the folder on GitHubat commit 8d2fb45

Compare with similar skills

Codewhale Predecessor Finder next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Codewhale Predecessor Finder compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Codewhale Predecessor Finder this skillcodewhale-hq/Codewhale41k—~1.6kAutomated safety check: PassMIT
PonytailDavidObando/gsharp5648 repos~1.7kAutomated safety check: PassMIT
Ponytail Lazy Developer ModeDietrichGebert/ponytail159k—~873Automated safety check: PassMIT
Code Simplification for ego-litecitrolabs/ego-lite17k—~1.2kAutomated safety check: PassMIT
Refactor Pass for Simplicitystar-history/star-history9.6k1 repos~168Automated safety check: PassMIT
RTK Rust Code Simplifierrtk-ai/rtk83k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Ponytail

    DavidObando/gsharp

    Forces the laziest solution that actually works, simplest, shortest, most minimal.

    564 GitHub starsUsed in 8 repos~1.7k tokens
    DevelopmentAuto-check passed
  • Ponytail Lazy Developer Mode

    DietrichGebert/ponytail

    Makes the agent pick the laziest solution that works: skip unneeded work, reuse what exists, prefer the standard library and platform features, and keep diffs small.

    159k GitHub stars~873 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Finds and implements evidence-backed simplifications in the ego-lite repository, such as dead code, duplicated state and speculative abstractions, without hiding behavior changes.

    17k GitHub stars~1.2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Refactor Pass for Simplicity

    star-history/star-history

    Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, or dead-code removal…

    9.6k GitHub starsUsed in 1 repo~168 tokens
    DevelopmentAuto-check passed
  • Reviews RTK's Rust code for over-engineering and verbose patterns, applying idioms like iterator chains and early returns while protecting a specific list of constraints from being simplified away.

    83k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Over-Engineering Review

    DietrichGebert/ponytail

    Reviews a diff only for unnecessary complexity and lists what to delete or shrink, one numbered line per finding with the location, the cut and its replacement.

    159k GitHub stars~1.3k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from codewhale-hq/Codewhale

All 63 skills in this repo
  • Codewhale Dogfood Install

    codewhale-hq/Codewhale

    Proves a Codewhale change in the real product: a stamped release build, an atomic local install, fresh-shell verification and manual QA that automated gates cannot cover.

    41k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Codewhale Session Handoff

    codewhale-hq/Codewhale

    Writes a paste-ready handoff for the next agent session, opening with a state-check command block and separating done, suspected and blocked work.

    41k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Codewhale Landing Workflow

    codewhale-hq/Codewhale

    Decides how verified work should reach main, directly, in a worktree or on an integration branch, while keeping contributor credit and respecting merge gates.

    41k GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Sub-Agent Delegation

    codewhale-hq/Codewhale

    Guides when and how to split multi-step coding, research or verification work into focused sub-agent runs while the parent keeps integration and final checks.

    41k GitHub stars~790 tokensUpdated today
    Auto-check passed
  • Codewhale Fleet Manager

    codewhale-hq/Codewhale

    Triages and manages Codewhale fleet runs and workers with typed commands, classifying failures and choosing a safe restart, resume or escalation.

    41k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • GitHub Issue Bulk Assigner

    codewhale-hq/Codewhale

    Moves a list of GitHub issues into a milestone or assigns them to owners with the gh CLI, checking each one before and after the change.

    41k GitHub stars~953 tokensUpdated today
    Auto-check passed

Categories

Questions about Codewhale Predecessor Finder

What does Codewhale Predecessor Finder do?

Searches a codebase for the existing module that already owns a behavior before any new code is written, so a feature request edits that owner instead of shipping a second implementation. This skill names the repository's most expensive mistake as not a bad implementation but a second one: a new model_*, *_config, provider_* or bridge module built beside one that already does the job, leaving two systems and a comment that is no longer true. It is stage 2 of a six-stage loop, used before writing code for any feature, upgrade or refactor, before creating a new module, trait, config struct or command, and whenever a plan or issue says to build something that has not yet been confirmed absent from the codebase.

When should I use Codewhale Predecessor Finder?

Codewhale Predecessor Finder fits situations like: starting a new feature, upgrade or refactor in the Codewhale codebase; deciding whether to create a new module, trait, config struct or command; checking whether behavior a plan asks for already exists somewhere in the crates; avoiding a second implementation of something the codebase already does.

How do I install Codewhale Predecessor Finder in Claude Code?

Run `npx skills add codewhale-hq/Codewhale --skill cw-slice -a claude-code`. Or copy the skill folder (docs/skills/cw-slice in codewhale-hq/Codewhale) into .claude/skills/cw-slice in your project. Claude Code loads it when a task matches its description.

How do I install Codewhale Predecessor Finder in Codex?

Run `npx skills add codewhale-hq/Codewhale --skill cw-slice -a codex`. Or copy the skill folder (docs/skills/cw-slice in codewhale-hq/Codewhale) into .agents/skills/cw-slice in your project. Codex loads it when a task matches its description.

Can I use Codewhale Predecessor Finder in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add codewhale-hq/Codewhale --skill cw-slice -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cw-slice, .gemini/skills/cw-slice, .github/skills/cw-slice and .opencode/skills/cw-slice in your project.

What does Codewhale Predecessor Finder need to run?

SKILL.md names no scripts, command-line tools or credentials: Codewhale Predecessor Finder is instructions for the agent only. Our summary lists: A Codewhale checkout with the crates directory and its AGENTS.md files.

Does Codewhale Predecessor Finder access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Codewhale Predecessor Finder safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Codewhale Predecessor Finder use?

Codewhale Predecessor Finder is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Codewhale Predecessor Finder use?

About 1.6k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Codewhale Predecessor Finder?

Skills that share tags, products or a category with Codewhale Predecessor Finder: Ponytail (DavidObando/gsharp, 564 stars), Ponytail Lazy Developer Mode (DietrichGebert/ponytail, 159k stars), Code Simplification for ego-lite (citrolabs/ego-lite, 17k stars) and Refactor Pass for Simplicity (star-history/star-history, 9.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Codewhale Predecessor Finder?

codewhale-hq (a GitHub organization) maintains it in codewhale-hq/Codewhale, which has 41,078 GitHub stars. The repository holds 63 skills in this directory. The repository was last updated on October 9, 2026.

Source: codewhale-hq/Codewhale on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.