Skip to content

Commit 08b806f

Browse files
aclark4lifeCopilot
andauthored
PYTHON-5768 Add AGENTS.md w/copilot instructions (#2744)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent db4db92 commit 08b806f

File tree

2 files changed

+46
-43
lines changed

2 files changed

+46
-43
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
1-
When reviewing code, focus on:
1+
Please see [AGENTS.md](../AGENTS.md).
22

3-
## Security Critical Issues
4-
- Check for hardcoded secrets, API keys, or credentials.
5-
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
6-
7-
## Performance Red Flags
8-
- Spot inefficient loops and algorithmic issues.
9-
- Check for memory leaks and resource cleanup.
10-
11-
## Code Quality Essentials
12-
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
13-
- Use clear, descriptive naming conventions.
14-
- Avoid encapsulation violations and ensure proper separation of concerns.
15-
- All public classes, modules, and methods should have clear documentation in Sphinx format.
16-
17-
## PyMongo-specific Concerns
18-
- Do not review files within `pymongo/synchronous` or files in `test/` that also have a file of the same name in `test/asynchronous` unless the reviewed changes include a `_IS_SYNC` statement. PyMongo generates these files from `pymongo/asynchronous` and `test/asynchronous` using `tools/synchro.py`.
19-
- All asynchronous functions must not call any blocking I/O.
20-
21-
## Review Style
22-
- Be specific and actionable in feedback.
23-
- Explain the "why" behind recommendations.
24-
- Acknowledge good patterns when you see them.
25-
- Ask clarifying questions when code intent is unclear.
26-
27-
Always prioritize security vulnerabilities and performance issues that could impact users.
28-
29-
Always suggest changes to improve readability and testability. For example, this suggestion seeks to make the code more readable, reusable, and testable:
30-
31-
```python
32-
# Instead of:
33-
if user.email and "@" in user.email and len(user.email) > 5:
34-
submit_button.enabled = True
35-
else:
36-
submit_button.enabled = False
37-
38-
# Consider:
39-
def valid_email(email):
40-
return email and "@" in email and len(email) > 5
41-
42-
43-
submit_button.enabled = valid_email(user.email)
44-
```
3+
Follow the repository instructions defined in `AGENTS.md` when working in this codebase.

AGENTS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
When reviewing code, focus on:
2+
3+
## Security Critical Issues
4+
- Check for hardcoded secrets, API keys, or credentials.
5+
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
6+
7+
## Performance Red Flags
8+
- Spot inefficient loops and algorithmic issues.
9+
- Check for memory leaks and resource cleanup.
10+
11+
## Code Quality Essentials
12+
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
13+
- Use clear, descriptive naming conventions.
14+
- Avoid encapsulation violations and ensure proper separation of concerns.
15+
- All public classes, modules, and methods should have clear documentation in Sphinx format.
16+
17+
## PyMongo-specific Concerns
18+
- Do not review files within `pymongo/synchronous` or files in `test/` that also have a file of the same name in `test/asynchronous` unless the reviewed changes include a `_IS_SYNC` statement. PyMongo generates these files from `pymongo/asynchronous` and `test/asynchronous` using `tools/synchro.py`.
19+
- All asynchronous functions must not call any blocking I/O.
20+
21+
## Review Style
22+
- Be specific and actionable in feedback.
23+
- Explain the "why" behind recommendations.
24+
- Acknowledge good patterns when you see them.
25+
- Ask clarifying questions when code intent is unclear.
26+
27+
Always prioritize security vulnerabilities and performance issues that could impact users.
28+
29+
Always suggest changes to improve readability and testability. For example, this suggestion seeks to make the code more readable, reusable, and testable:
30+
31+
```python
32+
# Instead of:
33+
if user.email and "@" in user.email and len(user.email) > 5:
34+
submit_button.enabled = True
35+
else:
36+
submit_button.enabled = False
37+
38+
# Consider:
39+
def valid_email(email):
40+
return email and "@" in email and len(email) > 5
41+
42+
43+
submit_button.enabled = valid_email(user.email)
44+
```

0 commit comments

Comments
 (0)