fix

fix is a command for Claude Code from xiaobei930/cc-best. It costs 27 tokens per session (1,706 once invoked), scanned C, original, MIT.

A command for fixing build, type-checking, and compilation errors with only the smallest necessary code changes. It covers common issues such as missing types, invalid imports, null values, configuration errors, and missing dependencies.

In plain words
What is it for?
Use it to collect build and TypeScript errors, fix them one at a time, and verify that the full build passes.
Why use it?
It helps get a project building again without also refactoring code, changing its design, or adding features.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the TodoWrite tool.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { util } from "../lib/utils";.

Part of the cc-best plugin — 19 skills, 44 commands, 8 agents, 20 hooks shipped together

Good fit Use it to collect build and TypeScript errors, fix them one at a time, and verify that the full build passes.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best
agentmods
npx agentmods add commands/xiaobei930/cc-best/fix

Made for: Claude Code.

Or install cc-best, the plugin that ships this one along with the rest of its 19 skills, 44 commands, 8 agents, 20 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fix

README.md
[![agentmods](https://agentmods.dev/badge/commands/xiaobei930/cc-best/fix/github.svg)](https://agentmods.dev/commands/xiaobei930/cc-best/fix)
Your own site
<a href="https://agentmods.dev/commands/xiaobei930/cc-best/fix"><img src="https://agentmods.dev/badge/commands/xiaobei930/cc-best/fix/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fix

Your own site · 80×15
<a href="https://agentmods.dev/commands/xiaobei930/cc-best/fix"><img src="https://agentmods.dev/badge/commands/xiaobei930/cc-best/fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,706 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00027 $0.01706
Opus 5.5 $0.00011 $0.00682
Sonnet 5.5 $0.00005 $0.00341
Haiku 4.5 $0.00003 $0.00171

Measured 1mo ago against content hash 6dc8d8b4220f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

fix scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf .next node_modules/.cache && npm run build
commands/fix.md · 276 lines

How it starts

The opening of the file, as written. The whole thing — 276 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/fix - 构建错误修复

专注于快速修复构建/类型/编译错误。核心原则:最小化 diff,只修错误,不重构。

角色定位

  • 身份: 构建错误修复专家
  • 目标: 让构建通过,以最小改动修复错误
  • 原则: 精准、快速、不引入新问题

核心理念

只修复错误,不改其他任何东西

做什么

✅ 添加缺失的类型注解 ✅ 修复导入/导出错误 ✅ 添加空值检查 ✅ 修复配置文件错误 ✅ 安装缺失的依赖

不做什么

❌ 重构代码 ❌ 改变架构 ❌ 重命名变量 ❌ 添加新功能 ❌ 优化性能 ❌ 改善代码风格

工作流程

1. 收集所有错误
   ├─ 运行 npx tsc --noEmit(TypeScript)
   ├─ 运行 npm run build(构建)
   └─ 记录所有错误数量

2. 分类错误
   ├─ 类型推断错误
   ├─ 空值/未定义错误
   ├─ 导入/导出错误
   ├─ 配置错误
   └─ 依赖缺失

3. 逐个修复(最小化改动)
   ├─ 每次只改一处
   ├─ 改完立即验证
   └─ 记录修复进度

4. 验证构建通过
   └─ 运行完整构建命令

常见错误模式与修复

1. 类型推断失败

// ❌ 错误: Parameter 'x' implicitly has 'any' type
function process(data) {
  return data.value;
}

// ✅ 修复: 添加类型注解(最小改动)
function process(data: any) {
  // 或更具体的类型
  return data.value;
}

2. 空值/未定义错误

// ❌ 错误: Object is possibly 'undefined'
const name = user.profile.name;

// ✅ 修复: 添加可选链
const name = user?.profile?.name;

3. 缺少属性

// ❌ 错误: Property 'age' does not exist on type 'User'
interface User {
  name: string;
}
const user: User = { name: "Tom", age: 20 };

// ✅ 修复: 添加缺失属性
interface User {
  name: string;
  age?: number; // 可选属性
}

4. 导入错误

// ❌ 错误: Cannot find module '@/lib/utils'

// ✅ 修复方案 1: 检查 tsconfig paths
// ✅ 修复方案 2: 使用相对路径
import { util } from "../lib/utils";

// ✅ 修复方案 3: 安装缺失的包
// npm install @/lib/utils

5. 异步函数错误

// ❌ 错误: 'await' is only valid in async function
function getData() {
  const data = await fetch("/api");
}

// ✅ 修复: 添加 async
async function getData() {
  const data = await fetch("/api");
}

6. React Hooks 错误

// ❌ 错误: Hooks can only be called inside function component
if (condition) {
  const [state, setState] = useState(0);
}

// ✅ 修复: 移到顶层
const [state, setState] = useState(0);
if (condition) {
  // 使用 state
}

诊断命令

# TypeScript 类型检查
npx tsc --noEmit

# 显示所有错误(不中断)
npx tsc --noEmit --pretty

# 检查特定文件
npx tsc --noEmit src/path/to/file.ts

# Next.js 构建
npm run build

# ESLint 检查
npx eslint . --ext .ts,.tsx

# 清理缓存重试
rm -rf .next node_modules/.cache && npm run build

Read the full file on GitHub · 276 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 276 lines · 27 tokens per session scan C 6dc8d8b4220f

Subscribe to this mod's changes

fix is a command published in the GitHub repository xiaobei930/cc-best (48 stars, last pushed 4mo ago), licensed MIT. It adds 27 tokens to every session and 1,706 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.