self-improvement by pskoett/pskoett-ai-skills
npx skills add https://github.com/pskoett/pskoett-ai-skills --skill self-improvementnpx skills add pskoett/pskoett-ai-skills/skills/self-improvement
仅用于 CI 执行时,请使用:
npx skills add pskoett/pskoett-ai-skills/skills/self-improvement-ci
将学习内容和错误记录到 Markdown 文件中,以实现持续改进。编码代理稍后可以将这些内容处理成修复方案,重要的学习内容会被提升到项目记忆中。
| 情境 | 操作 |
|---|---|
| 命令/操作失败 | 记录到 .learnings/ERRORS.md |
| 用户纠正你 | 记录到 .learnings/LEARNINGS.md,类别为 correction |
| 用户需要缺失的功能 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
记录到 .learnings/FEATURE_REQUESTS.md |
| API/外部工具失败 | 记录到 .learnings/ERRORS.md,包含集成详情 |
| 知识已过时 | 记录到 .learnings/LEARNINGS.md,类别为 knowledge_gap |
| 找到更好的方法 | 记录到 .learnings/LEARNINGS.md,类别为 best_practice |
| 简化/加固重复出现的模式 | 记录/更新 .learnings/LEARNINGS.md,包含 Source: simplify-and-harden 和一个稳定的 Pattern-Key |
| 与现有条目类似 | 使用 **See Also** 链接,考虑提升优先级 |
| 广泛适用的学习内容 | 提升到 CLAUDE.md、AGENTS.md 和/或 .github/copilot-instructions.md |
| 工作流改进 | 提升到 AGENTS.md(openclaw 工作区) |
| 工具陷阱 | 提升到 TOOLS.md(openclaw 工作区) |
| 行为模式 | 提升到 SOUL.md(openclaw 工作区) |
如果项目根目录下不存在 .learnings/ 目录,请创建:
mkdir -p .learnings
从 assets/ 复制模板或创建带标题的文件。
追加到 .learnings/LEARNINGS.md:
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
One-line description of what was learned
### Details
Full context: what happened, what was wrong, what's correct
### Suggested Action
Specific fix or improvement to make
### Metadata
- Source: conversation | error | user_feedback
- Related Files: path/to/file.ext
- Tags: tag1, tag2
- See Also: LRN-20250110-001 (if related to existing entry)
- Pattern-Key: simplify.dead_code | harden.input_validation (optional, for recurring-pattern tracking)
- Recurrence-Count: 1 (optional)
- First-Seen: 2025-01-15 (optional)
- Last-Seen: 2025-01-15 (optional)
---
追加到 .learnings/ERRORS.md:
## [ERR-YYYYMMDD-XXX] skill_or_command_name
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
Brief description of what failed
### Error
Actual error message or output
### Context
- Command/operation attempted
- Input or parameters used
- Environment details if relevant
### Suggested Fix
If identifiable, what might resolve this
### Metadata
- Reproducible: yes | no | unknown
- Related Files: path/to/file.ext
- See Also: ERR-20250110-001 (if recurring)
---
追加到 .learnings/FEATURE_REQUESTS.md:
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Requested Capability
What the user wanted to do
### User Context
Why they needed it, what problem they're solving
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
How this could be built, what it might extend
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_feature_name
---
格式:TYPE-YYYYMMDD-XXX
LRN (学习), ERR (错误), FEAT (功能)001, A7B)示例:LRN-20250115-001, ERR-20250115-A3F, FEAT-20250115-002
当问题被修复时,更新条目:
**Status**: pending 改为 **Status**: resolved### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Commit/PR**: abc123 or #42
- **Notes**: Brief description of what was done
其他状态值:
in_progress - 正在积极处理中wont_fix - 决定不处理(在解决说明中添加原因)promoted - 已提升到 CLAUDE.md、AGENTS.md 或 .github/copilot-instructions.md当一个学习内容广泛适用(不是一次性修复)时,将其提升到永久的项目记忆中。
| 目标 | 应包含的内容 |
|---|---|
CLAUDE.md | 项目事实、约定、所有 Claude 交互的陷阱 |
AGENTS.md | 代理特定的工作流、工具使用模式、自动化规则 |
.github/copilot-instructions.md | GitHub Copilot 的项目上下文和约定 |
SOUL.md | 行为指南、沟通风格、原则(openclaw) |
TOOLS.md | 工具能力、使用模式、集成陷阱(openclaw) |
**Status**: pending 改为 **Status**: promoted**Promoted**: CLAUDE.md、AGENTS.md 或 .github/copilot-instructions.md学习内容(详细):
项目使用 pnpm 工作区。尝试了
npm install但失败了。锁文件是pnpm-lock.yaml。必须使用pnpm install。
在 CLAUDE.md 中(简洁):
## Build & Dependencies
- Package manager: pnpm (not npm) - use `pnpm install`
学习内容(详细):
修改 API 端点时,必须重新生成 TypeScript 客户端。忘记这一点会导致运行时类型不匹配。
在 AGENTS.md 中(可操作):
## After API Changes
1. Regenerate client: `pnpm run generate:api`
2. Check for type errors: `pnpm tsc --noEmit`
如果记录的内容与现有条目类似:
grep -r "keyword" .learnings/**See Also**: ERR-20250110-001使用此工作流来接收来自 simplify-and-harden 技能的重复模式,并将其转化为持久的提示指导。
simplify_and_harden.learning_loop.candidates。pattern_key 作为稳定的去重键。.learnings/LEARNINGS.md 中搜索具有该键的现有条目:
grep -n "Pattern-Key: <pattern_key>" .learnings/LEARNINGS.mdRecurrence-CountLast-SeenSee Also 链接到相关条目/任务LRN-... 条目Source: simplify-and-hardenPattern-Key、Recurrence-Count: 1 和 First-Seen/Last-Seen当以下所有条件都满足时,将重复模式提升到代理上下文/系统提示文件中:
Recurrence-Count >= 3提升目标:
CLAUDE.mdAGENTS.md.github/copilot-instructions.mdSOUL.md / TOOLS.md 用于 openclaw 工作区级别的指导(如适用)将提升的规则写为简短的预防规则(在编码之前/期间要做什么),而不是冗长的事件报告。
在自然的断点处审查 .learnings/:
# Count pending items
grep -h "Status\*\*: pending" .learnings/*.md | wc -l
# List pending high-priority items
grep -B5 "Priority\*\*: high" .learnings/*.md | grep "^## \["
# Find learnings for a specific area
grep -l "Area\*\*: backend" .learnings/*.md
当你注意到以下情况时自动记录:
纠正(→ 学习,类别为 correction):
功能请求(→ 功能请求):
知识缺口(→ 学习,类别为 knowledge_gap):
错误(→ 错误条目):
| 优先级 | 何时使用 |
|---|---|
critical | 阻塞核心功能,有数据丢失风险,安全问题 |
high | 重大影响,影响常见工作流,重复出现的问题 |
medium | 中等影响,存在变通方案 |
low | 轻微不便,边缘情况,锦上添花的功能 |
用于按代码库区域筛选学习内容:
| 区域 | 范围 |
|---|---|
frontend | UI、组件、客户端代码 |
backend | API、服务、服务器端代码 |
infra | CI/CD、部署、Docker、云 |
tests | 测试文件、测试工具、覆盖率 |
docs | 文档、注释、README |
config | 配置文件、环境、设置 |
保持学习内容本地化(每个开发者):
.learnings/
在仓库中跟踪学习内容(团队范围内):不要添加到 .gitignore - 学习内容成为共享知识。
混合模式(跟踪模板,忽略条目):
.learnings/*.md
!.learnings/.gitkeep
通过代理钩子启用自动提醒。这是选择加入的 - 你必须明确配置钩子。
在你的项目中创建 .claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/activator.sh"
}]
}]
}
}
这会在每次提示后注入学习评估提醒(约 50-100 个令牌的开销)。
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/activator.sh"
}]
}],
"PostToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/error-detector.sh"
}]
}]
}
}
| 脚本 | 钩子类型 | 目的 |
|---|---|---|
scripts/activator.sh | UserPromptSubmit | 提醒在任务后评估学习内容 |
scripts/error-detector.sh | PostToolUse (Bash) | 在命令错误时触发 |
有关详细配置和故障排除,请参阅 references/hooks-setup.md。
当一个学习内容足够有价值,可以成为可重用技能时,使用提供的帮助程序进行提取。
当满足以下任何条件时,学习内容有资格进行技能提取:
| 标准 | 描述 |
|---|---|
| 重复出现 | 有 See Also 链接指向 2 个以上类似问题 |
| 已验证 | 状态为 resolved 且修复有效 |
| 非显而易见 | 需要实际调试/调查才能发现 |
| 广泛适用 | 非项目特定;在多个代码库中有用 |
| 用户标记 | 用户说"将其保存为技能"或类似表达 |
识别候选:学习内容满足提取标准
运行帮助程序(或手动创建):
./skills/self-improvement/scripts/extract-skill.sh skill-name --dry-run
./skills/self-improvement/scripts/extract-skill.sh skill-name
自定义 SKILL.md:用学习内容填充模板
更新学习内容:将状态设置为 promoted_to_skill,添加 Skill-Path
验证:在新会话中阅读技能,确保其自包含
如果你更喜欢手动创建:
skills/<skill-name>/SKILL.mdassets/SKILL-TEMPLATE.md 中的模板name 和 description 的 YAML 前言注意这些信号,表明学习内容应该成为技能:
在对话中:
在学习条目中:
See Also 链接(重复出现的问题)best_practice 且广泛适用在提取之前,验证:
此技能适用于不同的 AI 编码代理,并具有代理特定的激活方式。
激活:钩子(UserPromptSubmit, PostToolUse) 设置:.claude/settings.json 带钩子配置 检测:通过钩子脚本自动
激活:钩子(与 Claude Code 相同的模式) 设置:.codex/settings.json 带钩子配置 检测:通过钩子脚本自动
激活:手动(不支持钩子) 设置:添加到 .github/copilot-instructions.md:
## Self-Improvement
After solving non-obvious issues, consider logging to `.learnings/`:
1. Use format from self-improvement skill
2. Link related entries with See Also
3. Promote high-value learnings to skills
Ask in chat: "Should I log this as a learning?"
检测:会话结束时手动审查
OpenClaw 特定的设置、提升目标和混合使用细节保存在 references/openclaw-integration.md 中,以便此主要技能专注于编码代理的核心自我提升工作流。
无论使用哪种代理,在以下情况下应用自我提升:
对于 Copilot 用户,在相关时将此内容添加到你的提示中:
完成此任务后,评估是否有任何学习内容应使用自我提升技能格式记录到
.learnings/。
或使用快速提示:
每周安装数
757
仓库
GitHub 星标
72
首次出现
Jan 27, 2026
安全审计
安装于
opencode701
gemini-cli695
codex691
cursor690
github-copilot688
amp676
npx skills add pskoett/pskoett-ai-skills/skills/self-improvement
For CI-only execution, use:
npx skills add pskoett/pskoett-ai-skills/skills/self-improvement-ci
Log learnings and errors to markdown files for continuous improvement. Coding agents can later process these into fixes, and important learnings get promoted to project memory.
| Situation | Action |
|---|---|
| Command/operation fails | Log to .learnings/ERRORS.md |
| User corrects you | Log to .learnings/LEARNINGS.md with category correction |
| User wants missing feature | Log to .learnings/FEATURE_REQUESTS.md |
| API/external tool fails | Log to .learnings/ERRORS.md with integration details |
| Knowledge was outdated | Log to .learnings/LEARNINGS.md with category knowledge_gap |
| Found better approach | Log to .learnings/LEARNINGS.md with category best_practice |
| Simplify/Harden recurring patterns | Log/update .learnings/LEARNINGS.md with Source: simplify-and-harden and a stable Pattern-Key |
| Similar to existing entry | Link with **See Also**, consider priority bump |
| Broadly applicable learning | Promote to CLAUDE.md, AGENTS.md, and/or .github/copilot-instructions.md |
| Workflow improvements | Promote to AGENTS.md (openclaw workspace) |
| Tool gotchas | Promote to TOOLS.md (openclaw workspace) |
| Behavioral patterns | Promote to SOUL.md (openclaw workspace) |
Create .learnings/ directory in project root if it doesn't exist:
mkdir -p .learnings
Copy templates from assets/ or create files with headers.
Append to .learnings/LEARNINGS.md:
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
One-line description of what was learned
### Details
Full context: what happened, what was wrong, what's correct
### Suggested Action
Specific fix or improvement to make
### Metadata
- Source: conversation | error | user_feedback
- Related Files: path/to/file.ext
- Tags: tag1, tag2
- See Also: LRN-20250110-001 (if related to existing entry)
- Pattern-Key: simplify.dead_code | harden.input_validation (optional, for recurring-pattern tracking)
- Recurrence-Count: 1 (optional)
- First-Seen: 2025-01-15 (optional)
- Last-Seen: 2025-01-15 (optional)
---
Append to .learnings/ERRORS.md:
## [ERR-YYYYMMDD-XXX] skill_or_command_name
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Summary
Brief description of what failed
### Error
Actual error message or output
### Context
- Command/operation attempted
- Input or parameters used
- Environment details if relevant
### Suggested Fix
If identifiable, what might resolve this
### Metadata
- Reproducible: yes | no | unknown
- Related Files: path/to/file.ext
- See Also: ERR-20250110-001 (if recurring)
---
Append to .learnings/FEATURE_REQUESTS.md:
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
**Area**: frontend | backend | infra | tests | docs | config
### Requested Capability
What the user wanted to do
### User Context
Why they needed it, what problem they're solving
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
How this could be built, what it might extend
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_feature_name
---
Format: TYPE-YYYYMMDD-XXX
LRN (learning), ERR (error), FEAT (feature)001, A7B)Examples: LRN-20250115-001, ERR-20250115-A3F, FEAT-20250115-002
When an issue is fixed, update the entry:
**Status**: pending → **Status**: resolved### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Commit/PR**: abc123 or #42
- **Notes**: Brief description of what was done
Other status values:
in_progress - Actively being worked onwont_fix - Decided not to address (add reason in Resolution notes)promoted - Elevated to CLAUDE.md, AGENTS.md, or .github/copilot-instructions.mdWhen a learning is broadly applicable (not a one-off fix), promote it to permanent project memory.
| Target | What Belongs There |
|---|---|
CLAUDE.md | Project facts, conventions, gotchas for all Claude interactions |
AGENTS.md | Agent-specific workflows, tool usage patterns, automation rules |
.github/copilot-instructions.md | Project context and conventions for GitHub Copilot |
SOUL.md | Behavioral guidelines, communication style, principles (openclaw) |
TOOLS.md | Tool capabilities, usage patterns, integration gotchas (openclaw) |
**Status**: pending → **Status**: promoted**Promoted**: CLAUDE.md, AGENTS.md, or .github/copilot-instructions.mdLearning (verbose):
Project uses pnpm workspaces. Attempted
npm installbut failed. Lock file ispnpm-lock.yaml. Must usepnpm install.
In CLAUDE.md (concise):
## Build & Dependencies
- Package manager: pnpm (not npm) - use `pnpm install`
Learning (verbose):
When modifying API endpoints, must regenerate TypeScript client. Forgetting this causes type mismatches at runtime.
In AGENTS.md (actionable):
## After API Changes
1. Regenerate client: `pnpm run generate:api`
2. Check for type errors: `pnpm tsc --noEmit`
If logging something similar to an existing entry:
grep -r "keyword" .learnings/**See Also**: ERR-20250110-001 in MetadataUse this workflow to ingest recurring patterns from the simplify-and-harden skill and turn them into durable prompt guidance.
simplify_and_harden.learning_loop.candidates from the task summary.pattern_key as the stable dedupe key..learnings/LEARNINGS.md for an existing entry with that key:
grep -n "Pattern-Key: <pattern_key>" .learnings/LEARNINGS.mdRecurrence-CountLast-SeenSee Also links to related entries/tasksLRN-... entryPromote recurring patterns into agent context/system prompt files when all are true:
Recurrence-Count >= 3Promotion targets:
CLAUDE.mdAGENTS.md.github/copilot-instructions.mdSOUL.md / TOOLS.md for openclaw workspace-level guidance when applicableWrite promoted rules as short prevention rules (what to do before/while coding), not long incident write-ups.
Review .learnings/ at natural breakpoints:
# Count pending items
grep -h "Status\*\*: pending" .learnings/*.md | wc -l
# List pending high-priority items
grep -B5 "Priority\*\*: high" .learnings/*.md | grep "^## \["
# Find learnings for a specific area
grep -l "Area\*\*: backend" .learnings/*.md
Automatically log when you notice:
Corrections (→ learning with correction category):
Feature Requests (→ feature request):
Knowledge Gaps (→ learning with knowledge_gap category):
Errors (→ error entry):
| Priority | When to Use |
|---|---|
critical | Blocks core functionality, data loss risk, security issue |
high | Significant impact, affects common workflows, recurring issue |
medium | Moderate impact, workaround exists |
low | Minor inconvenience, edge case, nice-to-have |
Use to filter learnings by codebase region:
| Area | Scope |
|---|---|
frontend | UI, components, client-side code |
backend | API, services, server-side code |
infra | CI/CD, deployment, Docker, cloud |
tests | Test files, testing utilities, coverage |
docs | Documentation, comments, READMEs |
config | Configuration files, environment, settings |
Keep learnings local (per-developer):
.learnings/
Track learnings in repo (team-wide): Don't add to .gitignore - learnings become shared knowledge.
Hybrid (track templates, ignore entries):
.learnings/*.md
!.learnings/.gitkeep
Enable automatic reminders through agent hooks. This is opt-in - you must explicitly configure hooks.
Create .claude/settings.json in your project:
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/activator.sh"
}]
}]
}
}
This injects a learning evaluation reminder after each prompt (~50-100 tokens overhead).
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/activator.sh"
}]
}],
"PostToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "./skills/self-improvement/scripts/error-detector.sh"
}]
}]
}
}
| Script | Hook Type | Purpose |
|---|---|---|
scripts/activator.sh | UserPromptSubmit | Reminds to evaluate learnings after tasks |
scripts/error-detector.sh | PostToolUse (Bash) | Triggers on command errors |
See references/hooks-setup.md for detailed configuration and troubleshooting.
When a learning is valuable enough to become a reusable skill, extract it using the provided helper.
A learning qualifies for skill extraction when ANY of these apply:
| Criterion | Description |
|---|---|
| Recurring | Has See Also links to 2+ similar issues |
| Verified | Status is resolved with working fix |
| Non-obvious | Required actual debugging/investigation to discover |
| Broadly applicable | Not project-specific; useful across codebases |
| User-flagged | User says "save this as a skill" or similar |
Identify candidate : Learning meets extraction criteria
Run helper (or create manually):
./skills/self-improvement/scripts/extract-skill.sh skill-name --dry-run
./skills/self-improvement/scripts/extract-skill.sh skill-name
Customize SKILL.md : Fill in template with learning content
Update learning : Set status to promoted_to_skill, add Skill-Path
Verify : Read skill in fresh session to ensure it's self-contained
If you prefer manual creation:
skills/<skill-name>/SKILL.mdassets/SKILL-TEMPLATE.mdname and descriptionWatch for these signals that a learning should become a skill:
In conversation:
In learning entries:
See Also links (recurring issue)best_practice with broad applicabilityBefore extraction, verify:
This skill works across different AI coding agents with agent-specific activation.
Activation : Hooks (UserPromptSubmit, PostToolUse) Setup : .claude/settings.json with hook configuration Detection : Automatic via hook scripts
Activation : Hooks (same pattern as Claude Code) Setup : .codex/settings.json with hook configuration Detection : Automatic via hook scripts
Activation : Manual (no hook support) Setup : Add to .github/copilot-instructions.md:
## Self-Improvement
After solving non-obvious issues, consider logging to `.learnings/`:
1. Use format from self-improvement skill
2. Link related entries with See Also
3. Promote high-value learnings to skills
Ask in chat: "Should I log this as a learning?"
Detection : Manual review at session end
OpenClaw-specific setup, promotion targets, and hybrid usage details are kept in references/openclaw-integration.md so this main skill stays focused on the core self-improvement workflow for coding agents.
Regardless of agent, apply self-improvement when you:
For Copilot users, add this to your prompts when relevant:
After completing this task, evaluate if any learnings should be logged to
.learnings/using the self-improvement skill format.
Or use quick prompts:
Weekly Installs
757
Repository
GitHub Stars
72
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode701
gemini-cli695
codex691
cursor690
github-copilot688
amp676
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
Source: simplify-and-hardenPattern-Key, Recurrence-Count: 1, and First-Seen/Last-Seen