

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Code Commenting Guidelines78## 基本原则 Basic Principles9- 注释应该解释**为什么**这样做,而不是**做了什么**10- 代码即文档,仅在必要时添加注释11- 使用清晰简洁的语言,避免冗余, English12- 及时更新注释,确保与代码同步1314## 文件头注释 File Header Comments15```typescript16/**17 * @file 文件的简要描述18 * @description 详细描述文件的功能和用途19 * @author [作者名称]20 * @date YYYY-MM-DD21 */22```2324## 函数注释 Function Comments25```typescript26/**27 * 函数的简要描述28 * @description 详细描述函数的功能29 * @param {string} param1 - 参数1的描述30 * @param {number} param2 - 参数2的描述31 * @returns {Promise<boolean>} 返回值的描述32 * @throws {Error} 可能抛出的错误33 * @example34 * const result = await someFunction('test', 123);35 */36function someFunction(param1: string, param2: number): Promise<boolean> {37 // ...38}39```4041## 行内注释 Inline Comments42```typescript43// ✅ 好的注释:解释复杂的业务逻辑44if (user.role === 'admin' && !isHoliday) {45 // 管理员在非假日期间具有特殊权限46 grantSpecialAccess();47}4849// ❌ 不好的注释:陈述显而易见的事实50// 检查用户是否为管理员51if (user.role === 'admin') {52 // ...53}54```5556## 待办注释 TODO Comments57```typescript58// TODO(github-username): 实现用户认证功能 (#123)59// FIXME(github-username): 修复内存泄漏问题 (#456)60// NOTE: 这里使用递归可能会导致性能问题61```6263## 类型定义注释 Type Definition Comments64```typescript65/**66 * 用户配置接口67 * @interface UserConfig68 * @property {string} name - 用户名69 * @property {number} age - 年龄70 * @property {string[]} permissions - 权限列表71 */72interface UserConfig {73 name: string;74 age: number;75 permissions: string[];76}77```7879## 常量和枚举注释 Constants and Enum Comments80```typescript81/**82 * 用户角色枚举83 * @enum {string}84 */85enum UserRole {86 /** 管理员用户 */87 ADMIN = 'admin',88 /** 普通用户 */89 USER = 'user',90 /** 访客用户 */91 GUEST = 'guest',92}9394/** 最大重试次数 */95const MAX_RETRY_COUNT = 3;96```9798## 弃用注释 Deprecation Comments99```typescript100/**101 * @deprecated 从 v2.0.0 开始弃用,请使用 `newFunction()` 替代102 * @see {@link newFunction}103 */104function oldFunction() {105 // ...106}107```108109## 区块注释 Section Comments110```typescript111//===================================112// 初始化配置113//===================================114115//===================================116// 工具函数117//===================================118119//===================================120// 事件处理121//===================================122```123124## 注释规范检查 Comment Linting125- 使用 ESLint 的 `eslint-plugin-jsdoc` 插件检查注释格式126- 在 CI/CD 流程中包含注释检查127- 定期审查和更新过时的注释128129## 最佳实践 Best Practices130- 使用 JSDoc 风格的注释以获得更好的 IDE 支持131- 为公共 API 和复杂的业务逻辑编写详细注释132- 避免注释掉的代码,使用版本控制系统代替133- 定期清理无用和过时的注释
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ai.mdc · 6 | Cursor rules | no sections | 16/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/breadcrumb.mdc · 6 | Cursor rules | ui | 16/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/i18n.mdc · 6 | Cursor rules | ui | 45/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/postgresql.mdc · 6 | Cursor rules | styledo-not | 65/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/typescript.mdc · 6 | Cursor rules | style | 40/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ui-style.mdc · 6 | Cursor rules | styleui | 29/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursor/rules/ui.mdc · 6 | Cursor rules | ui | 36/100 | today | |
| leaperone/nextjs-i18n-prisma-authjs-tailwindcss-template.cursorrules · 6 | .cursorrules | style | 38/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/leaperone-nextjs-i18n-prisma-authjs-tailwindcss-template-cursor-rules-comment)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.