Cursor rule to track how often rules are used

This rule explains how to create and update an analytics.md file to track how often .mdc rules is being used.
Back to rules
Type
Integration
Stats
294 views
24 copies
14 downloads
Author
Elie Steinbock
Elie Steinbock
rule-analytics.mdc
---
description: This rule explains how to create and update an analytics.md file to track how often .mdc rules is being used.
globs: *
alwaysApply: false
---

# Cursor Rules Analytics

Each time you use a Cursor rule, update the analytics tracking file.

File location:
```
PROJECT_ROOT/.cursor/analytics.md
```

## Format

The analytics file contains a count of how many times each rule has been used:

```
rule-name.mdc: 5
another-rule.mdc: 2
```

Add new rules as needed.

Track rule usage with automated analytics for your Cursor projects. This rule manages a centralized analytics file that keeps count of how often each Cursor rule is being used, providing visibility into which rules are most valuable to your workflow.

What this rule does

The Cursor Rules Analytics rule creates and maintains a simple tracking system that automatically counts how many times each rule in your project has been used. It works by updating a dedicated analytics file within your project's .cursor directory each time a rule is invoked.

The analytics data is stored in a straightforward format—a list of rule filenames paired with their usage counts:

rule-name.mdc: 5
another-rule.mdc: 2

This provides a quick way to see which rules are most frequently used in your workflow, helping you understand which rules provide the most value.

How the analytics tracking works

When the rule is activated, it checks for the existence of an analytics file at .cursor/analytics.md in your project's root directory. If the file doesn't exist, it creates one. Each time a rule is used, the counter for that specific rule is incremented in the analytics file.

The system is designed to be:

  • Simple: Plain text format that's easy to read
  • Persistent: Analytics are stored in your project, making them available across sessions
  • Extensible: New rules are automatically added to the tracking list

Using Cursor Rules Analytics in Cursor

The rule is stored in the file rule-analytics.mdc and can be activated in Cursor based on its glob pattern configuration:

Since this rule has a glob pattern of *, it's configured as an "Auto Attached" rule that activates automatically whenever you're working with any file in your project. This means the analytics tracking should work without manual intervention.

If you need to invoke it manually for any reason, you can do so by typing @rule-analytics in the chat or Command-K interface.

The automatic nature of this rule makes it particularly valuable—once configured, you can simply work as usual while the rule silently tracks which rules are being used most frequently.

Usage tips

Reviewing analytics data

To check which rules are being used most often:

  1. Open the analytics file at .cursor/analytics.md in your project
  2. Rules are listed with their usage counts in descending order
  3. Use this information to identify your most valuable rules

Leveraging analytics insights

  • Refine frequently used rules: If certain rules show high usage, consider optimizing them further for even greater productivity
  • Share valuable rules: When you see rules with high usage counts, consider sharing them with teammates
  • Prune unused rules: Rules with consistently low counts might be candidates for removal or revision

Version control considerations

Since the analytics file lives in the .cursor directory, you may want to:

  • Include it in version control to share analytics across your team
  • Exclude it if you prefer to keep usage tracking personal

By monitoring rule usage through this analytics system, you can make more informed decisions about which rules to invest time in improving and which might be unnecessary for your workflow.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later