Development
Command
/cache-clean
Clean Rust docs cache
Install
> /plugin marketplace add zhanghandong/rust-skills > /plugin install rust-skills@rust-skills
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/cache-clean
Context preview
What this command does when you run it.
Clean Rust docs cache
Command definition
cache-clean.mddescription: Clean Rust docs cache
argument-hint: [--all | --expired | crate_name]
Cache Clean
Clean cached Rust documentation.
Arguments: $ARGUMENTS
- `--all`: Remove all cached docs
- `--expired`: Remove only expired docs (default)
- `crate_name`: Remove cache for specific crate/item
---
Instructions
1. Parse Arguments
CACHE_DIR="$HOME/.claude/cache/rust-docs"
MODE="expired" # default
TARGET=""
for arg in $ARGUMENTS; do
case $arg in
--all) MODE="all" ;;
--expired) MODE="expired" ;;
*) TARGET="$arg" ;;
esac
done2. Clean Based on Mode
Mode: --all
if [ "$MODE" = "all" ]; then
echo "Removing all cached docs..."
rm -rf "$CACHE_DIR"/*
echo "Cache cleared."
exit 0
fiMode: --expired (default)
if [ "$MODE" = "expired" ]; then
echo "Removing expired cache entries..."
now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
count=0
for f in $(find "$CACHE_DIR" -name "*.json" -type f); do
exp=$(jq -r '.meta.expires_at' "$f" 2>/dev/null)
if [[ "$exp" < "$now" ]]; then
rm "$f"
((count++))
echo "Removed: ${f#$CACHE_DIR/}"
fi
done
# Clean empty directories
find "$CACHE_DIR" -type d -empty -delete 2>/dev/null
echo ""
echo "Removed $count expired entries."
exit 0
fiMode: specific target
if [ -n "$TARGET" ]; then
echo "Removing cache for: $TARGET"
# Search in all categories
found=0
for category in std docs.rs lib.rs clippy; do
target_dir="$CACHE_DIR/$category/$TARGET"
if [ -d "$target_dir" ]; then
rm -rf "$target_dir"
echo "Removed: $category/$TARGET/"
((found++))
fi
# Also check for files matching the target
for f in $(find "$CACHE_DIR/$category" -name "*$TARGET*" -type f 2>/dev/null); do
rm "$f"
echo "Removed: ${f#$CACHE_DIR/}"
((found++))
done
done
if [ $found -eq 0 ]; then
echo "No cache found for: $TARGET"
else
echo ""
echo "Removed $found items."
fi
exit 0
fi---
Output Format
--expired (default)
Removing expired cache entries...
Removed: docs.rs/tokio/task-fn.spawn.json
Removed: std/marker/trait.Send.json
Removed: lib.rs/serde.json
Removed 3 expired entries.
--all
Removing all cached docs...
Cache cleared.
specific target
Removing cache for: tokio
Removed: docs.rs/tokio/
Removed: lib.rs/tokio.json
Removed 2 items.
---
Example Usage
# Clean only expired entries (default)
/rust-skills:cache-clean
# Clean all cache
/rust-skills:cache-clean --all
# Clean specific crate cache
/rust-skills:cache-clean tokio
# Clean std library cache for specific item
/rust-skills:cache-clean Send
Read more
description: Clean Rust docs cache argument-hint: [--all | --expired | crate_name]
Cache Clean
Clean cached Rust documentation.
Arguments: $ARGUMENTS
- `--all`: Remove all cached docs
- `--expired`: Remove only expired docs (default)
- `crate_name`: Remove cache for specific crate/item
---
Instructions
1. Parse Arguments
CACHE_DIR="$HOME/.claude/cache/rust-docs"
MODE="expired" # default
TARGET=""
for arg in $ARGUMENTS; do
case $arg in
--all) MODE="all" ;;
--expired) MODE="expired" ;;
*) TARGET="$arg" ;;
esac
done2. Clean Based on Mode
Mode: --all
if [ "$MODE" = "all" ]; then
echo "Removing all cached docs..."
rm -rf "$CACHE_DIR"/*
echo "Cache cleared."
exit 0
fiMode: --expired (default)
if [ "$MODE" = "expired" ]; then
echo "Removing expired cache entries..."
now=$(date -u +%Y-%m-%dT%H:%M:%SZ)
count=0
for f in $(find "$CACHE_DIR" -name "*.json" -type f); do
exp=$(jq -r '.meta.expires_at' "$f" 2>/dev/null)
if [[ "$exp" < "$now" ]]; then
rm "$f"
((count++))
echo "Removed: ${f#$CACHE_DIR/}"
fi
done
# Clean empty directories
find "$CACHE_DIR" -type d -empty -delete 2>/dev/null
echo ""
echo "Removed $count expired entries."
exit 0
fiMode: specific target
if [ -n "$TARGET" ]; then
echo "Removing cache for: $TARGET"
# Search in all categories
found=0
for category in std docs.rs lib.rs clippy; do
target_dir="$CACHE_DIR/$category/$TARGET"
if [ -d "$target_dir" ]; then
rm -rf "$target_dir"
echo "Removed: $category/$TARGET/"
((found++))
fi
# Also check for files matching the target
for f in $(find "$CACHE_DIR/$category" -name "*$TARGET*" -type f 2>/dev/null); do
rm "$f"
echo "Removed: ${f#$CACHE_DIR/}"
((found++))
done
done
if [ $found -eq 0 ]; then
echo "No cache found for: $TARGET"
else
echo ""
echo "Removed $found items."
fi
exit 0
fi---
Output Format
--expired (default)
Removing expired cache entries... Removed: docs.rs/tokio/task-fn.spawn.json Removed: std/marker/trait.Send.json Removed: lib.rs/serde.json Removed 3 expired entries.
--all
Removing all cached docs... Cache cleared.
specific target
Removing cache for: tokio Removed: docs.rs/tokio/ Removed: lib.rs/tokio.json Removed 2 items.
---
Example Usage
# Clean only expired entries (default) /rust-skills:cache-clean # Clean all cache /rust-skills:cache-clean --all # Clean specific crate cache /rust-skills:cache-clean tokio # Clean std library cache for specific item /rust-skills:cache-clean Send
Ships withrust-skills
AI-powered Rust development assistant with meta-cognition framework
Get the whole plugin
Other commands on rust-skills.
- /achievement
View coding achievements, stats, and progress
Open command - /ai-daily
Generate AI daily/weekly news report from Reddit communities
Open command - /audit
Heavy-weight security and safety audit using os-checker tools.
Open command - /cache-status
Show Rust docs cache status
Open command - /clean-crate-skills
Remove local dynamic crate skills
Open command - /crate-info
Get information about a Rust crate including latest version, features, and changelog.
Open command

