# to-skills

> Compile-time generator of AI agent skills from your codebase. Inline docs, CLI definitions, config schemas, and examples compile into progressively disclosed SKILL.md files that any LLM can discover.

## @to-skills/core

> Shared types, renderers, and utilities for the to-skills ecosystem.

### API

- `renderSkills`: Render multiple extracted skills into progressive disclosure file sets.
- `renderSkill`: Render a single skill into SKILL.md + references/.
- `writeSkills`: Write rendered skill file sets to disk (SKILL.md + references/).
- `estimateTokens`: Rough token estimate: ~4 chars per token for English/code.
Not exact, but good enough for budgeting skill file sizes.
- `truncateToTokenBudget`: Truncate text to fit within a token budget, preserving complete lines.
- `renderLlmsTxt`: Render llms.txt and llms-full.txt from extracted skills
- `parseReadme`: Parse a README markdown string and extract structured sections.
- `auditSkill`: Run the documentation audit on a single extracted skill.
- `formatAuditText`: Format an AuditResult as human-readable text suitable for TypeDoc logs.
- `formatAuditJson`: Format an AuditResult as pretty-printed JSON for machine consumption.
- `renderConfigSurfaceSection`: Render ExtractedConfigSurface[] as SKILL.md inline sections.

CLI surfaces → ## Commands
Config/env surfaces → ## Configuration
- `renderConfigReference`: Render ExtractedConfigSurface[] as per-option detail for reference files.
- `parseMarkdownDoc`: Parse a markdown document string into a structured `ParsedMarkdownDoc`.
- `scanDocs`: Scan a docs directory and return parsed markdown documents.
- `docsToExtractedDocuments`: Convert parsed markdown documents to the generic `ExtractedDocument` shape.
- `scanRootDocs`: Scan root-level .md files that contain useful documentation.
Skips README.md (parsed separately), LICENSE, CODE_OF_CONDUCT.md.
- `scanExamples`: Scan an examples directory for `.ts`/`.js`/`.tsx`/`.jsx` files and parse
their import statements and top-level comments.
- `linkExamplesToSkill`: Mutate an `ExtractedSkill` in place by linking each example to the first
matching exported function or class.

## Optional

### Types

- `ExtractedSkill`: Extracted API surface for a single package/module
- `ExtractedFunction`
- `ExtractedClass`
- `ExtractedType`
- `ExtractedEnum`
- `ExtractedParameter`
- `ExtractedProperty`
- `ExtractedVariable`
- `ExtractedDocument`
- `RenderedFile`: A single rendered file
- `RenderedSkill`: A rendered skill with progressive disclosure structure
- `LlmsTxtResult`
- `AuditSeverity`: Severity levels for audit issues, ordered from most to least severe.
- `AuditIssue`: A single audit finding that identifies a problem in the skill package.
- `AuditPass`: A check that the audit engine ran and the skill package passed.
- `AuditContext`: Contextual metadata about the package being audited, used to evaluate
relevance and quality of skill content.
- `ParsedReadme`: Structured representation of key sections extracted from a package README.
- `AuditResult`: The complete output of an audit run against a single skill package.
- `ConfigSourceType`: The source type of a configuration surface:
- 'cli'    — a command-line command or subcommand
- 'config' — a configuration file (e.
- `ExtractedConfigSurface`: Describes a single configuration surface: a CLI command, config file schema,
or environment-variable group that an agent may need to invoke or popu...
- `ExtractedConfigOption`: A single configurable option within a surface: a CLI flag, a config-file key,
or an environment variable (or any combination of the three).
- `ExtractedConfigArgument`: A positional command-line argument accepted by a CLI surface.
Positional arguments are ordered and do not use flag prefixes.
- `ParsedSection`: A single section extracted from a markdown document, corresponding to one
heading and all content that follows it until the next heading.
- `ParsedMarkdownDoc`: A fully parsed markdown document with structured metadata and sections.
- `ParsedExample`

## @to-skills/typedoc

> TypeDoc plugin that extracts structured AI agent skills from the TypeDoc reflection tree.

### API

- `load`

## @to-skills/cli

> CLI extraction for commander/yargs programs.

### API

- `introspectCommander`: Introspects a commander Program object and extracts all top-level command
definitions as ExtractedConfigSurface[].
- `parseHelpOutput`: Parse standard `--help` text output into an ExtractedConfigSurface.
- `correlateFlags`: Merges JSDoc tag metadata from a typed config interface surface into CLI
option metadata extracted from commander/--help output.
- `extractCliSkill`: Extract a structured skill from a CLI program.
