SkillAgentSearch skills...

code-style

- Use TypeScript strict mode (but project config has `strict: false`, note compatibility). - 使用 TypeScript 严格模式(但项目配置中 `strict: false`,注意兼容性) - Prefer type inference, explicitly declare types when necessary. - 优先使用类型推断,必要时显式声明类型

Install / Use

npx skills add BT-Rajan/Aiva

Installs into whichever agent you are using.

About this skill
📐

Cursor Rules

Cursor IDE rules (v2)

Quality Score

69/100

Supported Platforms

Cursor

Our assessment of code-style

code-style scores 69/100 on our quality scale, 2024th of 2,854 Development & Engineering skills we index.

Its Cursor Rules is 9.5 KB long, well organised into 18 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.

It has no GitHub stars yet, so there is no community track record; judge it on its content.

Substance
29/30
Structure
20/20
Description
15/15
Adoption
0/20
Freshness
5/15

Maintenance, license and trust

  • We could not determine when the repository was last updated.
  • Our last check on 2026-09-27 found the source still online.
  • No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
  • Its trust signals score 68/100, with 3 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.

AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

code-style compared with similar skills

All 4 of these similar skills score higher than code-style; compare them before choosing.

SkillScoreStarsUpdatedFormat
code-style (this skill)by BT-Rajan690—Cursor Rules
headroomby headroomlabs-ai10074.0k1d agoCLAUDE.md
rufloby ruvnet10073.4ktodayCLAUDE.md
ai-job-searchby MadsLorentzen10044.2ktodayCLAUDE.md
claude-howtoby luongnv8910041.7k1d agoCLAUDE.md

Frequently asked questions

How do I install code-style?
Run npx skills add BT-Rajan/Aiva. The install tabs above show the steps for each supported agent.
Which AI agents does code-style work with?
It is written for Cursor, as a Cursor Rules file. Other agents that read the same format can often use it too.
Is code-style safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 68/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is code-style still maintained?
We could not determine when the repository was last updated.

Code Style Guidelines / 代码风格规范

TypeScript

  • Use TypeScript strict mode (but project config has strict: false, note compatibility).
  • 使用 TypeScript 严格模式(但项目配置中 strict: false,注意兼容性)
  • Prefer type inference, explicitly declare types when necessary.
  • 优先使用类型推断,必要时显式声明类型
  • Use interfaces (interface) to define object types.
  • 使用接口(interface)定义对象类型
  • Use type aliases (type) for union types and complex types.
  • 使用类型别名(type)定义联合类型和复杂类型
  • Avoid using any, prefer unknown or specific types.
  • 避免使用 any,优先使用 unknown 或具体类型

Examples / 示例

// Good: Use interface for object types / 好的:使用接口定义对象类型
interface User {
  id: number
  name: string
  email: string
}

// Good: Use type for union types / 好的:使用类型别名定义联合类型
type Status = 'pending' | 'approved' | 'rejected'

// Good: Prefer type inference / 好的:优先使用类型推断
const users = ['alice', 'bob'] // string[]

// Good: Use unknown instead of any / 好的:使用 unknown 而非 any
function processData(data: unknown) {
  if (typeof data === 'string') {
    return data.toUpperCase()
  }
  return null
}

// Avoid / 避免
function badExample(data: any) {
  return data.something // No type safety / 没有类型安全
}

React Components / React 组件

  • Use functional components and Hooks.
  • 使用函数式组件和 Hooks
  • Component files use PascalCase naming (e.g., UserProfile.tsx).
  • 组件文件使用 PascalCase 命名(如 UserProfile.tsx)
  • Use React.FC or direct function declarations.
  • 使用 React.FC 或直接函数声明
  • Define Props using interfaces.
  • Props 使用接口定义
  • Prefer named exports over default exports.
  • 优先使用命名导出而非默认导出

Examples / 示例

// Good: Functional component with interface / 好的:使用接口的函数组件
interface UserProfileProps {
  userId: number
  onUpdate?: (user: User) => void
}

export const UserProfile: React.FC<UserProfileProps> = ({ userId, onUpdate }) => {
  const [user, setUser] = useState<User | null>(null)

  useEffect(() => {
    fetchUser(userId).then(setUser)
  }, [userId])

  return <div>{user?.name}</div>
}

// Good: Direct function declaration / 好的:直接函数声明
export function UserCard({ user }: { user: User }) {
  return <div>{user.name}</div>
}

// Avoid: Default export / 避免:默认导出
export default function UserProfile() { } // Not recommended / 不推荐

File Naming / 文件命名

  • Component files: PascalCase (e.g., UserProfile.tsx)
  • 组件文件: PascalCase (如 UserProfile.tsx)
  • Utility files: camelCase (e.g., formatDate.ts)
  • 工具文件: camelCase (如 formatDate.ts)
  • Constant files: UPPER_SNAKE_CASE (e.g., API_CONSTANTS.ts)
  • 常量文件: UPPER_SNAKE_CASE (如 API_CONSTANTS.ts)
  • Type definitions: PascalCase (e.g., UserTypes.ts)
  • 类型定义: PascalCase (如 UserTypes.ts)

Import Order / 导入顺序

  1. React-related imports React 相关导入
  2. Third-party library imports 第三方库导入
  3. Internal project imports (sorted by path hierarchy) 项目内部导入(按路径层级排序)
  4. Type imports (use import type) 类型导入(使用 import type)

Example / 示例

// 1. React imports / React 导入
import React, { useState, useEffect } from 'react'
import { useRouter } from 'react-router-dom'

// 2. Third-party imports / 第三方库导入
import { Button } from 'antd'
import { useRequest } from 'ahooks'
import dayjs from 'dayjs'

// 3. Internal project imports - Core packages / 项目内部导入 - 核心包
import { Application } from '@aiva/core'
import { Plugin, useAPIClient } from '@aiva/client'
import { Server } from '@aiva/server'

// 3. Internal project imports - Functional modules / 项目内部导入 - 功能模块
import { Database } from '@aiva/database'
import { AuthManager } from '@aiva/auth'
import { CacheManager } from '@aiva/cache'
import { UserService } from '../services/UserService'
import { formatDate } from '../utils/date'

// 4. Type imports / 类型导入
import type { User } from '../types'
import type { ApplicationOptions } from '@aiva/core'
import type { APIClientOptions } from '@aiva/client'

Code Style / 代码风格

  • Use 2-space indentation.
  • 使用 2 空格缩进
  • Use single quotes (unless string contains single quotes).
  • 使用单引号(除非字符串包含单引号)
  • No semicolons at end of lines (according to project Prettier config).
  • 行尾不使用分号(根据项目 Prettier 配置)
  • Use trailing commas for objects and arrays.
  • 对象和数组使用尾随逗号
  • Maximum line length: 100 characters (according to Prettier config).
  • 最大行长度:100 字符(根据 Prettier 配置)

Code Refactoring Principles / 代码重构原则

DRY (Don't Repeat Yourself) / DRY 原则(不要重复自己)

  • Core Principle / 核心原则: Eliminate duplicate code by extracting common logic into reusable functions.
  • 核心原则:通过提取公共逻辑到可复用函数来消除重复代码
  • When you find identical or similar code blocks in multiple places, extract them into a shared function.
  • 当发现多个地方有相同或相似的代码块时,应提取为共享函数
  • This improves maintainability, consistency, and reduces the risk of bugs.
  • 这能提高可维护性、一致性,并降低 bug 风险

When to Refactor / 何时重构

  • Duplicate Logic / 重复逻辑: If the same logic appears in 2+ places, extract it.
  • 重复逻辑:如果相同逻辑出现在 2 个或更多地方,应提取它
  • Similar Patterns / 相似模式: If similar code patterns exist with only minor differences, parameterize them.
  • 相似模式:如果存在仅细微差异的相似代码模式,应参数化它们
  • Before Adding Features / 添加功能前: Refactor existing code to make it easier to extend.
  • 添加功能前:重构现有代码,使其更易于扩展

Refactoring Guidelines / 重构指南

1. Extract Common Functions / 提取公共函数

// ❌ Bad: Duplicate logic / 不好的:重复逻辑
function processEnglishData(data: string) {
  const lines = data.split('\n');
  const seen = new Set();
  const result = [];
  for (const line of lines) {
    if (line.trim().startsWith('- ')) {
      const normalized = line.trim();
      if (!seen.has(normalized)) {
        seen.add(normalized);
        result.push(line);
      }
    } else {
      result.push(line);
    }
  }
  return result.join('\n');
}

function processChineseData(data: string) {
  const lines = data.split('\n');
  const seen = new Set();
  const result = [];
  for (const line of lines) {
    if (line.trim().startsWith('- ')) {
      const normalized = line.trim();
      if (!seen.has(normalized)) {
        seen.add(normalized);
        result.push(line);
      }
    } else {
      result.push(line);
    }
  }
  return result.join('\n');
}

// ✅ Good: Extracted common function / 好的:提取公共函数
function deduplicateContent(content: string): string {
  const contentLines = content.split('\n');
  const seen = new Set<string>();
  const deduplicatedLines: string[] = [];

  for (const line of contentLines) {
    if (line.trim().startsWith('- ')) {
      const normalized = line.trim();
      if (!seen.has(normalized)) {
        seen.add(normalized);
        deduplicatedLines.push(line);
      }
    } else {
      deduplicatedLines.push(line);
    }
  }

  return deduplicatedLines.join('\n');
}

function processEnglishData(data: string) {
  return deduplicateContent(data);
}

function processChineseData(data: string) {
  return deduplicateContent(data);
}

2. Parameterize Similar Functions / 参数化相似函数

// ❌ Bad: Similar functions with hardcoded values / 不好的:硬编码值的相似函数
function updateEnglishChangelog(changelog: string, content: string) {
  if (changelog.includes('## [Unreleased]')) {
    const index = changelog.indexOf('## [Unreleased]');
    // ... complex logic ...
    return beforeSection + '## [Unreleased]\n\n' + content + afterSection;
  }
  return '## [Unreleased]\n\n' + content + '\n\n' + changelog;
}

function updateChineseChangelog(changelog: string, content: string) {
  if (changelog.includes('## [未发布]')) {
    const index = changelog.indexOf('## [未发布]');
    // ... complex logic ...
    return beforeSection + '## [未发布]\n\n' + content + afterSection;
  }
  return '## [未发布]\n\n' + content + '\n\n' + changelog;
}

// ✅ Good: Parameterized function / 好的:参数化函数
function updateChangelogSection(
  changelog: string,
  sectionTitle: string,
  sectionLinkPattern: RegExp,
  newContent: string
): string {
  if (changelog.includes(sectionTitle)) {
    const sectionIndex = changelog.indexOf(sectionTitle);
    // ... shared logic ...
    return beforeSection + sectionTitle + '\n\n' + newContent + afterSection;
  }
  return sectionTitle + '\n\n' + newContent + '\n\n' + changelog;
}

function updateEnglishChangelog(changelog: string, content: string) {
  return updateChangelogSection(
    changelog,
    '## [Unreleased]',
    /\[Unreleased\]:\s*https:\/\/[^\s]+/,
    content
  );
}

function updateChineseChangelog(changelog: string, content: string) {
  return updateChangelogSection(
    changelog,
    '## [未发布]',
    /\[未发布\]:\s*https:\/\/[^\s]+/,
    content
  );
}

3. Benefits of Refactoring / 重构的好处

  • Maintainability / 可维护性: Changes only need to be made in one place.
  • 可维护性:修改只需在一处进行
  • Consistency / 一致性: Ensures identical behavior across all usages.
  • 一致性:确保所有使用场景的行为一致
  • Readability / 可读性: Code becomes cleaner and easier to understand.
  • 可读性:代码更清晰、更易理解
  • Testability / 可测试性: Common functions can be tested independently.
  • 可测试性:公共函数可以独立测试

Refactoring Workflow / 重构流程

  1. Identify Duplication / 识别重复: Look for similar code blocks or patterns.
  • 识别重复:查找相似的代码块或模式
  1. Extract Common Logic / 提取公共逻辑: Create a shared function with parameters.
  • 提取公共逻辑:创建带参数的共享函数
  1. Replace Duplicates / 替换重复: Update all occurrences to use the new function.
  • 替换重复:更新所有出现的地方以使用新函数
  1. Test / 测试: Verify that behavior remains unchanged.
  • 测试:验证行为保持不变
  1. Check Lint Errors / 检查 Lint 错误: Run lint checks after refactoring.
  • 检查 Lint 错误:重构后运行 lint 检查

Code Review Checklist / 代码审查清单

When reviewing code, check for: 审查代码时,检查:

  • [ ] Duplicate code blocks that could be extracted
  • [ ] 可以提取的重复代码块
  • [ ] Similar functions that could be parameterized
  • [ ] 可以参数化的相似函数
  • [ ] Repeated patterns that could be abstracted
  • [ ] 可以抽象的重复模式
  • [ ] Opportunities to improve code organization
  • [ ] 改进代码组织的机会

Related Skills

View on GitHub
GitHub Stars0
CategoryDevelopment
UpdatedNaNy ago
Forks0

Trust signals

68/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

2 medium1 low