Skip to content

feat(cli): enable skill activation via slash commands#21758

Merged
NTaylorMullen merged 4 commits intomainfrom
ntm/skill-slash-commands
Mar 10, 2026
Merged

feat(cli): enable skill activation via slash commands#21758
NTaylorMullen merged 4 commits intomainfrom
ntm/skill-slash-commands

Conversation

@NTaylorMullen
Copy link
Copy Markdown
Collaborator

@NTaylorMullen NTaylorMullen commented Mar 9, 2026

Summary

This PR enables the ability to invoke agent skills directly via slash commands (e.g., /google-foo). It also supports optional follow-up prompts, where /<skill-name> hello world will activate the skill and then immediately submit "hello world" as a prompt to the model.

Details

  • SkillCommandLoader: A new loader in the CLI that registers all displayable agent skills as dynamic slash commands.
  • Implicit Confirmation: Updated the policy engine to skip user confirmation for client-initiated tool calls (like those from slash commands) when the policy decision is ASK_USER.
  • postSubmitPrompt: Enhanced ToolActionReturn and SlashCommandProcessorResult to support an optional prompt to be submitted after a tool call completes.
  • useGeminiStream: Updated the stream hook to handle postSubmitPrompt and trigger the model accordingly.

Related Issues

None.

How to Validate

  1. Create a dummy skill in .gemini/skills/my-test-skill/SKILL.md.
  2. Start the CLI.
  3. Verify that /my-test-skill appears in the slash command suggestions.
  4. Run /my-test-skill and observe it activates without a confirmation dialogue.
  5. Run /my-test-skill please help me with X and observe it activates the skill and then submits the prompt.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

- Register agent skills as dynamic slash commands using SkillCommandLoader
- Allow client-initiated tool calls to skip user confirmation if policy is ASK_USER
- Support follow-up prompt in skill slash commands via postSubmitPrompt
- Add tests for SkillCommandLoader and policy bypass
@NTaylorMullen NTaylorMullen requested a review from a team as a code owner March 9, 2026 19:51
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the CLI's interactivity by integrating agent skills directly into the slash command system. Users can now activate skills with a simple command and optionally provide an immediate follow-up prompt, creating a more fluid conversational experience. The changes also refine the policy engine to intelligently handle client-initiated tool calls, reducing friction by skipping redundant confirmation steps for actions explicitly requested by the user through slash commands.

Highlights

  • Skill Activation via Slash Commands: Introduced the ability to activate agent skills directly through slash commands in the CLI (e.g., /google-foo), making skill invocation more intuitive and accessible.
  • Optional Follow-Up Prompts: Enabled support for providing an optional follow-up prompt immediately after a skill is activated via a slash command (e.g., /skill-name hello world), streamlining multi-step interactions.
  • Implicit Confirmation for Client-Initiated Tool Calls: Updated the policy engine to automatically allow client-initiated tool calls (like those from slash commands) when the policy decision would normally be ASK_USER, bypassing unnecessary user confirmation prompts.
  • New SkillCommandLoader: Implemented a new SkillCommandLoader service that dynamically registers displayable agent skills as slash commands within the CLI, ensuring all available skills are discoverable.
  • Enhanced Tool Action and Slash Command Results: Extended ToolActionReturn and SlashCommandProcessorResult interfaces to include an optional postSubmitPrompt field, facilitating the submission of additional prompts after a tool call.
  • Stream Hook Integration: Modified the useGeminiStream hook to correctly process and submit the postSubmitPrompt after a scheduled tool call completes, ensuring the follow-up prompt is handled as intended.
Changelog
  • packages/cli/src/services/SkillCommandLoader.test.ts
    • Added comprehensive unit tests for the new SkillCommandLoader to ensure its functionality, including handling disabled skills support, missing skill manager, admin-disabled skills, and correct command loading and action execution with and without follow-up prompts.
  • packages/cli/src/services/SkillCommandLoader.ts
    • Introduced the SkillCommandLoader class, responsible for discovering and converting agent skills into executable slash commands.
    • Implemented logic to check for enabled skills support and admin status before loading skills.
    • Mapped displayable skills to SlashCommand objects, including dynamic descriptions and an action that returns a tool action with an optional postSubmitPrompt.
  • packages/cli/src/ui/commands/types.ts
    • Extended the CommandKind enum with a new SKILL type to categorize skill-related slash commands.
  • packages/cli/src/ui/hooks/slashCommandProcessor.ts
    • Imported the new SkillCommandLoader.
    • Registered SkillCommandLoader with the CommandService to enable dynamic loading of skill commands.
    • Updated the schedule_tool type within SlashCommandProcessorResult to include the postSubmitPrompt property.
  • packages/cli/src/ui/hooks/useGeminiStream.ts
    • Modified the useGeminiStream hook to extract the postSubmitPrompt from slashCommandResult when scheduling a tool.
    • Added logic to conditionally set localQueryToSendToGemini and proceed with a new query if postSubmitPrompt is present after a tool call.
  • packages/cli/src/ui/types.ts
    • Added an optional postSubmitPrompt property to the SlashCommandProcessorResult type for schedule_tool actions, allowing for follow-up prompts.
  • packages/core/src/commands/types.ts
    • Introduced an optional postSubmitPrompt property to the ToolActionReturn interface, enabling tools to specify a prompt to be submitted after their execution.
  • packages/core/src/scheduler/policy.test.ts
    • Added new test cases to policy.test.ts to verify the behavior of checkPolicy when isClientInitiated is true, ensuring ASK_USER decisions are converted to ALLOW while DENY decisions are maintained.
  • packages/core/src/scheduler/policy.ts
    • Modified the checkPolicy function to automatically change a PolicyDecision.ASK_USER outcome to PolicyDecision.ALLOW if the tool call request is marked as isClientInitiated, effectively bypassing user confirmation for client-driven actions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

Size Change: +1.86 kB (+0.01%)

Total Size: 26.2 MB

Filename Size Change
./bundle/gemini.js 25.7 MB +1.86 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ability to activate agent skills using slash commands, which is a great usability improvement. The implementation correctly adds a new SkillCommandLoader and propagates a postSubmitPrompt for follow-up queries. The logic to implicitly confirm user-initiated tool calls by bypassing the ASK_USER policy step is also implemented correctly. My main feedback is a high-severity issue regarding the handling of skill names that contain spaces, which would make them impossible to invoke as slash commands. I've suggested a fix to sanitize skill names to ensure they are valid command identifiers, consistent with other parts of the codebase.

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 9, 2026
@NTaylorMullen NTaylorMullen added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 5d21376 Mar 10, 2026
27 checks passed
@NTaylorMullen NTaylorMullen deleted the ntm/skill-slash-commands branch March 10, 2026 19:45
JaisalJain pushed a commit to JaisalJain/gemini-cli that referenced this pull request Mar 11, 2026
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
SUNDRAM07 pushed a commit to SUNDRAM07/gemini-cli that referenced this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants