js-ts-clean-code

Refactor JavaScript or TypeScript code to improve readability and type safety.

Updated Mar 21, 2026
One-click install
npx skills add https://github.com/babyhzz/mini-viewer --skill js-ts-clean-code
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: js-ts-clean-code
Source: https://github.com/babyhzz/mini-viewer/tree/main/.codex/skills/js-ts-clean-code
Command: npx skills add https://github.com/babyhzz/mini-viewer --skill js-ts-clean-code

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers refactor their JavaScript or TypeScript code to enhance readability, maintainability, and type safety.

Core Features & Use Cases

  • Readability Enhancement: Replace nested ternaries and long if chains with named helper functions or typed lookup tables.
  • Maintainability: Keep one source of truth for UI metadata like labels and icons.
  • Type Safety: Use TypeScript features to make repeated id-based logic explicit and type-safe.
  • Use Case: If you have a complex JavaScript or TypeScript application with multiple components and you want to improve its maintainability and readability.

Quick Start

Refactor your code for improved readability using the js-ts-clean-code skill.

Frequently Asked Questions about js-ts-clean-code

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

FAQPage Schema
How do I refactor nested ternaries in TypeScript for better readability?

To refactor nested ternaries for readability, replace them with named helper functions or typed lookup tables. This approach simplifies complex conditional logic in TypeScript and makes the codebase significantly easier to maintain.

What is the best way to manage UI metadata like labels and icons in JavaScript?

The best way to manage UI metadata is to maintain a single source of truth for labels and icons. Refactoring your JavaScript code to consolidate this metadata prevents repetitive patterns and improves overall application maintainability.

How can I make repeated id-based logic type-safe in TypeScript?

You can make repeated id-based logic type-safe in TypeScript by utilizing TypeScript's advanced type features. Refactoring this logic ensures explicit type checking, reducing runtime errors and enhancing type safety across your application.

Can I use this refactoring approach for complex JavaScript applications with repetitive patterns?

Yes, this refactoring approach is specifically applicable to complex JavaScript or TypeScript applications with repetitive patterns. It targets complex logic to enhance code readability, maintainability, and type safety without altering external behavior.

How do I replace long if chains in JavaScript to improve maintainability?

To replace long if chains and improve maintainability, extract conditions into named helper functions or typed lookup tables. This refactoring technique clarifies the execution path and reduces nested logic in your JavaScript code.