mcpField
A
analytics-unused

analytics-unused

github.com/laurigatesAgent 工作流5946 次安装1 天前更新
代码仓库

关于 analytics-unused

用于从 Claude 分析数据中找出从未调用过的命令和技能的技能。可帮助发现未使用的功能或清理插件;没有分析数据时无法判断。

主要功能

  1. 01检查分析摘要文件是否存在
  2. 02识别未调用的命令和技能
  3. 03用于发现闲置功能或插件

适用场景

  1. 01找出从未使用的命令
  2. 02清理未使用的技能或插件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/laurigates/claude-plugins --skill analytics-unused

安装后在 Claude Code 中输入/analytics-unused确认已加载。

详细介绍

/analytics:unused

识别从未调用过的命令和技能,帮助你发现未使用的功能或清理未使用的插件。

上下文

检查分析功能是否可用:

if [[ ! -f ~/.claude-analytics/summary.json ]]; then
  echo "No analytics data yet. Cannot determine unused commands/skills."
  exit 0
fi

执行

扫描未使用的命令和技能:

ANALYTICS_DIR="${HOME}/.claude-analytics"
SUMMARY_FILE="${ANALYTICS_DIR}/summary.json"

echo "🔍 Scanning for unused commands and skills..."
echo ""

# Get list of used commands/skills
if [[ -f "${SUMMARY_FILE}" ]]; then
  USED=$(cat "${SUMMARY_FILE}" | jq -r '.items | keys[]')
else
  USED=""
fi

# Find all command files in plugins
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Unused Commands"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""

UNUSED_COUNT=0

# Scan for skill files
find . -type f \( -name "SKILL.md" -o -name "skill.md" \) -not -path "*/node_modules/*" 2>/dev/null | while read -r cmd_file; do
  # Extract command name from filename
  # Format: plugin-name/commands/plugin-command.md -> plugin:command
  BASENAME=$(basename "$cmd_file" .md)

  # Try to extract command name from frontmatter
  CMD_NAME=$(grep -A 20 "^---$" "$cmd_file" | grep "^# /" | head -1 | sed 's/^# \///' || echo "")

  if [[ -z "$CMD_NAME" ]]; then
    # Fallback: derive from filename (e.g., analytics-report.md -> analytics:report)
    CMD_NAME=$(echo "$BASENAME" | sed 's/-/:/' | sed 's/-/:/')
  fi

  # Check if command has been used
  if ! echo "$USED" | grep -q "^${CMD_NAME}$"; then
    echo "  📝 /${CMD_NAME}"
    echo "     File: ${cmd_file}"
    echo ""
    UNUSED_COUNT=$((UNUSED_COUNT + 1))
  fi
done

if [[ $UNUSED_COUNT -eq 0 ]]; then
  echo "  All commands have been used! 🎉"
  echo ""
fi

# Find all skill files
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Unused Skills"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""

UNUSED_SKILLS=0

find . -type f -path "*/skills/*/skill.md" -not -path "*/node_modules/*" 2>/dev/null | while read -r skill_file; do
  # Extract skill name from directory name
  SKILL_DIR=$(dirname "$skill_file")
  SKILL_NAME=$(basename "$SKILL_DIR")

  # Try to get skill name from frontmatter
  FRONTMATTER_NAME=$(grep -A 5 "^---$" "$skill_file" | grep "^name:" | head -1 | sed 's/^name: *//' || echo "")

  if [[ -n "$FRONTMATTER_NAME" ]]; then
    SKILL_NAME="$FRONTMATTER_NAME"
  fi

  # Check if skill has been used
  if ! echo "$USED" | grep -qi "$SKILL_NAME"; then
    echo "  🎯 ${SKILL_NAME}"
    echo "     File: ${skill_file}"
    echo ""
    UNUSED_SKILLS=$((UNUSED_SKILLS + 1))
  fi
done

if [[ $UNUSED_SKILLS -eq 0 ]]; then
  echo "  All skills have been used! 🎉"
  echo ""
fi

echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""

if [[ $UNUSED_COUNT -eq 0 && $UNUSED_SKILLS -eq 0 ]]; then
  echo "✨ All commands and skills have been used at least once!"
else
  echo "💡 Consider:"
  echo "  • Trying out unused features to see if they're helpful"
  echo "  • Removing plugins you never use"
  echo "  • Sharing useful commands with your team"
fi

echo ""

后续操作

无。

评论

支持 Markdown