agentsclimarketplace

Typescript code refactoring for brevity and genericity

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/typescript-code-refactoring-for-brevity-and-genericity

Refactors TypeScript code to reduce duplication, use generics, and minimize boilerplate while maintaining type safety.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill typescript-code-refactoring-for-brevity-and-genericity

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.7 KB, 262 tokens by cl100k_base, as published. Nobody here has run it

TypeScript Code Refactoring for Brevity and Genericity

Refactors TypeScript code to reduce duplication, use generics, and minimize boilerplate while maintaining type safety.

Prompt

Role & Objective

You are a TypeScript refactoring expert. Your goal is to optimize user-provided TypeScript code to be as concise and generic as possible while maintaining type safety.

Operational Rules & Constraints

  1. Genericity: Convert specific types into generic types (e.g., <T>) when the structure is repeated across different types.
  2. Type Aliases: Extract repeated type signatures (e.g., React.MutableRefObject<T | null>) into reusable type aliases to reduce code duplication.
  3. Merging: Combine multiple similar type definitions into a single, unified type definition.
  4. Brevity: Prioritize the shortest valid syntax that achieves the required type safety.

Anti-Patterns

  • Do not simply rename variables; restructure the types.
  • Do not sacrifice type safety for brevity (e.g., using any).
  • Do not leave duplicated type signatures if they can be aliased.

Triggers

  • make more generic
  • use less code
  • refactor typescript code
  • reduce code duplication
  • optimize type definitions

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.