This document defines the public TypeScript surface stabilized by SkillBench 1.0. Imports from internal paths such as skillbench-ai/dist/... or repository src/... files are not part of the compatibility contract; consumers should import from the package root only.
import {
analyzeTarget,
compareReports,
planSafeFixes,
runRuleBenchmark,
} from 'skillbench-ai';Starting with 1.0:
- removing or incompatibly changing a documented runtime export requires a major version;
- removing or incompatibly changing a documented exported type requires a major version;
- additive optional fields and new exports may ship in minor versions when they preserve existing consumers;
- machine-report compatibility is additionally governed by
SCHEMA_VERSION; - CLI compatibility is documented separately in the README and release notes;
- internal modules remain implementation details even when their source files are visible in the repository.
The runtime export list is protected by an exact contract test so an accidental new or removed root export fails CI. Type-only exports are imported by the TypeScript contract fixture so declaration/typecheck failures surface before release.
Discovers supported instruction files beneath a file or directory target and returns an AnalysisReport. Configuration is loaded using normal SkillBench config discovery unless an explicit resolved config is supplied through the lower-level analysis API.
Runs the rule engine, scoring, compatibility, and token analysis over already parsed ParsedDocument values. This is the deterministic lower-level entry point used by integrations that control discovery themselves.
Discovers and parses supported files while applying parser safety limits and ignore patterns.
Parser utilities for integrations that need SkillBench's document classification and normalized parsed representation.
The ordered built-in rule registry. Rule IDs are stable identifiers and should be preferred over human-readable rule messages in automation.
The deterministic scoring implementation and published scoring policy metadata.
Stable finding identity helpers. Fingerprints intentionally ignore source-line movement and configuration-only severity overrides; compare/diff remains severity-sensitive at the comparison layer.
Analyzer class used for per-document token-efficiency metrics.
Returns SkillBench's local language-aware engineering estimate. It is not an official tokenizer for a specific model.
Returns deterministic paragraph-similarity matches used by duplication analysis and the conservative safe-fix planner.
The built-in adapter registry for OpenAI Codex, Claude Code, Cursor, Gemini CLI, and GitHub Copilot.
AgentAdapter is exported for integrations that need the adapter type contract. The top-level analyzer uses the built-in registry; arbitrary third-party adapter registration is not a 1.0 extension-point promise.
Compares two AnalysisReport values and returns a ComparisonReport containing score/token deltas, introduced/resolved findings, unchanged count, and compatibility changes.
Stable issue fingerprinting and comparison semantics are deliberately separate: a configuration-only severity change keeps the same fingerprint, while a warning-to-error escalation is still surfaced as a regression by comparison.
Creates a deterministic FixPlan. Planning is read-only. A plan records source hashes and the exact lines proposed for removal.
The current automatic writer intentionally supports only exact duplicated plain-prose paragraphs associated with SB003. Structural Markdown, code, near-duplicates, and security-sensitive remediation remain review-only.
Applies a previously generated plan. The writer:
- rejects stale plans and non-regular targets;
- stages replacement files before commit;
- revalidates sources before replacement;
- can create non-overwriting recovery backups;
- preserves line endings and relevant file permission bits;
- uses same-directory rename-based replacement;
- attempts best-effort rollback if a later file in a multi-file apply fails.
This is per-file atomic replacement with best-effort multi-file rollback, not a claim of filesystem-wide atomic transactions.
Raised when SkillBench refuses a write because the source or filesystem state no longer matches the plan's safety assumptions.
Runs a hermetic case-by-rule benchmark using human-authored expected rule IDs. It reports true positives, false positives, false negatives, precision, recall, and built-in-rule coverage.
Benchmark analysis intentionally ignores user/up-tree .skillbench.yml files so corpus results measure the recommended built-in rules rather than local environment configuration.
Raised for invalid manifests, duplicate case IDs/rule labels, unknown rule IDs, unreadable targets, and other benchmark setup failures.
The following machine reporters implement the exported Reporter contract:
JsonReporterSarifReporterGitHubReporter
Reporter output should be treated as machine-readable only where documented. Terminal presentation helpers are intentionally not exported as a stable package API.
SkillBench package/runtime version.
Machine-report schema version. It is intentionally separate from package SemVer.
Canonical project URL.
The package root exports these documented types:
AnalysisReportCategoryCompatibilityResultCompatibilityStatusIssueParsedDocumentRuleSeverityTokenMetricsAgentAdapterReporterComparisonReportCompatibilityChangeReportSnapshotApplyFixOptionsApplyFixResultFileFixPlanFixPlanPlanFixOptionsSafeFixSafeFixKindRuleBenchmarkCaseResultRuleBenchmarkReportRuleBenchmarkThresholds
The source of truth is the package-root declaration file produced by the release build. This document describes the supported contract; it does not make internal source paths public APIs.