@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
77 lines • 2.69 kB
TypeScript
/**
* Validation for Skills following the Agent Skills specification.
* @see https://agentskills.io/specification
*
* This module uses plain validation functions instead of Zod to avoid
* version compatibility issues between Zod 3 and Zod 4.
*/
/**
* Recommended limits from the Agent Skills spec
*/
export declare const SKILL_LIMITS: {
/** Recommended max tokens for instructions */
readonly MAX_INSTRUCTION_TOKENS: 5000;
/** Recommended max lines for SKILL.md */
readonly MAX_INSTRUCTION_LINES: 500;
/** Max characters for name field */
readonly MAX_NAME_LENGTH: 64;
/** Max characters for description field */
readonly MAX_DESCRIPTION_LENGTH: 1024;
/** Max characters for compatibility field */
readonly MAX_COMPATIBILITY_LENGTH: 500;
};
/**
* Skill metadata input type (what users provide)
*/
export interface SkillMetadataInput {
/** Skill name (1-64 chars, lowercase letters/numbers/hyphens only, must match directory name) */
name: string;
/** Description of what the skill does and when to use it (1-1024 characters) */
description: string;
/** License for the skill (e.g., "Apache-2.0", "MIT") */
license?: string;
/** Environment requirements or compatibility notes (string or object for flexibility) */
compatibility?: unknown;
/** Whether this skill should be directly invokable by users. Defaults to true. */
'user-invocable'?: boolean;
/** Arbitrary key-value metadata - values can be strings, arrays, objects, etc. */
metadata?: Record<string, unknown>;
}
/**
* Skill metadata output type (after validation)
*/
export type SkillMetadataOutput = SkillMetadataInput;
/**
* Validation result with warnings
*/
export interface SkillValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
/**
* Validate skill metadata with optional content warnings.
*
* @param metadata - The skill metadata to validate
* @param dirName - The directory name (must match skill name)
* @param instructions - Optional instructions content for token/line warnings
* @returns Validation result with errors and warnings
*
* @example
* ```typescript
* const result = validateSkillMetadata(
* { name: 'my-skill', description: 'A helpful skill' },
* 'my-skill',
* '# Instructions\n...'
* );
*
* if (!result.valid) {
* console.error('Validation errors:', result.errors);
* }
* if (result.warnings.length > 0) {
* console.warn('Warnings:', result.warnings);
* }
* ```
*/
export declare function validateSkillMetadata(metadata: unknown, dirName?: string, instructions?: string): SkillValidationResult;
//# sourceMappingURL=schemas.d.ts.map