alivirgo/major-ai-skills/type-alias-compression
Claude Code and agent skill by alivirgo/major-ai-skills
- community
Checking that the SKILL.md file is still in the repository.
Extract repeated complex type expressions into named aliases that keep signatures readable.
Install
npx vskill@latest install alivirgo/major-ai-skills/type-alias-compressionSKILL.md
Type Alias Compression Protocol (Generic Signature Normalization)
Overview
When writing enterprise applications in TypeScript, Python, or Rust, complex nested generic signatures (e.g., `Promise<AxiosResponse<PaginatedResponse<UserProfileDTO>>>`) are frequently repeated across 10 to 20 method definitions in a single module.
Repeating nested generic signatures causes:
- Severe Token Multiplication: Repeating an 80-character generic signature across 15 functions burns 400+ output tokens on syntax boilerplate.
- Maintenance Drift: Changing the underlying response envelope requires mutating 15 separate function signatures across the file.
- Cognitive Clutter: The actual function argument names are pushed off-screen by long type annotations.
The Type Alias Compression Protocol extracts common nested generic patterns into concise top-level type aliases (`type Res<T> = ...`), normalizing signatures to 1 to 2 clean tokens.
Repetitive Nested Generics vs. Compressed Type Aliases
Multi-Language Type Alias Compression Recipes
1. TypeScript / JavaScript
2. Python 3.12+ (PEP 695 Type Aliases)
3. Rust Type Aliasing
Benchmark Comparison
Generating a standard 12-method REST API controller:
| Implementation Pattern | Total Signature Tokens | Refactoring Friction | AST Complexity | |
|---|---|---|---|---|
| Inline Nested Generic Signatures | 980 tokens | 12 files to change | High ($>18$ nodes/sig) | |
| Compressed Type Alias Protocol | 340 tokens | 1 alias to change | Low (2 nodes/sig) |
Agent Operational Directive
MANDATORY: When a nested generic type signature is used $\ge 2$ times in a file or module, agents must extract it into a top-level type alias (type Result<T> = ...). Never repeat multi-layered generic chains across function signatures.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/type-alias-compression/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alivirgo/major-ai-skills/type-alias-compression)