Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Refactoring Code

ASecurity

Improve code structure without changing behavior. Use when code is hard to read, modify, or test. Covers Extract Method, Rename, and other safe refactorings.

34 stars
0 votes
0 copies
0 views
Added 9/22/2026
toolsbashrefactoring

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add nguyenhuuca/assessment --skill refactoring-code --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactoring Code?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Refactoring Code
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nguyenhuuca-refactoring-code/badge)](https://www.skillsdirectory.com/skills/nguyenhuuca-refactoring-code)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: refactoring-code
description: Improve code structure without changing behavior. Use when code is hard to read, modify, or test. Covers Extract Method, Rename, and other safe refactorings.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
---

# Refactoring Code

## The Refactoring Hat

When refactoring, you change **structure** without changing **behavior**. Always have tests passing before and after.

## Workflows

- [ ] **Tests Green**: Ensure all tests pass before starting
- [ ] **Analyze**: Use Grep to understand dependencies
- [ ] **Small Steps**: Make one small change at a time
- [ ] **Verify Usages**: Use Grep to find all usages before changes
- [ ] **Commit Often**: Commit after each successful refactoring
- [ ] **Tests Green**: Verify tests still pass after each change

## Common Refactorings

### Extract Method
When a code block does one thing, extract it to a named method.

1. Use Grep to verify extraction won't break callers
2. Extract the method
3. Run tests

### Rename for Clarity
Names should reveal intent.

1. Use Grep to find ALL usages
2. Use Edit with replace_all for codebase-wide rename
3. Verify no missed references

### Remove Dead Code
1. Use Grep to verify code is unused
2. If zero references, safe to remove
3. If references exist, trace to understand usage

## Code Smells to Address

- **Long Method**: Extract smaller methods
- **Long Parameter List**: Introduce parameter object
- **Duplicate Code**: Extract to shared function (use Grep to locate duplicates)
- **Feature Envy**: Move method to the class it uses most
- **Data Clumps**: Group related data into objects
- **Primitive Obsession**: Replace primitives with value objects

## Safety Rules

1. Never refactor and add features simultaneously
2. **Always use Grep to find all usages before removing/renaming**
3. Run tests after every change
4. Use targeted Edit operations instead of broad find-replace
5. Commit working states frequently

Attribution

nguyenhuucanguyenhuuca
View sourceMore from nguyenhuuca →
SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Related Skills

ucoz-landing-skill

Playbook for creating and editing uCoz landing pages via MCP tools (`templates_tool`, `ftp_tool`, `modules_tool`). Use for tasks such as: "build a landing page", "update the homepage as a landing page", "create a promo page on the homepage", "add a lead form / menu / SEO to the homepage". Homepage: `page_list`, `page_get`; first publish — `page_update` with full `page_tmpl`; HTML edits after generation — `patch_template` (module_id=2, template_id=1), not `update_template`. Activate the mail f...

107 votes

Paperclip

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

805541 votes

Instantly Rdsthomas Mission Control

Instantly.ai cold email outreach API - manage campaigns, leads, accounts, and analytics. Use for cold email automation, lead management, campaign creation/monitoring, and email account warmup.

761 votes

Daw Music

Digital Audio Workstation usage, music composition, interactive music systems, and game audio implementation for immersive soundscapes.

761 votes

Caveman Compress

Compress natural language memory files (CLAUDE.md, todos, preferences) into caveman format to save input tokens. Preserves all technical substance, code, URLs, and structure. Compressed version overwrites the original file. Human-readable backup saved as FILE.original.md. Trigger: /caveman-compress FILEPATH or "compress memory file"

1066600 votes
View all in tools →