data/tools/skill_tool library

Classes

PermissionRule
A permission rule matching content for a specific tool.
PermissionSuggestion
A suggestion for adding a permission rule.
PluginInfo
Plugin info for marketplace skills.
PluginManifest
Plugin manifest data.
SkillCommand
Represents a skill/slash command.
SkillInfo
Skill info summary.
SkillRegistry
Registry of available skills, supporting lookup by name or alias.
SkillTool
The SkillTool — executes skills (slash commands) in the conversation.
SkillToolForkedOutput
Output for forked skill execution.
SkillToolInlineOutput
Output for inline skill execution.
SkillToolInput
Input for the SkillTool.

Constants

charsPerToken → const int
Approximate characters per token for budget calculation.
defaultCharBudget → const int
Fallback: 1% of 200k tokens * 4 chars/token.
maxListingDescChars → const int
Per-entry hard cap. The listing is for discovery only — the Skill tool loads full content on invoke, so verbose whenToUse strings waste turn-1 cache_creation tokens without improving match rate.
minDescLength → const int
Minimum description length before going names-only.
skillBudgetContextPercent → const double
Skill listing gets 1% of the context window (in characters).
skillToolName → const String

Functions

extractUrlScheme(String url) String
Extract URL scheme for telemetry.
formatCommandsWithinBudget(List<SkillCommand> commands, {int? contextWindowTokens}) String
Format commands within the character budget, preserving bundled skill descriptions while truncating others as needed.
getCharBudget({int? contextWindowTokens, int? envOverride}) int
Calculate the character budget for skill descriptions.
isOfficialMarketplaceName(String? marketplace) bool
Check if a marketplace name is official.
isOfficialMarketplaceSkill(SkillCommand command) bool
Check if a skill command is from an official marketplace.
parseFrontmatter(String content) → ({String content, Map<String, String> frontmatter})
Parse YAML frontmatter from skill content. Returns the body content without frontmatter.
parsePluginIdentifier(String repository) → ({String? marketplace, String owner, String repo})
Parse a plugin identifier into its components. Format: "marketplace/owner/repo" or "owner/repo" or just "repo".
skillHasOnlySafeProperties(Map<String, dynamic> commandData) bool
Check if a skill command only uses safe properties (auto-allow).