-
Notifications
You must be signed in to change notification settings - Fork 12
Update cursor rules #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+112
−2
Merged
Update cursor rules #489
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| We setup Cursor context rules to help give useful information to agents. For more info see: | ||
| https://docs.cursor.com/en/context/rules | ||
|
|
||
| https://cursor.com/docs/context/rules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| description: Core coding standards - explicit naming and fail-fast error handling | ||
| alwaysApply: true | ||
| --- | ||
|
|
||
| # Coding Standards | ||
|
|
||
| ## Use Explicit Variable Names | ||
|
|
||
| Never abbreviate variable names unless the abbreviation is universally understood in the domain | ||
| (e.g. `i` for a loop index, `e` in a catch block, `url`, `id`, `config`). | ||
| Shortened names reduce readability and make code harder to search and refactor. | ||
| It is ok to shorten or abbreviate names to avoid shadowing other variables. | ||
|
|
||
| ```python | ||
| # BAD - unclear abbreviation | ||
| for nt in node_types: | ||
| et = edge_type_map.get(nt) | ||
|
|
||
| # GOOD - explicit and readable | ||
| for node_type in node_types: | ||
| edge_type = edge_type_map[node_type] | ||
| ``` | ||
|
|
||
| When in doubt, spell it out. | ||
|
|
||
| ## Fail Fast on Invalid State | ||
|
|
||
| Surface errors immediately when invariants are violated. | ||
| Do not silently swallow errors, return defaults, or skip logic when the situation is genuinely unexpected. | ||
|
|
||
| ### Dict Access | ||
|
|
||
| Use `dict[key]` (bracket access) when the key **must** exist. | ||
| Only use `dict.get(key, default)` when the absence of a key is a valid, expected case with a meaningful default. | ||
|
|
||
| ```python | ||
| # BAD - silently returns None when the key is missing, hiding bugs downstream | ||
| value = config.get("required_setting") | ||
|
|
||
| # GOOD - raises KeyError immediately, surfacing the real problem | ||
| value = config["required_setting"] | ||
|
|
||
| # OK - .get() is correct when absence is an expected, handled case | ||
| value = optional_overrides.get("timeout", DEFAULT_TIMEOUT) | ||
| ``` | ||
|
|
||
| ### Validate Preconditions Early | ||
|
|
||
| Check invariants at function entry. Prefer raising an explicit exception over silently continuing | ||
| with bad data. | ||
|
|
||
| ```python | ||
| # BAD - silently skips work on invalid input | ||
| def process_batch(batch): | ||
| if batch: | ||
| ... | ||
|
|
||
| # GOOD - fails immediately with a clear message | ||
| def process_batch(batch): | ||
| if not batch: | ||
| raise ValueError("process_batch received an empty batch") | ||
| ... | ||
| ``` | ||
|
|
||
| ## Verify Features Before Submitting | ||
|
|
||
| Once a feature is code complete, verify it works by running the type checker and relevant tests. | ||
| Do not skip these steps or suppress errors with workarounds like `# type: ignore`. | ||
|
|
||
| ### Type Checking | ||
|
|
||
| Run the type checker to ensure all type annotations are correct: | ||
|
|
||
| ```bash | ||
| make type_check | ||
| ``` | ||
|
|
||
| If there are type errors, fix them properly. Do **not** add `# type: ignore` comments to silence them. | ||
|
|
||
| ### Unit Tests | ||
|
|
||
| Run the unit tests for the files affected by your change: | ||
|
|
||
| ```bash | ||
| make unit_test_py PY_TEST_FILES="path/to/test_file.py" | ||
| ``` | ||
|
|
||
| ### Integration Tests | ||
|
|
||
| If the change touches cross-component behavior, also run integration tests: | ||
|
|
||
| ```bash | ||
| make integration_test PY_TEST_FILES="path/to/test_file.py" | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.