parser-development

Parse Claude Code CLI NDJSON events into validated Socket.IO socket events.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill parser-development-recca0120
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: parser-development
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/parser-development
Command: npx skills add https://github.com/recca0120/code-quest --skill parser-development-recca0120

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Parser-development helps you reliably interpret Claude Code CLI NDJSON output, validate event payloads, and convert parsed protocol events into stable socket events for the client.

Core Features & Use Cases

  • ProtocolEvent → SocketEvent pipeline: Transform CLI protocol events into SocketEvent messages that the UI can render.
  • Zod-based schema validation: Safely parse and validate discriminated event types (with explicit handling for unknown events).
  • Adapter pattern with server actions: Produce adapter outputs that include events, autoResponses, controlResponses, and serverActions such as auto_respond, read_diff, and forward_to_client.
  • Debuggable, testable workflow: Provides a clear flow for parseLine() and transform() plus a test pattern for adapter behavior.
  • Event naming convention coverage: Supports type:subtype naming (message, stream, control, system, notification, and raw fallback for unknown types) to keep the event contract consistent.

Quick Start

Add a new Zod schema for the event in claude-schemas.ts, register it in KNOWN_EVENT_TYPES/getSchemaForType(), then implement the conversion in claude-adapter.ts and validate with tests in apps/summoner/src/protocol/__tests__/.

Frequently Asked Questions about parser-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse NDJSON stream events from a CLI into typed socket events?

To parse NDJSON stream events into typed socket events, you need a pipeline that performs JSON parsing, discriminated type detection, Zod safe validation, and adapter transformation. This produces validated, Socket.IO-ready socket events with deterministic emission and unknown-type fallback.

What is the best way to validate unknown CLI protocol event types safely?

The best way to validate unknown CLI protocol event types safely is using Zod discriminated union schemas for type detection. This approach applies explicit handling for unknown events with a raw fallback, ensuring stable event contracts across message, stream, control, system, and notification subtypes.

How do I add a new event type to an NDJSON protocol parser?

To add a new event type to an NDJSON protocol parser, add a Zod schema for the event, register it in the known event types registry and schema lookup function, then implement the conversion in the adapter and validate with tests in the protocol test directory.

Does this stream parser support server actions like auto_respond and read_diff?

Yes, this stream parser supports server actions through the adapter pattern. It produces adapter outputs that include events, autoResponses, controlResponses, and serverActions such as auto_respond, read_diff, and forward_to_client across CLI, summoner, and client layers.

Why does my CLI event schema validation fail on unknown event types?

CLI event schema validation fails on unknown event types when they are not registered in the known event types registry or lack a matching Zod schema. Using safe validation with a deterministic unknown-type fallback ensures unregistered events are handled gracefully instead of crashing the parse pipeline.

Can I use the adapter pattern to transform protocol events into UI-renderable messages?

Yes, you can use the adapter pattern to transform protocol events into UI-renderable messages. The adapter converts parsed protocol events into socket event messages, producing events, autoResponses, controlResponses, and serverActions that the client UI can render directly.