data-formats
Data format specialist covering TOON encoding, JSON/YAML optimization, serialization patterns, and data validation for modern applications. Use when optimizing data for LLM transmission, implementing high-performance serialization, validating data schemas, or converting between data formats.
What this skill does
# Data Format Specialist ## Quick Reference Advanced Data Format Management - Comprehensive data handling covering TOON encoding, JSON/YAML optimization, serialization patterns, and data validation for performance-critical applications. Core Capabilities: - TOON Encoding: 40-60% token reduction vs JSON for LLM communication - JSON/YAML Optimization: Efficient serialization and parsing patterns - Data Validation: Schema validation, type checking, error handling - Format Conversion: Seamless transformation between data formats - Performance: Optimized data structures and caching strategies - Schema Management: Dynamic schema generation and evolution When to Use: - Optimizing data transmission to LLMs within token budgets - High-performance serialization/deserialization - Schema validation and data integrity - Format conversion and data transformation - Large dataset processing and optimization Quick Start: Create a TOONEncoder instance and call encode with a dictionary containing user and age fields to compress the data. The encoded result achieves 40-60% token reduction. Call decode to restore the original data structure. Create a JSONOptimizer instance and call serialize_fast with a large dataset to achieve ultra-fast JSON processing. Create a DataValidator instance and call create_schema with a dictionary defining name as a required string type. Call validate with the data and schema to check validity. --- ## Implementation Guide ### Core Concepts TOON (Token-Optimized Object Notation): - Custom binary-compatible format optimized for LLM token usage - Type markers: # for numbers, ! for booleans, @ for timestamps, ~ for null - 40-60% size reduction vs JSON for typical data structures - Lossless round-trip encoding/decoding Performance Optimization: - Ultra-fast JSON processing with orjson achieving 2-5x faster than standard json - Streaming processing for large datasets using ijson - Intelligent caching with LRU eviction and memory management - Schema compression and validation optimization Data Validation: - Type-safe validation with custom rules and patterns - Schema evolution and migration support - Cross-field validation and dependency checking - Performance-optimized batch validation ### Basic Implementation TOON Encoding for LLM Optimization: Create a TOONEncoder instance. Define data with user object containing id, name, active boolean, and created datetime, plus permissions array. Call encode to compress and decode to restore. Compare sizes to verify reduction. Fast JSON Processing: Create a JSONOptimizer instance. Call serialize_fast to get bytes and deserialize_fast to parse. Use compress_schema with a type object and properties definition to optimize repeated validation. Data Validation: Create a DataValidator instance. Define user_schema with username requiring string type, minimum length 3, email requiring email type, and age as optional integer with minimum value 13. Call validate with user_data and schema, then check result for valid status, sanitized_data, or errors list. ### Common Use Cases API Response Optimization: Create a function to optimize API responses for LLM consumption by encoding data with TOONEncoder. Create a corresponding function to parse optimized responses by decoding TOON data back to dictionary. Configuration Management: Create a YAMLOptimizer instance and call load_fast with a config file path. Call merge_configs with base_config, env_config, and user_config for multi-file merging. Large Dataset Processing: Create a StreamProcessor with chunk_size of 8192. Define a process_item function that handles each item. Call process_json_stream with the file path and callback to process large JSON files without loading into memory. --- ## Advanced Features Overview ### Advanced TOON Features See modules/toon-encoding.md for custom type handlers (UUID, Decimal), streaming TOON processing, batch TOON encoding, and performance characteristics with benchmarks. ### Advanced Validation Patterns See modules/data-validation.md for cross-field validation, schema evolution and migration, custom validation rules, and batch validation optimization. ### Performance Optimization See modules/caching-performance.md for intelligent caching strategies, cache warming and invalidation, memory management, and performance monitoring. ### JSON/YAML Advanced Features See modules/json-optimization.md for streaming JSON processing, memory-efficient parsing, schema compression, and format conversion utilities. --- ## Works Well With - moai-domain-backend - Backend data serialization and API responses - moai-domain-database - Database data format optimization - moai-foundation-core - MCP data serialization and transmission patterns - moai-workflow-docs - Documentation data formatting - moai-foundation-context - Context optimization for token budgets --- ## Module References Core Implementation Modules: - modules/toon-encoding.md - TOON encoding implementation - modules/json-optimization.md - High-performance JSON/YAML - modules/data-validation.md - Advanced validation and schemas - modules/caching-performance.md - Caching strategies Supporting Files: - modules/README.md - Module overview and integration patterns - reference.md - Extended reference documentation - examples.md - Complete working examples --- ## Technology Stack Core Libraries: - orjson: Ultra-fast JSON parsing and serialization - PyYAML: YAML processing with C-based loaders - ijson: Streaming JSON parser for large files - python-dateutil: Advanced datetime parsing - regex: Advanced regular expression support Performance Tools: - lru_cache: Built-in memoization - pickle: Object serialization - hashlib: Hash generation for caching - functools: Function decorators and utilities Validation Libraries: - jsonschema: JSON Schema validation - cerberus: Lightweight data validation - marshmallow: Object serialization/deserialization - pydantic: Data validation using Python type hints --- ## Resources For working code examples, see [examples.md](examples.md). Status: Production Ready Last Updated: 2026-01-11 Maintained by: MoAI-ADK Data Team
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.