home / skills / laurigates / claude-plugins / analytics-clear

This skill clears all analytics data and starts fresh, ensuring clean tracking from the next command usage.

npx playbooks add skill laurigates/claude-plugins --skill analytics-clear

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.8 KB
---
model: haiku
description: Clear all analytics data and start fresh
args: "[--confirm]"
allowed-tools: Bash
argument-hint: "Use --confirm to skip confirmation prompt"
created: 2026-01-10
modified: 2026-01-10
reviewed: 2026-01-10
name: analytics-clear
---

# /analytics:clear

Reset all analytics data, removing tracking history and statistics.

## Context

Check if analytics data exists:

```bash
ANALYTICS_DIR="${HOME}/.claude-analytics"

if [[ -d "${ANALYTICS_DIR}" ]]; then
  SUMMARY_FILE="${ANALYTICS_DIR}/summary.json"
  if [[ -f "${SUMMARY_FILE}" ]]; then
    TOTAL=$(cat "${SUMMARY_FILE}" | jq -r '.total_invocations // 0')
    SINCE=$(cat "${SUMMARY_FILE}" | jq -r '.tracking_since // "unknown"')
    echo "Current analytics: ${TOTAL} invocations since ${SINCE}"
  fi
else
  echo "No analytics data to clear."
  exit 0
fi
```

## Parameters

- `$ARGS` - Optional `--confirm` flag to skip confirmation

## Execution

**Clear analytics data:**

```bash
ANALYTICS_DIR="${HOME}/.claude-analytics"
CONFIRM="${ARGS}"

if [[ "${CONFIRM}" != "--confirm" ]]; then
  echo "⚠️  This will permanently delete all analytics data."
  echo ""
  echo "This includes:"
  echo "  • All command/skill usage history"
  echo "  • Success/failure statistics"
  echo "  • Timing data"
  echo ""
  read -p "Are you sure? (yes/no): " RESPONSE

  if [[ "${RESPONSE}" != "yes" ]]; then
    echo "Cancelled."
    exit 0
  fi
fi

echo ""
echo "🗑️  Clearing analytics data..."

if [[ -d "${ANALYTICS_DIR}" ]]; then
  rm -rf "${ANALYTICS_DIR}"
  echo "✓ Analytics data cleared"
  echo ""
  echo "Analytics will start collecting again automatically."
else
  echo "No analytics data found."
fi
```

## Post-actions

None. Analytics tracking will automatically restart on next command/skill usage.

Overview

This skill clears all local analytics data and resets tracking so collection can start fresh. It removes stored usage history, aggregated statistics, and timing information from the analytics directory. Use it when you need to purge analytics for privacy, testing, or to reset baselines.

How this skill works

The skill checks a predefined analytics directory in the user's home folder for a summary file and reports current totals if present. When executed, it prompts for confirmation unless run with a --confirm flag, then deletes the analytics directory and its contents. Tracking resumes automatically on the next command or skill execution.

When to use it

  • You want to remove all local analytics for privacy or compliance reasons.
  • You need a clean slate for testing or benchmarking without historical data.
  • Analytics data is corrupted or inconsistent and should be rebuilt.
  • Preparing a demo or shared environment that must not contain prior usage.
  • After changing tracking configuration and wanting to reset collected metrics.

Best practices

  • Review current totals before clearing to preserve any needed metrics.
  • Export or save important summary.json data if you may need it later.
  • Use --confirm in scripts or CI to avoid interactive prompts.
  • Run the command during maintenance windows if analytics are used for live monitoring.
  • Ensure no parallel processes are writing to the analytics directory during deletion.

Example use cases

  • Run interactively to inspect current totals and then confirm deletion when preparing a demo machine.
  • Include analytics-clear --confirm in a teardown script for automated test environments.
  • Clear analytics after long-term accumulation to re-establish baseline metrics for a new release.
  • Purge analytics on developer workstations before handing them off or provisioning to a new user.

FAQ

Will tracking restart after clearing?

Yes. Analytics collection restarts automatically on the next command or skill usage once the directory is removed.

Can I run this non-interactively?

Yes. Pass the --confirm flag to skip the interactive confirmation prompt for scripted runs.