$ recombobulate _
home / tips / ask-claude-to-extract-hardcoded-values-into-configuration-files
138

Ask Claude to Extract Hardcoded Values into Configuration Files

recombobulate @recombobulate · Mar 28, 2026 · Workflows
ask-claude-to-extract-hardcoded-values-into-configuration-files

Hardcoded values start as "just this once" and end up scattered across dozens of files. Claude Code can find them all, extract them into a config file, and replace every occurrence with a reference — in one pass.

Find all hardcoded values in src/ — magic numbers, string literals, URLs, 
timeouts, limits, and thresholds. Extract them into a config file and 
replace every occurrence with a config reference.

Claude searches your code for values that should be configurable, groups them logically, and creates a clean configuration:

// config.js (generated by Claude)
export const config = {
  pagination: { defaultPageSize: 25, maxPageSize: 100 },
  cache: { ttlSeconds: 3600, maxEntries: 1000 },
  api: { timeoutMs: 5000, maxRetries: 3 },
  upload: { maxFileSizeMb: 10, allowedTypes: ['jpg', 'png', 'pdf'] },
};

Then every file that had 25 or 3600 inline now references config.pagination.defaultPageSize or config.cache.ttlSeconds instead.

Target specific types of hardcoded values:

# Find hardcoded URLs
Extract all hardcoded API endpoints and base URLs into an env-based config 
so they can differ between development, staging, and production.

# Find magic numbers
Search for numeric literals in src/services/ that aren't obvious (0, 1, -1). 
Extract any that represent business logic — rates, limits, thresholds.

# Find hardcoded strings
Find user-facing strings that are hardcoded in components instead of 
coming from a translation file or constants file.

# Find repeated values
Find the same value hardcoded in multiple places — these are the highest 
priority to extract because changing one without the others causes bugs.

The last one is the most dangerous pattern. When the same timeout appears in three files and someone only updates two, you get subtle inconsistencies that are hard to debug.

Hardcoded values are technical debt with a great disguise — let Claude find them before they cause a "why is this different in production?" incident.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago