Skip to content
Back to skills

Typescript Code Refactoring For Brevity And Genericity

ASecurity

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

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationtypescriptgoreactrefactoring

Security analysis

A100/100

Scanned November 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Typescript Code Refactoring For Brevity And Genericity?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Typescript Code Refactoring For Brevity And Genericity
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-typescript-code-refactoring-for-brevity-and-generi/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-typescript-code-refactoring-for-brevity-and-generi)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "f5c063bc-8d87-47b0-9486-776941f613fb"
name: "TypeScript Code Refactoring for Brevity and Genericity"
description: "Refactors TypeScript code to reduce duplication, use generics, and minimize boilerplate while maintaining type safety."
version: "0.1.0"
tags:
  - "typescript"
  - "refactoring"
  - "generics"
  - "code-optimization"
  - "react"
triggers:
  - "make more generic"
  - "use less code"
  - "refactor typescript code"
  - "reduce code duplication"
  - "optimize type definitions"
---

# 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.