/powertools:tidy-firstfrom powertools
Apply Kent Beck's Tidy First? framework to decide when and how to improve code structure before making behavioral changes. Use this skill whenever someone asks about refactoring, code cleanup, when to clean up vs. ship, whether to make a PR for tidying, how to manage structural debt, or how to improve code readability incrementally. Also trigger when someone says things like "should I clean this up first?", "is this worth refactoring?", "the code is messy but I need to ship a feature", "how do I separate tidying from behavior changes", or when they describe code that is hard to read, inconsistent, or tangled. This skill is especially useful for engineers deciding whether structural improvements are worth doing now, later, or never — and how to do them safely in small batches.
Ships in powertools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill walks users through Kent Beck's Tidy First? framework — a practical approach to small, safe, incremental structural improvements ("tidyings") that make code easier to read and change without altering its behavior.
The core insight: the biggest cost of code is reading it, not writing it. Thoughtful tidying is economically justified precisely because developers spend far more time reading code than writing it. But tidying has its own costs — batch size, timing, and separation from behavior changes all matter.
The central question the skill answers: Should I tidy first, tidy after, tidy later, or never tidy this code at all?
These are the atomic moves. Each one is a safe, behavior-preserving structural change. When a user wants to improve code, identify which of these applies.
Guard Classes Replace nested conditions with early returns:
# Before
if condition:
if another_condition:
do_thing()
# After
if not condition: return
if not another_condition: return
do_thing()
Exit early. Preconditions become visible before the reader encounters the details.
Dead Code Delete it. If it's ever needed again, version control has it. Delete in small diffs — easier to revert if wrong.
Normalize Symmetries When two or more patterns accomplish the same thing interchangeably, pick one and apply it consistently. Inconsistency forces readers to wonder if the variation is meaningful.
Reading Order Reorder code in the file to match the order a reader would prefer to encounter it. Put what you need to understand first, put the details after.
Cohesion Order Coupled functions go next to each other. Coupled files go in the same directory. If you know how to eliminate the coupling, do that instead — but if not, at least co-locate.
New Interface, Old Implementation When an existing interface is hard to use, implement the interface you wish you could call. Have the new interface delegate to the old one. Callers can now use the clean interface while the messy internals remain temporarily. This is especially powerful when you can't change the old code.
Explaining Variables When you understand part of a complex expression, extract the subexpression into a named variable. The name expresses the intent. Always separate this commit from any behavior change.
Explaining Constants Replace magic literals with symbolic constants. Use the symbol everywhere the literal was used.
Explicit Parameters When parameters are passed as a map or dict, make them explicit:
# Before
foo(params) # What does this accept?
# After
foo(width, height, color) # Obvious
Explaining Comments Write down only what isn't obvious from the code. Put yourself in the place of the future reader — or yourself 15 minutes ago. Immediately upon finding a defect is a good time to add a comment pointing it out, rather than leaving it buried.
Delete Redundant Comments When a comment says exactly what the code says, remove it.
Move Declaration and Initialization Together Declare and initialize variables just before they're used. Separation forces readers to hold state in their head while scanning.
Chunk Statements The simplest tidying: put a blank line between two parts doing different things. After chunking, you have a clearer path forward: Explaining Variables, Extract Helper, or Explaining Comments.
Extract Helper When a block of code has an obvious purpose and limited interaction with the rest of the function, extract it into a helper. Name the helper after its purpose, not its mechanism.
One Pile Sometimes code has been over-decomposed into tiny pieces that obscure the overall flow. Merge them together so you can see the whole picture, then re-extract with better boundaries. This is the inverse of Extract Helper — and sometimes it has to come first.
This is the non-negotiable rule: tidying goes into its own separate PRs, with as few tidyings per PR as possible. Behavior changes go in separate PRs.
Why: reviewers can verify a tidying is safe (no behavior change) only if it isn't mixed with behavior changes. Mixed PRs are expensive to review and risky to merge.
Tidyings set up other tidyings. You will begin to flow them together to achieve larger structural changes. This is intentional. Be wary of changing too much, too fast — a failed tidying is expensive relative to the cost of a series of successful ones.
Small batches are safer and faster to integrate:
Many orgs have high fixed costs per PR, which pushes engineers toward large batches. Resist this. The integration risk is real.
More than an hour of tidying before making a behavior change means you've probably lost sight of the minimum set of structural changes actually needed. Tidying is a minutes-to-an- hour activity. If it's taking longer, stop and ask: am I doing the minimum to enable my actual change?
When you've started a tidying and it leads to more tidying and you lose track of your original goal, you have three options:
Re-implementation often surfaces insights you missed the first time.
This is the central decision the skill helps users make.
Tidy never when:
Don't tidy code you don't touch. Code you're not changing doesn't need to be beautiful.
Tidy later when:
Add it to the backlog and accept you won't do it today. This is fine.
Tidy after the behavior change when:
Tidy after shipping the behavior change. Keep it in a separate commit or PR.
Tidy first when:
This is the answer the book is named for. Tidy first when the tidying directly enables or clarifies the change you're about to make.
Software creates value in two ways:
Behavior creates value directly. Customers pay for running software.
Structure creates options. Good structure makes it easy to add new behavior. Bad structure makes every change expensive.
The economic tension: a dollar earned today is worth more than a dollar earned tomorrow (time value of money), which favors shipping now over tidying first. But in uncertain situations, options are worth more than things — which favors building structure that keeps future options open.
Tidy First? reconciles these by asking: does this tidying immediately improve comprehension or cheapen my next behavior change? If yes, tidy first — the economic return is immediate. If not, earn your dollar first.
Ask:
If the tidying directly enables the change: tidy first, in a separate commit. If it's unrelated: later or never, depending on whether you'll touch this code again.
Walk through the tidying catalog. Identify which atomic moves apply:
Recommend the smallest possible set of tidyings that would have the most impact, and remind them to keep each tidying in its own commit, separate from behavior changes.
Be practical. Kent Beck's framework is not about perfection — it's about small, safe moves that pay off. Don't encourage tidying binges. Don't moralize about messy code.
The test for any tidying: does it make the next reader's job easier, or does it make my next behavior change cheaper? If neither, skip it.
Based on Kent Beck's Tidy First? A Personal Exercise in Empirical Software Design (2023). The 24 tidying patterns and the First/After/Later/Never decision framework are Beck's. The economics framing (time value of money + optionality) is drawn from the book's later chapters on software design as a discipline.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jordangaston/claude-plugins --plugin powertools79 skills in this plugin
/ai-camera-movementsLibrary of 46 camera movement prompt blocks for AI video generation (Seedance, Kling, Veo, Runway, Higgsfield). Use this skill EVERY time the user needs a camera move for a video prompt, asks "what camera movement should I use", wants a dolly/pan/orbit/zoom/crane/drone/tracking/handheld/whip-pan/FPV/snorricam/tilt-shift/earth-zoom prompt, asks to add camera motion to a shot, wants to compare camera moves for a scene, or says "Run Camera" / "camera move for this shot". Also trigger when building shot lists or video prompts with other skills (ai-filmmaking, seedance-prompt-structure, genhq-seedance-2-prompt-builder) and a camera instruction is needed — this skill supplies the camera block./ai-image-promptsTurn a seed idea into a polished AI image-generation prompt using a 6-part structure: [medium], [subject], [action/pose], [environment], [style/vibe], [technical specs]. Use this skill whenever the user wants a prompt for generating an image with any model — Midjourney, DALL-E, Imagen, Nano Banana, Flux, Stable Diffusion, Freepik, or unnamed — or asks to 'write an image prompt,' 'make a prompt for this idea,' 'improve my image prompt,' or gives a rough visual idea ('a red panda barista,' 'cyberpunk samurai in the rain') and wants it image-ready. Also trigger when the user asks why their image prompts produce weak or inconsistent results. Covers any visual medium: photorealistic, digital painting, 3D render, anime, illustration, pixel art, watercolor, concept art, and more.Other plugins' skills for the same job