getPlatformPaths()
Get OS-appropriate paths for CAAMP’s global directories. SignaturegetSystemInfo()
Get a cached system information snapshot. Signature_resetPlatformPathsCache()
Invalidate the path and system info caches. Use in tests after mutating AGENTS_HOME env var. SignaturegetPlatformLocations()
Resolves platform-specific directory locations for the current OS. SignaturegetAgentsHome()
Returns the global agents home directory path. SignaturegetProjectAgentsDir(projectRoot)
Returns the project-local.agents directory path.
Signature
Returns — The absolute path to the project’s
.agents directory
Example
resolveProjectPath(relativePath, projectDir)
Resolves a relative path against a project directory. Signature
Returns — The resolved absolute path
Example
getCanonicalSkillsDir()
Returns the canonical skills storage directory path. SignaturegetLockFilePath()
Returns the path to the CAAMP lock file. Signature.caamp-lock.json file
Example
getAgentsMcpDir(scope, projectDir)
Gets the MCP directory within the.agents/ standard structure.
Signature
Returns — The absolute path to the MCP directory
Example
getAgentsMcpServersPath(scope, projectDir)
Gets the MCP servers.json path within the.agents/ standard structure.
Signature
Returns — The absolute path to the
servers.json file
Example
getAgentsInstructFile(scope, projectDir)
Gets the primary AGENTS.md instruction file path within.agents/.
Signature
Returns — The absolute path to the AGENTS.md file
Example
getAgentsConfigPath(scope, projectDir)
Gets the config.toml path within the.agents/ standard structure.
Signature
Returns — The absolute path to the config.toml file
Example
getAgentsWikiDir(scope, projectDir)
Gets the wiki directory within the.agents/ standard structure.
Signature
Returns — The absolute path to the wiki directory
Example
getAgentsSpecDir(scope, projectDir)
Gets the spec directory within the.agents/ standard structure.
Signature
Returns — The absolute path to the spec directory
Example
getAgentsLinksDir(scope, projectDir)
Gets the links directory within the.agents/ standard structure.
Signature
Returns — The absolute path to the links directory
Example
resolveRegistryTemplatePath(template)
Resolves a registry template path by substituting platform variables. Signature
Returns — The resolved absolute path with all variables expanded
Example
resolveProviderConfigPath(provider, scope, projectDir)
Resolves the configuration file path for a provider at the given scope. Signature
Returns — The resolved config file path, or null if unavailable for the given scope
Example
resolvePreferredConfigScope(provider, useGlobalFlag)
Determines the preferred configuration scope for a provider. Signature
Returns — The preferred path scope for configuration
Example
resolveProviderSkillsDir(provider, scope, projectDir)
Resolves the skills directory path for a provider at the given scope. Signature
Returns — The resolved skills directory path
Example
resolveProviderSkillsDirs(provider, scope, projectDir)
Gets all target directories for skill installation based on provider precedence. Signature
Returns — Array of target directories for symlink creation
Example
resolveProviderProjectPath(provider, projectDir)
Resolves a provider’s project-level path against a project directory. Signature
Returns — The resolved absolute path for the provider’s project directory
Example
resolveProvidersRegistryPath(startDir)
Locates the providers registry.json file by searching up from a start directory. Signature
Returns — The absolute path to the found
providers/registry.json file
Throws
- Error if
providers/registry.jsoncannot be found within 8 parent levels
normalizeSkillSubPath(path)
Normalizes a skill sub-path by cleaning separators and removing SKILL.md suffix. Signature
Returns — The normalized path, or undefined if the input is empty or falsy
Example
buildSkillSubPathCandidates(marketplacePath, parsedPath)
Builds a list of candidate sub-paths for skill file resolution. Signature
Returns — A deduplicated array of candidate sub-paths
Example
getAllProviders()
Retrieve all registered providers with resolved platform paths. Providers are lazily loaded fromproviders/registry.json on first call and cached for subsequent calls.
Signature
getProvider(idOrAlias)
Look up a provider by its ID or any of its aliases. Signature
Returns — The matching provider, or
undefined if not found
Example
resolveAlias(idOrAlias)
Resolve an alias to its canonical provider ID. If the input is already a canonical ID (or unrecognized), it is returned as-is. Signature
Returns — The canonical provider ID
Example
getProvidersByPriority(priority)
Filter providers by their priority tier. Signature
Returns — Array of providers matching the given priority
Example
getPrimaryProvider()
Get the single primary harness provider, if any is registered. Signatureundefined if none is registered
Example
getProvidersByStatus(status)
Filter providers by their lifecycle status. Signature
Returns — Array of providers matching the given status
Example
getProvidersByInstructFile(file)
Filter providers that use a specific instruction file. Multiple providers often share the same instruction file (e.g. many use"AGENTS.md").
Signature
Returns — Array of providers that use the given instruction file
Example
getInstructionFiles()
Get the set of all unique instruction file names across all providers. Signature["CLAUDE.md", "AGENTS.md", "GEMINI.md"])
Example
getProviderCount()
Get the total number of registered providers. SignaturegetRegistryVersion()
Get the semantic version string of the provider registry. Signatureproviders/registry.json (e.g. "2.0.0")
Example
getProvidersByHookEvent(event)
Filter providers that support a specific hook event. Signature
Returns — Array of providers whose hooks capability includes the given event
Example
getCommonHookEvents(providerIds)
Get hook events common to all specified providers. If providerIds is provided, returns the intersection of their supported events. If providerIds is undefined or empty, uses all providers. Signature
Returns — Array of hook events supported by ALL specified providers
Example
providerSupports(provider, dotPath)
Check whether a provider supports a specific capability via dot-path query. The dot-path addresses a value insideprovider.capabilities. For boolean fields the provider “supports” the capability when the value is true. For non-boolean fields the provider “supports” it when the value is neither null nor undefined (and, for arrays, non-empty).
Signature
Returns —
true when the provider has the specified capability
Example
getSpawnCapableProviders()
Filter providers that support spawning subagents. Signaturecapabilities.spawn.supportsSubagents === true
Example
getProvidersBySpawnCapability(flag)
Filter providers by a specific boolean spawn capability flag. Signature
Returns — Array of providers where the specified flag is
true
Example
resetRegistry()
Reset cached registry data, forcing a reload on next access. SignaturegetProvidersBySkillsPrecedence(precedence)
Filter providers by their skills precedence value. Signature
Returns — Array of providers matching the given precedence
Example
getEffectiveSkillsPaths(provider, scope, projectDir)
Get the effective skills paths for a provider, ordered by precedence. Signature
Returns — Ordered array of paths with source and scope metadata
Example
buildSkillsMap()
Build a full skills map for all providers. SignaturegetProviderCapabilities(idOrAlias)
Get capabilities for a provider by ID or alias. Signature
Returns — The provider’s capabilities, or undefined if not found
Example
providerSupportsById(idOrAlias, capabilityPath)
Check if a provider supports a capability using ID/alias lookup. Convenience wrapper that resolves the provider first, then delegates to the provider-levelproviderSupports.
Signature
Returns — true if the provider supports the capability, false otherwise
Example
buildInjectionContent(template)
Build injection content from a structured template. Produces a string suitable for injection between CAAMP markers. References are output as@ lines, content blocks are appended as-is.
Signature
Returns — Formatted injection content string
Example
parseInjectionContent(content)
Parse injection content back into template form. Lines starting with@ are treated as references. All other non-empty lines are treated as content blocks.
Signature
Returns — Parsed InjectionTemplate
Example
generateInjectionContent(options)
Generate a standard CAAMP injection block for instruction files. Produces markdown content suitable for injection between CAAMP markers. Optionally includes MCP server and custom content sections. Signature
Returns — Generated markdown string
Example
generateSkillsSection(skillNames)
Generate a skills discovery section for instruction files. Signature
Returns — Markdown string listing installed skills
Example
getInstructFile(provider)
Get the correct instruction file name for a provider. Signature
Returns — Instruction file name
Example
groupByInstructFile(providers)
Group providers by their instruction file name. Useful for determining which providers share the same instruction file (e.g. multiple providers usingAGENTS.md).
Signature
Returns — Map from instruction file name to array of providers using that file
Example
checkInjection(filePath, expectedContent)
Check the status of a CAAMP injection block in an instruction file. Returns the injection status: -"missing" - File does not exist - "none" - File exists but has no CAAMP markers - "current" - CAAMP block exists and matches expected content (or no expected content given) - "outdated" - CAAMP block exists but differs from expected content
Signature
Returns — The injection status
Example
inject(filePath, content)
Inject content into an instruction file between CAAMP markers. Behavior depends on the file state: - File does not exist: creates the file with the injection block →"created" - File exists without markers: prepends the injection block → "added" - File exists with multiple markers (duplicates): consolidates into single block → "consolidated" - File exists with markers, content differs: replaces the block → "updated" - File exists with markers, content matches: no-op → "intact" This function is idempotent — calling it multiple times with the same content will not modify the file after the first write.
Signature
Returns — Action taken:
"created", "added", "consolidated", "updated", or "intact"
Example
removeInjection(filePath)
Remove the CAAMP injection block from an instruction file. If removing the block would leave the file empty, the file is deleted entirely. Signature
Returns —
true if a CAAMP block was found and removed, false otherwise
Example
checkAllInjections(providers, projectDir, scope, expectedContent)
Check injection status across all providers’ instruction files. Deduplicates by file path since multiple providers may share the same instruction file (e.g. many providers useAGENTS.md).
Signature
Returns — Array of injection check results, one per unique instruction file
Example
injectAll(providers, projectDir, scope, content)
Inject content into all providers’ instruction files. Deduplicates by file path to avoid injecting the same file multiple times. Signature
Returns — Map of file path to action taken (
"created", "added", "consolidated", "updated", or "intact")
Example
ensureProviderInstructionFile(providerId, projectDir, options)
Ensure a provider’s instruction file exists with the correct CAAMP block. This is the canonical API for adapters and external packages to manage provider instruction files. Instead of directly creating/modifying CLAUDE.md, GEMINI.md, etc., callers should use this function to delegate instruction file management to CAAMP. The instruction file name is resolved from CAAMP’s provider registry (single source of truth), not hardcoded by the caller. Signature
Returns — Result with file path, action taken, and provider metadata
Throws
- Error if the provider ID is not found in the registry
ensureAllProviderInstructionFiles(providerIds, projectDir, options)
Ensure instruction files for multiple providers at once. Deduplicates by file path — providers sharing the same instruction file (e.g. many providers use AGENTS.md) are only written once. Signature
Returns — Array of results, one per unique instruction file
Throws
- Error if any provider ID is not found in the registry
setVerbose(v)
Enable or disable verbose (debug) logging mode. When enabled, debug messages are written to stderr. Signature
Example
setQuiet(q)
Enable or disable quiet mode. When enabled, info and warning messages are suppressed. Errors are always shown. Signature
Example
debug(args)
Log a debug message to stderr when verbose mode is enabled. Signature
Example
info(args)
Log an informational message to stdout. Signature
Example
warn(args)
Log a warning message to stderr. Signature
Example
error(args)
Log an error message to stderr. Signature
Example
isVerbose()
Check if verbose (debug) logging is currently enabled. Signaturetrue if verbose mode is active
Example
isQuiet()
Check if quiet mode is currently enabled. Signaturetrue if quiet mode is active
Example
setHuman(h)
Enable or disable human-readable output mode. When enabled, commands output human-readable format instead of JSON. Signature
Example
isHuman()
Check if human-readable output mode is currently enabled. Signaturetrue if human mode is active
Example
detectProvider(provider)
Detect if a single provider is installed on the system. Checks each detection method configured for the provider (binary, directory, appBundle, flatpak) and returns which methods matched. Signature
Returns — Detection result with installation status and matched methods
Example
detectProjectProvider(provider, projectDir)
Detect if a provider has project-level config in the given directory. Signature
Returns —
true if the provider has a config file in the project directory
Example
detectAllProviders(options)
Detect all registered providers and return their installation status. Runs detection for every provider in the registry. Signature
Returns — Array of detection results for all providers
Example
getInstalledProviders(options)
Get only providers that are currently installed on the system. Convenience wrapper that filtersdetectAllProviders results to only those with installed === true.
Signature
Returns — Array of installed provider definitions
Example
detectProjectProviders(projectDir, options)
Detect all providers and enrich results with project-level presence. ExtendsdetectAllProviders by also checking whether each provider has a project-level config file in the given directory.
Signature
Returns — Array of detection results with
projectDetected populated
Example
resetDetectionCache()
Reset the detection result cache, forcing fresh detection on next call. SignatureinstallToCanonical(sourcePath, skillName)
Copy skill files to the canonical location. Signature
Returns — Absolute path to the canonical installation directory
Example
installSkill(sourcePath, skillName, providers, isGlobal, projectDir)
Install a skill from a local path to the canonical location and link to agents. Signature
Returns — Install result with linked agents and any errors
Example
removeSkill(skillName, providers, isGlobal, projectDir)
Remove a skill from the canonical location and all agent symlinks. Signature
Returns — Object with arrays of successfully removed provider IDs and error messages
Example
listCanonicalSkills()
List all skills installed in the canonical skills directory. SignatureselectProvidersByMinimumPriority(providers, minimumPriority)
Filters providers by minimum priority and returns them in deterministic tier order. Signature
Returns — A filtered and sorted array of providers meeting the priority threshold
Example
installBatchWithRollback(options)
Installs multiple skills across filtered providers with rollback. Signature
Returns — A result object indicating success, applied counts, and any rollback information
Example
updateInstructionsSingleOperation(providers, content, scope, projectDir)
Updates instruction files across providers as a single operation. Signature
Returns — A summary of updated files and actions taken per file
Example
resolveFormat(options)
Resolves output format based on flags and defaults. Signature
Returns —
"json" or "human"
Throws
- Error if format flags conflict
buildEnvelope(operation, mvi, result, error, page, sessionId, warnings)
Builds a standard LAFS envelope. Signature
Returns — LAFS-compliant envelope
Example
emitError(operation, mvi, code, message, category, details, exitCode)
Emits a JSON error envelope to stderr and exits the process. Signature
Example
emitJsonError(operation, mvi, code, message, category, details)
Emits a JSON error envelope without exiting (for catch blocks). Signature
Example
outputSuccess(operation, mvi, result, page, sessionId, warnings)
Outputs a successful LAFS envelope to stdout. Signature
Example
handleFormatError(error, operation, mvi, jsonFlag)
Handles format resolution errors consistently. Signature
Returns — never (exits process)
Example
LAFSCommandError
Structured error class for LAFS-compliant command failures with error codes and recovery hints. SignatureemitSuccess(operation, result, mvi)
Emits a successful LAFS result envelope to stdout. Signature
Example
emitError(operation, error, mvi)
Emits a failed LAFS error envelope to stderr. Signature
Example
runLafsCommand(command, mvi, action)
Runs an async action and emits the result as a LAFS success or error envelope. Signature
Returns — Resolves when the action completes and output is emitted
Example
parsePriority(value)
Parses and validates a provider priority tier string. Signature
Returns — The validated ProviderPriority value
Example
resolveProviders(options)
Resolves the set of target providers from CLI targeting options. Signature
Returns — An array of resolved Provider objects
Example
readJsonFile(path)
Reads and parses a JSON file from disk. Signature
Returns — The parsed JSON value
Example
readSkillOperations(path)
Reads and validates a JSON file containing skill batch operations. Signature
Returns — An array of validated SkillBatchOperation objects
Example
readTextInput(inlineContent, filePath)
Reads text input from either inline content or a file path, enforcing mutual exclusivity. Signature
Returns — The text content string, or undefined if no input was provided
Example
registerAdvancedBatch(parent)
Registers theadvanced batch subcommand for rollback-capable batch install of skills.
Signature
Example
registerAdvancedInstructions(parent)
Registers theadvanced instructions subcommand for single-operation instruction updates.
Signature
Example
registerAdvancedProviders(parent)
Registers theadvanced providers subcommand for selecting providers by priority tier.
Signature
Example
registerAdvancedCommands(program)
Registers theadvanced command group with providers, batch, and instructions subcommands.
Signature
Example
deepMerge(target, source)
Deep merge two objects, withsource values winning on conflict. Recursively merges nested plain objects. Arrays and non-object values from source overwrite target values.
Signature
Returns — A new merged object (does not mutate inputs)
Example
setNestedValue(obj, keyPath, key, value)
Set a nested value using a dot-notation key path. Signature
Returns — A new object with the value set at the specified path
Example
getNestedValue(obj, keyPath)
Get a nested value from an object using a dot-notation key path. Signature
Returns — The value at the key path, or
undefined if not found
Example
ensureDir(filePath)
Ensure that the parent directories of a file path exist. Creates directories recursively if they do not exist. Signature
Example
readJsonConfig(filePath)
Read and parse a JSON or JSONC config file. Signature
Returns — Parsed config object
Example
writeJsonConfig(filePath, configKey, serverName, serverConfig)
Write a server config entry to a JSON/JSONC file, preserving comments. Signature
Example
removeJsonConfig(filePath, configKey, serverName)
Remove a server entry from a JSON/JSONC config file. Signature
Returns —
true if the entry was removed, false if the file or entry was not found
Example
readTomlConfig(filePath)
Read and parse a TOML config file. Signature
Returns — Parsed config object
Example
writeTomlConfig(filePath, configKey, serverName, serverConfig)
Write a server config entry to a TOML file. Signature
Example
removeTomlConfig(filePath, configKey, serverName)
Remove a server entry from a TOML config file. Signature
Returns —
true if the entry was removed, false if the file or entry was not found
Example
readYamlConfig(filePath)
Read and parse a YAML config file. Signature
Returns — Parsed config object
Example
writeYamlConfig(filePath, configKey, serverName, serverConfig)
Write a server config entry to a YAML file. Signature
Example
removeYamlConfig(filePath, configKey, serverName)
Remove a server entry from a YAML config file. Signature
Returns —
true if the entry was removed, false if the file or entry was not found
Example
readConfig(filePath, format)
Read and parse a config file in the specified format. Dispatches to the appropriate format handler (JSON/JSONC, YAML, or TOML). Signature
Returns — Parsed config object
Throws
- If the file cannot be read or the format is unsupported
writeConfig(filePath, format, key, serverName, serverConfig)
Write a server entry to a config file, preserving existing content. Dispatches to the appropriate format handler. For JSONC files, comments are preserved usingjsonc-parser.
Signature
Throws
- If the format is unsupported
removeConfig(filePath, format, key, serverName)
Remove a server entry from a config file in the specified format. Signature
Returns —
true if the entry was removed, false otherwise
Throws
- If the format is unsupported
registerConfigCommand(program)
Registers theconfig command group with show and path subcommands for viewing provider configurations.
Signature
Example
readLockFile()
Read and parse the CAAMP lock file from disk. SignaturewriteLockFile(lock)
Write the lock file atomically under a process lock guard. Signature
Example
updateLockFile(updater)
Safely read-modify-write the lock file under a process lock guard. Signature
Returns — The updated lock file contents after the write
Example
getCaampVersion()
Retrieve the current CAAMP package version from the nearestpackage.json.
Signature
"1.8.1")
Example
registerDoctorCommand(program)
Registers thedoctor command for diagnosing configuration issues and overall system health.
Signature
Example
registerInstructionsCheck(parent)
Registers theinstructions check subcommand for verifying injection status across providers.
Signature
Example
registerInstructionsInject(parent)
Registers theinstructions inject subcommand for injecting instruction blocks into provider files.
Signature
Example
registerInstructionsUpdate(parent)
Registers theinstructions update subcommand for refreshing all instruction file injections.
Signature
Example
registerInstructionsCommands(program)
Registers theinstructions command group with inject, check, and update subcommands.
Signature
Example
resetHookMappings()
Reset the cached hook mappings data. SignaturegetCanonicalEvent(event)
Get the canonical event definition (category, description, canBlock). Signature
Returns — The event definition containing category, description, and canBlock flag.
Example
getAllCanonicalEvents()
Get all canonical event definitions. SignaturegetCanonicalEventsByCategory(category)
Get canonical events filtered by category. Signature
Returns — Array of canonical event names that belong to the specified category.
Example
getProviderHookProfile(providerId)
Get the full hook profile for a provider. Signature
Returns — The provider’s hook profile, or
undefined if not found.
Example
getMappedProviderIds()
Get all provider IDs that have hook mappings. SignaturetoNative(canonical, providerId)
Translate a CAAMP canonical event name to the provider’s native name. Signature
Returns — The native event name, or
null if unsupported.
Example
toCanonical(nativeName, providerId)
Translate a provider-native event name to the CAAMP canonical name. Signature
Returns — The canonical event name, or
null if no mapping exists.
Example
toNativeBatch(canonicals, providerId)
Batch-translate multiple canonical events to native names for a provider. Signature
Returns — Array of normalized events (only supported ones included).
Example
supportsHook(canonical, providerId)
Check if a provider supports a specific canonical hook event. Signature
Returns —
true if the provider supports this canonical event, false otherwise.
Example
getHookSupport(canonical, providerId)
Get full hook support details for a canonical event on a provider. Signature
Returns — Support result including native name and optional notes.
Example
getSupportedEvents(providerId)
Get all supported canonical events for a provider. Signature
Returns — Array of canonical event names the provider supports.
Example
getUnsupportedEvents(providerId)
Get all unsupported canonical events for a provider. Signature
Returns — Array of canonical event names the provider does not support.
Example
getProvidersForEvent(canonical)
Get providers that support a specific canonical event. Signature
Returns — Array of provider IDs that support this event.
Example
getCommonEvents(providerIds)
Get canonical events common to all specified providers. Signature
Returns — Array of canonical events supported by all specified providers.
Example
getProviderSummary(providerId)
Get a summary of hook support for a provider. Signature
Returns — The hook support summary, or
undefined if the provider is not found.
Example
buildHookMatrix(providerIds)
Build a cross-provider hook support matrix. Signature
Returns — The cross-provider matrix with events, providers, and mapping data.
Example
getHookSystemType(providerId)
Get the hook system type for a provider. Signature
Returns — The hook system type (
"config", "plugin", or "none").
Example
getHookConfigPath(providerId)
Get the resolved hook config path for a provider. Signature
Returns — The resolved filesystem path, or
null if not available.
Example
getProviderOnlyEvents(providerId)
Get provider-only events (native events with no canonical mapping). Signature
Returns — Array of native event names unique to this provider.
Example
translateToAll(canonical, providerIds)
Translate a canonical event to native names across multiple providers. Signature
Returns — Record mapping provider IDs to their native event names (supported only).
Example
resolveNativeEvent(nativeName)
Find the best canonical match for a native event name across all providers. Signature
Returns — Array of matches, each containing the provider ID and canonical event name.
Example
getHookMappingsVersion()
Get the version of the hook mappings data. SignatureregisterProvidersCommand(program)
Registers theproviders command group with list, detect, show, skills-map, hooks, and capabilities subcommands.
Signature
Example
getRulesByCategory(category)
Get audit rules filtered by category. Signature
Returns — Array of rules matching the given category
Example
getRulesBySeverity(severity)
Get audit rules filtered by severity level. Signature
Returns — Array of rules matching the given severity
Example
getCategories()
Get all unique rule categories. SignaturescanFile(filePath, rules)
Scan a single file against security audit rules. Signature
Returns — Audit result with findings, score, and pass/fail status
Example
scanDirectory(dirPath)
Scan a directory of skills for security issues. Signature
Returns — Array of audit results, one per scanned SKILL.md
Example
toSarif(results)
Convert audit results to SARIF 2.1.0 format (Static Analysis Results Interchange Format). Signature
Returns — SARIF 2.1.0 JSON object
Example
registerSkillsAudit(parent)
Registers theskills audit subcommand for security scanning skill files.
Signature
Example
parseSource(input)
Parse and classify a source string into a typedParsedSource.
Signature
Returns — Parsed source with type, value, and inferred name
Example
isMarketplaceScoped(input)
Check if a source string looks like a marketplace scoped name (@author/name).
Signature
Returns —
true if the input matches the @scope/name pattern
Example
recordSkillInstall(skillName, scopedName, source, sourceType, agents, canonicalPath, isGlobal, projectDir, version)
Record a skill installation in the lock file. Signature
Example
removeSkillFromLock(skillName)
Remove a skill entry from the lock file. Signature
Returns —
true if the entry was found and removed, false if not found
Example
getTrackedSkills()
Get all skills tracked in the lock file. SignaturecheckSkillUpdate(skillName)
Check if a skill has updates available by comparing the installed version against the latest remote commit SHA. Signature
Returns — Object with update status, current version, and latest version
Example
checkAllSkillUpdates()
Check for updates across all tracked skills. SignatureregisterSkillsCheck(parent)
Registers theskills check subcommand for checking available skill updates.
Signature
Example
NetworkError
Structured error for network failures with categorized kind. SignaturefetchWithTimeout(url, init, timeoutMs)
Fetch a URL with an automatic timeout viaAbortSignal.timeout.
Signature
Returns — The
Response object from the fetch call
Throws
NetworkErroron timeout or network failure
ensureOkResponse(response, url)
Assert that aResponse has an OK status, throwing on failure.
Signature
Returns — The same
Response if status is OK
Throws
NetworkErrorwhenresponse.okisfalse
formatNetworkError(error)
Format a network error into a user-friendly message string. Signature
Returns — Human-readable error description
Example
SkillsMPAdapter
Marketplace adapter for the agentskills.in API. Signaturesearch()
Search for skills by query string.getSkill()
Look up a specific skill by its scoped name.SkillsShAdapter
Marketplace adapter for the skills.sh API. Signaturesearch()
Search for skills by query string.getSkill()
Look up a specific skill by its scoped name.MarketplaceUnavailableError
Error thrown when all marketplace sources fail to respond. SignatureMarketplaceClient
Unified marketplace client that aggregates results from multiple marketplace adapters. Queries all configured marketplaces in parallel, deduplicates results by scoped name, and sorts by star count. Signaturesearch()
Search all marketplaces and return deduplicated, sorted results. Queries all adapters in parallel and deduplicates byscopedName, keeping the entry with the highest star count. Results are sorted by stars descending.
getSkill()
Get a specific skill by its scoped name from any marketplace. Tries each adapter in order and returns the first match.tokenizeCriteriaValue(value)
Splits a comma-separated criteria string into normalized tokens. Signature
Returns — An array of trimmed, lowercased, non-empty tokens
Example
validateRecommendationCriteria(input)
Validates recommendation criteria input for correctness and consistency. Signature
Returns — A validation result indicating success or listing all issues
Example
normalizeRecommendationCriteria(input)
Normalizes raw recommendation criteria into a consistent tokenized form. Signature
Returns — Normalized criteria with tokenized, sorted, deduplicated terms
Example
scoreSkillRecommendation(skill, criteria, options)
Computes a recommendation score for a single skill against normalized criteria. Signature
Returns — A ranked recommendation with score, reasons, and tradeoffs
Example
recommendSkills(skills, criteriaInput, options)
Validates, normalizes, scores, and ranks a list of skills against criteria. Signature
Returns — The normalized criteria and ranked skill recommendations
Throws
- Error with
codeandissuesproperties when criteria are invalid
formatSkillRecommendations(result, opts)
Format skill recommendation results for display or serialization. Signature
Returns — Formatted string for human mode, or a structured object for JSON mode
Example
searchSkills(query, options)
Search for skills via marketplace APIs. Signature
Returns — Array of marketplace skill entries matching the query
Example
recommendSkills(query, criteria, options)
Search and rank skills based on query and recommendation criteria. Signature
Returns — Ranked recommendation results with scores and reasons
Example
registerSkillsFind(parent)
Registers theskills find subcommand for searching marketplaces and recommending skills.
Signature
Example
registerSkillsInit(parent)
Registers theskills init subcommand for scaffolding new SKILL.md templates.
Signature
Example
loadLibraryFromModule(root)
Load a SkillLibrary from a module (index.js) at the given root directory. Signature
Returns — A validated SkillLibrary instance
Throws
- If the module cannot be loaded or does not implement SkillLibrary
buildLibraryFromFiles(root)
Build a SkillLibrary from raw files in a directory. Signature
Returns — A SkillLibrary instance backed by filesystem reads
Throws
- If skills.json is not found at the root
registerSkillLibrary(library)
Registers a SkillLibrary instance directly as the active catalog. Signature
Example
registerSkillLibraryFromPath(root)
Registers a skill library by loading it from a directory path. Signature
Throws
- Error if the library cannot be loaded from the given path
clearRegisteredLibrary()
Clears the registered skill library instance. SignatureisCatalogAvailable()
Checks whether a skill library is available for use. SignaturegetSkills()
Returns all skill entries from the catalog. SignaturegetManifest()
Returns the parsed skill library manifest. SignaturelistSkills()
Lists all available skill names in the catalog. SignaturegetSkill(name)
Gets skill metadata by name from the catalog. Signature
Returns — The skill entry if found, or undefined
Example
getSkillPath(name)
Resolves the absolute path to a skill’s SKILL.md file. Signature
Returns — The absolute path to the skill’s SKILL.md file
Example
getSkillDir(name)
Resolves the absolute path to a skill’s directory. Signature
Returns — The absolute path to the skill’s directory
Example
readSkillContent(name)
Reads a skill’s SKILL.md content as a string. Signature
Returns — The full text content of the skill’s SKILL.md file
Example
getCoreSkills()
Returns all skills marked as core in the catalog. SignaturegetSkillsByCategory(category)
Returns skills filtered by category. Signature
Returns — An array of skill entries in the specified category
Example
getSkillDependencies(name)
Gets the direct dependency names for a skill. Signature
Returns — An array of direct dependency skill names
Example
resolveDependencyTree(names)
Resolves the full dependency tree for a set of skill names. Signature
Returns — A deduplicated array of all required skill names including transitive dependencies
Example
listProfiles()
Lists all available profile names in the catalog. SignaturegetProfile(name)
Gets a profile definition by name from the catalog. Signature
Returns — The profile definition if found, or undefined
Example
resolveProfile(name)
Resolves a profile to its full skill list including inherited skills. Signature
Returns — A deduplicated array of all skill names required by the profile
Example
listSharedResources()
Lists all available shared resource names in the catalog. SignaturegetSharedResourcePath(name)
Gets the absolute path to a shared resource file. Signature
Returns — The absolute path to the resource file, or undefined if not found
Example
readSharedResource(name)
Reads a shared resource file’s content as a string. Signature
Returns — The text content of the resource, or undefined if not found
Example
listProtocols()
Lists all available protocol names in the catalog. SignaturegetProtocolPath(name)
Gets the absolute path to a protocol file. Signature
Returns — The absolute path to the protocol file, or undefined if not found
Example
readProtocol(name)
Reads a protocol file’s content as a string. Signature
Returns — The text content of the protocol, or undefined if not found
Example
validateSkillFrontmatter(name)
Validates a single skill’s frontmatter against the schema. Signature
Returns — A validation result indicating success or listing errors
Example
validateAll()
Validates all skills in the catalog and returns results per skill. SignaturegetDispatchMatrix()
Gets the dispatch matrix from the skill library manifest. SignaturegetVersion()
Returns the skill library version string. SignaturegetLibraryRoot()
Returns the absolute path to the skill library root directory. SignatureparseSkillFile(filePath)
Parse a SKILL.md file and extract its frontmatter metadata. Signature
Returns — Parsed metadata, or
null if invalid
Example
discoverSkill(skillDir)
Discover a single skill at a given directory path. Signature
Returns — Skill entry with metadata, or
null if no valid SKILL.md exists
Example
discoverSkills(rootDir)
Scan a directory for skill subdirectories, each containing a SKILL.md file. Signature
Returns — Array of discovered skill entries
Example
discoverSkillsMulti(dirs)
Discover skills across multiple directories. Signature
Returns — Deduplicated array of discovered skill entries
Example
cloneRepo(owner, repo, ref, subPath)
Clone a GitHub repo to a temp directory. Signature
Returns — Object with local path and cleanup function
Example
fetchRawFile(owner, repo, path, ref)
Fetch a specific file from GitHub using the raw API. Signature
Returns — File content as a string, or
null if the file cannot be fetched
Example
repoExists(owner, repo)
Check if a GitHub repo exists. Signature
Returns —
true if the repository exists and is accessible
Example
cloneGitLabRepo(owner, repo, ref, subPath)
Clone a GitLab repo to a temp directory. Signature
Returns — Object with local path and cleanup function
Example
fetchGitLabRawFile(owner, repo, path, ref)
Fetch a specific file from GitLab using the raw API. Signature
Returns — File content as a string, or
null if the file cannot be fetched
Example
registerSkillsInstall(parent)
Registers theskills install subcommand for installing skills from various sources.
Signature
Example
registerSkillsList(parent)
Registers theskills list subcommand for listing installed skills.
Signature
Example
registerSkillsRemove(parent)
Registers theskills remove subcommand for removing installed skills.
Signature
Example
registerSkillsUpdate(parent)
Registers theskills update subcommand for updating all outdated skills.
Signature
Example
validateSkill(filePath)
Validate a SKILL.md file against the Agent Skills standard. Signature
Returns — Validation result with issues and parsed metadata
Example
registerSkillsValidate(parent)
Registers theskills validate subcommand for validating SKILL.md file format.
Signature
Example
registerSkillsCommands(program)
Registers theskills command group with all skill management subcommands.
Signature
Example
isCaampOwnedSkill(skillName)
Check whether a skill name is reserved by CAAMP (ct-* prefix). Signature
Returns —
true if the skill name starts with ct-
Example
checkSkillIntegrity(skillName, providers, scope, projectDir)
Check the integrity of a single installed skill. Signature
Returns — Integrity check result
Example
checkAllSkillIntegrity(providers, scope, projectDir)
Check integrity of all tracked skills. Signature
Returns — Map of skill name to integrity result
Example
shouldOverrideSkill(skillName, incomingSource, existingEntry)
Resolve a skill name conflict where a user-installed skill collides with a CAAMP-owned (ct-*) skill. Signature
Returns —
true if the incoming installation should proceed
Example
validateInstructionIntegrity(providers, projectDir, scope, expectedContent)
Validate instruction file injection status across all providers. Signature
Returns — Array of file paths with issues
Example
resolveCantImports(content, projectRoot)
Resolve *.cant references in instruction file content. Scans each line for directives pointing to .cant files. For each match, reads and parses the .cant file, converts its definitions to markdown, and replaces the line with the generated content. Lines that don’t match the .cant import pattern are left unchanged. Signature
Returns — Resolved content, imported file list, and any errors
Example
cantToMarkdown(cantContent)
Convert a .cant file’s content to markdown equivalent. Parses the frontmatter to determine the document kind, then converts the body into structured markdown that providers can consume (headings, bullet lists, code blocks). Signature
Returns — Markdown representation of the .cant definitions
Example
discoverWellKnown(domain)
Discover skills from a well-known URL. Signature
Returns — Array of discovered skill entries
Example