‹ 首页

init

@oliver-kriska · 收录于 4 天前 · 上游提交 4 天前

Initialize plugin in a project — install Iron Laws, auto-activation rules, and reference auto-loading into CLAUDE.md. Use when setting up or updating the plugin.

适合你,如果每次新项目都要手动安装插件规则和自动加载配置。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add oliver-kriska/claude-elixir-phoenix/init
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- oliver-kriska/claude-elixir-phoenix/init
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify oliver-kriska/claude-elixir-phoenix/init
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
503GitHub stars
~1.2K最小装载
~1.2K含声明引用
~4K文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 88c1194 · 表述以原文为准
它做什么

在项目中安装Elixir/Phoenix插件的行为指令,包括Iron Laws、自动激活规则和参考文档自动加载。Claude会检测项目栈(如Phoenix版本、Ecto等)并插入对应的规则到CLAUDE.md文件中。

什么时候触发

当用户在项目目录中输入/phx:init或/phx:init --update命令时触发。适用于首次安装或更新已有插件设置。

装好后可以这样说
会在CLAUDE.md中添加规则。
更新已有安装的规则。
自动检测项目栈。
技能原文 SKILL.md作者撰写 · MIT · 88c1194

Plugin Initialization

Install the Elixir/Phoenix plugin's behavioral instructions into the project's CLAUDE.md.

Usage
/phx:init           # First-time installation
/phx:init --update  # Update existing installation with latest rules
Iron Laws
  1. NEVER overwrite content outside plugin markers — User-written CLAUDE.md rules must be preserved verbatim
  2. Always detect stack before generating — Never assume Phoenix/Ecto versions
  3. Always validate after installation — Verify markers present and stack correct
Workflow
Step 1: Check Existing CLAUDE.md

Use Glob to check if CLAUDE.md exists. Then use Grep to check for existing ELIXIR-PHOENIX-PLUGIN:START marker in CLAUDE.md.

Step 2: Detect Project Stack

Scan the project to customize the injected instructions:

Read mix.exs and use Grep to extract:

  • Phoenix version: search for phoenix.*"~> in mix.exs
  • Ecto version: search for ecto.*"~> in mix.exs
  • Oban: search for "oban" and "oban_pro" in mix.exs
  • Frameworks: search for "ash", "surface" in mix.exs
  • Tidewave: search for "tidewave" in mix.exs
  • Project size: use Glob to count lib/**/*.ex files
Step 3: Handle Installation Modes

Mode A: Fresh Install (no CLAUDE.md or no markers)

  1. Create/append to CLAUDE.md
  2. Insert full behavioral instructions between markers
  3. Include only relevant sections based on detected stack

Mode B: Update (--update flag or markers exist)

  1. Find content between <!-- ELIXIR-PHOENIX-PLUGIN:START --> and <!-- ELIXIR-PHOENIX-PLUGIN:END -->
  2. Replace with latest behavioral instructions
  3. Preserve everything outside the markers

CRITICAL: NEVER overwrite or delete existing CLAUDE.md content outside the plugin markers — user-written rules, project conventions, and other plugin sections must be preserved verbatim

Step 4: Generate Content

Write the following structure to CLAUDE.md:

<!-- ELIXIR-PHOENIX-PLUGIN:START -->
<!-- Last updated: {date} | Plugin version: 1.0 | Stack: Phoenix {version}, Ecto {version}, {optional: Oban, Tidewave} -->

# Elixir/Phoenix Plugin - Auto-Activation Rules

{Include all sections from the Content Template below, filtered by detected stack}

<!-- ELIXIR-PHOENIX-PLUGIN:END -->
Step 4b: Offer Codex Review Guidelines (optional)

If command -v codex succeeds (or the user asks): offer to install a managed ## Review guidelines block into the project's AGENTS.md — honored by BOTH codex exec review locally and the Codex cloud PR reviewer. Follow the install rules and exact block in ${CLAUDE_SKILL_DIR}/references/codex-review-guidelines.md: markers ELIXIR-PHOENIX-REVIEW-GUIDELINES:START/END, upsert in place on --update, never touch content outside markers, and STOP to ask if an unmanaged ## Review guidelines section already exists. When codex is absent and not requested, skip silently — never mention codex to users who don't have it.

Step 5: Output Summary
✅ Elixir/Phoenix plugin initialized

Detected stack:
- Phoenix {version}
- Ecto {version}
- {Oban standard | Oban Pro | not detected}
- {Tidewave ✓ | Tidewave not detected}
- {Ash Framework detected - Ecto patterns disabled | not detected}

Added to CLAUDE.md:
- Auto-activation rules (complexity detection, interview mode)
- Agent trigger patterns ({n} agents available)
- Reference auto-loading ({n} reference docs)
- Iron Laws enforcement ({n} laws)
- Verification rules
{- Codex review guidelines → AGENTS.md (only if installed in Step 4b)}

Run /phx:init --update after plugin updates.
Run /phx:audit for a full project health check.
Content Template

The exact content to inject is in ${CLAUDE_SKILL_DIR}/references/injectable-template.md.

Key structure:

  1. 7-Step Mandatory Procedure — Claude Code MUST execute before every response
  2. Iron Laws — STOP behavior on violations
  3. Conditional Sections — Include based on detected stack:
  4. {OBAN_SECTION} — If Oban detected (not Pro)
  5. {OBAN_PRO_SECTION} — If Oban Pro detected
  6. {ASH_SECTION} — If Ash Framework detected
  7. {TIDEWAVE_SECTION} — If Tidewave detected
  8. Verification — Mandatory after code changes
  9. Quick Reference — Skill routing table

Placeholder substitution:

| Placeholder | Source | |-------------|--------| | {DATE} | Current date | | {PHOENIX_VERSION} | From mix.exs | | {ECTO_VERSION} | From mix.exs | | {OPTIONAL_STACK} | Detected optional deps |

See ${CLAUDE_SKILL_DIR}/references/injectable-template.md for full template with all placeholders and conditional sections.

Validation

After running /phx:init:

  1. Check CLAUDE.md contains markers
  2. Verify detected stack matches actual project
  3. New session should:
  4. Auto-detect complexity when given tasks
  5. Stop on Iron Law violations
  6. Offer relevant workflows based on task
Error Handling

| Scenario | Action | |----------|--------| | CLAUDE.md read-only | Error: "Cannot modify CLAUDE.md - check permissions" | | Markers corrupted | Warn, offer to remove and reinstall | | Unknown Phoenix version | Use conservative defaults (all features enabled) | | Not an Elixir project | Error: "No mix.exs found - is this an Elixir project?" |

Relationship to Other Commands

| Command | When to Use | |---------|-------------| | /phx:init | First time, or after plugin updates | | /phx:audit | Periodic project health check | | /phx:verify | After code changes |

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。