AgentSkillsCN

workspace-search

在工作区的所有项目中搜索模式,并按项目分组呈现结果。当用户说“跨项目搜索”“在所有仓库中查找”或“在工作区中进行grep搜索”时,可使用此技能。

SKILL.md
--- frontmatter
name: workspace-search
description: Search for patterns across all projects in the workspace with results grouped by project. Use when user says "search across projects", "find in all repos", or "grep workspace".

Skill: Workspace Search

Description

Search for patterns across all projects in the workspace. Results are grouped by project.

Arguments

  • <query> - The search pattern (supports regex)
  • --type <ext> - Filter by file type (e.g., --type ts)
  • --files - Show only file names, not content

Instructions

When the user wants to search across projects:

Step 1: Get Search Query

Parse the search query from the command arguments.

Step 2: Identify Projects

Get all cloned projects from the workspace configuration.

Step 3: Execute Search

For each project, run a search using ripgrep (rg) or grep:

bash
rg "$query" "$project_path" --heading --line-number

Step 4: Format Results

Group results by project:

code
🔍 Searching for "TODO" across workspace...

📁 api (12 matches)
  src/controllers/auth.ts:45:    // TODO: Add rate limiting
  src/services/email.ts:23:      // TODO: Use template engine
  src/middleware/auth.ts:78:     // TODO: Implement refresh tokens

📁 admin (5 matches)
  src/components/Dashboard.tsx:34:  {/* TODO: Add loading state */}
  src/hooks/useAuth.ts:12:          // TODO: Handle token expiry

📁 homepage (0 matches)

Summary:
  • Total matches: 17
  • Projects searched: 3

Options

  • File type filter: /workspaces:search "TODO" --type ts - Only TypeScript files
  • Files only: /workspaces:search "config" --files - Show only file paths