-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Add $skill-name autocomplete functionality #10455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add Skill type to ContextMenuOptionType enum - Implement $ trigger detection anywhere after whitespace - Add insertSkill function for $skill-name insertion with metadata - Add skill-related message types (ExtensionMessage and WebviewMessage) - Update ChatTextArea to handle skill autocomplete (request/receive/display) - Update handleMentionSelect to use insertSkill for skill selection - Update ContextMenu component to render skill suggestions - Add requestSkills handler in ClineProvider to provide mode-filtered skills - Add send-time skill resolution to include SKILL.md content in prompts - Update highlight layer to visually highlight valid $skill-name tokens - Add comprehensive tests for skill autocomplete functionality - Skills are filtered by current mode and resolved at message send time - Skill content is attached as structured metadata for extension processing
Reviewed the $skill-name autocomplete implementation. Found 1 issue related to redundant file I/O and potential test mismatch. Issues
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| try { | ||
| // Read the full SKILL.md content | ||
| const skillContent = await fs.readFile(skillInfo.path, "utf-8") | ||
| parsedText += `\n\n<skill name="${skillName}">\n${skillContent}\n</skill>` | ||
| } catch (error) { | ||
| parsedText += `\n\n<skill name="${skillName}">\nError loading skill '${skillName}': ${error.message}\n</skill>` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads the skill content from the filesystem, but getSkillContent() already reads and parses the file (returning content in its instructions field). This creates two issues:
-
Redundant file I/O: The skill file is read twice - once in the validation loop via
getSkillContent()and again here. -
Test mismatch: The tests mock
getSkillContentto return skill metadata withinstructions, but this code ignores that and reads from the path directly. Since mocked paths like/path/to/skill/SKILL.mddon't exist,fs.readFilethrows and the tests would fail unlessfsis globally mocked.
Consider storing the skill content during validation and reusing it here, or using the instructions field from SkillContent.
| try { | |
| // Read the full SKILL.md content | |
| const skillContent = await fs.readFile(skillInfo.path, "utf-8") | |
| parsedText += `\n\n<skill name="${skillName}">\n${skillContent}\n</skill>` | |
| } catch (error) { | |
| parsedText += `\n\n<skill name="${skillName}">\nError loading skill '${skillName}': ${error.message}\n</skill>` | |
| } | |
| // Use the skill content that was already fetched during validation | |
| const skillFullContent = await skillsManager.getSkillContent(skillName, currentMode) | |
| if (skillFullContent) { | |
| parsedText += `\n\n<skill name="${skillName}">\n${skillFullContent.instructions}\n</skill>` | |
| } |
Fix it with Roo Code or mention @roomote and request a fix.
Implements
$autocomplete for Agent Skills in the chat textarea, similar to how/works for commands.Features
UI/UX
$trigger works anywhere in message after whitespace/newline (not just at start)$skill-nametokens in textareaBackend
requestSkillshandler provides mode-filtered skill list to webview$skill-nametokens are detected and SKILL.md content is included in the prompt$pdf-processingand$pdfprocessing)Implementation Details
Frontend Changes
Skilltype toContextMenuOptionTypeenumshouldShowContextMenu()to detect$triggerinsertSkill()function for$skill-nameinsertion with trailing spacegetContextMenuOptions()to handle$queries with fuzzy matchingChatTextAreato request and receive skills from extensionContextMenuto render skill suggestions with descriptionsskillRegexGlobalpattern for highlightingBackend Changes
Skillinterface toExtensionMessageandWebviewMessagetypesrequestSkillsmessage handler inwebviewMessageHandler.tsparseMentions()to detect and resolve$skill-nametokens<skill>XML blocksTests
shouldShowContextMenuwith$triggerinsertSkillbehaviorparseMentionsRelated
Implements the Slack discussion for skill autocomplete with:
$skill-name+ trailing spaceView task on Roo Code Cloud