code-deduplication by alinaqi/claude-bootstrap
npx skills add https://github.com/alinaqi/claude-bootstrap --skill code-deduplication加载方式:base.md
目的: 防止语义重复和代码膨胀。维护一个能力索引,以便 Claude 在编写新代码之前始终知道已存在的内容。
┌─────────────────────────────────────────────────────────────────┐
│ 先检查,再编写 │
│ ───────────────────────────────────────────────────────────── │
│ AI 不会复制/粘贴 - 它会重新实现。 │
│ 问题不在于重复的代码,而在于重复的意图。 │
│ │
│ 在编写任何新函数之前: │
│ 1. 检查 CODE_INDEX.md 中已有的能力 │
│ 2. 在代码库中搜索类似的功能 │
│ 3. 如果可能,扩展现有代码 │
│ 4. 只有在没有合适内容时才创建新的 │
├─────────────────────────────────────────────────────────────────┤
│ 编写后:立即更新索引。 │
│ 定期:运行 /audit-duplicates 以捕获重叠。 │
└─────────────────────────────────────────────────────────────────┘
在项目根目录维护 CODE_INDEX.md,按而非文件位置组织:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 代码索引
*最后更新:[时间戳]*
*运行 `/update-code-index` 重新生成*
## 快速参考
| 类别 | 数量 | 位置 |
|----------|-------|----------|
| 日期/时间 | 5 个函数 | src/utils/dates.ts |
| 验证 | 8 个函数 | src/utils/validate.ts |
| API 客户端 | 12 个函数 | src/api/*.ts |
| 认证 | 6 个函数 | src/auth/*.ts |
---
## 日期/时间操作
| 函数 | 位置 | 功能 | 参数 |
|----------|----------|-----------|--------|
| `formatDate()` | utils/dates.ts:15 | 格式化日期 → "Jan 15, 2024" | `(date: Date, format?: string)` |
| `formatRelative()` | utils/dates.ts:32 | 格式化日期 → "2 days ago" | `(date: Date)` |
| `parseDate()` | utils/dates.ts:48 | 解析字符串 → Date | `(str: string, format?: string)` |
| `isExpired()` | auth/tokens.ts:22 | 检查时间戳是否已过期 | `(timestamp: number)` |
| `addDays()` | utils/dates.ts:61 | 为日期添加天数 | `(date: Date, days: number)` |
---
## 验证
| 函数 | 位置 | 功能 | 参数 |
|----------|----------|-----------|--------|
| `isEmail()` | utils/validate.ts:10 | 验证电子邮件格式 | `(email: string)` |
| `isPhone()` | utils/validate.ts:25 | 验证电话号码(含国家代码) | `(phone: string, country?: string)` |
| `isURL()` | utils/validate.ts:42 | 验证 URL 格式 | `(url: string)` |
| `isUUID()` | utils/validate.ts:55 | 验证 UUID v4 | `(id: string)` |
| `sanitizeHTML()` | utils/sanitize.ts:12 | 从输入中去除 XSS | `(html: string)` |
| `sanitizeSQL()` | utils/sanitize.ts:28 | 转义 SQL 特殊字符 | `(input: string)` |
---
## 字符串操作
| 函数 | 位置 | 功能 | 参数 |
|----------|----------|-----------|--------|
| `slugify()` | utils/strings.ts:8 | 转换为 URL 友好字符串 | `(str: string)` |
| `truncate()` | utils/strings.ts:20 | 截断字符串并添加省略号 | `(str: string, len: number)` |
| `capitalize()` | utils/strings.ts:32 | 首字母大写 | `(str: string)` |
| `pluralize()` | utils/strings.ts:40 | 正确添加 s/es | `(word: string, count: number)` |
---
## API 客户端
| 函数 | 位置 | 功能 | 返回值 |
|----------|----------|-----------|---------|
| `fetchUser()` | api/users.ts:15 | GET /users/:id | `Promise<User>` |
| `fetchUsers()` | api/users.ts:28 | GET /users(带分页) | `Promise<User[]>` |
| `createUser()` | api/users.ts:45 | POST /users | `Promise<User>` |
| `updateUser()` | api/users.ts:62 | PATCH /users/:id | `Promise<User>` |
| `deleteUser()` | api/users.ts:78 | DELETE /users/:id | `Promise<void>` |
---
## 错误处理
| 函数/类 | 位置 | 功能 |
|----------------|----------|-----------|
| `AppError` | utils/errors.ts:5 | 带有错误码的基础错误类 |
| `ValidationError` | utils/errors.ts:20 | 输入验证失败 |
| `NotFoundError` | utils/errors.ts:32 | 资源未找到 |
| `handleAsync()` | utils/errors.ts:45 | 包装异步路由处理器 |
| `errorMiddleware()` | middleware/error.ts:10 | Express 错误处理器 |
---
## Hooks (React)
| Hook | 位置 | 功能 |
|------|----------|-----------|
| `useAuth()` | hooks/useAuth.ts | 认证状态 + 登录/登出 |
| `useUser()` | hooks/useUser.ts | 当前用户数据 |
| `useDebounce()` | hooks/useDebounce.ts | 防抖值变化 |
| `useLocalStorage()` | hooks/useLocalStorage.ts | 持久化状态 |
| `useFetch()` | hooks/useFetch.ts | 数据获取(带加载/错误状态) |
---
## 组件 (React)
| 组件 | 位置 | 功能 |
|-----------|----------|-----------|
| `Button` | components/Button.tsx | 带变体的样式化按钮 |
| `Input` | components/Input.tsx | 带验证的表单输入 |
| `Modal` | components/Modal.tsx | 对话框覆盖层 |
| `Toast` | components/Toast.tsx | 通知弹窗 |
| `Spinner` | components/Spinner.tsx | 加载指示器 |
每个文件都应有一个摘要头部:
/**
* @file 用户认证工具
* @description 处理登录、登出、会话管理和令牌刷新。
*
* 主要导出:
* - login(email, password) - 认证用户,返回令牌
* - logout() - 清除会话和令牌
* - refreshToken() - 获取新的访问令牌
* - validateSession() - 检查会话是否有效
*
* @see src/api/auth.ts 查看 API 端点
* @see src/hooks/useAuth.ts 查看 React hook
*/
import { ... } from '...';
"""
用户认证工具。
处理登录、登出、会话管理和令牌刷新。
主要导出:
- login(email, password) - 认证用户,返回令牌
- logout() - 清除会话和令牌
- refresh_token() - 获取新的访问令牌
- validate_session() - 检查会话是否有效
另请参阅:
- src/api/auth.py 查看 API 端点
- src/services/user.py 查看用户操作
"""
from typing import ...
每个函数都需要一行摘要:
/**
* 将日期格式化为人类可读的相对时间字符串。
* 示例:"2 minutes ago", "yesterday", "3 months ago"
*/
export function formatRelative(date: Date): string {
// ...
}
/**
* 验证电子邮件格式并检查是否为一次性域名。
* 对有效的非一次性电子邮件返回 true。
*/
export function isValidEmail(email: string): boolean {
// ...
}
def format_relative(date: datetime) -> str:
"""将日期格式化为人类可读的相对时间字符串。
示例:"2 minutes ago", "yesterday", "3 months ago"
"""
...
def is_valid_email(email: str) -> bool:
"""验证电子邮件格式并检查是否为一次性域名。
对有效的非一次性电子邮件返回 True。
"""
...
┌─────────────────────────────────────────────────────────────────┐
│ 编写新代码之前 │
│ ───────────────────────────────────────────────────────────── │
│ │
│ 1. 用简单英语描述你的需求 │
│ "我需要将日期格式化为相对时间" │
│ │
│ 2. 检查 CODE_INDEX.md │
│ 搜索:date, time, format, relative │
│ → 找到:utils/dates.ts 中的 formatRelative() │
│ │
│ 3. 评估现有代码是否可用 │
│ - 它能满足我的需求吗? → 使用它 │
│ - 接近但不完全符合? → 扩展它 │
│ - 没有合适的? → 创建新的,更新索引 │
│ │
│ 4. 如果扩展,检查是否会破坏现有功能 │
│ - 添加可选参数,不要改变现有行为 │
│ - 为新功能更新测试 │
└─────────────────────────────────────────────────────────────────┘
需要新功能
│
▼
检查 CODE_INDEX.md 中是否有类似的
│
├─► 找到完全匹配 ──────► 使用它
│
├─► 找到类似的 ──────────► 是否可以扩展?
│ │
│ ┌──────────────┴──────────────┐
│ ▼ ▼
│ 是:扩展 否:创建新的
│ (添加参数) (更新索引)
│
└─► 未找到 ──────────► 创建新的(更新索引)
❌ 不好: 当 isEmail() 已存在时创建 validateEmail()
// 不要这样做:这已经以 isEmail() 的形式存在了
function validateEmail(email: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
✅ 好: 先检查索引,使用现有的
import { isEmail } from '@/utils/validate';
if (isEmail(userInput)) { ... }
❌ 不好: 多个日期格式化器,只有细微差别
// 在文件 A 中
function formatDate(d: Date) { return d.toLocaleDateString(); }
// 在文件 B 中
function displayDate(d: Date) { return d.toLocaleDateString('en-US'); }
// 在文件 C 中
function showDate(d: Date) { return d.toLocaleDateString('en-US', { month: 'short' }); }
✅ 好: 一个带选项的函数
// utils/dates.ts
function formatDate(d: Date, options?: { locale?: string; format?: 'short' | 'long' }) {
const locale = options?.locale ?? 'en-US';
const formatOpts = options?.format === 'short'
? { month: 'short', day: 'numeric' }
: { month: 'long', day: 'numeric', year: 'numeric' };
return d.toLocaleDateString(locale, formatOpts);
}
❌ 不好: 相同的验证逻辑分散在多个文件中
// 在 signup.ts 中
if (!email || !email.includes('@') || email.length < 5) { ... }
// 在 profile.ts 中
if (!email || !email.includes('@') || email.length < 5) { ... }
// 在 invite.ts 中
if (!email || !email.includes('@') || email.length < 5) { ... }
✅ 好: 提取一次,到处导入
// utils/validate.ts
export const isEmail = (email: string) =>
email && email.includes('@') && email.length >= 5;
// 其他所有地方
import { isEmail } from '@/utils/validate';
if (!isEmail(email)) { ... }
定期运行 /audit-duplicates 以捕获语义重叠:
## 重复审计 - [日期]
### 🔴 高优先级(合并这些)
1. **日期格式化** - 找到 3 个类似函数
- utils/dates.ts 中的 `formatDate()`
- components/Header.tsx 中的 `displayDate()`
- pages/Profile.tsx 中的 `showDate()`
- **操作:** 合并到 utils/dates.ts
2. **电子邮件验证** - 5 个文件中的内联逻辑
- signup.ts:42
- profile.ts:28
- invite.ts:15
- settings.ts:67
- admin.ts:33
- **操作:** 提取到 utils/validate.ts
### 🟡 中优先级(考虑合并)
1. **用户获取** - 2 种不同的模式
- api/users.ts 中的 `fetchUser()`
- services/user.ts 中的 `getUser()`
- **操作:** 决定使用一种模式
### 🟢 低优先级(监控)
1. **按钮组件** - 存在 3 种变体
- 可能是针对不同用例的有意设计
- **操作:** 记录差异
对于大型代码库(100+ 文件),添加向量搜索:
# scripts/index_codebase.py
import chromadb
from chromadb.utils import embedding_functions
# 初始化
client = chromadb.PersistentClient(path="./.chroma")
ef = embedding_functions.DefaultEmbeddingFunction()
collection = client.get_or_create_collection("code_index", embedding_function=ef)
# 索引一个函数
collection.add(
documents=["将日期格式化为人类可读的相对字符串,如 '2 days ago'"],
metadatas=[{"function": "formatRelative", "file": "utils/dates.ts", "line": 32}],
ids=["formatRelative"]
)
# 编写前搜索
results = collection.query(
query_texts=["将日期格式化为相对时间"],
n_results=5
)
# 返回:utils/dates.ts 中的 formatRelative - 0.92 相似度
# scripts/index_codebase.py
import lancedb
db = lancedb.connect("./.lancedb")
# 创建表
data = [
{"function": "formatRelative", "file": "utils/dates.ts", "description": "将日期格式化为相对时间"},
{"function": "isEmail", "file": "utils/validate.ts", "description": "验证电子邮件格式"},
]
table = db.create_table("code_index", data)
# 搜索
results = table.search("验证电子邮件地址").limit(5).to_list()
| 代码库大小 | 建议 |
|---|---|
| < 50 个文件 | 仅使用 Markdown 索引 |
| 50-200 个文件 | Markdown + 定期审计 |
| 200+ 个文件 | 添加向量数据库 |
| 500+ 个文件 | 向量数据库必不可少 |
CODE_INDEX.mdgrep -r "functionName\|similar_term" src/在实现之前,让我检查一下我们是否已经有类似的东西...
[检查 CODE_INDEX.md]
找到:utils/file.ts 中的 `existingFunction()` 有类似功能。
选项:
1. 按原样使用现有函数
2. 用新功能扩展它
3. 创建新的(如果确实是不同的用例)
您更喜欢哪种方法?
/update-code-index
/audit-duplicates
/**
* @file [简短描述]
* @description [此文件的功能]
*
* 主要导出:
* - function1() - [功能描述]
* - function2() - [功能描述]
*/
/**
* [一行描述其功能]
*/
export function name(params): ReturnType {
| `functionName()` | path/file.ts:line | 用简单英语描述功能 | `(params)` |
每周安装量
88
仓库
GitHub 星标数
531
首次出现
Jan 20, 2026
安全审计
安装于
claude-code67
opencode67
codex62
gemini-cli61
cursor57
antigravity50
Load with: base.md
Purpose: Prevent semantic duplication and code bloat. Maintain a capability index so Claude always knows what exists before writing something new.
┌─────────────────────────────────────────────────────────────────┐
│ CHECK BEFORE YOU WRITE │
│ ───────────────────────────────────────────────────────────── │
│ AI doesn't copy/paste - it reimplements. │
│ The problem isn't duplicate code, it's duplicate PURPOSE. │
│ │
│ Before writing ANY new function: │
│ 1. Check CODE_INDEX.md for existing capabilities │
│ 2. Search codebase for similar functionality │
│ 3. Extend existing code if possible │
│ 4. Only create new if nothing suitable exists │
├─────────────────────────────────────────────────────────────────┤
│ AFTER WRITING: Update the index immediately. │
│ PERIODICALLY: Run /audit-duplicates to catch overlap. │
└─────────────────────────────────────────────────────────────────┘
Maintain CODE_INDEX.md in project root, organized by capability not file location:
# Code Index
*Last updated: [timestamp]*
*Run `/update-code-index` to regenerate*
## Quick Reference
| Category | Count | Location |
|----------|-------|----------|
| Date/Time | 5 functions | src/utils/dates.ts |
| Validation | 8 functions | src/utils/validate.ts |
| API Clients | 12 functions | src/api/*.ts |
| Auth | 6 functions | src/auth/*.ts |
---
## Date/Time Operations
| Function | Location | Does What | Params |
|----------|----------|-----------|--------|
| `formatDate()` | utils/dates.ts:15 | Formats Date → "Jan 15, 2024" | `(date: Date, format?: string)` |
| `formatRelative()` | utils/dates.ts:32 | Formats Date → "2 days ago" | `(date: Date)` |
| `parseDate()` | utils/dates.ts:48 | Parses string → Date | `(str: string, format?: string)` |
| `isExpired()` | auth/tokens.ts:22 | Checks if timestamp past now | `(timestamp: number)` |
| `addDays()` | utils/dates.ts:61 | Adds days to date | `(date: Date, days: number)` |
---
## Validation
| Function | Location | Does What | Params |
|----------|----------|-----------|--------|
| `isEmail()` | utils/validate.ts:10 | Validates email format | `(email: string)` |
| `isPhone()` | utils/validate.ts:25 | Validates phone with country | `(phone: string, country?: string)` |
| `isURL()` | utils/validate.ts:42 | Validates URL format | `(url: string)` |
| `isUUID()` | utils/validate.ts:55 | Validates UUID v4 | `(id: string)` |
| `sanitizeHTML()` | utils/sanitize.ts:12 | Strips XSS from input | `(html: string)` |
| `sanitizeSQL()` | utils/sanitize.ts:28 | Escapes SQL special chars | `(input: string)` |
---
## String Operations
| Function | Location | Does What | Params |
|----------|----------|-----------|--------|
| `slugify()` | utils/strings.ts:8 | Converts to URL slug | `(str: string)` |
| `truncate()` | utils/strings.ts:20 | Truncates with ellipsis | `(str: string, len: number)` |
| `capitalize()` | utils/strings.ts:32 | Capitalizes first letter | `(str: string)` |
| `pluralize()` | utils/strings.ts:40 | Adds s/es correctly | `(word: string, count: number)` |
---
## API Clients
| Function | Location | Does What | Returns |
|----------|----------|-----------|---------|
| `fetchUser()` | api/users.ts:15 | GET /users/:id | `Promise<User>` |
| `fetchUsers()` | api/users.ts:28 | GET /users with pagination | `Promise<User[]>` |
| `createUser()` | api/users.ts:45 | POST /users | `Promise<User>` |
| `updateUser()` | api/users.ts:62 | PATCH /users/:id | `Promise<User>` |
| `deleteUser()` | api/users.ts:78 | DELETE /users/:id | `Promise<void>` |
---
## Error Handling
| Function/Class | Location | Does What |
|----------------|----------|-----------|
| `AppError` | utils/errors.ts:5 | Base error class with code |
| `ValidationError` | utils/errors.ts:20 | Input validation failures |
| `NotFoundError` | utils/errors.ts:32 | Resource not found |
| `handleAsync()` | utils/errors.ts:45 | Wraps async route handlers |
| `errorMiddleware()` | middleware/error.ts:10 | Express error handler |
---
## Hooks (React)
| Hook | Location | Does What |
|------|----------|-----------|
| `useAuth()` | hooks/useAuth.ts | Auth state + login/logout |
| `useUser()` | hooks/useUser.ts | Current user data |
| `useDebounce()` | hooks/useDebounce.ts | Debounces value changes |
| `useLocalStorage()` | hooks/useLocalStorage.ts | Persisted state |
| `useFetch()` | hooks/useFetch.ts | Data fetching with loading/error |
---
## Components (React)
| Component | Location | Does What |
|-----------|----------|-----------|
| `Button` | components/Button.tsx | Styled button with variants |
| `Input` | components/Input.tsx | Form input with validation |
| `Modal` | components/Modal.tsx | Dialog overlay |
| `Toast` | components/Toast.tsx | Notification popup |
| `Spinner` | components/Spinner.tsx | Loading indicator |
Every file should have a summary header:
/**
* @file User authentication utilities
* @description Handles login, logout, session management, and token refresh.
*
* Key exports:
* - login(email, password) - Authenticates user, returns tokens
* - logout() - Clears session and tokens
* - refreshToken() - Gets new access token
* - validateSession() - Checks if session is valid
*
* @see src/api/auth.ts for API endpoints
* @see src/hooks/useAuth.ts for React hook
*/
import { ... } from '...';
"""
User authentication utilities.
Handles login, logout, session management, and token refresh.
Key exports:
- login(email, password) - Authenticates user, returns tokens
- logout() - Clears session and tokens
- refresh_token() - Gets new access token
- validate_session() - Checks if session is valid
See Also:
- src/api/auth.py for API endpoints
- src/services/user.py for user operations
"""
from typing import ...
Every function needs a one-line summary:
/**
* Formats a date into a human-readable relative string.
* Examples: "2 minutes ago", "yesterday", "3 months ago"
*/
export function formatRelative(date: Date): string {
// ...
}
/**
* Validates email format and checks for disposable domains.
* Returns true for valid non-disposable emails.
*/
export function isValidEmail(email: string): boolean {
// ...
}
def format_relative(date: datetime) -> str:
"""Formats a date into a human-readable relative string.
Examples: "2 minutes ago", "yesterday", "3 months ago"
"""
...
def is_valid_email(email: str) -> bool:
"""Validates email format and checks for disposable domains.
Returns True for valid non-disposable emails.
"""
...
┌─────────────────────────────────────────────────────────────────┐
│ BEFORE WRITING NEW CODE │
│ ───────────────────────────────────────────────────────────── │
│ │
│ 1. DESCRIBE what you need in plain English │
│ "I need to format a date as relative time" │
│ │
│ 2. CHECK CODE_INDEX.md │
│ Search for: date, time, format, relative │
│ → Found: formatRelative() in utils/dates.ts │
│ │
│ 3. EVALUATE if existing code works │
│ - Does it do what I need? → Use it │
│ - Close but not quite? → Extend it │
│ - Nothing suitable? → Create new, update index │
│ │
│ 4. If extending, check for breaking changes │
│ - Add optional params, don't change existing behavior │
│ - Update tests for new functionality │
└─────────────────────────────────────────────────────────────────┘
Need new functionality
│
▼
Check CODE_INDEX.md for similar
│
├─► Found exact match ──────► USE IT
│
├─► Found similar ──────────► Can it be extended?
│ │
│ ┌──────────────┴──────────────┐
│ ▼ ▼
│ Yes: Extend No: Create new
│ (add params) (update index)
│
└─► Nothing found ──────────► Create new (update index)
❌ Bad: Creating validateEmail() when isEmail() exists
// DON'T: This already exists as isEmail()
function validateEmail(email: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
✅ Good: Check index first, use existing
import { isEmail } from '@/utils/validate';
if (isEmail(userInput)) { ... }
❌ Bad: Multiple date formatters with slight variations
// In file A
function formatDate(d: Date) { return d.toLocaleDateString(); }
// In file B
function displayDate(d: Date) { return d.toLocaleDateString('en-US'); }
// In file C
function showDate(d: Date) { return d.toLocaleDateString('en-US', { month: 'short' }); }
✅ Good: One function with options
// utils/dates.ts
function formatDate(d: Date, options?: { locale?: string; format?: 'short' | 'long' }) {
const locale = options?.locale ?? 'en-US';
const formatOpts = options?.format === 'short'
? { month: 'short', day: 'numeric' }
: { month: 'long', day: 'numeric', year: 'numeric' };
return d.toLocaleDateString(locale, formatOpts);
}
❌ Bad: Same validation logic scattered across files
// In signup.ts
if (!email || !email.includes('@') || email.length < 5) { ... }
// In profile.ts
if (!email || !email.includes('@') || email.length < 5) { ... }
// In invite.ts
if (!email || !email.includes('@') || email.length < 5) { ... }
✅ Good: Extract once, import everywhere
// utils/validate.ts
export const isEmail = (email: string) =>
email && email.includes('@') && email.length >= 5;
// Everywhere else
import { isEmail } from '@/utils/validate';
if (!isEmail(email)) { ... }
Run /audit-duplicates periodically to catch semantic overlap:
## Duplicate Audit - [DATE]
### 🔴 High Priority (Merge These)
1. **Date formatting** - 3 similar functions found
- `formatDate()` in utils/dates.ts
- `displayDate()` in components/Header.tsx
- `showDate()` in pages/Profile.tsx
- **Action:** Consolidate into utils/dates.ts
2. **Email validation** - Inline logic in 5 files
- signup.ts:42
- profile.ts:28
- invite.ts:15
- settings.ts:67
- admin.ts:33
- **Action:** Extract to utils/validate.ts
### 🟡 Medium Priority (Consider Merging)
1. **User fetching** - 2 different patterns
- `fetchUser()` in api/users.ts
- `getUser()` in services/user.ts
- **Action:** Decide on one pattern
### 🟢 Low Priority (Monitor)
1. **Button components** - 3 variants exist
- May be intentional for different use cases
- **Action:** Document the differences
For large codebases (100+ files), add vector search:
# scripts/index_codebase.py
import chromadb
from chromadb.utils import embedding_functions
# Initialize
client = chromadb.PersistentClient(path="./.chroma")
ef = embedding_functions.DefaultEmbeddingFunction()
collection = client.get_or_create_collection("code_index", embedding_function=ef)
# Index a function
collection.add(
documents=["Formats a date into human-readable relative string like '2 days ago'"],
metadatas=[{"function": "formatRelative", "file": "utils/dates.ts", "line": 32}],
ids=["formatRelative"]
)
# Search before writing
results = collection.query(
query_texts=["format date as relative time"],
n_results=5
)
# Returns: formatRelative in utils/dates.ts - 0.92 similarity
# scripts/index_codebase.py
import lancedb
db = lancedb.connect("./.lancedb")
# Create table
data = [
{"function": "formatRelative", "file": "utils/dates.ts", "description": "Formats date as relative time"},
{"function": "isEmail", "file": "utils/validate.ts", "description": "Validates email format"},
]
table = db.create_table("code_index", data)
# Search
results = table.search("validate email address").limit(5).to_list()
| Codebase Size | Recommendation |
|---|---|
| < 50 files | Markdown index only |
| 50-200 files | Markdown + periodic audit |
| 200+ files | Add vector DB |
| 500+ files | Vector DB essential |
CODE_INDEX.md if it existsgrep -r "functionName\|similar_term" src/Before implementing, let me check if we already have something similar...
[Checks CODE_INDEX.md]
Found: `existingFunction()` in utils/file.ts does something similar.
Options:
1. Use existing function as-is
2. Extend it with new capability
3. Create new (if truly different use case)
Which approach would you prefer?
/update-code-index
/audit-duplicates
/**
* @file [Short description]
* @description [What this file does]
*
* Key exports:
* - function1() - [what it does]
* - function2() - [what it does]
*/
/**
* [One line description of what it does]
*/
export function name(params): ReturnType {
| `functionName()` | path/file.ts:line | Does what in plain English | `(params)` |
Weekly Installs
88
Repository
GitHub Stars
531
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code67
opencode67
codex62
gemini-cli61
cursor57
antigravity50
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
40,000 周安装
Google Drive 批量下载文件夹工具 - 一键下载云端文件与文档转PDF
7,700 周安装
Google Sheets 工作表比较工具 | 自动识别数据差异 | Google Workspace CLI 技能
7,600 周安装
Google Workspace CLI 事件订阅续订工具 - gws-events-renew 命令详解与使用教程
7,600 周安装
数据叙事技能:将数据转化为决策故事,驱动业务行动 | 数据分析与可视化
7,600 周安装
Google Workspace CLI 文件宣布工具:在聊天空间快速分享云端硬盘文件
7,600 周安装
Google Workspace CLI gws-chat-send 命令:向聊天空间发送消息 | 命令行工具
7,600 周安装