Index of every page on this site: llms.txt
All skills
adityaarakeri avatar

/safe-refactor

@468f6a1
Run it yourself

Change internal code structure while preserving observable behavior through small verified steps. Use for renames, extractions, moves, decomposition, and duplication removal when behavior must remain stable. Do not use for bug fixes, public contract changes, dependency or framework migrations, schema migrations, or other work expected to change compatibility or runtime behavior.

Use this Skill: https://skilld.dev/gh/adityaarakeri/senior-agent-skills/safe-refactor

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈99 tokens for metadata: the name and description. ≈407 when used: this file.

Description uses 5.0% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈397 characters, or 5.0%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Safe Refactor

Treat behavior preservation as a claim that requires a baseline and repeated evidence.

Define Observable Behavior

Include public APIs and types, serialized and database representations, errors, logs and events, generated output, filesystem effects, performance budgets, deployment compatibility, and user-visible behavior that callers rely on.

Refactor Loop

  1. Inspect repository instructions, worktree status, callers, tests, and generated-code boundaries. Preserve unrelated work.
  2. Establish a green focused baseline. If coverage is thin, add characterization tests that capture current behavior before changing structure.
  3. Make one mechanical step: rename, extract, move, or deduplicate.
  4. Update direct callers and search for dynamic references in configuration, reflection, templates, serialization, migrations, documentation, and build tooling.
  5. Run the smallest relevant checks after each step and expand to the full affected suite at stable checkpoints.
  6. Keep behavior fixes and compatibility migrations outside the refactor. Pause and reclassify the task when a behavior change becomes necessary.
  7. Use logical working-tree checkpoints. Do not create branches or commits unless the user explicitly requests them.

Completion Evidence

  • Show that focused and relevant suites remain green against the baseline.
  • Confirm snapshots, golden files, generated output, and public contracts did not change unless explicitly approved.
  • Search for obsolete names and paths after moves or renames.
  • Review the final diff for a clear structural improvement and no hidden behavior change.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    No security issues were detected. The skill provides purely instructional guidelines for safe code refactoring and contains no executable scripts, external dependencies, or network operations.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 468f6a1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 3 months ago

README badge

README badge for adityaarakeri/senior-agent-skills/safe-refactor