Skip to content

Commit cfe3e2c

Browse files
authored
Update agent documentations to avoid unnecessary code comments (#4115)
* Update agent documentations to avoid unnecessary code comments * Fix broken docs link
1 parent efca6c5 commit cfe3e2c

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

.cursor/rules/comments.mdc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: Project-wide commenting policy — explain WHY the code is the way it is; avoid change-log comments.
3+
alwaysApply: true
4+
---
5+
6+
# Commenting Policy: Explain **Why**, Not **What**
7+
8+
**Goal:** Comments should help a future maintainer understand intent and constraints months later—not narrate edits.
9+
10+
## Use comments to explain
11+
- Non-obvious design decisions / trade-offs and invariants
12+
- Complex logic or algorithms (what makes them tricky)
13+
- Business rules and constraints that drive the design
14+
- Purpose and contract of functions/classes (especially public APIs)
15+
- Edge cases and gotchas being handled and why they matter
16+
17+
## Avoid change-tracking comments
18+
- “Updated from previous version”
19+
- “New implementation”
20+
- “Changed to use X instead of Y”
21+
- “Refactored this section”
22+
23+
## Avoid simple explanatory comments
24+
- Avoid comments that are obvious descriptions of what the code does when it's
25+
already clear from the code itself.
26+
27+
## Guidance
28+
- Prefer self-explanatory code; add comments only where extra context is genuinely needed.
29+
- Write for “future you” 6+ months from now.
30+
- In Python, prefer docstrings for API intent and inline comments only for truly non-obvious lines.

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Use filesystem navigation tools to explore the codebase structure as needed.
1414

1515
## Code Style & Quality Standards
1616

17+
### Commenting policy — explain why, not what
18+
- Use comments to document intent, trade‑offs, constraints, invariants, and tricky edge cases—i.e., why the code is this way—rather than narrating changes. Prefer self‑explanatory code; add comments only where extra context is needed. Write for a reader 6+ months later.
19+
- Use for: complex logic/algorithms, non‑obvious design decisions, business rules/constraints, API purpose/contracts, edge cases.
20+
- Avoid: change‑tracking comments (“Updated from previous version”, “New implementation”, “Changed to use X instead of Y”, “Refactored this section”).
21+
- Avoid simple explanatory comments, where it is already clear from the code itself.
22+
1723
### Formatting and Linting
1824
- Format code with: `bash scripts/format.sh` (requires Python environment with dev dependencies)
1925
- Run this before every commit to ensure proper formatting

CLAUDE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ Note: The MCP server indexes the latest released docs, not the develop branch. F
2424

2525
## Code Style & Quality Standards
2626

27+
### Commenting policy — explain why, not what
28+
- Use comments to document intent, trade‑offs, constraints, invariants, and tricky edge cases—i.e., why the code is this way—rather than narrating changes. Prefer self‑explanatory code; add comments only where extra context is needed. Write for a reader 6+ months later.
29+
- Use for: complex logic/algorithms, non‑obvious design decisions, business rules/constraints, API purpose/contracts, edge cases.
30+
- Avoid: change‑tracking comments (“Updated from previous version”, “New implementation”, “Changed to use X instead of Y”, “Refactored this section”).
31+
- Avoid simple explanatory comments, where it is already clear from the code itself.
32+
2733
### Formatting and Linting
2834
- Format code with: `bash scripts/format.sh` (requires Python environment with dev dependencies)
2935
- Run this before every commit to ensure proper formatting
@@ -297,4 +303,4 @@ When tackling complex tasks:
297303
---
298304

299305
*This document is maintained to help Claude Code work effectively with the
300-
ZenML codebase. For human contributors, see CONTRIBUTING.md.*
306+
ZenML codebase. For human contributors, see CONTRIBUTING.md.*

docs/book/getting-started/zenml-pro/secrets-stores.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This operation has two main stages:
1717

1818
## AWS Secrets Manager
1919

20-
The authentication used by the AWS secrets store is built on the [ZenML Service Connector](https://docs.zenml.io/stacks/service-connectors/overview) of the same type as the secrets store. This means that you can use any of the [authentication methods supported by the Service Connector](https://docs.zenml.io/stacks/service-connectors/connector-types/aws-service-connector#authentication-methods) to authenticate with the secrets store.
20+
The authentication used by the AWS secrets store is built on the [ZenML Service Connector](https://docs.zenml.io/stacks/service-connectors/auth-management) of the same type as the secrets store. This means that you can use any of the [authentication methods supported by the Service Connector](https://docs.zenml.io/stacks/service-connectors/connector-types/aws-service-connector#authentication-methods) to authenticate with the secrets store.
2121

2222
The recommended authentication method documented here is to use the [implicit authentication method](https://docs.zenml.io/stacks/service-connectors/connector-types/aws-service-connector#implicit-authentication), because this doesn't need any sensitive credentials to be exchanged with the ZenML Pro support team.
2323

@@ -236,4 +236,4 @@ After your workspace is updated, you will see the following changes in the works
236236
}
237237
}
238238
}
239-
```
239+
```

0 commit comments

Comments
 (0)