TL;DR
This paper investigates how developers provide context to AI coding assistants beyond simple prompts, analyzing "cursor rules" in open-source projects. They found developers use a rich taxonomy of context, often mirroring traditional documentation practices but also introducing LLM-specific directives, highlighting the evolving landscape of human-AI collaboration in software development.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly used in software engineering, but their effectiveness hinges not just on explicit prompts but also on the surrounding context. For complex software projects, this context is crucial for guiding LLMs to produce relevant and accurate code that aligns with project-specific constraints, conventions, and goals. While AI coding assistants are introducing features for developers to author persistent, machine-readable directives (like "cursor rules") to encode this context, the content and nature of these directives have remained largely unstudied. This paper aims to fill this gap by empirically characterizing this developer-provided context.
Methods
The researchers conducted a large-scale qualitative study of 401 open-source repositories containing "cursor rules" (specifically, .mdc files used by the Cursor IDE). They employed thematic analysis, iteratively coding the content of these rules to develop a comprehensive taxonomy. To scale the analysis, they leveraged a large language model (LLM) to assist in coding, validating its performance against human coders. They then analyzed how the types and prevalence of context vary across different programming languages and application domains.
Datasets
The study analyzed a dataset of 401 open-source repositories that contained developer-authored cursor rule files (.mdc). These repositories were collected using Sourcegraph and filtered to exclude forked, archived, or non-English repositories, as well as those with irrelevant or template-only rule files. The dataset comprised repositories created between 2008 and 2025, with a median creation date in 2023.
Key Insights and Ideas
- Beyond the Prompt: Developers are actively shaping AI behavior through structured, persistent context beyond simple prompts.
- Familiarity and Novelty: Much of the context provided in cursor rules mirrors traditional software documentation (e.g., project overviews, conventions). However, a distinct category of "LLM Directives" emerges, offering instructions specifically for AI behavior and workflows, akin to prompt engineering techniques.
- Context Varies by Language and Domain: The type and amount of context provided differ significantly based on the programming language (e.g., more context for dynamic languages like JavaScript) and application domain (e.g., more examples for complex domains like data analysis).
- Duplication is Common: A substantial portion of cursor rule lines (28.7%) were found to be duplicated, suggesting developers often reuse existing templates or documentation, potentially indicating uncertainty about what context is truly necessary or accessible to the AI.
- Evolution Over Time: Newer projects tend to include more LLM-specific directives, suggesting developers are becoming more aware of tailoring context for AI, while older projects lean more towards general documentation.
Key Results
The study identified five high-level categories of context provided in cursor rules: Project, Convention, Guideline, LLM Directive, and Example.
- Project context (describing the software project) was the most prevalent, found in 85% of repositories.
- Guideline context (prescriptive instructions) was also highly common (89% of repositories).
- Convention context (standards for writing code) was present in 84% of repositories.
- LLM Directive context (instructions for the AI) was less frequent, appearing in about 50% of repositories, suggesting this is a newer area for developers.
- Example context was found in 50% of repositories.
Analysis revealed that:
- Developers provide more context for dynamic languages (e.g., JavaScript, PHP) than statically typed ones (e.g., Go, Java).
- PHP projects received the most overall context, possibly due to its diverse coding styles.
- C# projects showed a higher proportion of LLM-related context.
- JavaScript and TypeScript projects most frequently included examples.
- Complex application domains like data analysis and web development provided more examples.
- Approximately 28.7% of all lines in cursor rules were duplicated.
- Repositories with newer cursor rules (added closer to project creation) showed a slight increase in LLM Directives, while older projects focused more on general context.
Limitations and Future Work
The authors acknowledge several limitations:
- Generalizability: The study focused solely on
.mdcfiles for the Cursor IDE, which may not represent all forms of developer-provided context for other AI coding assistants. - Early Adoption Bias: The dataset might overrepresent early adopters of cursor rules, potentially not reflecting sustained or evolved usage patterns.
- LLM Bias: The use of an LLM for coding introduced potential biases.
- Correlation: The strong correlation between programming language and application domain could confound findings.
Future work suggested includes:
- Context Transparency: Developing tools to help developers understand what context is already accessible to the AI.
- Context-Aware Rule Generation: Creating tools that automatically generate more tailored and effective cursor rules based on project characteristics.
- Efficacy of Rules: Quantitatively evaluating the impact of different context types on LLM performance.
- Longitudinal Studies: Tracking the evolution of cursor rule usage over time.
- Broader AI Assistants: Studying rules for other AI coding assistants to validate and extend findings.
- Education: Developing educational materials to guide developers on best practices for providing context to AI.
Summary updated