skills/ → skills-dev(9), skills-req(10), skills-ops(4), skills-integration(8), skills-biz(4), skills-workflow(7) generate-marketplace.py 改为自动扫描所有 skills-* 目录。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
129 lines
4.2 KiB
Markdown
129 lines
4.2 KiB
Markdown
---
|
|
name: search-sessions
|
|
description: Search saved Claude sessions by title, tags, date, or content
|
|
---
|
|
|
|
# Search Sessions Skill
|
|
|
|
You are now in session search mode. Your task is to help the user find saved conversations.
|
|
|
|
## Instructions
|
|
|
|
1. **Read Index**: Load `~/.claude/sessions/index.json` to get the list of all sessions
|
|
- If file doesn't exist, inform user no sessions have been saved yet
|
|
|
|
2. **Parse Search Query**: Understand what the user is looking for:
|
|
- Keywords in title or summary
|
|
- Specific tags (e.g., "react", "bug-fix", "authentication")
|
|
- Date range (e.g., "last week", "January 2026", "today")
|
|
- Combination of filters
|
|
- Special flags like "--all" to show all results
|
|
|
|
3. **Search Logic**:
|
|
- First search in index.json (fast search by title, tags, date, summary preview)
|
|
- If user needs full content search, load individual session JSON files from `~/.claude/sessions/`
|
|
- Support case-insensitive search
|
|
- Support partial matches
|
|
- Score results by relevance
|
|
|
|
4. **Display Results**: Show matching sessions in a clear, readable format:
|
|
```
|
|
🔍 Found 3 sessions matching "react":
|
|
|
|
1. [2026-01-20_1430] Implement Dark Mode Toggle Feature
|
|
📅 2026-01-20 14:30 | 🏷️ react, css, ui, feature
|
|
💡 Added dark mode toggle to application settings...
|
|
|
|
2. [2026-01-19_1015] Debug Memory Leak in React Component
|
|
📅 2026-01-19 10:15 | 🏷️ react, debugging, performance
|
|
💡 Investigated and fixed memory leak caused by...
|
|
|
|
3. [2026-01-18_1600] Setup Authentication with JWT
|
|
📅 2026-01-18 16:00 | 🏷️ authentication, jwt, security
|
|
💡 Implemented JWT-based authentication system...
|
|
|
|
To reload a session: /reload-session <id>
|
|
```
|
|
|
|
5. **Advanced Search**:
|
|
- Support filtering by multiple tags: "react AND authentication"
|
|
- Support OR logic: "react OR vue"
|
|
- Support date ranges: "between 2026-01-01 and 2026-01-20"
|
|
- Support exclusion: "react NOT bug"
|
|
- Support tag-specific search: "tag:authentication"
|
|
|
|
## Search Examples
|
|
|
|
**By keyword:**
|
|
- `search sessions about react` → Search for "react" in title, tags, and summary
|
|
|
|
**By date:**
|
|
- `find sessions from last week` → Filter by date range (last 7 days)
|
|
- `sessions from January` → Filter by month
|
|
- `sessions today` → Today's sessions only
|
|
|
|
**By tag:**
|
|
- `search sessions tagged authentication` → Filter by specific tag
|
|
- `sessions with tag:bug-fix` → Explicit tag search
|
|
|
|
**List all:**
|
|
- `list all sessions` → Show all sessions (newest first)
|
|
- `show recent sessions` → Show last 10 sessions
|
|
|
|
**Combined:**
|
|
- `search react sessions from last month` → Keyword + date filter
|
|
- `find authentication AND api sessions` → Multiple tags
|
|
|
|
## Important Notes
|
|
|
|
- Show most recent sessions first by default
|
|
- Limit initial results to 10, offer to show more with --all flag
|
|
- If no matches found, suggest related searches or show recent sessions
|
|
- Provide the session ID clearly so user can reload it
|
|
- Display dates in human-readable format (e.g., "2 days ago", "last week")
|
|
- If only one result found, offer to load it automatically
|
|
|
|
## Example Output Formats
|
|
|
|
**Multiple results:**
|
|
```
|
|
🔍 Found 5 sessions matching "authentication":
|
|
|
|
1. [2026-01-20_1430] Setup OAuth2 Integration
|
|
📅 Jan 20, 14:30 (today) | 🏷️ oauth, authentication, api
|
|
💡 Integrated OAuth2 provider for third-party login...
|
|
|
|
2. [2026-01-18_1600] Implement JWT Authentication
|
|
📅 Jan 18, 16:00 (2 days ago) | 🏷️ jwt, authentication, security
|
|
💡 Built JWT-based auth system with refresh tokens...
|
|
|
|
Showing 2 of 5 results. Use "/search-sessions authentication --all" to see all.
|
|
To reload: /reload-session <id>
|
|
```
|
|
|
|
**No results:**
|
|
```
|
|
🔍 No sessions found matching "xyz"
|
|
|
|
Suggestions:
|
|
- Try different keywords
|
|
- Check spelling
|
|
- Use broader search terms
|
|
|
|
Recent sessions:
|
|
1. [2026-01-20_1430] Implement Dark Mode Toggle Feature
|
|
2. [2026-01-19_1015] Debug Memory Leak in React Component
|
|
...
|
|
```
|
|
|
|
**Single result:**
|
|
```
|
|
🔍 Found 1 session matching "oauth":
|
|
|
|
[2026-01-20_1430] Setup OAuth2 Integration
|
|
📅 Jan 20, 14:30 (today) | 🏷️ oauth, authentication, api
|
|
💡 Integrated OAuth2 provider for third-party login...
|
|
|
|
Would you like to reload this session? (/reload-session 2026-01-20_1430)
|
|
```
|