auto-improvement
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOverview
概述
The auto-improvement skill implements a self-improving feedback loop that tracks effectiveness metrics, learns from errors, identifies recurring failure patterns, and adapts workflows to prevent repeated mistakes. It enables the agent to become measurably better over time through structured self-assessment rather than ad-hoc adjustments. Without this skill, the same mistakes repeat across sessions — with it, every error becomes a permanent improvement.
This skill is ALWAYS active. It runs automatically on every session and cannot be disabled.
自动改进技能实现了一套自优化反馈循环,可跟踪效能指标、从错误中学习、识别重复失败模式、适配工作流以避免错误重复发生。它让Agent能够通过结构化自我评估而非临时调整,随时间实现可量化的能力提升。没有该技能时,相同错误会在不同会话中重复出现;使用该技能后,每一次错误都会转化为永久性的能力提升。
本技能始终处于激活状态,每个会话自动运行,无法禁用。
Phase 1: Metric Collection
阶段1:指标收集
At the start of every task, instrument key decision points:
- Record task start time and initial estimate
- Define expected outcome and success criteria
- Track each decision point (approach chosen, alternatives considered)
- Log revision count (how many times the output was revised)
- Track user corrections as improvement signals
每个任务启动时,为关键决策点埋点:
- 记录任务开始时间和初始预估耗时
- 定义预期产出和成功标准
- 跟踪每个决策点(选择的方案、考虑过的替代方案)
- 记录修订次数(产出被修改的次数)
- 记录用户修正内容作为改进信号
Core Metrics
核心指标
| Metric | Formula | Target | Measurement Period |
|---|---|---|---|
| First-attempt success rate | Tasks without revision / Total tasks | >80% | Per session |
| Average revision count | Total revisions / Total tasks | <1.5 | Per session |
| Error recurrence rate | Repeated errors / Total errors | <10% | Rolling 10 sessions |
| Time-to-completion accuracy | Actual time / Estimated time | 0.8-1.2 | Per task |
| User correction rate | User corrections / Total outputs | <5% | Per session |
| 指标 | 计算公式 | 目标值 | 统计周期 |
|---|---|---|---|
| 首次尝试成功率 | 无需修订的任务数 / 总任务数 | >80% | 单会话 |
| 平均修订次数 | 总修订次数 / 总任务数 | <1.5 | 单会话 |
| 错误重复率 | 重复发生的错误数 / 总错误数 | <10% | 滚动10个会话 |
| 完成时间准确率 | 实际耗时 / 预估耗时 | 0.8-1.2 | 单任务 |
| 用户修正率 | 用户修正次数 / 总产出数 | <5% | 单会话 |
Tracking Template
追踪模板
markdown
undefinedmarkdown
undefinedSession Metrics -- [Date]
Session Metrics -- [Date]
Tasks
Tasks
| Task | Estimated | Actual | Revisions | Success | Error Type |
|---|---|---|---|---|---|
| ... | 30m | 45m | 1 | Partial | Execution |
| Task | Estimated | Actual | Revisions | Success | Error Type |
|---|---|---|---|---|---|
| ... | 30m | 45m | 1 | Partial | Execution |
Summary
Summary
- Tasks completed: X
- First-attempt success: X/Y (Z%)
- Total revisions: N
- Errors by category: Comprehension(n), Execution(n), Process(n)
- Improvement actions taken: [list]
> **STOP: Complete metric collection setup before proceeding to error analysis. Do NOT skip instrumentation.**
---- Tasks completed: X
- First-attempt success: X/Y (Z%)
- Total revisions: N
- Errors by category: Comprehension(n), Execution(n), Process(n)
- Improvement actions taken: [list]
> **注意:继续进行错误分析前必须完成指标收集配置,禁止跳过埋点步骤。**
---Phase 2: Error Analysis
阶段2:错误分析
When an error occurs, classify it immediately using the taxonomy:
发生错误时,立即使用以下分类法进行归类:
Error Taxonomy
错误分类法
| Category | Subcategory | Example | Typical Root Cause |
|---|---|---|---|
| Comprehension | Misread requirement | Built feature X when Y was asked | Insufficient clarification |
| Comprehension | Wrong assumption | Assumed REST when GraphQL was used | Missing context discovery |
| Execution | Syntax error | Invalid TypeScript type annotation | Unfamiliar API surface |
| Execution | Logic error | Off-by-one in pagination | Insufficient test coverage |
| Execution | Integration error | Wrong API endpoint or payload format | Missing documentation check |
| Process | Skipped step | Forgot to run tests before commit | Process not followed |
| Process | Wrong order | Wrote code before understanding spec | Eagerness over methodology |
| Judgment | Over-engineering | Built abstraction for single use case | Premature optimization |
| Judgment | Under-engineering | Skipped error handling for "simple" task | Underestimated complexity |
| Knowledge | Unknown API | Used deprecated method | Outdated training data |
| Knowledge | Framework gap | Wrong Next.js pattern for app router | Need to check docs first |
| 分类 | 子分类 | 示例 | 典型根因 |
|---|---|---|---|
| 理解偏差 | 需求误读 | 需求要求做Y功能却开发了X功能 | 需求澄清不充分 |
| 理解偏差 | 假设错误 | 项目用GraphQL却默认假设是REST | 上下文挖掘不足 |
| 执行错误 | 语法错误 | 无效的TypeScript类型注解 | 不熟悉API表层 |
| 执行错误 | 逻辑错误 | 分页逻辑中出现差一错误 | 测试覆盖不足 |
| 执行错误 | 集成错误 | 错误的API端点或 payload 格式 | 未检查文档 |
| 流程错误 | 跳过步骤 | 提交前忘记运行测试 | 未遵循流程 |
| 流程错误 | 顺序错误 | 未理解需求规范就开始写代码 | 急于求成忽略方法论 |
| 判断偏差 | 过度工程 | 为单一场景构建抽象层 | 过早优化 |
| 判断偏差 | 工程不足 | 认为任务「简单」跳过错误处理 | 低估复杂度 |
| 知识缺口 | 未知API | 使用了已废弃的方法 | 训练数据过时 |
| 知识缺口 | 框架认知缺口 | Next.js app router 模式使用错误 | 需要优先查阅文档 |
Severity Levels
严重程度等级
| Level | Definition | Response Required |
|---|---|---|
| Critical | Task must be completely redone | Immediate root cause analysis + add guardrail |
| Major | Significant rework needed (>50% of task) | Root cause analysis + add checklist item |
| Minor | Small fix needed (<30 minutes) | Log pattern, review if recurring |
| Cosmetic | Style or preference issue | Note for future, no process change |
| 等级 | 定义 | 所需响应 |
|---|---|---|
| 致命 | 任务必须完全重做 | 立即根因分析 + 新增防护规则 |
| 严重 | 需要大量返工(>50%任务量) | 根因分析 + 新增检查清单项 |
| 轻微 | 需要小幅修复(<30分钟) | 记录模式,复现时再review |
| ** cosmetic ** | 风格或偏好类问题 | 记录供未来参考,无需修改流程 |
Error Log Format
错误日志格式
markdown
undefinedmarkdown
undefinedError Log Entry
Error Log Entry
ID: ERR-[YYYY]-[MMDD]-[NNN]
Date: [date]
Task: [what was being done]
Severity: [Critical / Major / Minor / Cosmetic]
Category: [Category > Subcategory]
ID: ERR-[YYYY]-[MMDD]-[NNN]
Date: [date]
Task: [what was being done]
Severity: [Critical / Major / Minor / Cosmetic]
Category: [Category > Subcategory]
What Happened
What Happened
[Description of the error and its observable impact]
[Description of the error and its observable impact]
Root Cause
Root Cause
[Why this error occurred — the actual underlying reason]
[Why this error occurred — the actual underlying reason]
What Was Tried
What Was Tried
- [First attempt to resolve]
- [Second attempt if applicable]
- [Final resolution]
- [First attempt to resolve]
- [Second attempt if applicable]
- [Final resolution]
Resolution
Resolution
[What ultimately fixed the problem]
[What ultimately fixed the problem]
Time Lost
Time Lost
[Estimated time wasted due to this error]
[Estimated time wasted due to this error]
Prevention
Prevention
- New checklist item: [if applicable]
- Memory update: [what was persisted]
- Guardrail added: [if applicable]
- New checklist item: [if applicable]
- Memory update: [what was persisted]
- Guardrail added: [if applicable]
Recurrence Check
Recurrence Check
- Similar error seen before? [Yes/No — reference previous ID]
- Guardrail added? [Yes/No]
> **STOP: Every error MUST be classified and logged before proceeding to fix it. Do NOT skip the log entry.**
---- Similar error seen before? [Yes/No — reference previous ID]
- Guardrail added? [Yes/No]
> **注意:修复错误前必须完成所有错误的分类和记录,禁止跳过日志填写步骤。**
---Phase 3: Pattern Recognition
阶段3:模式识别
After accumulating 3+ errors, analyze for patterns:
- Group related errors into failure categories
- Identify environmental triggers (specific file types, frameworks, patterns)
- Detect workflow bottlenecks causing consistent slowdowns
- Recognize successful patterns worth reinforcing
- Map anti-patterns to their corrective actions
积累3个以上错误后,分析识别模式:
- 将相关错误归类到不同失败分类
- 识别环境触发因素(特定文件类型、框架、模式)
- 检测导致持续卡顿的工作流瓶颈
- 识别值得复用的成功模式
- 将反模式对应到修正方案
Pattern Detection Decision Table
模式识别决策表
| Signal | Pattern | Action |
|---|---|---|
| Same error >2 times | Recurring failure | Create guardrail (mandatory) |
| Same category >3 times | Systemic weakness | Add pre-flight checklist for that category |
| Time estimate off by >50% consistently | Estimation blind spot | Adjust estimation heuristics |
| User corrections in same area | Knowledge gap | Deep-dive learning for that domain |
| Success rate >90% in specific area | Strength pattern | Document and reinforce |
| Errors cluster around specific framework | Framework knowledge gap | Run context discovery for that framework |
| 信号 | 模式 | 动作 |
|---|---|---|
| 相同错误出现>2次 | 重复失败 | 强制创建防护规则 |
| 同分类错误出现>3次 | 系统性缺陷 | 为该分类新增前置检查清单 |
| 耗时预估持续偏差>50% | 预估盲区 | 调整预估启发规则 |
| 用户修正集中在同一领域 | 知识缺口 | 深入学习该领域知识 |
| 特定领域成功率>90% | 优势模式 | 文档化并强化复用 |
| 错误集中在特定框架 | 框架知识缺口 | 执行该框架的上下文挖掘 |
Positive Pattern Reinforcement
正向模式强化
When a pattern consistently leads to success, document it:
markdown
undefined当某个模式持续带来成功时,进行文档化:
markdown
undefinedPositive Pattern: [Name]
Positive Pattern: [Name]
OBSERVATION: [What was done and why it worked]
EVIDENCE: [Sessions/tasks where this pattern succeeded, with success rate]
REINFORCEMENT: [How to ensure this pattern continues to be applied]
> **STOP: Pattern recognition must be evidence-based. Do NOT create patterns from single occurrences.**
---OBSERVATION: [What was done and why it worked]
EVIDENCE: [Sessions/tasks where this pattern succeeded, with success rate]
REINFORCEMENT: [How to ensure this pattern continues to be applied]
> **注意:模式识别必须基于实证,禁止基于单次 occurrence 创建模式。**
---Phase 4: Adaptation
阶段4:适配优化
Generate and implement improvements based on identified patterns:
基于识别到的模式生成并落地改进方案:
Pre-Flight Checklists
前置检查清单
Create checklists that run before high-risk operations:
markdown
undefined为高风险操作创建执行前的检查清单:
markdown
undefinedPre-Flight: Before Writing [Framework] Code
Pre-Flight: Before Writing [Framework] Code
- Identify the framework and version (check package.json / composer.json)
- Identify the routing pattern (pages/ vs app/, file-based vs code-based)
- Check for existing patterns in the codebase (find similar files)
- Verify the API surface in documentation (do not assume from memory)
- Check for project-specific conventions (linter config, type config)
undefined- Identify the framework and version (check package.json / composer.json)
- Identify the routing pattern (pages/ vs app/, file-based vs code-based)
- Check for existing patterns in the codebase (find similar files)
- Verify the API surface in documentation (do not assume from memory)
- Check for project-specific conventions (linter config, type config)
undefinedGuardrail Rules
防护规则
markdown
undefinedmarkdown
undefinedGuardrail: [Operation Type]
Guardrail: [Operation Type]
BEFORE [specific operation]:
- [Check 1]
- [Check 2]
- [Check 3]
- [Check 4]
TRIGGERED BY: [keywords or conditions that activate this guardrail]
ADDED BECAUSE: [Error ID that caused this guardrail to be created]
EFFECTIVENESS: [Track whether this guardrail has prevented errors]
undefinedBEFORE [specific operation]:
- [Check 1]
- [Check 2]
- [Check 3]
- [Check 4]
TRIGGERED BY: [keywords or conditions that activate this guardrail]
ADDED BECAUSE: [Error ID that caused this guardrail to be created]
EFFECTIVENESS: [Track whether this guardrail has prevented errors]
undefinedAdaptation Decision Table
适配决策表
| Error Pattern | Adaptation Type | Example |
|---|---|---|
| Recurring comprehension errors | Add clarification step to workflow | "Before implementing, restate the requirement in your own words" |
| Recurring execution errors | Add pre-flight checklist | "Before writing framework code, check version and router type" |
| Recurring process errors | Add hard checkpoint | "STOP marker before commit: did you run tests?" |
| Recurring judgment errors | Add decision criteria table | "When to abstract vs. inline: frequency >3, complexity >medium" |
| Recurring knowledge errors | Add context discovery step | "Before using API, check current docs, not memory" |
STOP: Every adaptation must be validated against historical data before being persisted.
| 错误模式 | 适配类型 | 示例 |
|---|---|---|
| 重复出现理解类错误 | 在工作流中新增澄清步骤 | "实现前先用自己的话复述需求" |
| 重复出现执行类错误 | 新增前置检查清单 | "编写框架代码前,检查版本和路由类型" |
| 重复出现流程类错误 | 新增硬性检查点 | "提交前的STOP标记:你运行测试了吗?" |
| 重复出现判断类错误 | 新增决策标准表 | "何时抽象vs内联:使用频率>3,复杂度>中等" |
| 重复出现知识类错误 | 新增上下文挖掘步骤 | "使用API前,查阅最新文档而非依赖记忆" |
注意:所有适配方案落地前必须经过历史数据验证。
Phase 5: Feedback Loop and Validation
阶段5:反馈循环与验证
Measure whether improvements actually work:
- Compare current error rates against baseline (pre-improvement)
- Track each guardrail's prevention count
- Archive improvements that demonstrably reduce errors
- Revert improvements that do not reduce errors or add overhead
- Share learnings across sessions via memory files
评估改进方案是否真实有效:
- 对比当前错误率与改进前基线
- 跟踪每个防护规则的错误拦截次数
- 归档可显著降低错误率的改进方案
- 回退无法降低错误率或增加额外开销的改进方案
- 通过内存文件在不同会话间共享经验
Retrospective Template
复盘模板
markdown
undefinedmarkdown
undefinedRetrospective -- [Period]
Retrospective -- [Period]
What Went Well
What Went Well
- [Pattern/approach that consistently succeeded]
- [New technique that improved outcomes]
- [Pattern/approach that consistently succeeded]
- [New technique that improved outcomes]
What Went Poorly
What Went Poorly
- [Recurring error pattern with frequency]
- [Process gap that caused rework]
- [Recurring error pattern with frequency]
- [Process gap that caused rework]
Error Trends
Error Trends
| Category | This Period | Last Period | Trend |
|---|---|---|---|
| Comprehension | 3 | 5 | Improving |
| Execution | 7 | 4 | Worsening -- investigate |
| Process | 1 | 3 | Improving |
| Knowledge | 4 | 4 | Stable |
| Category | This Period | Last Period | Trend |
|---|---|---|---|
| Comprehension | 3 | 5 | Improving |
| Execution | 7 | 4 | Worsening -- investigate |
| Process | 1 | 3 | Improving |
| Knowledge | 4 | 4 | Stable |
Root Cause Analysis (Top 3 Errors)
Root Cause Analysis (Top 3 Errors)
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
- [Error pattern] -- Root cause: [analysis] -- Fix: [action]
Improvement Actions
Improvement Actions
| Action | Priority | Status | Expected Impact | Actual Impact |
|---|---|---|---|---|
| Add pre-flight check for X | High | Done | -30% execution errors | [measured] |
| Update memory with Y pattern | Medium | Done | -20% knowledge errors | [measured] |
| Create guardrail for Z | High | In Progress | Prevent critical error class | [pending] |
| Action | Priority | Status | Expected Impact | Actual Impact |
|---|---|---|---|---|
| Add pre-flight check for X | High | Done | -30% execution errors | [measured] |
| Update memory with Y pattern | Medium | Done | -20% knowledge errors | [measured] |
| Create guardrail for Z | High | In Progress | Prevent critical error class | [pending] |
Metrics vs. Targets
Metrics vs. Targets
| Metric | Target | Actual | Status |
|---|---|---|---|
| First-attempt success | >80% | 75% | Below target |
| Revision count | <1.5 | 1.8 | Below target |
| Error recurrence | <10% | 8% | On target |
---| Metric | Target | Actual | Status |
|---|---|---|---|
| First-attempt success | >80% | 75% | Below target |
| Revision count | <1.5 | 1.8 | Below target |
| Error recurrence | <10% | 8% | On target |
---Memory File Integration
内存文件集成
What to Persist
需持久化的内容
| File | Update When | Content |
|---|---|---|
| New pattern discovered or error pattern identified | Coding conventions, framework patterns, anti-patterns |
| User corrects style, format, or approach | Communication preferences, code style, tool choices |
| Significant architectural or approach decision | Decision, rationale, alternatives considered |
| New project context discovered | Tech stack, architecture, dependencies |
| 文件 | 更新时机 | 内容 |
|---|---|---|
| 发现新模式或识别到错误模式时 | 编码规范、框架模式、反模式 |
| 用户修正风格、格式或实现方式时 | 沟通偏好、代码风格、工具选择 |
| 做出重要架构或实现方案决策时 | 决策内容、决策理由、考虑过的替代方案 |
| 发现新的项目上下文时 | 技术栈、架构、依赖 |
Update Protocol
更新规则
- Identify the learning from the error or success
- Check if it conflicts with existing memory entries
- If conflict: update the existing entry with new information and date
- If new: add entry with context, evidence, and date
- Remove entries that are no longer valid (tech changed, project evolved)
Do NOT persist gut feelings as patterns. Evidence required: 2+ occurrences minimum.
- 从错误或成功案例中提炼经验
- 检查是否与现有内存条目冲突
- 若冲突:用新信息更新现有条目并标注日期
- 若为新内容:添加上下文、实证和日期
- 删除不再有效的条目(技术迭代、项目演进)
禁止将主观判断作为模式持久化,至少需要2次 occurrence 作为实证。
Continuous Improvement Cycle
持续改进循环
Execute Tasks -> Collect Metrics -> Analyze Errors -> Identify Patterns
^ |
| v
+-- Persist to Memory <-- Validate Impact <-- Implement Improvements
|
+-- Did not work? -> Revert, try different approachExecute Tasks -> Collect Metrics -> Analyze Errors -> Identify Patterns
^ |
| v
+-- Persist to Memory <-- Validate Impact <-- Implement Improvements
|
+-- Did not work? -> Revert, try different approachAnti-Patterns / Common Mistakes
反模式/常见错误
| What NOT to Do | Why It Fails | What to Do Instead |
|---|---|---|
| Same mistake 3 times without guardrail | Errors keep recurring with no prevention | Create guardrail after 2nd occurrence |
| Track metrics without acting on them | Measurement theater — effort without outcome | Every metric must have an action threshold |
| Over-correct from single error | One bad experience does not justify avoiding a tool forever | Require 2+ occurrences before creating a pattern |
| Treat all errors equally | Wastes effort on cosmetic issues | Prioritize by frequency x impact |
| Update memory without evidence | Poisons future sessions with wrong patterns | Require 2+ examples before persisting |
| Create so many checklists they become overhead | Checklist fatigue leads to skipping all of them | Max 5 items per checklist, retire unused ones |
| Blame external factors only | Misses internal process improvements | Always examine what YOU could have done differently |
| Skip validation of improvements | No way to know if improvements actually work | Compare error rates before and after |
| Persist outdated patterns | Stale advice causes new errors | Review and prune memory periodically |
| Never do retrospectives | Lose the big picture, focus only on individual errors | Schedule retrospective after every 10 tasks |
| 禁止行为 | 失败原因 | 替代方案 |
|---|---|---|
| 相同错误出现3次仍未添加防护规则 | 错误会持续重复发生无任何预防 | 第2次出现后就创建防护规则 |
| 只跟踪指标不采取行动 | 为了测量而测量,投入无产出 | 每个指标必须设置对应动作阈值 |
| 基于单次错误过度修正 | 一次糟糕体验不足以证明要永远避免某个工具 | 创建模式前至少需要2次 occurrence |
| 对所有错误同等对待 | 在外观类问题上浪费精力 | 按频率×影响优先级处理 |
| 无实证更新内存 | 错误模式会污染未来会话 | 持久化前至少需要2个示例 |
| 清单过多形成额外负担 | 清单疲劳导致全部被跳过 | 每个清单最多5项,淘汰未使用的清单 |
| 只归咎于外部因素 | 错过内部流程改进机会 | 始终复盘你本可以采取的不同做法 |
| 跳过改进方案验证 | 无法确认改进是否真实有效 | 对比改进前后的错误率 |
| 持久化过时模式 | 陈旧建议会引发新错误 | 定期审查和清理内存内容 |
| 从不做复盘 | 丢失全局视角,只关注单个错误 | 每完成10个任务安排一次复盘 |
Anti-Rationalization Guards
反合理化防护
| Thought | Reality |
|---|---|
| "This error is a one-off" | Log it anyway. If it happens again, you have the data. |
| "Metrics collection slows me down" | Not collecting metrics means repeating the same mistakes. |
| "The checklist is overkill for this task" | The checklist exists because a similar task failed before. Use it. |
| "I will remember this lesson" | You will not. Sessions are independent. Persist to memory. |
| "The error was not my fault" | External or internal, log the pattern. Prevention is your job. |
| "Retrospectives are a waste of time" | Without retrospectives, you cannot see trends. Do them. |
| "My success rate is good enough" | Good enough stagnates. The target is continuous improvement. |
Do NOT skip error logging. Do NOT skip metric collection. These are mandatory.
| 错误想法 | 现实 |
|---|---|
| "这个错误是偶发的" | 无论如何都要记录,再发生时你就有数据支撑 |
| "收集指标拖慢速度" | 不收集指标意味着会重复犯同样的错误 |
| "这个任务用清单太夸张了" | 清单存在是因为之前类似任务失败过,用就对了 |
| "我会记住这个教训" | 你不会的,会话是独立的,持久化到内存里 |
| "这个错误不是我的问题" | 不管是外部还是内部原因,记录模式,预防是你的工作 |
| "复盘浪费时间" | 不复盘你看不到趋势,必须做 |
| "我的成功率已经够好了" | 够好就会停滞,目标是持续改进 |
禁止跳过错误日志,禁止跳过指标收集,这些是强制要求。
Integration Points
集成点
| Skill | Relationship |
|---|---|
| Provides project context that prevents knowledge errors |
| Failed retries feed into error analysis |
| Stagnation events are major error signals |
| Verification failures trigger error logging |
| Improvement actions inform future plan quality |
| Review findings feed into pattern recognition |
| 技能 | 关系 |
|---|---|
| 提供项目上下文,预防知识类错误 |
| 失败的重试请求会输入到错误分析 |
| 停滞事件属于严重错误信号 |
| 验证失败会触发错误日志记录 |
| 改进动作会提升未来计划质量 |
| 评审发现的问题会输入到模式识别 |
Concrete Examples
具体示例
Guardrail Created from Error Pattern
基于错误模式创建的防护规则
Error: ERR-2026-0212-003 — Dropped production table during migration
Error: ERR-2026-0301-007 — Applied migration without rollback plan
Pattern: Database operations without safety checks (2 occurrences)
Guardrail Created:Error: ERR-2026-0212-003 — Dropped production table during migration
Error: ERR-2026-0301-007 — Applied migration without rollback plan
Pattern: Database operations without safety checks (2 occurrences)
Guardrail Created:Guardrail: Database Operations
Guardrail: Database Operations
BEFORE any database migration or schema change:
- Check if there is an existing migration framework
- Verify the current schema state
- Create a rollback plan
- Test migration on a copy first
TRIGGERED BY: any task involving database, schema, migration, model
ADDED BECAUSE: ERR-2026-0212-003, ERR-2026-0301-007
EFFECTIVENESS: 0 errors in 5 subsequent database tasks
undefinedBEFORE any database migration or schema change:
- Check if there is an existing migration framework
- Verify the current schema state
- Create a rollback plan
- Test migration on a copy first
TRIGGERED BY: any task involving database, schema, migration, model
ADDED BECAUSE: ERR-2026-0212-003, ERR-2026-0301-007
EFFECTIVENESS: 0 errors in 5 subsequent database tasks
undefinedPositive Pattern Documentation
正向模式文档
undefinedundefinedPositive Pattern: Context Discovery First
Positive Pattern: Context Discovery First
OBSERVATION: Tasks where project context was gathered first had
a 92% first-attempt success rate vs. 64% without.
EVIDENCE: Sessions 2026-02-01 through 2026-03-15 (47 tasks)
REINFORCEMENT: Always run context discovery before implementation.
Minimum: check package.json, read existing code in same domain,
identify conventions.
---OBSERVATION: Tasks where project context was gathered first had
a 92% first-attempt success rate vs. 64% without.
EVIDENCE: Sessions 2026-02-01 through 2026-03-15 (47 tasks)
REINFORCEMENT: Always run context discovery before implementation.
Minimum: check package.json, read existing code in same domain,
identify conventions.
---Skill Type
技能类型
RIGID — Error tracking, classification, and the improvement cycle must be followed consistently. Every recurring error (2+ occurrences) must result in a concrete preventive action. Memory files must be updated with evidence-based patterns only. Metric collection and error logging are mandatory on every session. Do not skip retrospectives.
刚性 — 错误跟踪、分类和改进循环必须严格遵循。每一个重复错误(出现≥2次)必须对应落地具体的预防动作。内存文件仅可更新基于实证的模式。指标收集和错误日志在每个会话都是强制要求,禁止跳过复盘。