/major-ai-skills:type-alias-compressionfrom major-ai-skills
Extract repeated complex type expressions into named aliases that keep signatures readable.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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:
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.
┌─────────────────────────────────────────────────────────────┐
│ Type Signature Token Density │
│ │
│ Repetitive Nested Generics (15 Methods / 420 Tokens): │
│ export async function getUser(id: string): │
│ Promise<AxiosResponse<ApiResponse<PaginatedResult<User>>>>{...}│
│ export async function getOrg(id: string): │
│ Promise<AxiosResponse<ApiResponse<PaginatedResult<Org>>>>{...} │
│ ↳ 420 tokens billed purely repeating identical generic wraps│
│ │
│ Compressed Type Alias (1 Definition / 65 Tokens): │
│ type ApiPage<T> = Promise<AxiosResponse<ApiResponse<PaginatedResult<T>>>>;│
│ export async function getUser(id: string): ApiPage<User> {...}│
│ export async function getOrg(id: string): ApiPage<Org> {...} │
│ ↳ 65 clean tokens (84.5% Reduction!), single point of change│
└─────────────────────────────────────────────────────────────┘
// 1. Define High-Frequency Aliases at Top of File
export type AsyncResult<T> = Promise<{ data: T; error: null } | { data: null; error: string }>;
export type Handler<TReq, TRes> = (req: Request<TReq>, res: Response<TRes>) => Promise<void>;
export type ID = string | number;
// 2. Ultra-Clean Method Signatures
export async function fetchUser(id: ID): AsyncResult<User> { ... }
export async function updateProfile(id: ID, payload: UserDto): AsyncResult<User> { ... }
from typing import Callable, Coroutine, Any
# Python 3.12 native type statement
type JsonResult[T] = Coroutine[Any, Any, dict[str, T]]
type MiddlewareFn = Callable[[Request, Callable], Response]
async def get_user_profile(user_id: str) -> JsonResult[UserProfile]:
...
use std::result::Result as StdResult;
// Aliasing heavy error types across the crate
pub type Result<T> = StdResult<T, AppEngineError>;
pub type UserMap = std::collections::HashMap<String, UserProfile>;
pub fn get_user(id: &str) -> Result<UserProfile> { ... }
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) |
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.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing./add-your-own-human-voiceRevise AI-assisted writing to preserve the author's voice, concrete experience, and intended tone./adobe-after-effectsScaffold After Effects comps and expression rigs, queue Render Queue / AME jobs, and export Essential Graphics (.mogrt) with ExtendScript-safe patterns.Other plugins' skills for the same job