magic-number-eliminator

Replace hardcoded numeric literals in source code with named constants.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/mouayadakel/flixCamFinal --skill magic-number-eliminator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: magic-number-eliminator
Source: https://github.com/mouayadakel/flixCamFinal/tree/main/.cursor/skills/magic-number-eliminator
Command: npx skills add https://github.com/mouayadakel/flixCamFinal --skill magic-number-eliminator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the issue of hardcoded numeric values in code, which can make it difficult to understand, maintain, and update.

Core Features & Use Cases

  • Identify: Detects and flags literal numbers used for configuration, limits, or calculations.
  • Extract & Name: Replaces these numbers with descriptive, named constants.
  • Organize: Groups related constants for better readability and reusability.
  • Use Case: Refactor code that uses 3000 for a timeout value into a constant like DEFAULT_TIMEOUT_MS.

Quick Start

Use the magic number eliminator skill to replace all hardcoded numbers with named constants.

Frequently Asked Questions about magic-number-eliminator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace hardcoded numeric literals with named constants in source code?

To replace hardcoded numeric literals with named constants, you need to identify repeated or significant numeric values in your source code and extract them into centralized constant definitions. This process refactors values like a timeout of 3000 into a descriptive constant such as DEFAULT_TIMEOUT_MS.

What are magic numbers in code and why should they be eliminated?

Magic numbers are hardcoded numeric values used directly in source code for configuration, limits, or calculations. Eliminating magic numbers by extracting them into named constants improves code readability, maintainability, and makes future updates significantly easier.

Can I use this refactoring approach for JavaScript, Python, and Java source files?

Yes, replacing hardcoded numeric literals with named constants applies to any programming language where magic numbers are prevalent, including JavaScript, Python, and Java. It detects literal numbers and organizes related constants for better reusability across these environments.

What is the best way to organize extracted constants after removing magic numbers?

The best way to organize extracted constants is by grouping related constant definitions together into a centralized location. This ensures better readability and reusability, allowing developers to easily manage configuration values and calculation limits across the codebase.

Do I need any external dependencies to detect and extract literal numbers from my codebase?

No external dependencies are required to detect and extract literal numbers from your codebase. The process works directly on your source code to flag configuration values and replace them with descriptive, named constants without needing additional components.