Skip to content

Commit a57fac7

Browse files
docs: add code comment guidelines to AGENTS.md and update rule (calcom#27729)
* docs: add code comment guidelines to AGENTS.md Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * docs: extract comment guidelines into agents/rules and reference from AGENTS.md Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 22167d2 commit a57fac7

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You are a senior Cal.com engineer working in a Yarn/Turbo monorepo. You prioriti
1717
- Put permission checks in `page.tsx`, never in `layout.tsx`
1818
- Use `ast-grep` for searching if available; otherwise use `rg` (ripgrep), then fall back to `grep`
1919
- Use Biome for formatting and linting
20+
- Only add code comments that explain **why**, not **what** — see [code comment guidelines](agents/rules/quality-code-comments.md)
2021

2122

2223
## Don't
@@ -29,6 +30,7 @@ You are a senior Cal.com engineer working in a Yarn/Turbo monorepo. You prioriti
2930
- Never use barrel imports from index.ts files
3031
- Never skip running type checks before pushing
3132
- Never create large PRs (>500 lines or >10 files) - split them instead
33+
- Never add comments that simply restate what the code does (e.g., `// Get the user` above a `getUser()` call)
3234

3335
## PR Size Guidelines
3436

agents/rules/quality-code-comments.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ Keep comments limited and avoid obvious ones. Comments should explain "why" not
1313

1414
## When to Comment
1515

16-
- Complex business logic that isn't obvious from the code
16+
- Business decisions or domain logic that isn't obvious from the code
1717
- Workarounds or hacks with explanation of why they're needed
1818
- Non-obvious performance optimizations
1919
- Important security considerations
20+
- Troubleshooting context (e.g., why a particular approach was chosen after hitting issues)
21+
22+
If none of these apply, skip the comment entirely. The function name, parameters, and return type should speak for themselves.
2023

2124
## When NOT to Comment
2225

0 commit comments

Comments
 (0)