agentleFS
ivangrynenkoivangrynenko/cursorrules/.cursor/rules/improve-cursorrules-efficiency.mdc

cursorrules / rules

Cursor rule88 starsChanged 13 months agoMITView on GitHub

AI Query Efficiency & Auto-Optimization

The file

We split this improve-cursorrules-efficiency.mdc into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use more specific or detailed prompts.

    line 28
  2. Distinctive:

    Use specific technical terminology for clearer communication.

    line 32
  3. Distinctive:

    Update rule suggestions to guide users towards more effective interactions.

    line 36
  4. Distinctive:

    Create new rules for frequently encountered patterns.

    line 37
  5. Distinctive:

    Ask for step-by-step approaches for complex problems

    line 53
  6. Distinctive:

    Use precise technical terms for your domain (Drupal, Lagoon, etc.)

    line 62
  7. Distinctive:

    Use file references when discussing specific code

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
improve-cursorrules-efficiency.mdc
---
description: AI Query Efficiency & Auto-Optimization
globs: *.mdc
---
# AI Query Efficiency & Auto-Optimization

Ensures Cursor analyzes AI query efficiency, detects repeated requests, and automatically updates relevant rules to improve response quality and reduce redundancy.

<rule>
name: ai_query_efficiency_optimization
description: Analyze AI query efficiency, optimize rules, and prevent repeated requests.
filters:
  # Match AI query interactions in supported files
  - type: file_extension
    pattern: "\\.(md|mdc|txt|json|py|js|ts|php|yaml|yml|cursorrules)$"
  # Match AI communication patterns indicating inefficiency or repetition
  - type: content
    pattern: "(?i)(retry|again|didn't work|not what I expected|try another way|improve|fix this|optimize|rewrite|regenerate)"

actions:
  - type: analyze
    conditions:
      - pattern: "(?i)(retry|again|fix this|not what I expected|didn't work|rewrite|regenerate)"
        message: "Detected inefficiencies or repeated requests. Initiating efficiency analysis..."
    execute: |
      - **Identify inefficiencies** in AI responses by comparing previous queries and results.
      - **Suggest improvements** in query structure or Cursor usage based on analysis:
        - Use more specific or detailed prompts.
        - Implement structured queries for complex tasks.
        - Provide feedback on past responses for better contextual understanding.
        - Break down complex tasks into smaller, more manageable steps.
        - Use specific technical terminology for clearer communication.
      - **Automatically update** relevant Cursor rules:
        - Enhance pattern recognition for similar future queries.
        - Adjust rule priorities or conditions to prevent repeat inefficiencies.
        - Update rule suggestions to guide users towards more effective interactions.
        - Create new rules for frequently encountered patterns.

  - type: suggest
    message: |
      ## Query Optimization Recommendations

      I notice you're making multiple requests for similar tasks. Here's how to optimize your AI interactions:

      ### 1. Refine Your Prompts
      - **Be more specific:** Include technical details, file paths, and exact requirements
      - **Use structured formats:** For complex requests, use bullet points or numbered lists
      - **Include context:** Mention relevant technologies, frameworks, or standards
      - **Set clear expectations:** Specify the format and level of detail you need

      ### 2. Break Down Complex Tasks
      - Split large tasks into smaller, focused requests
      - Ask for step-by-step approaches for complex problems
      - Request specific examples for unclear concepts

      ### 3. Provide Feedback
      - Tell the AI what worked and what didn't in previous responses
      - Clarify misunderstandings explicitly
      - Highlight successful parts of previous responses

      ### 4. Use Technical Terminology
      - Use precise technical terms for your domain (Drupal, Lagoon, etc.)
      - Reference specific functions, methods, or patterns
      - Mention relevant standards or best practices

      ### 5. Leverage Cursor Features
      - Use file references when discussing specific code
      - Reference line numbers for targeted changes
      - Utilize code blocks for examples

      The system will now optimize rules based on this interaction pattern to improve future responses.

  - type: auto_update
    target: ".cursor/rules/ai-optimization.mdc"
    conditions:
      - pattern: "(?i)(retry|again|fix this|not what I expected|not what I meant|didn't work|rewrite|regenerate)"
    message: "Updating AI efficiency rules based on detected inefficiencies or repeated queries."

  - type: log
    message: "AI Query Efficiency Analysis: [{{query_count}} queries in {{time_period}} detected inefficiency.]"
    conditions:
      - pattern: "(?i)(retry|again|fix this|not what I expected|didn't work|rewrite|regenerate)"

examples:
  - input: |
      "This Drupal module is not working, let's try again."
      "That didn't work, let's refine the approach."
      "Please rewrite this code to be more efficient."
    output: |
      Cursor detects inefficiency in queries and suggests:
      
      "I notice you're making multiple attempts. To get better results:
      1. Specify which part of the module isn't working
      2. Include any error messages you're seeing
      3. Mention the Drupal version and relevant modules
      4. Describe what you've already tried"

  - input: |
      "Generate a Lagoon configuration file."
      "This doesn't look right, regenerate it."
      "Try again with better practices."
    output: |
      Cursor detects repetition and suggests:
      
      "For better Lagoon configuration results:
      1. Specify which services you need (nginx, php, mariadb, etc.)
      2. Mention your project type (Drupal, WordPress, etc.)
      3. Include any specific environment requirements
      4. Reference any existing configuration you want to maintain"

metadata:
  priority: critical
  version: 1.2
</rule>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.