跳到正文
cccskills
免费在 GitHub 公开

phx-learn-from-fix

Capture Elixir/Ecto/LiveView lessons and Hex API rules. Use after corrections or when asked to document learning, record a lesson, prevent a fixed mistake, or remember package guidance with --library.

中文简介正在准备中。当前显示原文说明。

集成工具X (Twitter)
查看安装方法

包含的文件(2)

  • SKILL.md6.8 KB
  • references/common-mistakes.md5.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Learn From Fix

After fixing a bug or receiving a correction, capture the lesson to prevent future mistakes.

Usage

phx-learn-from-fix Fixed N+1 query in user listing - was missing preload
phx-learn-from-fix String vs atom key mismatch in params handling
phx-learn-from-fix LiveView assign_async needs render_async in tests
phx-learn-from-fix --library ical --scope personal ICal.to_ics output needs CRLF line endings
phx-learn-from-fix --library ical --scope project Use method: "PUBLISH" for calendar feeds

Workflow

Step 1: Verify the Lesson

Persist only one of:

  • A completed fix verified by tests, reproduction, or user confirmation
  • An explicit rule the user taught or asked to save

Stop without writing if neither condition is met. Do not save a hypothesis, unverified workaround, investigation narrative, or unsolved error. Use phx-compound for a detailed completed investigation. Capture the root cause as a concise actionable rule, not the symptom.

Step 2: Select the Route

When both --library <package> and --scope personal|project are present, use the Library Route. Require both flags; do not guess scope. For the skill directory only, trim surrounding whitespace and lowercase the package name. Preserve underscores when forming directory names (phoenix_live_view becomes hex-phoenix_live_view). Validate the normalized name against ^[a-z][a-z0-9_]+$. If it does not match, ask for a valid Hex package identifier instead of replacing characters or inventing a name. Use the trimmed original identifier, not the normalized directory name, to look up mix.lock.

Without --library, use the General Correction Route.

Step 3: Check Existing Knowledge

Check if already documented:

  • Grep project CLAUDE.md and ~/.claude/CLAUDE.md for the pattern keyword
  • Check auto-memory files for similar lessons
  • For library lessons, inspect both ~/.claude/skills/hex-<package>/SKILL.md and .claude/skills/hex-<package>/SKILL.md
  • Read references/common-mistakes.md (read-only plugin reference)

Do not duplicate the same lesson across CLAUDE.md, memory, and a package skill. If the same rule exists, merge wording or report it as already captured.

Library Route

Plugin files are read-only: files under ~/.claude/plugins/ are cached and get overwritten on updates. Package skills are user-owned files, never plugin cache files.

Resolve Scope and Precedence

--scopeCanonical destination
personal~/.claude/skills/hex-<package>/SKILL.md
project.claude/skills/hex-<package>/SKILL.md

Personal skills override same-named project skills. If a personal hex-<package> skill exists, never unknowingly create or update a shadowed project skill: explain the conflict and ask whether to update personal scope or keep distinct project-only knowledge. If project scope already exists before a personal write, warn that the new skill will shadow it and offer to merge or move it. Maintain one canonical skill per package unless the user explicitly needs distinct scope-specific rules; never create one skill per lesson.

Read the Locked Version

Inspect mix.lock for the package. Record the exact locked version when found. If it is absent, say the lesson is not tied to a locally locked version and do not invent one. Qualify version-sensitive rules. When two verified rules conflict across versions, preserve both with explicit version ranges instead of replacing either.

Create or Safely Update the Skill

For a new package skill, create:

---
name: hex-<package>
description: <Package/module/API/task trigger terms for this knowledge>
user-invocable: false
---

# <Package> Knowledge

## Verified Rules

- **<Rule>** (verified with <package> <version>): <actionable guidance>

Make the description precise: include the Hex package, Elixir module names, important APIs/file formats, and tasks that should trigger this knowledge. Activation is model-selected from this description; package presence in mix.lock does not guarantee activation.

Before updating an existing skill, read all of it. Preserve unrelated and hand-authored sections. Merge semantically identical rules. If safe merging is unclear, show the conflict and ask instead of overwriting content.

Do not add paths: to a personal package skill by default: it is a file-path activation gate, not a dependency predicate. Add paths: only to project scope when explicitly appropriate and meaningful package-specific paths exist.

General Correction Route

Choose the narrowest non-library destination:

ScopeWrite toExample
This projectProject CLAUDE.md"Never use raw SQL in this app"
This project across sessionsProject-keyed auto-memory"jsonb uses string keys"
All your projects~/.claude/CLAUDE.md personal instructions"Prefer explicit error tuples"
Detailed completed fix.claude/solutions/ via phx-compoundDebugging narrative

For project or personal instructions, preserve existing content and append **RULE NAME** — Do NOT [bad]. Instead [good] under the relevant category. Use personal instructions only for rules that should load in every project. For auto-memory, append to the project-keyed ~/.claude/projects/{project-hash}/memory/MEMORY.md:

### Lesson: [Title]
- **Pattern**: Do NOT [bad] — instead [good]
- **Why**: [root cause explanation]

If the lesson is universal to the plugin rather than one project or package, suggest a plugin contribution; never write it into cached plugin files.

Output

After capturing, confirm:

Lesson captured in [location]

Pattern: Do NOT [bad pattern] — instead [good pattern]
Category: [Ecto/LiveView/OTP/Testing/etc]
Version: [locked package version, not found, or not applicable]

For package skills, also state that description-based activation is model-selected, not guaranteed by mix.lock.

Iron Laws

  1. NEVER write generated knowledge to plugin cache — use only the user-owned destinations above
  2. DO NOT duplicate existing lessons — always check CLAUDE.md and memory before writing
  3. NEVER overwrite hand-authored content — read both package skill scopes and merge safely
  4. ONLY persist verified knowledge — completed fixes or explicit user-taught rules, never hypotheses
  5. DISCLOSE scope precedence — a global package skill shadows its project counterpart

References (READ-ONLY — do NOT edit)

  • references/common-mistakes.md — Common Elixir mistakes reference. Consult when checking for duplicates.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

analyze

免费

Analyze a legacy app in any language before rewriting it in Elixir: inventory, features as goals, why each mechanism exists, runtime topology, external contracts. Use to start or refresh a rewrite.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

architect

免费

Design the idiomatic Elixir architecture for a rewrite: set the compatibility bar (ADR-000), consult phx specialists on open questions, then build contexts, ledger and ADRs. Use after /rewrite:analyze.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

Ash Framework — resources, actions, policies, aggregates, calculations, AshPhoenix.Form, LiveView, migrations. Use when generating resources via mix ash.codegen, editing changes, checks, types, validations, or domain code interfaces.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

Ash Framework — resources, actions, policies, aggregates; Use when generating resources via mix ash.codegen, editing…

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

assigns

免费

Compatibility alias for the Elixir/Phoenix plugin's LiveView assigns audit. Invoke explicitly with /lv:assigns.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

Inspect LiveView socket assigns for memory bloat — missing temporary_assigns, unused assigns, unbounded lists needing streams, memory estimates. Use when LiveView memory grows or you need to add temporary_assigns.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月20日 更新

查看 oliver-kriska 的全部技能

报告此技能的问题