一键导入
pwrl-learnings-extract
Extract actionable learnings from code, commits, tasks, documentation, errors, and reviews.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Extract actionable learnings from code, commits, tasks, documentation, errors, and reviews.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Extract, classify, deduplicate, structure, and save learnings from code, commits, tasks, and documentation
Create structured implementation plans with three tiers (Fast/Standard/Deep). Pure skill pipeline orchestrator—no agent routing.
Review code changes through 4-phase micro-skill pipeline (scope, prepare, analyze, report)
Execute implementation work efficiently through 4-phase micro-skill pipeline
Verify repository state and confirm session completion before committing.
Create a clear session commit with state and next steps. Orchestrates checkpoint and commit micro-skills, optionally chains to pwrl-learnings.
| name | pwrl-learnings-extract |
| description | Extract actionable learnings from code, commits, tasks, documentation, errors, and reviews. |
| argument-hint | [source type: code|commit|task|documentation|error|review, and source content] |
Purpose: Entry point to the learnings workflow. Scans source materials (code, commits, tasks, docs, errors, reviews) for learning signals and extracts actionable learning candidates. Produces extraction artifact consumed by pwrl-learnings-classify.
interactionMode selected in Step 1.5 below. The scanning itself is identical in all three modes; only the confirmations and dedup resolutions differ.User provides:
source_type: code | commit | task | documentation | error | review
source_content: [File content, commit message, error trace, etc.]
context:
file_path: [optional]
line_range: [optional]
task_id: [optional]
timestamp: [optional]
Emit extraction artifact (YAML + markdown):
---
format: pwrl-learnings-extract-artifact
version: "1.0"
extract_id: YYYY-MM-DD-NNN-extract
created: ISO-8601-timestamp
source_type: code | commit | task | documentation | error | review
source_ref: [file_path | commit_hash | task_id | error_id]
interactionMode: detailed | smart | yolo
---
# Learning Extraction Results
## Summary
- **Total Learnings Found:** [count]
- **By Category:**
- Gotchas: [count]
- Patterns: [count]
- Decisions: [count]
- Technical Fixes: [count]
- Workflows: [count]
## Extracted Learnings
### Learning 1
- **Type:** [gotcha | pattern | decision | technical_fix | workflow]
- **Title:** [Concise 1-line title]
- **Problem:** [What problem does this learning address?]
- **Application:** [How/when to apply this learning?]
- **Source Context:** [File:line or relevant snippet]
- **Confidence:** [high | medium | low]
- **Linked Issues:** [GitHub issue numbers if available]
[Additional learnings...]
## Extraction Status
- **Status:** success
- **Quality:** [all|most|some] learnings are actionable
- **Coverage:** Scanned [N] lines / [N] items
## Ready for Classification
- **Next Skill:** pwrl-learnings-classify
- **Artifacts Passed:** This extraction artifact + source reference
- **Interaction Mode:** [chosen-value]
Artifact passed to pwrl-learnings-classify.
Before scanning source materials, ask the user to choose their engagement level for this extraction. Use the platform's ask_user_question extension (or equivalent) to present the following three options:
Question: "How would you like to proceed with this extraction?"
Options:
Note: In Yolo mode (the default for users who skip the prompt), the workflow proceeds as it did before this mode ask was added.
Store the selection in the extraction artifact (replacing the placeholder in the schema above):
interactionMode: detailed | smart | yolo
Mode-aware behavior propagation: The interactionMode value flows into pwrl-learnings-classify, pwrl-learnings-dedup, pwrl-learnings-structure, and pwrl-learnings-save artifacts. Each downstream phase reads the value and adjusts its confirmation behavior:
For complete step-by-step instructions, see extract-learnings-detailed-workflow.md.
This SKILL.md provides an overview. The detailed workflow document contains:
After completing this phase, run quality gate validation:
/pwrl-phase-checkpoint learnings 1 [artifact-path]
See pwrl-phase-checkpoint for validation rules.
For source_type = "code":
Code comment signals:
Code pattern signals:
Code quality signals:
For source_type = "commit":
Commit message analysis:
Diff pattern analysis:
Linked issues:
For source_type = "task":
Requirements analysis:
Learning signals:
For source_type = "documentation":
Architecture sections:
Setup/configuration:
FAQ/troubleshooting:
For source_type = "error":
Error trace analysis:
Symptom-to-fix mapping:
For source_type = "review":
Review feedback patterns:
Categories:
For each signal found, create learning object:
Learning Candidate:
Type: [gotcha | pattern | decision | technical_fix | workflow]
Title: [Concise, actionable title]
Problem: [Clear statement of problem/opportunity]
Application: [How to use this learning]
Confidence: [high | medium | low]
Source: [File:line or commit hash or task_id]
Confidence levels:
Assign preliminary types:
Gotcha: "Beware of X" or "Don't do X"
Pattern: "Effective approach for Y"
Decision: "Why we chose X over Y"
Technical Fix: "How to solve specific problem Z"
Workflow: "Process or best practice"
For each learning, collect:
Check each candidate learning has:
If validation fails:
Emit artifact with:
Look for these signals:
// FIXME: Race condition when multiple instances access cache
class Cache {
constructor() {
this.data = {};
}
// ^^ Learning: "Race condition gotcha"
}
// HACK: Temporary workaround until DB migration complete
if (legacyFormat) {
data = convertFromLegacy(data);
}
// ^^ Learning: "Technical fix or temporary solution"
// Complex logic with nested conditions
if (auth && perms && !banned && date < expiry && verified) {
// 5-level nesting
// ^^ Learning: "Condition complexity pattern"
}
Commit: "Fix: Race condition in cache access (closes #456)"
Extract:
Type: technical_fix
Title: "Use mutex to prevent race condition"
Problem: "Multiple threads accessing shared cache"
Application: "Add locking for shared mutable state"
Issue: #456
Error: TypeError: Cannot read property 'foo' of undefined
Stack: at app.js:42 in processData()
Extract:
Type: gotcha
Title: "Null/undefined check before property access"
Problem: "Uninitialized object passed to function"
Application: "Always validate inputs; add null checks"
Prevention: "Use TypeScript or strict null checking"
| Error | Recovery |
|---|---|
| Invalid source_type | Ask user to clarify (code/commit/task/etc.) |
| Empty source | Return error; ask user to provide content |
| Unreadable format | Ask user to provide plain text or summary |
| No signals found | Return empty artifact; continue to classify |
| Parse error | Log issue; continue with parsed portion |
Test file: tests/pwrl-learnings/extract-learnings.test.ts
Happy Path Tests:
Edge Cases:
Output Validation Tests: