clean-code_skill

This skill helps improve TypeScript/JavaScript code quality by detecting smells, applying refactoring patterns, and producing maintainable code.
  • HTML

6

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill toilahuongg/shopify-agents-kit --skill clean-code

  • SKILL.md4.6 KB

Overview

This skill helps identify code smells and apply practical refactorings for TypeScript and JavaScript codebases. It focuses on improving naming, function design, file structure, and reducing duplication so code becomes easier to read, test, and maintain. Use it to get concrete, safe refactor suggestions and step-by-step changes you can apply to your code.

How this skill works

The skill inspects code for common smells: poor naming, long functions, deep nesting, magic values, duplicated logic, primitive obsession, and incorrect abstractions. For each issue it recommends targeted refactor patterns (guard clauses, extract function, options object, lookup maps, destructuring, array helpers) and shows minimal before/after changes. It also produces a quick checklist and concrete naming suggestions tailored to the detected problems.

When to use it

  • During code reviews to surface clarity and design issues
  • When refactoring messy or legacy modules for maintainability
  • Before adding features to reduce risk of introducing bugs
  • To standardize naming and structure across a codebase
  • When preparing code for testing or handing off to other teams

Best practices

  • Prefer descriptive names over abbreviations and single-letter identifiers
  • Keep functions focused: aim for single responsibility and under ~20 lines
  • Replace deep nesting with guard clauses and early returns
  • Group related parameters into an options object when >3 parameters
  • Extract duplicated logic into small reusable helpers rather than copying
  • Use constants for magic values and prefer polymorphism or lookup maps over long switch chains

Example use cases

  • Convert a 300-line file into cohesive modules and highlight split points
  • Refactor a god function by extracting maintainable helper functions and tests
  • Replace nested if/else chains with guard clauses or an object lookup
  • Rename confusing identifiers across a module and update usages safely
  • Detect and consolidate repeated validation or parsing logic into a shared utility

FAQ

Refactor suggestions prioritize behavior-preserving transformations and highlight places where you must verify semantics or tests. Always run automated tests after applying changes.

Can it suggest typing improvements for TypeScript?

Yes — it recommends replacing primitive-typed domain concepts with value objects or explicit types and points out use of any that should be tightened.

How should I handle over-engineering recommendations?

Prefer minimal, pragmatic abstractions. The skill flags potential over-engineering and suggests simpler alternatives or delayed extensibility until a real need appears.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
clean-code skill by toilahuongg/shopify-agents-kit | VeilStrat