Skip to content

feat(skills): hierarchical skill optimization and search command#507

Open
dumko2001 wants to merge 11 commits intogoogleworkspace:mainfrom
dumko2001:feature/issue-82-skill-optimization
Open

feat(skills): hierarchical skill optimization and search command#507
dumko2001 wants to merge 11 commits intogoogleworkspace:mainfrom
dumko2001:feature/issue-82-skill-optimization

Conversation

@dumko2001
Copy link

Description

This PR implements hierarchical skill optimization to solve the context-pollution problem raised in #82. Instead of loading all 40+ API service skills at once, we now use a "Discovery-First" architecture inspired by Claude and GitHub Copilot.

Key changes:

  • Hierarchical Structure: High-level Personas and Recipes remain in the root skills/ directory, while granular technical references for individual services/helpers are moved to skills/references/.
  • gws skills search <query>: A new command for semantic/keyword discovery of tools. This allows agents to find the right skill without pre-loading the entire library.
  • Enhanced gws-shared: Restored all safety rails (zsh expansion, JSON quoting) and added a "Discovery & Search" section.
  • Automated Generation: Refactored generate-skills to handle the new hierarchy and update all internal Markdown cross-references automatically.
  • Cleanup: Removed 188 committed Markdown files (6,000+ lines of bloat) from the repository.

Dry Run Output:
(Since gws skills search is a local discovery tool, it does not produce a JSON API request. Here is the command output instead):

$ gws skills search "email"
Searching for skills matching "email"...

[Service] gws-gmail - Send, read, and manage email
  Reference: skills/references/gws-gmail/SKILL.md

[Recipe] recipe-label-and-archive-emails - Label and Archive Gmail Threads
  Description: Apply Gmail labels to matching messages and archive them to keep your inbox clean.
  Skill: skills/recipe-label-and-archive-emails/SKILL.md
...
Found 8 matching skills.

Checklist:

  • My code follows the AGENTS.md guidelines (no generated google-* crates).
  • I have run cargo fmt --all to format the code perfectly.
  • I have run cargo clippy -- -D warnings and resolved all warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have provided a Changeset file (e.g. via pnpx changeset) to document my changes.

@dumko2001 dumko2001 requested a review from jpoehnelt as a code owner March 15, 2026 18:27
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: 20e4c25

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@googleworkspace-bot googleworkspace-bot added area: skills area: docs area: core Core CLI parsing, commands, error handling, utilities labels Mar 15, 2026
@gemini-code-assist
Copy link
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 skill management system by introducing a hierarchical structure and a powerful search capability. The changes aim to optimize agent performance by reducing unnecessary context loading and improving the discoverability of specific tools. This refactoring also streamlines the skill generation process and cleans up the repository by removing redundant files.

Highlights

  • Hierarchical Skill Structure: Implemented a new hierarchical organization for skills, moving granular technical references for individual services and helpers into a skills/references/ subdirectory to reduce context pollution for agents.
  • New Skill Search Command: Introduced a gws skills search <query> command, enabling semantic and keyword-based discovery of tools without pre-loading the entire skill library.
  • Enhanced gws-shared Skill: Restored essential safety features like zsh expansion and JSON quoting in the gws-shared skill and added a dedicated 'Discovery & Search' section to its documentation.
  • Automated Skill Generation Refactoring: Refactored the generate-skills logic to automatically handle the new hierarchical structure, update internal Markdown cross-references, and include a new link checking script.
  • Repository Cleanup: Removed 188 committed Markdown files, significantly reducing repository bloat by over 6,000 lines.
Changelog
  • .changeset/skill-optimization.md
    • Added a new changeset file detailing the hierarchical skill discovery and search command implementation.
  • .gitignore
    • Modified to ignore the skills/ directory, reflecting the new generated nature of many skill files.
  • check_links.py
    • Added a new Python script to validate local Markdown links within the skills/ and docs/ directories.
  • docs/skills.md
    • Updated the skill index to reflect the new hierarchical structure, renaming 'Services' and 'Helpers' sections to 'Services (Reference)' and 'Helpers (Reference)' respectively.
    • Adjusted all skill paths to point to the new skills/references/ subdirectory for service and helper skills.
    • Added a new 'Shared Patterns' section for the gws-shared skill.
  • skills/gws-shared/SKILL.md
    • Modified to include a new 'Discovery & Search' section with examples for using the gws skills search command.
  • skills/persona-content-creator/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-customer-support/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-event-coordinator/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-exec-assistant/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-hr-coordinator/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-it-admin/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-project-manager/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-researcher/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-sales-ops/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/persona-team-lead/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-backup-sheet-as-csv/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-batch-invite-to-event/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-block-focus-time/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-bulk-download-folder/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-collect-form-responses/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-compare-sheet-tabs/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-copy-sheet-for-new-month/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-classroom-course/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-doc-from-template/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-events-from-sheet/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-expense-tracker/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-feedback-form/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-gmail-filter/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-meet-space/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-presentation/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-shared-drive/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-task-list/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-create-vacation-responder/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-draft-email-from-doc/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-email-drive-link/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-find-free-time/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-find-large-files/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-forward-labeled-emails/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-generate-report-from-sheet/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-label-and-archive-emails/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-log-deal-update/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-organize-drive-folder/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-plan-weekly-schedule/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-post-mortem-setup/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-reschedule-meeting/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-review-meet-participants/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-review-overdue-tasks/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-save-email-attachments/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-save-email-to-doc/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-schedule-recurring-event/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-send-team-announcement/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-share-doc-and-notify/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-share-event-materials/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-share-folder-with-team/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-sync-contacts-to-sheet/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/recipe-watch-drive-changes/SKILL.md
    • Updated required skill paths in metadata and prerequisite text to use the new references/gws-* format.
  • skills/references/gws-admin-reports/SKILL.md
    • Renamed from skills/gws-admin-reports/SKILL.md to skills/references/gws-admin-reports/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-calendar-agenda/SKILL.md
    • Renamed from skills/gws-calendar-agenda/SKILL.md to skills/references/gws-calendar-agenda/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-calendar.
  • skills/references/gws-calendar-insert/SKILL.md
    • Renamed from skills/gws-calendar-insert/SKILL.md to skills/references/gws-calendar-insert/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-calendar.
  • skills/references/gws-calendar/SKILL.md
    • Renamed from skills/gws-calendar/SKILL.md to skills/references/gws-calendar/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-chat-send/SKILL.md
    • Renamed from skills/gws-chat-send/SKILL.md to skills/references/gws-chat-send/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-chat.
  • skills/references/gws-chat/SKILL.md
    • Renamed from skills/gws-chat/SKILL.md to skills/references/gws-chat/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-classroom/SKILL.md
    • Renamed from skills/gws-classroom/SKILL.md to skills/references/gws-classroom/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-docs-write/SKILL.md
    • Renamed from skills/gws-docs-write/SKILL.md to skills/references/gws-docs-write/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-docs.
  • skills/references/gws-docs/SKILL.md
    • Renamed from skills/gws-docs/SKILL.md to skills/references/gws-docs/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-drive-upload/SKILL.md
    • Renamed from skills/gws-drive-upload/SKILL.md to skills/references/gws-drive-upload/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-drive.
  • skills/references/gws-drive/SKILL.md
    • Renamed from skills/gws-drive/SKILL.md to skills/references/gws-drive/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-events-renew/SKILL.md
    • Renamed from skills/gws-events-renew/SKILL.md to skills/references/gws-events-renew/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-events.
  • skills/references/gws-events-subscribe/SKILL.md
    • Renamed from skills/gws-events-subscribe/SKILL.md to skills/references/gws-events-subscribe/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-events.
  • skills/references/gws-events/SKILL.md
    • Renamed from skills/gws-events/SKILL.md to skills/references/gws-events/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-forms/SKILL.md
    • Renamed from skills/gws-forms/SKILL.md to skills/references/gws-forms/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-gmail-forward/SKILL.md
    • Renamed from skills/gws-gmail-forward/SKILL.md to skills/references/gws-gmail-forward/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail-reply-all/SKILL.md
    • Renamed from skills/gws-gmail-reply-all/SKILL.md to skills/references/gws-gmail-reply-all/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail-reply/SKILL.md
    • Renamed from skills/gws-gmail-reply/SKILL.md to skills/references/gws-gmail-reply/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail-send/SKILL.md
    • Renamed from skills/gws-gmail-send/SKILL.md to skills/references/gws-gmail-send/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail-triage/SKILL.md
    • Renamed from skills/gws-gmail-triage/SKILL.md to skills/references/gws-gmail-triage/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail-watch/SKILL.md
    • Renamed from skills/gws-gmail-watch/SKILL.md to skills/references/gws-gmail-watch/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-gmail.
  • skills/references/gws-gmail/SKILL.md
    • Renamed from skills/gws-gmail/SKILL.md to skills/references/gws-gmail/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-keep/SKILL.md
    • Renamed from skills/gws-keep/SKILL.md to skills/references/gws-keep/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-meet/SKILL.md
    • Renamed from skills/gws-meet/SKILL.md to skills/references/gws-meet/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-modelarmor-create-template/SKILL.md
    • Renamed from skills/gws-modelarmor-create-template/SKILL.md to skills/references/gws-modelarmor-create-template/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-modelarmor.
  • skills/references/gws-modelarmor-sanitize-prompt/SKILL.md
    • Renamed from skills/gws-modelarmor-sanitize-prompt/SKILL.md to skills/references/gws-modelarmor-sanitize-prompt/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-modelarmor.
  • skills/references/gws-modelarmor-sanitize-response/SKILL.md
    • Renamed from skills/gws-modelarmor-sanitize-response/SKILL.md to skills/references/gws-modelarmor-sanitize-response/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-modelarmor.
  • skills/references/gws-modelarmor/SKILL.md
    • Renamed from skills/gws-modelarmor/SKILL.md to skills/references/gws-modelarmor/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-people/SKILL.md
    • Renamed from skills/gws-people/SKILL.md to skills/references/gws-people/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-sheets-append/SKILL.md
    • Renamed from skills/gws-sheets-append/SKILL.md to skills/references/gws-sheets-append/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-sheets.
  • skills/references/gws-sheets-read/SKILL.md
    • Renamed from skills/gws-sheets-read/SKILL.md to skills/references/gws-sheets-read/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-sheets.
  • skills/references/gws-sheets/SKILL.md
    • Renamed from skills/gws-sheets/SKILL.md to skills/references/gws-sheets/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-slides/SKILL.md
    • Renamed from skills/gws-slides/SKILL.md to skills/references/gws-slides/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-tasks/SKILL.md
    • Renamed from skills/gws-tasks/SKILL.md to skills/references/gws-tasks/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • skills/references/gws-workflow-email-to-task/SKILL.md
    • Renamed from skills/gws-workflow-email-to-task/SKILL.md to skills/references/gws-workflow-email-to-task/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-workflow.
  • skills/references/gws-workflow-file-announce/SKILL.md
    • Renamed from skills/gws-workflow-file-announce/SKILL.md to skills/references/gws-workflow-file-announce/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-workflow.
  • skills/references/gws-workflow-meeting-prep/SKILL.md
    • Renamed from skills/gws-workflow-meeting-prep/SKILL.md to skills/references/gws-workflow-meeting-prep/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-workflow.
  • skills/references/gws-workflow-standup-report/SKILL.md
    • Renamed from skills/gws-workflow-standup-report/SKILL.md to skills/references/gws-workflow-standup-report/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-workflow.
  • skills/references/gws-workflow-weekly-digest/SKILL.md
    • Renamed from skills/gws-workflow-weekly-digest/SKILL.md to skills/references/gws-workflow-weekly-digest/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared and gws-workflow.
  • skills/references/gws-workflow/SKILL.md
    • Renamed from skills/gws-workflow/SKILL.md to skills/references/gws-workflow/SKILL.md.
    • Updated relative paths for gws-shared and other cross-references to reflect the new directory structure.
    • Added a 'See Also' section linking to gws-shared.
  • src/generate_skills.rs
    • Modified handle_generate_skills to categorize gws-shared as 'shared' instead of 'service'.
    • Added filtering logic to handle_generate_skills to skip services that do not match a specified filter, improving generation efficiency.
    • Updated calls to write_skill to include a new is_reference boolean parameter.
    • Modified the write_skill function to conditionally create skill directories under skills/references/ for reference skills.
    • Updated write_skills_index to include a 'Shared Patterns' section and adjust paths for 'Service' and 'Helper' skills to point to the references/ subdirectory.
    • Adjusted cross-reference paths in render_service_skill and render_helper_skill to use ../../gws-shared/SKILL.md and added a 'See Also' section to service skills.
    • Updated render_persona_skill and render_recipe_skill to reference required skills using the references/gws-{s} format.
  • src/main.rs
    • Added a new module skills_search.
    • Integrated handle_skills_command to process the new gws skills command.
    • Updated the print_usage function to include the new gws skills search <query> command and an example.
  • src/skills_search.rs
    • Added a new module implementing the gws skills search command.
    • Provided functionality to semantically search through service, persona, and recipe descriptions.
Activity
  • dumko2001 created the pull request with a detailed description outlining the problem (context pollution) and the proposed solution (hierarchical skill optimization and search command).
  • The pull request includes a dry run output demonstrating the functionality of the new gws skills search command.
  • The author has completed all checklist items, including code formatting, linting, adding tests, and providing a Changeset file.
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 Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 a hierarchical structure for skills to address context pollution, along with a new gws skills search command for discovery. The changes are extensive, refactoring the skill generation logic and updating numerous skill definition files.

My review has identified a few issues:

  • A critical bug in the new check_links.py script that prevents it from correctly identifying most local links.
  • A high-severity issue in the same script where file encoding is not specified, which could lead to errors on different operating systems.
  • A high-severity typo in .gitignore that will prevent the skills/ directory from being ignored correctly.

I've provided suggestions to fix these issues. The rest of the changes, particularly the refactoring of the Rust code for skill generation and the updates to the markdown files, appear to be correct and consistent with the goals of the pull request.

@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 a significant and well-executed refactoring to implement a hierarchical skill structure, moving granular API skills into a references/ subdirectory to solve context pollution. It also adds a new gws skills search <query> command for skill discovery. The changes are extensive, including updates to the skill generation logic, documentation, and numerous skill files, but they appear consistent and correct. I have one high-severity suggestion regarding error handling in the new search functionality to make it more robust against silent failures.

@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 a significant and well-executed refactoring of the skill management system. The move to a hierarchical skill structure and on-demand generation is a great improvement for maintainability and reduces repository bloat. The new gws skills search command is a valuable addition for discoverability. The code changes are generally of high quality, with improved error handling in the generation script. I have one high-severity suggestion regarding code duplication to further improve the long-term maintainability of the new search functionality.

@googleworkspace-bot
Copy link
Collaborator

/gemini review

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@dumko2001
Copy link
Author

/gemini review

Copy link
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 a significant and well-executed refactoring of the skill management system, moving to a hierarchical structure to address context pollution. The addition of the gws skills search command is a valuable enhancement for discoverability. The code changes are generally of high quality, with notable improvements in error handling within the skill generation logic and better code organization by introducing a registry module. I have identified one high-severity issue in the new search command's argument parsing that could lead to incorrect behavior for multi-word queries, and I've provided a suggestion for a fix.

Copy link
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 a significant and well-executed refactoring of the skill structure to be hierarchical, which should help with agent context pollution. The addition of the gws skills search command is a great step towards improving skill discoverability. The code changes are mostly clean and the refactoring of generate_skills.rs improves modularity and error handling. I've found one high-severity issue in the new search functionality that should be addressed.

@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 a hierarchical skill structure to address context pollution, along with a new gws skills search command for skill discovery. The changes are extensive, refactoring skill generation logic, updating all skill definitions, and adding a new link checker script. My review focuses on the new functionality and refactoring. I've found a high-severity issue in the argument parsing of the new skills search command that should be addressed.

Add explicit --help/-h handling to `handle_skills_command` so that
`gws skills --help` and `gws skills search --help` print a proper
help screen instead of treating the flag as a search query.

Keeps the same manual dispatch pattern as all other top-level commands
in main.rs rather than introducing a full clap subcommand tree for a
single new command.
@googleworkspace-bot
Copy link
Collaborator

/gemini review

@dumko2001
Copy link
Author

Summary of all Gemini review fixes

Addressed all reviewer feedback across the 4 review rounds:

Round 1 (on initial commit):

  • check_links.py: Fixed link regex to correctly resolve relative paths ([text](path)) and skip HTTP(S) links in-loop
  • check_links.py: Added encoding='utf-8' to open() to prevent UnicodeDecodeError on Windows
  • .gitignore: Fixed missing newline before skills/ entry so it is correctly recognized as its own pattern

Round 2 (error handling):

  • skills_search.rs / generate_skills.rs: Replaced silent if let Ok YAML parsing with explicit .map_err(...)? propagation so malformed registry files surface as real errors

Round 3 (code duplication):

  • ✅ Centralized PersonaRegistry, PersonaEntry, RecipeRegistry, RecipeEntry, PERSONAS_YAML, and RECIPES_YAML into a new src/registry.rs module; both generate_skills.rs and skills_search.rs now import from it

Round 4 (multi-word queries):

  • skills_search.rs: Replaced .get(1) with args[1..].join(" ") so gws skills search send email works without quotes

Round 5 (helper skills missing from search):

  • ✅ Added dynamic helper search: iterates all services, calls helpers::get_helper + inject_commands with a minimal RestDescription, and matches +cmd subcommands by name and description

Round 6 (latest — --help not handled):

  • ✅ Added print_skills_help() with proper USAGE / DESCRIPTION / ARGUMENTS / EXAMPLES output; both gws skills --help and gws skills search --help now print it and return Ok(()) instead of treating the flag as a query

All 630 tests pass. cargo clippy -- -D warnings is clean.

Copy link
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 a hierarchical structure for skills to reduce context pollution for agents, along with a new gws skills search command for discovery. The refactoring of skills into a references subdirectory is well-executed across the markdown files and the generation script.

Per CLI convention, invoking a subcommand with no arguments should display
usage/help rather than return an error. Since 'gws skills --help', 'gws skills',
and 'gws skills <unknown-subcommand>' all indicate the user wants guidance,
route all non-search invocations to print_skills_help() and return Ok(()).
@googleworkspace-bot
Copy link
Collaborator

/gemini review

Replace single-string substring match with a token-AND approach: split the
query into individual tokens and require all tokens to appear somewhere in
the combined fields (name + description + aliases).

Previously, `gws skills search send email` built the query string "send email"
and required that exact contiguous phrase to appear in a field. This failed
for descriptions like "Gmail: Send an email" where the words are present but
not adjacent. With token-AND matching, both tokens must match anywhere across
the combined text, which is the correct behavior for natural-language queries.
@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 a hierarchical skill structure to solve context pollution for AI agents, and adds a gws skills search command for discovery. The changes are extensive, refactoring skill generation, updating all skill definitions, and implementing the new search functionality. The implementation is solid and consistently applied across the codebase. The addition of a link checker script is a good step towards maintaining documentation quality. I've identified one high-severity issue in this new script where it can fail to parse markdown links that include a title, potentially causing it to miss broken links.

Copy link
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 a hierarchical skill structure to optimize agent performance and adds a new gws skills search command for discovery. The changes are well-executed, including refactoring the skill generation logic, updating all markdown links, and improving error handling. My main feedback concerns a performance and architectural issue in the new skill search and generation logic. The current method for discovering helper commands is inefficient as it dynamically builds command structures at runtime. I've suggested creating a static registry for helpers to improve performance and maintainability.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 a significant and valuable improvement by restructuring the skills into a hierarchical system and adding a new gws skills search command for discovery. This effectively addresses the context-pollution problem. The refactoring of the skill generation logic in generate_skills.rs is well-executed, and the introduction of the registry module improves code organization. The changes are consistent and the new search functionality is a great addition. I have one high-severity suggestion regarding adding tests for the new search functionality to ensure its long-term maintainability and correctness.

- check_links.py: strip optional title from markdown link paths so
  links like `[text](path "title")` resolve correctly
- registry.rs: add HelperMeta struct and HELPERS static const as single
  source of truth for helper command metadata
- skills_search.rs: replace runtime clap::Command construction with
  HELPERS registry iteration; extract token_matches() for unit testing;
  add 7 unit tests covering single/multi-token, case, cross-field,
  no-match, and empty-token cases
- generate_skills.rs: replace build_cli() helper-filter loop with
  HELPERS registry iteration, eliminating redundant CLI tree construction
@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 hierarchical skill optimization and a new search command to improve the gws CLI. The changes include restructuring the skills directory, adding a gws skills search command, enhancing gws-shared, automating artifact generation, and cleaning up committed Markdown files. The review focuses on ensuring the new structure and search functionality work as intended, and that the code adheres to best practices.

let service_md =
render_service_skill(alias, entry, &helpers, &resources, &product_name, &doc);
write_skill(output_path, &skill_name, &service_md)?;
write_skill(output_path, &skill_name, &service_md, true)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

high

high

Suggested change
write_skill(output_path, &skill_name, &service_md, true)?;
write_skill(output_path, &skill_name, &service_md, false);

Copy link
Author

Choose a reason for hiding this comment

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

Declining this suggestion — the true flag is intentional and correct. write_skill(..., true) routes output to skills/references/{name}/SKILL.md, which is the core feature of this PR (hierarchical structure). Changing it to false would write service skills back into skills/{name}/SKILL.md, reverting the hierarchical layout entirely. The ? is also kept to propagate I/O errors rather than silently swallowing them.

let helper_md =
render_helper_skill(alias, helper_name, helper, entry, &product_name);
write_skill(output_path, &helper_skill_name, &helper_md)?;
write_skill(output_path, &helper_skill_name, &helper_md, true)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

high

high

Suggested change
write_skill(output_path, &helper_skill_name, &helper_md, true)?;
write_skill(output_path, &helper_skill_name, &helper_md, false);

Copy link
Author

Choose a reason for hiding this comment

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

Same as above — declining this suggestion. Helper skills are also part of the hierarchical structure and must go into skills/references/gws-{service}-{helper}/SKILL.md. Using is_reference: false here would break that. The ? stays to propagate errors correctly.

@dumko2001
Copy link
Author

/gemini review

Copy link
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 a hierarchical structure for skills, moving service and helper skills into a references/ subdirectory, and implements a gws skills search command for discovery. Key changes include refactoring the skill generation logic in src/generate_skills.rs to support the new structure and filtering, updating skill documentation and metadata paths across numerous .md files, and adding new modules (src/registry.rs, src/skills_search.rs) for centralized skill metadata and search functionality. A check_links.py script was also added for link validation. The review comments point out that the persona and recipe skills' metadata and prerequisite text still incorrectly reference the old skill paths and need to be updated to reflect the new references directory.

.services
.iter()
.map(|s| format!("\"gws-{s}\""))
.map(|s| format!("\"references/gws-{s}\""))
Copy link
Contributor

Choose a reason for hiding this comment

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

high

high: The persona skills should reference the skills in the references directory.

Suggested change
.map(|s| format!("\"references/gws-{s}\""))
.map(|s| format!("\"references/gws-{s}\""

Copy link
Author

Choose a reason for hiding this comment

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

This is already implemented — the current code at line 778 already reads .map(|s| format\!("\"references/gws-{s}\"")). The diff you're reviewing shows the old line (gws-{s}) removed and the new line (references/gws-{s}) added as part of this PR.

.services
.iter()
.map(|s| format!("\"gws-{s}\""))
.map(|s| format!("\"references/gws-{s}\""))
Copy link
Contributor

Choose a reason for hiding this comment

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

high

high: The recipe skills should reference the skills in the references directory.

Suggested change
.map(|s| format!("\"references/gws-{s}\""))
.map(|s| format!("\"references/gws-{s}\""

Copy link
Author

Choose a reason for hiding this comment

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

Same as above — already implemented. Line 848 already reads .map(|s| format\!("\"references/gws-{s}\"")). The suggestion matches what this PR already puts in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Core CLI parsing, commands, error handling, utilities area: docs area: skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants