agentsclimarketplace

Code refactor

Skill bakerstreetco/skills/code-refactor

Reusable agent skills for real repository work: review, implementation, release, documentation, and project hygiene.

Install
npx -y skills add bakerstreetco/skills --skill code-refactor

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Refactor recently edited code into cleaner, better-scoped files, components, helpers, or asset folders. Use when asked to clean up a working implementation, move code out of test or work-in-progress files, reduce git conflicts, recontextualize comments, or simplify nested component props such as keeping pass-through defaults inside rest props.

SKILL.md

3.7 KB, as published. Nobody here has run it

Code Refactor

Use this skill to turn working code into maintainable code. Treat the current edits as evidence: inspect what changed, infer what purpose the code now serves, and move it to the smallest durable home that fits the codebase.

Workflow

  1. Inspect the changed files and nearby existing patterns before editing. Use git diff, rg, adjacent files, route/component structure, tests, and asset folders to understand where similar code already lives.
  2. Identify whether the edited code still belongs in its enclosing file. Split it out when it now has a clearer purpose than the parent file, is reused or likely to be reused, creates merge-conflict pressure, or is only present because it began as a test, spike, prototype, or work-in-progress build.
  3. Prefer existing homes over new ones. Move code into established sibling modules, feature folders, shared utilities, route-level components, test helpers, fixture folders, prompt folders, static-data folders, or asset-type folders when those already exist and match the ownership boundary.
  4. Create a new file only when no existing file is a good fit and the extracted unit has a stable name, purpose, and import path.
  5. Keep the public surface small. Export only what callers need, avoid broad index files unless the repo uses them, and preserve existing import style.
  6. Re-run the relevant formatter, typecheck, tests, or focused app verification after moving code.

Refactor Checks

  • File purpose: Does each file now have one understandable job?
  • Ownership: Is code under the feature, route, package, or shared area that would own future changes?
  • Conflict reduction: Did large edited blocks move out of crowded files when doing so makes future parallel edits easier?
  • Naming: Do filenames and exported symbols describe the wider purpose, not the temporary context where the code first appeared?
  • Dependency direction: Did extraction avoid importing feature-specific code into generic/shared modules?
  • Tests and fixtures: Did test-only code move into test helpers or fixture/data folders instead of production modules?
  • Assets: Did images, styles, JSON, prompts, templates, or static data move to the repo's existing asset/data conventions when applicable?

Comments

Treat comments as part of the refactor. Update or remove comments that describe old prototype context, old parent-file assumptions, or now-obvious mechanics.

Keep comments only when they explain non-obvious intent, constraints, browser/API quirks, data provenance, or a decision that future maintainers would otherwise rediscover.

Nested Props

When refactoring nested components, do not destructure props just to pass them onward.

Prefer this:

function Parent({ title, ...childProps }: ParentProps) {
  return <Child {...childProps} title={title} />;
}

Avoid this when Parent does not use the defaults directly:

function Parent({ title, variant = "compact", disabled = false }: ParentProps) {
  return <Child title={title} variant={variant} disabled={disabled} />;
}

Keep defaults close to the component that actually consumes them, unless the parent intentionally owns that behavior.

Reporting

In the final response, summarize what moved, why it belongs there now, and what verification ran. Mention any intentionally deferred extraction when the blast radius was not worth it.

Gives 0 of the 12 instructions most refactoring skills give

Counted across 521 of the 525 authors here whose files we hold, read 2026-08-06

  • run tests after each changein 59 of 521, across 56 files
  • write tests before refactoringin 27 of 521, across 24 files
  • preserve external behaviorin 26 of 521, across 22 files
  • remove dead codein 25 of 521, across 24 files
  • make small incremental changesin 20 of 521, across 17 files
  • break the implementation into tiny commitsin 18 of 521, across 5 files
  • ask the user about alternative optionsin 17 of 521, across 4 files
  • create a GitHub issue with the planin 17 of 521, across 4 files
  • explore the repository to verify assertionsin 17 of 521, across 4 files
  • interview the user about the refactorin 16 of 521, across 3 files
  • check the codebase for test coveragein 16 of 521, across 3 files
  • refactor one thing at a timein 16 of 521, across 12 files

Said here and by no other author read

  • inspect changed files and nearby patterns before editing
  • move code to the smallest durable home that fits
  • prefer existing homes over new files
  • keep the public surface small
  • preserve existing import style
  • run formatter, typecheck, tests, or focused verification after moving

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.