鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

moai-lang-elixir

专注 Elixir 1.17+ 全栈开发,深度支持 Phoenix 1.7 框架、LiveView 实时交互、Ecto 数据建模与事务控制、OTP 分布式行为模式,覆盖从代码编写、测试验证到生产部署的完整工程实践。

软件开发
访问 GitHub
文档Skills.MD
name
moai-lang-elixir
description
Elixir 1.17+ development specialist covering Phoenix 1.7, LiveView, Ecto, and OTP patterns. Use when developing real-time applications, distributed systems, or Phoenix projects.
version
1.1.0
category
language
modularizedtrue
progressive_disclosure{"enabled":true,"level1_tokens":"~100","level2_tokens":"~5000"}
triggers{"keywords":["Elixir","Phoenix","LiveView","Ecto","OTP","GenServer",".ex",".exs","mix.exs"],"languages":["elixir"]}
user-invocablefalse
tags["language","elixir","phoenix","liveview","ecto","otp","genserver"]
updated"2026-01-11T00:00:00.000Z"
status
active
allowed-tools["Read","Grep","Glob","Bash","mcp__context7__resolve-library-id","mcp__context7__get-library-docs"]

Quick Reference (30 seconds)

Elixir 1.17+ Development Specialist - Phoenix 1.7, LiveView, Ecto, OTP patterns, and functional programming.

Auto-Triggers: .ex, .exs files, mix.exs, config/, Phoenix/LiveView discussions

Core Capabilities:

  • Elixir 1.17: Pattern matching, pipes, protocols, behaviours, macros
  • Phoenix 1.7: Controllers, LiveView, Channels, PubSub, Verified Routes
  • Ecto: Schemas, Changesets, Queries, Migrations, Multi
  • OTP: GenServer, Supervisor, Agent, Task, Registry
  • ExUnit: Testing with setup, describe, async
  • Mix: Build tool, tasks, releases
  • Oban: Background job processing

Quick Patterns

Phoenix Controller: Define a module using MyAppWeb with :controller. Create alias for the context module like MyApp.Accounts. Define action functions like show taking conn and params map with destructured id. Fetch data using the context function with bang like get_user! and render the template passing the data as assigns.

For create actions, pattern match on the context result tuple. On ok tuple, use pipe operator to put_flash with success message and redirect using ~p sigil for verified routes. On error tuple with Ecto.Changeset, render the form template passing the changeset.

Ecto Schema with Changeset: Define a module using Ecto.Schema and importing Ecto.Changeset. Define the schema block with field declarations including types like :string and virtual fields. Create a changeset function taking the struct and attrs, using pipe operator to chain cast with the list of fields to cast, validate_required, validate_format with regex, validate_length with min option, and unique_constraint.

GenServer Pattern: Define a module using GenServer. Create start_link taking initial_value and calling GenServer.start_link with MODULE, initial_value, and name option. Define client API functions that call GenServer.call with MODULE and the message atom. Implement init callback returning ok tuple with state. Implement handle_call callbacks for each message, returning reply tuple with response and new state.


Implementation Guide (5 minutes)

Elixir 1.17 Features

Pattern Matching Advanced: Define function heads with pattern matching on map keys and types. Use guard clauses with when to add constraints like is_binary or byte_size checks. Add a catch-all clause returning error tuple for invalid inputs.

Pipe Operator with Error Handling: Use the with special form for chaining operations that may fail. Pattern match each step with left arrow, and on successful completion of all steps, return the final ok tuple. In the else block, handle error tuples by returning them unchanged.

Protocols for Polymorphism: Define a protocol with @doc and function specification using defprotocol. Implement the protocol for specific types using defimpl with for: option. Each implementation provides the specific behavior for that type.

Phoenix 1.7 Patterns

LiveView Component: Define a module using MyAppWeb with :live_view. Implement mount callback taking params, session, and socket, returning ok tuple with assigned state. Implement handle_event callback for user interactions, returning noreply tuple with updated socket using update helper. Implement render callback with assigns, using ~H sigil for HEEx templates with assigns accessed via @ prefix.

LiveView Form with Changesets: In mount, create initial changeset and assign using to_form helper. Implement validate event handler that creates changeset with :validate action and reassigns the form. Implement save event handler that calls context create function, on success using put_flash and push_navigate, on error reassigning the form with error changeset.

Phoenix Channels: Define a module using MyAppWeb with :channel. Implement join callback matching on topic pattern with angle brackets for dynamic segments. Use send with self() for after_join messages. Implement handle_info for server-side messages using push. Implement handle_in for client messages using broadcast! to send to all subscribers.

Verified Routes: Define routes in router.ex within scope blocks using live macro for LiveView routes. Use ~p sigil for verified routes in templates and controllers, with interpolation syntax for dynamic segments.

Ecto Patterns

Multi for Transactions: Use Ecto.Multi.new() and pipe through operations using Ecto.Multi.update with name atoms and changeset functions. Use Ecto.Multi.insert with function callback when needing results from previous steps. Pipe final Multi to Repo.transaction() which returns ok or error tuple with named results.

Query Composition: Create a query module with composable query functions. Define a base function returning from expression. Create filter functions with default parameter for query, returning modified from expression with where clause. Chain functions with pipe operator before passing to Repo.all.


Advanced Implementation (10+ minutes)

For comprehensive coverage including:

  • Production deployment with releases
  • Distributed systems with libcluster
  • Advanced LiveView patterns (streams, components)
  • OTP supervision trees and dynamic supervisors
  • Telemetry and observability
  • Security best practices
  • CI/CD integration patterns

See:

  • Advanced Patterns - Complete advanced patterns guide

Context7 Library Mappings

  • /elixir-lang/elixir - Elixir language documentation
  • /phoenixframework/phoenix - Phoenix web framework
  • /phoenixframework/phoenix_live_view - LiveView real-time UI
  • /elixir-ecto/ecto - Database wrapper and query language
  • /sorentwo/oban - Background job processing

Works Well With

  • moai-domain-backend - REST API and microservices architecture
  • moai-domain-database - SQL patterns and query optimization
  • moai-workflow-testing - DDD and testing strategies
  • moai-essentials-debug - AI-powered debugging
  • moai-platform-deploy - Deployment and infrastructure

Troubleshooting

Common Issues:

Elixir Version Check: Run elixir --version to verify 1.17+ and mix --version for Mix build tool version.

Dependency Issues: Run mix deps.get to fetch dependencies, mix deps.compile to compile them, and mix clean to remove build artifacts.

Database Migrations: Run mix ecto.create to create database, mix ecto.migrate to run migrations, and mix ecto.rollback to rollback last migration.

Phoenix Server: Run mix phx.server to start the server, iex -S mix phx.server to start with IEx shell, and MIX_ENV=prod mix release to build production release.

LiveView Not Loading:

  • Check websocket connection in browser developer console
  • Verify endpoint configuration includes websocket transport
  • Ensure Phoenix.LiveView is listed in mix.exs dependencies

Last Updated: 2026-01-11 Status: Active (v1.1.0)

软件开发

快捷安装

复制到终端去安装 Skill

npxskillsaddmodu-ai/moai-adk--skill"moai-lang-elixir"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
debug
debug 是一个系统化定位软件缺陷根因的技能,适用于用户报告 'fix'、'broken'、'error' 等问题或测试意外失败时。它通过可验证的假设、最小复现、因果链分析和回归测试,确保在修复前准确定位根本原因。
retrieving-developer-knowledge
retrieving-developer-knowledge 用于搜索、获取和整合 Google 官方开发者文档,覆盖 Google Cloud、AI/Gemini、Android、Chrome、Web、Flutter、Go、Firebase 等平台,适用于查询 gcloud CLI 命令、API 语法、IAM 权限或架构对比等场景。
diff-intake
diff-intake 读取 PR 或分支差异,生成结构化 YAML 变更摘要,用于下游 analytics instrumentation 技能。适用于用户提交 PR 链接、分支对比或原始 diff 后需理解变更内容、评估分析覆盖或启动埋点流程的场景。
implement
实现 Linus Dashboard 的功能开发与集成,基于 TypeScript 和 Python 构建前后端组件,遵循严格的代码规范与架构模式,完成视图、卡片、服务及传感器等模块的创建与验证,确保高质量交付并兼容 Home Assistant 生态。
pypi-server
支持从源码构建 Python 软件包,并搭建本地 PyPI 服务,实现私有包的托管与分发,使团队可通过 pip 直接安装内部开发的模块。