一键导入
promote-lesson
Promote a personal lesson from .claude/lessons/personal.md to the team-wide tasks/lessons.md, optionally rewording for team applicability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Promote a personal lesson from .claude/lessons/personal.md to the team-wide tasks/lessons.md, optionally rewording for team applicability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | promote-lesson |
| description | Promote a personal lesson from .claude/lessons/personal.md to the team-wide tasks/lessons.md, optionally rewording for team applicability. |
| type | skill |
| allowed-tools | Read, Write, Edit, Bash, AskUserQuestion |
| argument-hint | ["keyword to filter lessons"] |
| user-invocable | true |
Personal lessons in .claude/lessons/personal.md are gitignored — they belong to the engineer, not the team. When a personal lesson matures into a rule that every contributor should follow, promote it to the committed tasks/lessons.md. This skill is the explicit, audited path for that move.
tasks/lessons.mdLocate the personal file. Resolve to main worktree if in a worktree. If .claude/lessons/personal.md does not exist, tell the engineer there is nothing to promote and stop.
List candidates. Read .claude/lessons/personal.md and extract every ## header with its block. If the engineer passed a keyword argument, filter blocks whose body matches the keyword (case-insensitive). Show the list, numbered, with the title and a one-line excerpt.
Ask which to promote. Use AskUserQuestion with the numbered list. Accept multiple selections.
Reword for team. For each selected lesson, rewrite first-person language (I, my) into team-applicable phrasing (engineers, the codebase, we). Show the proposed reworded text and confirm with the engineer before writing — wording matters when it lands in a committed file.
Append to team store.
scripts/learnings.sh is present). Add a JSONL entry with --scope team --source promotion and the reworded body, then learnings.sh regen-markdown to rebuild tasks/lessons.md:
# Resolve the script: project copy first, else the plugin's copy.
LS="scripts/learnings.sh"; [ -f "$LS" ] || LS="${CLAUDE_PLUGIN_ROOT:-.}/scripts/learnings.sh"
bash "$LS" add --scope team --source promotion \
--decision-origin "<inherit from the personal entry being promoted>" \
--severity warn --phase any \
--title "<reworded title>" --body "<reworded body>" \
--rule "<rule>" --applies-when "<when>"
bash "$LS" regen-markdown
tasks/lessons.md at the bottom (newest last). Keep the structure: ## [Date] — [Title], **Correction:**, **Rule:**, **Why:**, **Applies to:**. Add a **Promoted from personal:** note with the original date so provenance is auditable.5b. Optional: attach an executable contract (v7.25). Promotion is the natural point to make a lesson checkable rather than advisory. When the lesson has a verifiable outcome, add the contract fields so a future session can confirm it, not just read it:
# $LS resolved in step 5 (project copy, else plugin copy).
bash "$LS" add --scope team --source promotion ... \
--confidence high \
--output-contract '{"required_files":[...],"json_fields":[...]}' \
--prefinal-checklist '[{"check_id":"...","description":"...","verification_method":"...","blocking":true}]' \
--source-evidence-refs "ref1,ref2"
Reserve --confidence high for a lesson whose golden path was actually verified — an unverified guess stays low/medium. mtk-doctor lints contract well-formedness. Contracts are optional; a prose lesson is still a valid lesson. See .claude/references/learnings-schema.md → Executable lesson contract.
Remove from personal file. Delete the promoted entry from .claude/lessons/personal.md. Do not leave a duplicate — the team file is now authoritative for that rule.
Suggest CLAUDE.md promotion. If the lesson is foundational (architectural rule, security constraint, repeated correction), tell the engineer this might belong in CLAUDE.md or .claude/rules/ rather than tasks/lessons.md. CLAUDE.md is for permanent standards; lessons.md is for accumulated patterns.
Offer team-wide contribute-back (optional). A team-promoted lesson can also be shared across all repos via the central toolkit. After step 5, ask via AskUserQuestion whether to open a contribute-back PR to the MTK repo (moberghr/mtk-agent-toolkit). Default is no — only offer, never auto-push.
If the engineer accepts:
a. Anonymize first (mandatory). Run the anonymization checklist below against the lesson text. The lesson is going to a shared repo — it must contain zero client/repo-identifying or secret material.
b. Write the anonymized lesson to a single file lessons/contributed/<YYYY-MM-DD>-<slug>.md following the format documented in lessons/contributed/README.md.
c. Open a PR with gh pr create targeting main, touching only that one file. The CI workflow .github/workflows/validate-lesson-pr.yml validates path/size/secret/injection constraints and labels the PR lesson-validated; a human merges it — the workflow never auto-merges.
d. Do not push anything else in that PR. One lesson per PR keeps the audit trail clean.
Anonymization checklist (every item must pass before the PR is opened):
tasks/lessons.md onlypersonal.md — duplication defeats the split.tasks/lessons.md does not exist (new repo), create it with the standard header before appending.tasks/lessons.md.claude/lessons/personal.mdPromoted from personal: <date>) preservedlessons/contributed/ with no auto-mergeCorrective batch of multiple small independent fixes (apply review findings, several/multiple fixes across >3 files, no new contract or architecture) — broader than fix, lighter than implement.
One-time repo setup that detects tech stack, audits the codebase, pulls coding guidelines, and generates a project-specific CLAUDE.md
Full feature implementation loop orchestrating planning, batching, verification, and review skills
Use when the task is a new feature, breaking change, multi-file change, or any work where approval should happen before coding begins.
Use to create, update, and read durable workflow state under .mtk/workflows/ so orchestration survives compaction, crash, and session handoff.
Use after a spec is approved and before multi-file implementation begins, to break work into verifiable batches with checkpoints.