/** * Skill Type Definitions * * Types for the Skills system, which evolves from the existing SOP * (Standard Operating Procedures) system. Skills combine prompts, * scripts, environment variables, and browser automation capabilities. * * @module types/skill.types */ /** * Skill category for grouping and filtering skills. * Includes both original categories and categories used by built-in skill.json files * (management, monitoring, memory, system, task-management, quality). */ export type SkillCategory = 'development' | 'design' | 'communication' | 'research' | 'content-creation' | 'automation' | 'analysis' | 'integration' | 'management' | 'monitoring' | 'memory' | 'system' | 'task-management' | 'quality'; /** * Skill type - defines the nature of the skill * - mcp: MCP-related skills that require MCP installation or runtime flags * - claude-skill: Specialized domain knowledge with optional bash scripts * - web-page: Page-specific skills with domain knowledge and actions */ export type SkillType = 'mcp' | 'claude-skill' | 'web-page'; /** * Type of skill execution */ export type SkillExecutionType = 'script' | 'browser' | 'mcp-tool' | 'composite' | 'prompt-only'; /** * Script interpreter options */ export type ScriptInterpreter = 'bash' | 'python' | 'node'; /** * Script execution configuration */ export interface SkillScriptConfig { /** Path to the script file (.sh, .py, .js) */ file: string; /** Script interpreter to use */ interpreter: ScriptInterpreter; /** Working directory for script execution */ workingDir?: string; /** Script timeout in milliseconds */ timeoutMs?: number; } /** * Browser automation configuration * Uses Claude's Chrome extension (claude-in-chrome MCP) for execution */ export interface SkillBrowserConfig { /** Target URL to navigate to */ url: string; /** Natural language instructions for Claude to follow */ instructions: string; /** Optional: specific actions to perform */ actions?: string[]; } /** * MCP tool invocation configuration */ export interface SkillMcpToolConfig { /** Name of the MCP tool to invoke */ toolName: string; /** Default parameters for the tool */ defaultParams?: Record; } /** * Composite skill configuration (combines multiple skills) */ export interface SkillCompositeConfig { /** Ordered list of skill IDs to execute */ skillSequence: string[]; /** Whether to continue on error */ continueOnError?: boolean; } /** * Skill execution configuration - only one type per skill */ export interface SkillExecutionConfig { /** Type of execution */ type: SkillExecutionType; /** Script execution config (when type is 'script') */ script?: SkillScriptConfig; /** Browser automation config (when type is 'browser') */ browser?: SkillBrowserConfig; /** MCP tool config (when type is 'mcp-tool') */ mcpTool?: SkillMcpToolConfig; /** Composite skill config (when type is 'composite') */ composite?: SkillCompositeConfig; } /** * Environment variable configuration for skill execution */ export interface SkillEnvironmentConfig { /** Path to .env file (relative to skill directory) */ file?: string; /** Inline environment variables */ variables?: Record; /** Required environment variables (will error if not set) */ required?: string[]; } export type { SkillCredentialRequirement, CredentialBindings } from './credential.types.js'; /** * Runtime configuration for skills that modify agent startup */ export interface SkillRuntimeConfig { /** Runtime this skill is compatible with (e.g., 'claude-code') */ runtime?: string; /** Additional flags to pass to the runtime (e.g., ['--chrome']) */ flags?: string[]; /** MCP servers required for this skill */ requiredMcpServers?: string[]; } /** * User notice configuration for skills */ export interface SkillNotice { /** Notice type for styling */ type: 'info' | 'warning' | 'requirement'; /** Notice title */ title: string; /** Notice message */ message: string; /** Optional link for more information */ link?: string; /** Link text */ linkText?: string; } /** * Full Skill definition */ export interface Skill { /** Unique identifier */ id: string; /** Human-readable name */ name: string; /** Detailed description of what this skill does */ description: string; /** Category for grouping */ category: SkillCategory; /** Type of skill (mcp, claude-skill, web-page) */ skillType: SkillType; /** Path to .md file with detailed instructions */ promptFile: string; /** Execution configuration (optional - prompt-only skills don't need this) */ execution?: SkillExecutionConfig; /** Environment configuration */ environment?: SkillEnvironmentConfig; /** Credential requirements (OAuth tokens, API keys) declared as named slots */ credentials?: import('./credential.types.js').SkillCredentialRequirement[]; /** Runtime configuration for agent startup modifications */ runtime?: SkillRuntimeConfig; /** Notices to display to users (requirements, warnings, etc.) */ notices?: SkillNotice[]; /** Role IDs that can use this skill */ assignableRoles: string[]; /** Keywords for matching in prompts */ triggers: string[]; /** Searchable tags */ tags: string[]; /** Skill version for updates */ version: string; /** Whether this is a built-in skill */ isBuiltin: boolean; /** Whether this skill is enabled */ isEnabled: boolean; /** Whether this skill was installed from the marketplace */ isMarketplace?: boolean; /** Minimum cloud tier required to use this skill (defaults to 'free') */ requiredTier?: string; /** Skill ID to use as a free-tier fallback when tier is insufficient */ fallbackSkill?: string; /** ISO timestamp of creation */ createdAt: string; /** ISO timestamp of last update */ updatedAt: string; } /** * Skill with resolved prompt content */ export interface SkillWithPrompt extends Skill { /** The actual content of the prompt file */ promptContent: string; } /** * Skill summary for list views */ export interface SkillSummary { /** Unique identifier */ id: string; /** Human-readable name */ name: string; /** Detailed description */ description: string; /** Category for grouping */ category: SkillCategory; /** Type of skill */ skillType: SkillType; /** Type of execution */ executionType: SkillExecutionType; /** Number of trigger keywords */ triggerCount: number; /** Number of assignable roles */ roleCount: number; /** Whether this is a built-in skill */ isBuiltin: boolean; /** Whether this skill is enabled */ isEnabled: boolean; /** Notices to display to users */ notices?: SkillNotice[]; /** Runtime configuration summary */ runtime?: SkillRuntimeConfig; } /** * Input for creating a new skill */ export interface CreateSkillInput { /** Human-readable name */ name: string; /** Detailed description */ description: string; /** Category for grouping */ category: SkillCategory; /** Type of skill */ skillType?: SkillType; /** Prompt content (markdown) */ promptContent: string; /** Execution configuration */ execution?: SkillExecutionConfig; /** Environment configuration */ environment?: SkillEnvironmentConfig; /** Runtime configuration */ runtime?: SkillRuntimeConfig; /** Notices to display to users */ notices?: SkillNotice[]; /** Role IDs that can use this skill */ assignableRoles?: string[]; /** Keywords for matching in prompts */ triggers?: string[]; /** Searchable tags */ tags?: string[]; } /** * Input for updating a skill */ export interface UpdateSkillInput { /** Human-readable name */ name?: string; /** Detailed description */ description?: string; /** Category for grouping */ category?: SkillCategory; /** Type of skill */ skillType?: SkillType; /** Prompt content (markdown) */ promptContent?: string; /** Execution configuration */ execution?: SkillExecutionConfig; /** Environment configuration */ environment?: SkillEnvironmentConfig; /** Runtime configuration */ runtime?: SkillRuntimeConfig; /** Notices to display to users */ notices?: SkillNotice[]; /** Role IDs that can use this skill */ assignableRoles?: string[]; /** Keywords for matching in prompts */ triggers?: string[]; /** Searchable tags */ tags?: string[]; /** Whether this skill is enabled */ isEnabled?: boolean; } /** * Filter options for querying skills */ export interface SkillFilter { /** Filter by category */ category?: SkillCategory; /** Filter by execution type */ executionType?: SkillExecutionType; /** Filter by assignable role ID */ roleId?: string; /** Filter by builtin status */ isBuiltin?: boolean; /** Filter by enabled status */ isEnabled?: boolean; /** Search term for name/description */ search?: string; /** Filter by tags */ tags?: string[]; } /** * Skill execution context - data passed when executing a skill */ export interface SkillExecutionContext { /** ID of the agent executing the skill */ agentId: string; /** ID of the role the agent is using */ roleId: string; /** Current project context */ projectId?: string; /** Current task context */ taskId?: string; /** User-provided input for the skill */ userInput?: string; /** Additional context data */ metadata?: Record; /** * Optional mapping from credential slot name to credential UUID. Overrides * the skill's declared `default` for each slot. Provided by the agent at * execution time (e.g., "use the personal-gmail account for this task"). */ credentialBindings?: import('./credential.types.js').CredentialBindings; /** * Who asked for the run, from the request's credentials (never its body). * For a verified agent the script gets that agent's session and badge * (`CREWLY_SESSION_NAME`, `CREWLY_AGENT_BADGE`), so it can call agent APIs * such as the API-key route as that agent (#1024). Absent: no identity. */ caller?: SkillExecutionCaller; } /** * The caller of a skill run (#1024). */ export type SkillExecutionCaller = { kind: 'agent'; session: string; } | { kind: 'owner'; }; /** * Result of skill execution */ export interface SkillExecutionResult { /** Whether execution was successful */ success: boolean; /** Output from the skill execution */ output?: string; /** Error message if failed */ error?: string; /** Execution duration in milliseconds */ durationMs: number; /** Additional result data */ data?: Record; } /** * Storage format for skill JSON files */ export interface SkillStorageFormat { /** Unique identifier */ id: string; /** Human-readable name */ name: string; /** Detailed description */ description: string; /** Category for grouping */ category: SkillCategory; /** Type of skill */ skillType: SkillType; /** Path to .md file with detailed instructions */ promptFile: string; /** Execution configuration */ execution?: SkillExecutionConfig; /** Environment configuration */ environment?: SkillEnvironmentConfig; /** Runtime configuration */ runtime?: SkillRuntimeConfig; /** Notices to display to users */ notices?: SkillNotice[]; /** Role IDs that can use this skill */ assignableRoles: string[]; /** Keywords for matching in prompts */ triggers: string[]; /** Searchable tags */ tags: string[]; /** Skill version for updates */ version: string; /** ISO timestamp of creation */ createdAt: string; /** ISO timestamp of last update */ updatedAt: string; } /** * Valid skill categories */ export declare const SKILL_CATEGORIES: SkillCategory[]; /** * Display names for skill categories */ export declare const SKILL_CATEGORY_DISPLAY_NAMES: Record; /** * Valid skill types */ export declare const SKILL_TYPES: SkillType[]; /** * Display names for skill types */ export declare const SKILL_TYPE_DISPLAY_NAMES: Record; /** * Valid execution types */ export declare const EXECUTION_TYPES: SkillExecutionType[]; /** * Display names for execution types */ export declare const EXECUTION_TYPE_DISPLAY_NAMES: Record; /** * Valid script interpreters */ export declare const SCRIPT_INTERPRETERS: ScriptInterpreter[]; /** * Skill system constants */ export declare const SKILL_CONSTANTS: { /** Directory paths */ readonly PATHS: { readonly SKILLS_DIR: "skills"; readonly SYSTEM_SKILLS_DIR: "system"; readonly CUSTOM_SKILLS_DIR: "custom"; readonly INDEX_FILE: "skills-index.json"; readonly PROMPTS_DIR: "prompts"; }; /** Limits */ readonly LIMITS: { readonly MAX_NAME_LENGTH: 100; readonly MAX_DESCRIPTION_LENGTH: 500; readonly MAX_PROMPT_LENGTH: 50000; readonly MAX_TRIGGERS: 50; readonly MAX_TAGS: 20; readonly MAX_ASSIGNABLE_ROLES: 50; readonly MAX_COMPOSITE_SKILLS: 10; readonly DEFAULT_SCRIPT_TIMEOUT_MS: 60000; readonly MAX_SCRIPT_TIMEOUT_MS: 300000; }; /** Default values */ readonly DEFAULTS: { readonly VERSION: "1.0.0"; readonly SCRIPT_TIMEOUT_MS: 60000; readonly IS_ENABLED: true; readonly IS_BUILTIN: false; }; }; /** * Check if a value is a valid skill category * * @param value - Value to check * @returns True if value is a valid SkillCategory */ export declare function isValidSkillCategory(value: string): value is SkillCategory; /** * Check if a value is a valid skill type * * @param value - Value to check * @returns True if value is a valid SkillType */ export declare function isValidSkillType(value: string): value is SkillType; /** * Check if a value is a valid execution type * * @param value - Value to check * @returns True if value is a valid SkillExecutionType */ export declare function isValidExecutionType(value: string): value is SkillExecutionType; /** * Check if a value is a valid script interpreter * * @param value - Value to check * @returns True if value is a valid ScriptInterpreter */ export declare function isValidScriptInterpreter(value: string): value is ScriptInterpreter; /** * Create a skill with default values from minimal input * * @param input - Required input fields for creating a skill * @returns A complete Skill object with default values */ export declare function createDefaultSkill(input: Pick & { skillType?: SkillType; }): Skill; /** * Convert a Skill to a SkillSummary for list views * * @param skill - Full skill object * @returns SkillSummary with derived fields */ export declare function skillToSummary(skill: Skill): SkillSummary; /** * Convert a Skill to storage format (omits isBuiltin since that's determined by location) * * @param skill - Full skill object * @returns SkillStorageFormat for JSON serialization */ export declare function skillToStorageFormat(skill: Skill): SkillStorageFormat; /** * Convert storage format back to a Skill * * @param storage - Stored skill data * @param isBuiltin - Whether this skill comes from the system directory * @returns Full Skill object */ export declare function storageFormatToSkill(storage: SkillStorageFormat, isBuiltin: boolean): Skill; /** * Get display name for a skill category * * @param category - Skill category * @returns Human-readable display name */ export declare function getSkillCategoryDisplayName(category: SkillCategory): string; /** * Get display name for an execution type * * @param executionType - Execution type * @returns Human-readable display name */ export declare function getExecutionTypeDisplayName(executionType: SkillExecutionType): string; /** * Validate CreateSkillInput * * @param input - Input to validate * @returns Array of error messages (empty if valid) */ export declare function validateCreateSkillInput(input: CreateSkillInput): string[]; /** * Validate UpdateSkillInput * * @param input - Input to validate * @returns Array of error messages (empty if valid) */ export declare function validateUpdateSkillInput(input: UpdateSkillInput): string[]; /** * Validate skill execution configuration * * @param config - Execution configuration to validate * @returns Array of error messages (empty if valid) */ export declare function validateSkillExecution(config: SkillExecutionConfig): string[]; /** * Check if a skill matches the given filter * * @param skill - Skill to check * @param filter - Filter criteria * @returns True if skill matches all filter criteria */ export declare function matchesSkillFilter(skill: Skill, filter: SkillFilter): boolean; //# sourceMappingURL=skill.types.d.ts.map