fix: improve skill system prompts and simplify tool descriptions

- Simplify skill-creator installation flow
- Refine skill selection prompt for better matching
- Add parameter alias and env variable hints for tools
- Skip linkai-agent when unconfigured
- Create skills/ dir in workspace on init
This commit is contained in:
zhayujie
2026-02-08 18:59:59 +08:00
parent cea7fb7490
commit 6c218331b1
13 changed files with 102 additions and 292 deletions

View File

@@ -1,91 +0,0 @@
---
name: bocha-search
description: High-quality web search with AI-optimized results. Use when user needs to search the internet for current information, news, or research topics.
homepage: https://open.bocha.cn/
metadata:
emoji: 🔍
requires:
bins: ["curl"]
env: ["BOCHA_API_KEY"]
primaryEnv: "BOCHA_API_KEY"
---
# Bocha Search
High-quality web search powered by Bocha AI, optimized for AI consumption. Returns web pages, images, and detailed metadata.
## Setup
This skill requires a Bocha API key. If not configured:
1. Visit https://open.bocha.cn to get an API key
2. Set the key using: `env_config(action="set", key="BOCHA_API_KEY", value="your-key")`
3. Or manually add to `~/cow/.env`: `BOCHA_API_KEY=your-key`
## Usage
**Important**: Scripts are located relative to this skill's base directory.
When you see this skill in `<available_skills>`, note the `<base_dir>` path.
```bash
# General pattern:
bash "<base_dir>/scripts/search.sh" "<query>" [count] [freshness] [summary]
# Parameters:
# - query: Search query (required)
# - count: Number of results (1-50, default: 10)
# - freshness: Time range filter (default: noLimit)
# Options: noLimit, oneDay, oneWeek, oneMonth, oneYear, YYYY-MM-DD..YYYY-MM-DD
# - summary: Include text summary (true/false, default: false)
```
## Examples
### Basic search
```bash
bash "<base_dir>/scripts/search.sh" "latest AI news"
```
### Search with more results
```bash
bash "<base_dir>/scripts/search.sh" "Python tutorials" 20
```
### Search recent content with summary
```bash
bash "<base_dir>/scripts/search.sh" "阿里巴巴ESG报告" 10 oneWeek true
```
### Search specific date range
```bash
bash "<base_dir>/scripts/search.sh" "tech news" 15 "2025-01-01..2025-02-01"
```
## Response Format
The API returns structured data compatible with Bing Search API:
**Web Pages** (in `data.webPages.value`):
- `name`: Page title
- `url`: Page URL
- `snippet`: Short description
- `summary`: Full text summary (if requested)
- `siteName`: Website name
- `siteIcon`: Website icon URL
- `datePublished`: Publication date (UTC+8)
- `language`: Page language
**Images** (in `data.images.value`):
- `contentUrl`: Image URL
- `hostPageUrl`: Source page URL
- `width`, `height`: Image dimensions
- `thumbnailUrl`: Thumbnail URL
## Notes
- **Optimized for AI**: Results include summaries and structured metadata
- **Time range**: Use `noLimit` for best results (algorithm auto-optimizes time range)
- **Timeout**: 30 seconds
- **Rate limits**: Check your API plan at https://open.bocha.cn
- **Response format**: Compatible with Bing Search API for easy integration

View File

@@ -1,75 +0,0 @@
#!/usr/bin/env bash
# Bocha Web Search API wrapper
# API Docs: https://open.bocha.cn/
set -euo pipefail
query="${1:-}"
count="${2:-10}"
freshness="${3:-noLimit}"
summary="${4:-false}"
if [ -z "$query" ]; then
echo '{"error": "Query is required", "usage": "bash search.sh <query> [count] [freshness] [summary]"}'
exit 1
fi
if [ -z "${BOCHA_API_KEY:-}" ]; then
echo '{"error": "BOCHA_API_KEY environment variable is not set", "help": "Visit https://open.bocha.cn to get an API key"}'
exit 1
fi
# Validate count (1-50)
if ! [[ "$count" =~ ^[0-9]+$ ]] || [ "$count" -lt 1 ] || [ "$count" -gt 50 ]; then
count=10
fi
# Build JSON request body
request_body=$(cat <<EOF
{
"query": "$query",
"count": $count,
"freshness": "$freshness",
"summary": $summary
}
EOF
)
# Call Bocha API
response=$(curl -sS --max-time 30 \
-X POST \
-H "Authorization: Bearer $BOCHA_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "$request_body" \
"https://api.bocha.cn/v1/web-search" 2>&1)
curl_exit_code=$?
if [ $curl_exit_code -ne 0 ]; then
echo "{\"error\": \"Failed to call Bocha API\", \"details\": \"$response\"}"
exit 1
fi
# Simple JSON validation - check if response starts with { or [
if [[ ! "$response" =~ ^[[:space:]]*[\{\[] ]]; then
echo "{\"error\": \"Invalid JSON response from API\", \"response\": \"$response\"}"
exit 1
fi
# Extract API code using grep and sed (basic JSON parsing)
api_code=$(echo "$response" | grep -o '"code"[[:space:]]*:[[:space:]]*[0-9]*' | grep -o '[0-9]*' | head -1)
# If code extraction failed or code is not 200, check for error
if [ -n "$api_code" ] && [ "$api_code" != "200" ]; then
# Try to extract error message
api_msg=$(echo "$response" | grep -o '"msg"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"msg"[[:space:]]*:[[:space:]]*"\(.*\)"/\1/' | head -1)
if [ -z "$api_msg" ]; then
api_msg="Unknown error"
fi
echo "{\"error\": \"API returned error\", \"code\": $api_code, \"message\": \"$api_msg\"}"
exit 1
fi
# Return the full response
echo "$response"

View File

@@ -1,6 +1,6 @@
---
name: skill-creator
description: Create or update skills. Use when designing, structuring, or packaging skills with scripts, references, and assets. COW simplified version - skills are used locally in workspace.
description: Create, install, or update skills in the workspace. Use when (1) installing a skill from a URL or remote source, (2) creating a new skill from scratch, (3) updating or restructuring existing skills. Always use this skill for any skill installation or creation task.
license: Complete terms in LICENSE.txt
---
@@ -93,9 +93,16 @@ Do NOT create auxiliary documentation files:
**Critical Rule**: Only create files that the agent will actually execute (scripts) or that are too large for SKILL.md (references). Documentation, examples, and guides ALL belong in SKILL.md.
## Skill Creation Process
## Installing a Skill from URL
**COW Simplified Version** - Skills are used locally, no packaging/sharing needed.
1. Fetch the URL content (curl or web-fetch skill)
2. Extract `name` from YAML frontmatter
3. Create directory `<workspace>/skills/<name>/` and save content as `SKILL.md`
4. Check the saved SKILL.md for an installation/setup section — if it defines additional steps (e.g., downloading scripts, installing dependencies), execute them; otherwise installation is complete
The `<workspace>` is the working directory from the "工作空间" section.
## Skill Creation Process (from scratch)
1. **Understand** - Clarify use cases with concrete examples
2. **Plan** - Identify needed scripts, references, assets
@@ -181,11 +188,13 @@ scripts/init_skill.py <skill-name> --path <output-directory> [--resources script
Examples:
```bash
scripts/init_skill.py my-skill --path ~/cow/skills
scripts/init_skill.py my-skill --path ~/cow/skills --resources scripts,references
scripts/init_skill.py my-skill --path ~/cow/skills --resources scripts --examples
scripts/init_skill.py my-skill --path <workspace>/skills
scripts/init_skill.py my-skill --path <workspace>/skills --resources scripts,references
scripts/init_skill.py my-skill --path <workspace>/skills --resources scripts --examples
```
Where `<workspace>` is your workspace directory shown in the "工作空间" section of the system prompt.
The script:
- Creates the skill directory at the specified path
@@ -195,7 +204,7 @@ The script:
After initialization, customize the SKILL.md and add resources as needed. If you used `--examples`, replace or delete placeholder files.
**Important**: Always create skills in workspace directory (`~/cow/skills`), NOT in project directory.
**Important**: Always create skills in workspace skills directory (`<workspace>/skills`), NOT in project directory. Check the "工作空间" section for the actual workspace path.
### Step 4: Edit the Skill
@@ -335,7 +344,7 @@ scripts/quick_validate.py <path/to/skill-folder>
Example:
```bash
scripts/quick_validate.py ~/cow/skills/weather-api
scripts/quick_validate.py <workspace>/skills/weather-api
```
Validation checks: