literal-hunter

Audits TypeScript codebases for magic numbers and duplicated string literals, then centralizes them into typed constants.

2|Updated Feb 15, 2026
One-click install
npx skills add https://github.com/SkinnnyJay/simpill-utils --skill literal-hunter-skinnnyjay
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: literal-hunter
Source: https://github.com/SkinnnyJay/simpill-utils/tree/main/.claude/skills/literal-hunter
Command: npx skills add https://github.com/SkinnnyJay/simpill-utils --skill literal-hunter-skinnnyjay

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Hardcoded strings, magic numbers, and duplicated literals scattered across a TypeScript codebase create maintenance risk, stringly-typed control flow, and inconsistent naming. This Skill audits files, folders, or entire repos to find every loose literal and produces a scored report with a phased remediation plan. ## Core Features & Use Cases - Literal Detection and Classification: Finds magic numbers, statuses, events, routes, storage keys, headers, error codes, regexes, and repeated UI copy, clustering duplicates and near-duplicates. - Scored Ratings and Findings Table: Produces 0-100 scores across Literal Hygiene, Type Safety of Literals, DRY Centralization, and Enforcement, plus a severity-ranked findings table with proposed fixes. - Phased Remediation Plan: Generates MAGIC_LITERALS_REPORT.md and MAGIC_LITERALS_TASKS.md with lint guardrails, domain-based centralization, codemod-friendly replacement sequences, and CI lock-in steps. - Use Case: Point it at a frontend module full of raw status strings in reducers and hardcoded API routes, and receive a typed const-map refactor plan with union types derived via as const. ## Quick Start Ask the assistant to run the literal-hunter audit on a specific file, folder, or the entire repo and produce the findings report with centralization recommendations.

Frequently Asked Questions about literal-hunter

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

FAQPage Schema
How do I find magic numbers in a TypeScript codebase?▼

Run the audit in file, folder, or repo mode to scan all numeric literals and classify non-trivial ones as MAGIC_NUMBER findings. Each finding includes severity, location, and a proposed centralized home such as a limits or config constants module.

How to replace string literals with constants in TypeScript?▼

The audit identifies loose strings in switch statements, reducers, routes, and storage keys, then recommends `as const` maps with derived union types. The phased plan sequences centralization first, then codemod-friendly usage replacement.

Should I use enums or const objects in TypeScript?▼

The Skill prefers `const MAP = {...} as const` objects over enums for most TypeScript code, deriving union types via `keyof typeof`. Enums are reserved for interop or runtime reflection scenarios.

What output files does the literal audit generate?▼

Each run writes MAGIC_LITERALS_REPORT.md with scope, ratings, and findings, plus MAGIC_LITERALS_TASKS.md with phased checklists and a dated change log that must be updated on every run.

Are any literals exempt from the audit?▼

Trivial values like 0 and 1 in obvious index contexts, one-off UI copy, and small inline CSS numbers are reported at lower severity rather than flagged as critical. Everything else, including near-duplicates with casing or spacing differences, is captured.