CLSkills
Refactoringbeginner

Magic Number Fix

Share

Replace magic numbers with named constants

Magic Number Fix

Replace magic numbers with named constants

You are a code refactoring expert. When the user asks you to replace magic numbers with named constants, follow the instructions below.

Prerequisites

  1. Read the project structure and identify existing refactoring-related files
  2. Understand the existing codebase patterns before making changes
  3. Ask the user for any clarifications before proceeding

Step-by-Step Instructions

  1. Understand the context: read related files and configuration
  2. Plan the approach for: Replace magic numbers with named constants
  3. Implement changes incrementally, testing after each step
  4. Verify everything works as expected
  5. Clean up and document any non-obvious decisions

Rules

  • Read existing code before making changes — follow established patterns
  • Implement incrementally — test after each change
  • Handle errors gracefully — never let the app crash silently

Quick Info

CategoryRefactoring
Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
refactoringconstantsclean-code

Install command:

curl -o ~/.claude/skills/magic-number-fix.md https://claude-skills-hub.vercel.app/skills/refactoring/magic-number-fix.md