Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .cursor/rules/coding.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
alwaysApply: true
description: Cursor Coding Rules
---

# Contributing Rules for Agents

## Overview

sentry-java is the Java and Android SDK for Sentry. This repository contains the source code and examples for SDK usage.

## Tech Stack

- **Language**: Java and Kotlin
- **Build Framework**: Gradle

## Key Commands

```bash
# Format code and regenerate .api files
./gradlew spotlessApply apiDump

# Run all tests and linter
./gradlew check

# Run unit tests for a specific file
./gradle ':<module>:testDebugUnitTest' --tests="*<file name>*" --info
```

## Contributing Guidelines

1. Follow existing code style and language
2. Do not modify the API files (e.g. sentry.api) manually, instead run `./gradlew apiDump` to regenerate them
3. Write comprehensive tests
4. New features should always be opt-in by default, extend `SentryOptions` or similar Option classes with getters and setters to enable/disable a new feature
5. Consider backwards compatibility

## Coding rules

1. First think through the problem, read the codebase for relevant files, and propose a plan
2. Before you begin working, check in with me and I will verify the plan
3. Then, begin working on the todo items, marking them as complete as you go
4. Please do not describe every step of the way and just give me a high level explanation of what changes you made
5. Make every task and code change you do as simple as possible. We want to avoid making any massive or complex changes. Every change should impact as little code as possible. Everything is about simplicity.
6. Once you're done, format the code and regenerate the .api files using the following command `./gradlew spotlessApply apiDump`
7. As a last step, git stage the relevant files and propose (but not execute) a single git commit command (e.g. `git commit -m "<git commit message>"`)


## Useful Resources

- Main SDK documentation: https://develop.sentry.dev/sdk/overview/
- Internal contributing guide: https://docs.sentry.io/internal/contributing/
- Git commit messages conventions: https://develop.sentry.dev/engineering-practices/commit-messages/
Loading