/major-ai-skills:compact-enum-mappingsfrom major-ai-skills
Define compact enum representations for structured payloads when both producer and consumer share the same documented mapping.
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.
In automated data extraction, log classification, and batch API workflows, models frequently output structured JSON containing long descriptive string identifiers ("transaction_status": "PAYMENT_AUTHORIZATION_PENDING_FRAUD_REVIEW" or "log_severity": "INFRASTRUCTURE_CRITICAL_FAILURE").
Verbose string constants consume 8 to 15 tokens per record. In a batch processing run of 5,000 items, transmitting repetitive string identifiers burns over 60,000 redundant output tokens.
The Compact Enum Mapping Protocol defines a lightweight integer or 1-character codebook in the prompt header, allowing the model to emit 1-token codes (0, 1, 2) that downstream application code deserializes into rich, strongly-typed domain objects.
┌─────────────────────────────────────────────────────────────┐
│ Enum Token Serialization │
│ │
│ Verbose String Identifiers (145 Tokens for 3 Records): │
│ [ │
│ {"id": 101, "status": "TRANSACTION_SETTLED_SUCCESSFUL"},│
│ {"id": 102, "status": "TRANSACTION_REJECTED_INSUFFICIENT"}│
│ {"id": 103, "status": "TRANSACTION_PENDING_VERIFICATION"}│
│ ] │
│ │
│ Compact Enum Codes (38 Tokens - 73.8% Reduction!): │
│ Map: { 0: SUCCESS, 1: INSUFFICIENT_FUNDS, 2: PENDING } │
│ [ [101, 0], [102, 1], [103, 2] ] │
└─────────────────────────────────────────────────────────────┘
When prompting an LLM to categorize or classify bulk records, inject the codebook at the top:
Classify the sentiment and urgency of the customer messages below.
### 🔑 Codebook Mapping:
- **Category (C)**: `0: Billing`, `1: Tech_Bug`, `2: Feature_Request`, `3: Account_Access`
- **Urgency (U)**: `0: Low`, `1: Medium`, `2: Critical_Outage`
- **Action (A)**: `0: Auto_Reply`, `1: Escalate_L2`, `2: Page_OnCall`
### Input Records:
1. "My server is down and throwing 500 errors on payment routes."
2. "How do I change my credit card on file?"
### Output Format:
Return a compact JSON array of integer tuples: `[[record_id, C, U, A], ...]`
Output JSON only:
[
[1, 1, 2, 2],
[2, 0, 0, 0]
]
from enum import IntEnum
from typing import List
from pydantic import BaseModel
class TicketCategory(IntEnum):
BILLING = 0
TECH_BUG = 1
FEATURE_REQUEST = 2
ACCOUNT_ACCESS = 3
class UrgencyLevel(IntEnum):
LOW = 0
MEDIUM = 1
CRITICAL = 2
class ProcessedTicket(BaseModel):
ticket_id: int
category: TicketCategory
urgency: UrgencyLevel
def parse_compact_llm_payload(raw_tuples: List[List[int]]) -> List[ProcessedTicket]:
"""Deserializes 1-token compact integer arrays into type-safe Pydantic domain models."""
return [
ProcessedTicket(
ticket_id=row[0],
category=TicketCategory(row[1]),
urgency=UrgencyLevel(row[2])
)
for row in raw_tuples
]
export enum LogSeverity {
DEBUG = 0,
INFO = 1,
WARN = 2,
ERROR = 3,
FATAL = 4,
}
type CompactLogEntry = [timestamp: number, severityCode: LogSeverity, message: string];
export function decodeLog(entry: CompactLogEntry) {
const [timestamp, severity, message] = entry;
console.log(`[${LogSeverity[severity]}] ${new Date(timestamp).toISOString()}: ${message}`);
}
Batch classification of 1,000 telemetry log lines:
| Payload Representation | Tokens Generated | API Generation Latency | Cost Savings |
|---|---|---|---|
| Verbose JSON Strings | 42,000 tokens | 34.0 seconds | Baseline |
Short-String Enums ("ERR", "WRN") | 18,500 tokens | 14.5 seconds | 56.0% Reduction |
Compact Integer Tuple ([id, 3]) | 5,200 tokens | 3.8 seconds | 87.6% Cost Reduction |
MANDATORY: For high-volume structured outputs ($>20$ records), agents must map long descriptive strings to integer or 1-character enums. Let client-side deserializers expand codes into human-readable strings.
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.Other plugins' skills for the same job