| name | apply-learnings |
| description | Reviews pending corrections from the developer learnings queue and applies them as generalized rules to the relevant skill's Learnings & Corrections section. Uses the Reflect-Abstract-Generalize-Write pattern to convert raw user corrections into absolute directives that improve future skill execution. Use when the user asks to: - Apply learnings or corrections - Review the learnings queue - Improve developer skills from past feedback - "What corrections have accumulated?"
|
| argument-hint | |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash, AskUserQuestion |
Apply Learnings
Process pending corrections from the developer learnings queue and apply them
as generalized rules to the relevant skill files.
Workspace Discovery
Before any file operation, run the discovery helper and substitute the
returned tokens into every path this skill reads, writes, or edits:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/validate-stories/scripts/status_rollup.py --mode discover
The JSON output supplies {workspace_root}, {project_root},
{project_name}, {stories_dir}, and {learnings_queue}. The plugin is
project-agnostic — never hardcode project or chapter names in edits.
Step 1: Read the Learnings Queue
cat "{learnings_queue}"
If the file is empty or contains no "status": "pending" entries, report
"No pending learnings to apply" and stop.
Step 2: Group by Skill
Parse each JSONL line and group entries by the skill field. Display a
summary to the user:
Pending learnings:
- create-dag: 2 corrections
- create-ingestion: 1 correction
Step 3: Process Each Correction
For each pending correction, apply the Reflect-Abstract-Generalize-Write pattern:
3a. Reflect
What exactly was corrected? Quote the user's original correction.
3b. Abstract
Is this specific to one case, or does it apply generally? Consider:
- Does it apply to all artifacts or just this one?
- Is it a style preference or a correctness issue?
- Could it conflict with existing learnings?
3c. Generalize
Write the learning as an absolute directive following the meta-rules:
- Start with "Always" or "Never"
- Lead with the problem, then the fix
- Include a concrete command or example
- One rule per bullet
3d. Confirm with User
Use AskUserQuestion to show the proposed learning and ask if it should be applied:
Proposed learning for create-dag:
- **L-001** (2026-04-22): Always declare `schedule=None` explicitly in DAGs
that have no automated trigger — do not omit the schedule parameter.
Apply this learning? [Yes / No / Edit]
Step 4: Write Approved Learnings
For each approved learning:
-
Read the target skill file:
${CLAUDE_PLUGIN_ROOT}/skills/{skill-name}/SKILL.md
-
Find the ### Active Learnings section (create it under a ## Learnings & Corrections
heading if absent)
-
Determine the next learning ID (L-001, L-002, etc.) by counting existing entries
-
Append the new learning bullet after any existing entries (or replace the
"No learnings recorded yet" placeholder if this is the first)
-
Use the Edit tool to make the change
Step 5: Update the Queue
After all learnings are processed, update {learnings_queue}:
- Change
"status": "pending" to "status": "applied" for applied entries
- Change
"status": "pending" to "status": "rejected" for rejected entries
Step 6: Report
Summarize what was done:
- Number of learnings applied per skill
- Number rejected
- Any conflicts with existing learnings that were resolved