feat: add comprehensive skills and agents for Rust development (#1573)

This commit is contained in:
安正超
2026-01-21 20:45:39 +08:00
committed by GitHub
parent 47ec125589
commit 0320508f8d
113 changed files with 16838 additions and 284 deletions
+71
View File
@@ -0,0 +1,71 @@
# Web Fetch Strategy
Common web fetching strategy for anti-crawler handling.
## Site Classification
| Type | Examples | Characteristics |
|------|----------|-----------------|
| Anti-crawler | Reddit, Twitter/X, LinkedIn | Need login or browser fingerprint |
| Regular | blog.rust-lang.org, docs.rs | No anti-crawler, direct fetch |
## Fetch Priority
```
Anti-crawler sites: Local Chrome → crawl4ai MCP → give up and mark
Regular sites: WebFetch → crawl4ai MCP
```
## Tools
### 1. Local Chrome (for anti-crawler)
User's real browser with login and normal fingerprint.
**macOS:**
```bash
# Open URL
osascript -e 'tell application "Google Chrome" to open location "URL"'
# Get page HTML
osascript -e 'tell application "Google Chrome" to execute front window'\''s active tab javascript "document.documentElement.outerHTML"'
```
### 2. crawl4ai MCP (fallback)
Strong anti-crawler bypass, needs Docker.
```
mcp__crawl4ai__scrape(url: "URL")
```
### 3. WebFetch (regular sites)
Built-in tool, simple and fast, no anti-crawler capability.
## Site Routing
| Domain | Tool | Reason |
|--------|------|--------|
| reddit.com | Local Chrome | Strict anti-crawler |
| twitter.com / x.com | Local Chrome | Needs login |
| linkedin.com | Local Chrome | Strict anti-crawler |
| *.rust-lang.org | WebFetch | No anti-crawler |
| docs.rs | WebFetch | No anti-crawler |
| crates.io | WebFetch | No anti-crawler |
| this-week-in-rust.org | WebFetch | No anti-crawler |
| rustfoundation.org | WebFetch | No anti-crawler |
| github.com | WebFetch | Light rate limit |
## Failure Handling
1. Local Chrome fails → try crawl4ai
2. crawl4ai fails → try WebFetch
3. All fail → mark "Fetch failed: {reason}"
## Validation
After fetch, check:
- Content is not empty
- Not an error page (403, 429, "blocked")
- Contains expected data
+26
View File
@@ -0,0 +1,26 @@
# browser-fetcher
Generic web content fetcher.
## Fetch
Use available tools:
- agent-browser (preferred)
- WebFetch (fallback)
## Output
```markdown
## Fetched Content
**URL:** <url>
**Title:** <title>
<content>
```
## Validation
1. Content is not empty
2. Not an error page (403, 429, blocked)
3. On failure: report reason
+49
View File
@@ -0,0 +1,49 @@
# clippy-researcher
Fetch Clippy lint information.
## URL
`rust-lang.github.io/rust-clippy/stable/index.html#<lint_name>`
## Fetch
Use available tools to get clippy docs.
## Lint Categories
| Category | Description |
|----------|-------------|
| correctness | Definite bugs |
| style | Code style |
| complexity | Overly complex |
| perf | Performance |
| pedantic | Strict checks |
## Output
```markdown
## clippy::<lint_name>
**Level:** warn/deny/allow
**Category:** <category>
**What:** <what it checks>
**Why:** <why it's a problem>
**Bad:**
\`\`\`rust
<code triggering lint>
\`\`\`
**Good:**
\`\`\`rust
<fixed code>
\`\`\`
```
## Validation
1. Content contains lint name
2. Has "What it does" or similar description
3. On failure: "Lint does not exist or fetch failed"
+31
View File
@@ -0,0 +1,31 @@
# crate-researcher
Fetch crate metadata from lib.rs / crates.io.
## Fetch
Use available tools:
- lib.rs (preferred, more info): `lib.rs/crates/<name>`
- crates.io (fallback): `crates.io/crates/<name>`
## Output
```markdown
## <Crate Name>
**Version:** <latest>
**Description:** <short>
**Features:**
- `feature1`: desc
**Links:**
- docs.rs | crates.io | repo
```
## Validation
1. Content contains version number
2. Not a "crate not found" page
3. Has description
4. On failure: "Crate does not exist or fetch failed"
+41
View File
@@ -0,0 +1,41 @@
# docs-cache
Documentation cache helper for agents.
## Cache Directory
```
~/.claude/cache/rust-docs/
├── docs.rs/{crate}/{item}.json
├── std/{module}/{item}.json
├── releases.rs/{version}.json
├── lib.rs/{crate}.json
└── clippy/{lint}.json
```
## TTL by Source
| Source | TTL | Reason |
|--------|-----|--------|
| std/ | 30 days | Stable |
| docs.rs/ | 7 days | Crate updates |
| releases.rs/ | 365 days | Historical |
| lib.rs/ | 1 day | Version changes |
| clippy/ | 14 days | Rust version updates |
## Cache Format
```json
{
"meta": {
"url": "...",
"fetched_at": "2025-01-01T00:00:00Z",
"expires_at": "2025-01-08T00:00:00Z"
},
"content": { ... }
}
```
## Skip Cache
Keywords: refresh, force, --force, update docs
+45
View File
@@ -0,0 +1,45 @@
# docs-researcher
Fetch third-party crate documentation from docs.rs.
> For std library (std::*), use `std-docs-researcher` instead.
## Fetch
Use available tools to get docs.rs content:
- agent-browser if available
- WebFetch otherwise
**URL format:** `docs.rs/<crate>/latest/<crate>/<path>`
## Cache
Location: `~/.claude/cache/rust-docs/docs.rs/{crate}/{item}.json`
TTL: 7 days
Skip cache if user says "refresh", "force", or "--force".
## Output
```markdown
## <Crate>::<Item>
**Signature:**
\`\`\`rust
<signature>
\`\`\`
**Description:** <main doc>
**Example:**
\`\`\`rust
<usage>
\`\`\`
```
## Validation
1. Content is not empty
2. Not a 404 page (check for "Not Found" or empty docblock)
3. Contains signature or description
4. On failure: report "Fetch failed: {reason}"
+38
View File
@@ -0,0 +1,38 @@
# rust-changelog
Fetch Rust version changelog from releases.rs.
## URL
`releases.rs/docs/<version>/` (e.g., `1.85`, `1.84.1`)
## Fetch
Use available tools to get releases.rs content.
## Output
```markdown
## Rust <Version> Release Notes
**Release Date:** <date>
### Language Features
- feature: desc
### Standard Library
- new/stabilized API: desc
### Cargo
- change: desc
### Breaking Changes
- note: desc
```
## Validation
1. Content contains version number
2. Has "Language" or "Features" sections
3. Not "version not found"
4. On failure: "Version {v} does not exist or fetch failed"
+65
View File
@@ -0,0 +1,65 @@
# Rust Daily Reporter
Aggregate Rust news, filter by time range.
## Data Sources (Required)
| Category | URL |
|----------|-----|
| Ecosystem | https://www.reddit.com/r/rust/hot/ |
| Ecosystem | https://this-week-in-rust.org/ |
| Official | https://blog.rust-lang.org/ |
| Official | https://blog.rust-lang.org/inside-rust/ |
| Foundation | https://rustfoundation.org/media/category/news/ |
| Foundation | https://rustfoundation.org/media/category/blog/ |
| Foundation | https://rustfoundation.org/events/ |
## Parameters
- `time_range`: day | week | month
- `category`: all | ecosystem | official | foundation
## Fetch Strategy
See: `_shared/fetch-strategy.md`
| Source | Tool |
|--------|------|
| Reddit | Local Chrome → crawl4ai |
| Others | WebFetch |
## Time Filter
| Range | Filter |
|-------|--------|
| day | Last 24 hours |
| week | Last 7 days |
| month | Last 30 days |
## Output
```markdown
# Rust {Day|Week|Month} Report
**Time:** {start} - {end} | **Generated:** {now}
## Ecosystem
### Reddit r/rust
| Score | Title | Link |
### This Week in Rust
- Issue #{number} ({date}): highlights
## Official
| Date | Title | Summary |
## Foundation
| Date | Title | Summary |
```
## Validation (Required)
1. Check each source has results
2. Mark "No updates" if empty
3. Retry with different tool on failure
4. Report reason if all fail
+55
View File
@@ -0,0 +1,55 @@
# std-docs-researcher
Fetch Rust std library documentation from doc.rust-lang.org.
## URL Patterns
| Type | URL |
|------|-----|
| Trait | `doc.rust-lang.org/std/marker/trait.Send.html` |
| Struct | `doc.rust-lang.org/std/sync/struct.Arc.html` |
| Module | `doc.rust-lang.org/std/collections/index.html` |
| Function | `doc.rust-lang.org/std/mem/fn.replace.html` |
## Common Paths
| Item | Path |
|------|------|
| Send, Sync, Copy, Clone | `std/marker/trait.<Name>.html` |
| Arc, Mutex, RwLock | `std/sync/struct.<Name>.html` |
| RefCell, Cell | `std/cell/struct.<Name>.html` |
| Vec | `std/vec/struct.Vec.html` |
| Option, Result | `std/<name>/enum.<Name>.html` |
## Fetch
Use available tools to get doc.rust-lang.org content.
## Cache
Location: `~/.claude/cache/rust-docs/std/{module}/{item}.json`
TTL: 30 days (std is stable)
## Output
```markdown
## std::<Item>
**Signature:**
\`\`\`rust
<signature>
\`\`\`
**Description:** <main doc>
**Key Points:**
- point 1
- point 2
```
## Validation
1. Content is not empty
2. Not a 404 page
3. Contains signature or docblock
4. On failure: "Fetch failed: {reason}, see doc.rust-lang.org"