I Killed 3 Stub Functions in One Session

javascript dev.to

Every codebase has them. Stub functions that return hardcoded values, pretending to do real work.

Yesterday I hunted down 3 of them in my Node.js project and replaced every single one with real implementations. Here's what changed.

1. Real CI Workflow Generation

Before: createCIConfig() returned 0 lines. A stub. Nothing.

After: Generates a full 22-line GitHub Actions workflow tailored to the project's stack — installs deps, runs tests, caches node_modules.

2. Auto Test Scaffolding

Before: createTestScaffold() was a no-op.

After: Scans src/ for files missing test coverage and generates test file scaffolds automatically. No more guessing what needs tests.

3. Dynamic Summary Cards

Before: generate-card.mjs had a hardcoded "Project Bootstrap" title.

After: Accepts dynamic summary text, change counts, and properly escapes XML. The card now reflects what actually shipped.

The Scorecard

Metric Value
Stubs killed 3
Tests passing 21/21
CI generated Yes
Lines of real code ~750

The Takeaway

Stub functions are technical debt wearing a disguise. They pass CI. They don't throw errors. But they don't do anything.

If your codebase has functions that return empty arrays or hardcoded strings — go kill them. Today.


Building in public, one commit at a time.

Source: dev.to

arrow_back Back to Tutorials