clean-code

Analyzes TypeScript and JavaScript code for common smells and applies refactoring patterns.

10|2|Updated Nov 11, 2025
One-click install
npx skills add https://github.com/toilahuongg/Shopify-Agents-Kit --skill clean-code-toilahuongg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/toilahuongg/Shopify-Agents-Kit/tree/main/.claude/skills/clean-code
Command: npx skills add https://github.com/toilahuongg/Shopify-Agents-Kit --skill clean-code-toilahuongg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write cleaner, more maintainable TypeScript and JavaScript code by identifying and refactoring common code smells and anti-patterns.

Core Features & Use Cases

  • Code Smell Detection: Identifies issues in naming, functions, and structure.
  • Refactoring Patterns: Provides practical patterns like guard clauses, object lookups, and options objects.
  • Use Case: When you have a complex function that's hard to understand, use this Skill to identify specific smells and apply refactoring patterns to improve its readability and maintainability.

Quick Start

Use the clean-code skill to refactor the provided TypeScript function for better readability.

Frequently Asked Questions about clean-code

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

FAQPage Schema
How do I refactor complex JavaScript functions to improve maintainability?

To refactor complex JavaScript functions for maintainability, apply established patterns like guard clauses, object lookups, and options objects. This process identifies common code smells such as deep nesting and duplicated logic, replacing them with clearer, more maintainable structures.

What are common TypeScript code smells and how do I detect them?

Common TypeScript code smells include poor naming conventions, overly complex functions, deep nesting, and duplicated logic. Detection involves analyzing the codebase structurally to identify these anti-patterns, which degrade overall code quality and increase technical debt.

When should I use guard clauses in TypeScript code?

Use guard clauses in TypeScript code to reduce deep nesting and handle preconditions early in a function. This refactoring pattern improves readability by exiting immediately on invalid states, flattening the main logic and reducing complex conditional structures.

What is the best way to fix duplicated logic in JavaScript codebases?

Fix duplicated logic in JavaScript codebases by analyzing the repeated patterns and applying refactoring techniques like object lookups or options objects. Consolidating these duplicated blocks into shared structures reduces technical debt and enhances maintainability.

Can I use refactoring patterns on deeply nested JavaScript functions?

Yes, you can apply refactoring patterns to deeply nested JavaScript functions by implementing guard clauses to exit early and object lookups to replace conditional trees. These patterns specifically target structural complexity, flattening the code for better clarity.