predictability

Standardize return types and eliminate hidden side effects in fetch functions.

2|1|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/ByeongminLee/nextjs-claude-code --skill predictability
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: predictability
Source: https://github.com/ByeongminLee/nextjs-claude-code/tree/main/template/.claude/skills/predictability
Command: npx skills add https://github.com/ByeongminLee/nextjs-claude-code --skill predictability

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers ensure code behavior is predictable by eliminating hidden side effects in data-fetching functions, standardizing return types across similar functions, and aligning function names with their actual behavior.

Core Features & Use Cases

  • Identify hidden side effects in getX()/fetchX() functions and promote explicitness.
  • Unify return types across related functions using discriminated unions or structured types.
  • Improve API readability by ensuring function names reflect behavior and return shape.

Quick Start

Refactor a sample fetchBalance function to remove side effects and standardize its return type.

Frequently Asked Questions about predictability

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

FAQPage Schema
How do I eliminate hidden side effects in TypeScript data-fetching functions?

To eliminate hidden side effects in TypeScript fetching functions, you must refactor them to enforce explicit side effects placement, ensuring operations like reads occur predictably and transparently.

Why do my similar TypeScript API functions return different shapes, and how do I fix it?

Similar TypeScript API functions returning different shapes causes unpredictable interfaces; you fix this by standardizing return types to a discriminated union or structured type.

What is the best way to align TypeScript function names with their actual behavior?

The best way to align TypeScript function names with behavior is refactoring them to reflect their explicit side effects and standardized return shapes, improving API readability and predictability.

Can I refactor utility get functions to improve code predictability?

Yes, you can refactor utility get functions to improve code predictability by identifying hidden side effects during reads and promoting explicitness in their implementation.

Does standardizing return types to a union help with TypeScript API design?

Standardizing return types to a union helps TypeScript API design by unifying return shapes across related functions, creating predictable interfaces and reducing unexpected data structures.

When should I not use a discriminated union for return types?

You should not use a discriminated union for return types when the similar functions operate on fundamentally unrelated data domains, as forcing a union reduces API readability.