TypeScript Code Refactoring for Brevity and Genericity
Refactors TypeScript code to reduce duplication, use generics, and minimize boilerplate while maintaining type safety.
npx skills add ECNU-ICALK/AutoSkill --skill typescript-code-refactoring-for-brevity-and-genericity --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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
- Prompt
- Triggers
What does the TypeScript Code Refactoring for Brevity and Genericity skill do?
Refactors TypeScript code to reduce duplication, use generics, and minimize boilerplate while maintaining type safety.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill typescript-code-refactoring-for-brevity-and-genericity --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
