Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/mr-chen-05/rules-2.1-optimized/bug-fixgit clone --depth 1 https://github.com/Mr-chen-05/rules-2.1-optimizedWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02365 |
| Opus 5 | $0.00000 | $0.01182 |
| Sonnet 5 | $0.00000 | $0.00473 |
| Haiku 4.5 | $0.00000 | $0.00236 |
Grade A, and why
bug-fix scanned grade A with 0 findings 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 2d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 342 lines — stays where its author put it; the contents beside it link to each section on GitHub.
🐛 Bug Fix Workflow - Bug修复工作流
从问题创建到拉取请求的完整Bug修复工作流程。
🚀 Commands - 命令
/bug-fix- 启动Bug修复工作流/reproduce-bug- 重现Bug/root-cause- 根因分析/fix-verify- 修复验证
📋 Process - 修复流程
🔍 Before Starting - 开始前准备
1. GitHub Issue Creation - 创建GitHub问题
**Bug标题**: [组件/模块] 简短描述性标题
**环境信息**:
- 操作系统: Windows 11 / macOS 13 / Ubuntu 22.04
- 浏览器: Chrome 120 / Firefox 121 / Safari 17
- 应用版本: v2.1.0
- Node.js版本: v18.19.0
**重现步骤**:
1. 打开应用
2. 点击登录按钮
3. 输入有效凭据
4. 点击提交
**预期行为**: 用户应该成功登录并跳转到仪表板
**实际行为**: 显示"网络错误",用户停留在登录页面
**错误信息**:
TypeError: Cannot read property 'token' of undefined at LoginComponent.handleLogin (login.component.ts:45)
**截图/录屏**: [附加相关截图或录屏]
**优先级**: High / Medium / Low
**标签**: bug, frontend, authentication
2. Git Branch Creation - 创建Git分支
# 创建并切换到功能分支
git checkout -b fix/login-token-error
# 或者使用更具描述性的分支名
git checkout -b fix/issue-123-login-authentication-error
🔧 Fix the Bug - 修复Bug
Step 1: Reproduce the Issue - 重现问题
# 1. 切换到问题分支
git checkout main
git pull origin main
# 2. 尝试重现Bug
npm start
# 按照问题描述的步骤操作
# 3. 确认问题存在
# 记录重现步骤和错误信息
Step 2: Write Failing Test - 编写失败测试
// 示例:为Bug编写测试用例
describe('LoginComponent', () => {
it('should handle login with valid credentials', async () => {
// 这个测试应该失败,因为Bug存在
const mockUser = { username: 'test', password: 'password' };
const result = await loginComponent.handleLogin(mockUser);
expect(result.success).toBe(true);
expect(result.token).toBeDefined();
expect(result.user).toEqual(expect.objectContaining({
username: 'test'
}));
});
it('should handle undefined response gracefully', async () => {
// 测试边界条件
mockApiService.login.mockResolvedValue(undefined);
const result = await loginComponent.handleLogin(mockUser);
expect(result.success).toBe(false);
expect(result.error).toBeDefined();
});
});
Step 3: Implement the Fix - 实现修复
// 修复前的代码
async handleLogin(credentials: LoginCredentials) {
try {
const response = await this.authService.login(credentials);
// Bug: 没有检查response是否存在
localStorage.setItem('token', response.token);
this.router.navigate(['/dashboard']);
} catch (error) {
this.showError('登录失败');
}
}
// 修复后的代码
async handleLogin(credentials: LoginCredentials) {
try {
const response = await this.authService.login(credentials);
// 修复: 添加响应验证
if (!response || !response.token) {
throw new Error('Invalid response from server');
}
localStorage.setItem('token', response.token);
this.router.navigate(['/dashboard']);
return { success: true, token: response.token, user: response.user };
} catch (error) {
console.error('Login error:', error);
this.showError('登录失败: ' + error.message);
return { success: false, error: error.message };
}
}
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.
- 2d ago First seen · 342 lines · 0 tokens per session scan A b56efabe5874
bug-fix is a cursor rule published in the GitHub repository Mr-chen-05/rules-2.1-optimized (172 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,365 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.