沉淀并查询代码库经验教训,帮助开发、验证与评审减少重复踩坑。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "harness-learnings" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/devsquad-copilot/main/.github/plugins/devsquad/skills/harness-learnings/SKILL.md 2. 保存为 ~/.claude/skills/harness-learnings/SKILL.md 3. 装好后重载技能,告诉我可以用了
请把这次集成测试的关键前置条件整理为可复用经验:必须先执行数据库迁移、再加载测试种子数据,否则会出现外键错误。输出一条适合后续开发和验证阶段查询的经验记录。
一条结构清晰的经验记录,说明适用场景、前置步骤、常见错误及后续使用建议。
我准备修改支付模块的退款流程。请先查询是否有与支付状态机、幂等处理、审计日志相关的代码库经验,并总结成开发前检查清单。
一份开发前检查清单,汇总相关经验、注意事项和应遵循的既有模式。
这次代码评审再次发现控制器直接访问数据库、绕过 service 层。请将这个重复出现的问题整理成代码库经验,包含反例、推荐做法和适用范围。
一条可复用的评审经验,明确反模式、正确实现方式,以及未来评审时的检查要点。
Agent sessions are ephemeral. Codebase knowledge is not. When an agent discovers a pattern through trial and error (failed tests, correction loops, review findings), that knowledge should persist so the next session starts smarter.
This skill has two modes: capture (write a learning) and consult (read learnings relevant to the current task).
Capture is auto-prompted by the lifecycle agents at trigger moments where the agent has likely done something that future sessions should know about. The auto-prompt sites are:
devsquad.implement.execute after self-correction loops (2+ correction
attempts, reverts of own work, max-attempt exhaustion)devsquad.implement.verify after discovering a test or build prerequisite
through a failed rundevsquad.review.code after producing Major or Critical findings that match
a codebase-specific patterndevsquad.implement.finalize after human PR feedback contradicts prior agent
output, or CI fails on a missing prerequisiteAt each trigger, the calling agent surfaces a [Y] / [N] / [E] prompt before
returning its output. Default is [Y] to capture. The user can also invoke
this skill explicitly at any time ("add this as a learning", "capture this as
a learning"); the skill runs in capture mode without a trigger.
Consult is automatic at the start of implement.execute, implement.verify,
and review.code (see "When to Consult" below).
| Trigger | What to capture |
|---|---|
| Self-correction loop needed (test failure, lint failure) | Root cause, fix pattern, affected files |
| Max correction attempts (2) exhausted | What the agent could not self-correct and why |
| Build/lint/test prerequisite missed | Required setup step (seed scripts, env vars, build order) |
| Review finding classified Major or Critical | Anti-pattern detected, correct pattern for this codebase |
| Recurring drift detected by refine.health | What drifts and how to prevent it |
| Successful debugging triage of non-obvious issue | Root cause pattern, diagnostic path |
| Human PR feedback on preventable issue | What the human caught that the agent missed |
coding-guidelines.md or .instructions.md.memory/harness-learnings.md (create from template if it does not exist)Scope (shared file paths or modules) AND similar failure typeOccurrences, update Last seen, upgrade Confidence if warrantedL-NNN IDPhase: the lifecycle phase where this learning is most relevant for consumption (not necessarily where it was captured). A review finding about missing error handling should have Phase = implement if the fix belongs at coding time.Dimension: what it regulates (maintainability, architecture, behaviour)Scope: concrete file paths, directories, or module names. Use glob patterns when appropriate (e.g., src/api/**, *.controller.ts). This is the primary field agents use to match learnings to their current task.Pattern: factual description of what happened (the observation)Guidance: actionable instruction for what to do differently (the prescription). Must include file paths, commands, or specific checks.…
帮助你创建、切换并检查代码分支,确保实现前遵循正确分支策略。
用于代码与分支审查,综合检查正确性、兼容性、架构、测试、性能与安全问题。