Skip to content
reaatech

@reaatech/agents-markdown

npm v1.0.1

Core domain types (`AgentsMdDocument`, `SkillMdDocument`, `Finding`, `LintResult`, `ValidationResult`), Zod validation schemas, and shared utilities for the `@reaatech/agents-markdown-*` ecosystem. Exports TypeScript interfaces, Zod schemas, and utility functions (`assertNever`, `delay`, `groupBy`, etc.) with no runtime dependencies.

@reaatech/agents-markdown

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Core domain types, Zod validation schemas, and shared utilities for the @reaatech/agents-markdown-* ecosystem. This package is the single source of truth for all document shapes — AgentsMdDocument, SkillMdDocument, Finding, LintResult, ValidationResult — used throughout the toolkit.

Installation

terminal
npm install @reaatech/agents-markdown
# or
pnpm add @reaatech/agents-markdown

Feature Overview

  • Canonical domain typesAgentsMdDocument, SkillMdDocument, ValidationResult, LintResult, Finding, ScaffoldConfig, and 10+ more interfaces
  • Zod validation schemasAgentsMdSchema, SkillMdSchema, AgentsMdFrontmatterSchema, SkillMdFrontmatterSchema derived from the AGENTS.md specification
  • Shared utilitiesassertNever, delay, debounce, groupBy, randomId, sanitizePath, normalizeLineEndings, truncate
  • Inferred typesAgentsMdFrontmatter, SkillMdFrontmatter, AgentsMdValidation, SkillMdValidation, McpTool, SkillReference
  • Version constantVERSION string shared across the ecosystem

Quick Start

typescript
import type { AgentsMdDocument, ValidationResult } from "@reaatech/agents-markdown";
import { AgentsMdFrontmatterSchema, VERSION } from "@reaatech/agents-markdown";
import { assertNever, groupBy, randomId } from "@reaatech/agents-markdown";
 
// Validate frontmatter with Zod
const parsed = AgentsMdFrontmatterSchema.safeParse({
  agent_id: "my-agent",
  display_name: "My Agent",
  version: "1.0.0",
  description: "An example agent",
  type: "mcp",
});
 
if (!parsed.success) {
  console.error(parsed.error.issues);
}

API Reference

AgentsMdDocument

The parsed representation of an AGENTS.md file after running through the @reaatech/agents-markdown-parser.

typescript
interface AgentsMdDocument {
  path: string;
  raw: string;
  frontmatter: ParsedFrontmatter;
  title: string;
  sections: Section[];
  tables: MarkdownTable[];
  codeBlocks: CodeBlock[];
  frontmatterRange?: { start: number; end: number };
}

SkillMdDocument

Identical shape to AgentsMdDocument, representing a parsed SKILL.md file.

ValidationResult

Returned by validators in @reaatech/agents-markdown-validator.

typescript
interface ValidationResult {
  valid: boolean;
  type: "agents" | "skill";
  path: string;
  errors: Finding[];
  warnings: Finding[];
  suggestions: Finding[];
}

LintResult

Returned by runLintRules in @reaatech/agents-markdown-linter.

PropertyTypeDescription
pathstringFile path being linted
findingsFinding[]All findings across all rules
errorCountnumberNumber of error-severity findings
warningCountnumberNumber of warning-severity findings
infoCountnumberNumber of info-severity findings
fixableCountnumberNumber of auto-fixable findings

Finding

PropertyTypeRequiredDescription
rulestringYesRule identifier
severitySeverityYeserror" | "warning" | "info" | "suggestion
messagestringYesHuman-readable description
locationErrorLocationNoLine/column in source
suggestionstringNoSuggested fix text
autoFixablebooleanNoWhether an auto-fix exists
fixunknownNoFix payload for auto-fix engine

ScaffoldConfig

typescript
interface ScaffoldConfig {
  agentType: AgentType;
  agentId: string;
  displayName: string;
  description?: string;
  version?: string;
  skills: ScaffoldSkillConfig[];
  outputDir: string;
  overwrite?: boolean;
}

Schemas

All Zod schemas are exported as named consts. Inferred types are exported alongside them.

SchemaInferred TypeValidates
AgentsMdFrontmatterSchemaAgentsMdFrontmatterYAML frontmatter fields (agent_id, display_name, version, description)
SkillMdFrontmatterSchemaSkillMdFrontmatterYAML frontmatter fields (skill_id, display_name, version, description)
AgentsMdSchemaAgentsMdValidationFull AGENTS.md structure with required sections
SkillMdSchemaSkillMdValidationFull SKILL.md structure with required sections
McpToolSchemaMcpToolMCP tool definition (name, inputSchema, output, rateLimit)
SkillReferenceSchemaSkillReferenceSkill reference (skillId, path)
SectionSchemaSchemaSectionSection heading metadata

Utilities

FunctionSignatureDescription
assertNever(x: never) => neverExhaustive switch guard
delay(ms: number) => Promise<void>setTimeout wrapper
randomId() => stringcrypto.randomUUID()
sanitizePath(path: string) => stringBackslash to forward slash
normalizeLineEndings(text: string) => string\r\n\n
truncate(text: string, max: number) => stringTruncate with ...
debounce(fn: Function, ms: number) => FunctionGeneric debounce
groupBy<T, K>(arr: T[], fn: (item: T) => K) => Record<K, T[]>Generic groupBy

Type Aliases

TypeValues
Severityerror" | "warning" | "info" | "suggestion
AgentTypemcp" | "orchestrator" | "classifier" | "router" | "evaluator
SkillTypetool" | "orchestration" | "evaluation" | "routing
OutputFormatconsole" | "json" | "html" | "markdown

License

MIT