用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill croma-elixir-conventions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | croma-elixir-conventions |
| description | >- Use when this capability is needed. |
When writing Elixir code in projects that use Croma, follow these conventions:
use Croma before the defmodule.defun / defunp instead of def / defp.case/cond over multi-clause functions when branching on a single argument's value. This keeps a single defun/defunp with v[] validation:
# Good - single defunp with case, gets v[] validation
defunp calculate_discount(price :: v[non_neg_integer()], membership_level :: v[atom()]) :: v[non_neg_integer()] do
case membership_level do
:gold -> round(price * 0.7)
:silver -> round(price * 0.85)
_ -> price
end
end
# Avoid - loses v[] validation, multiple clauses for simple value dispatch
@spec calculate_discount(non_neg_integer(), atom()) :: non_neg_integer()
defp calculate_discount(price, :gold), do: round(price * 0.7)
defp calculate_discount(price, :silver), do: round(price * 0.85)
defp calculate_discount(price, _), do: price
v[]v[] for runtime type validation. This applies to all types including union types and nilable types. Do not hesitate to use v[] on unions — it works correctly:
defun my_func(name :: v[String.t()], count :: v[non_neg_integer()]) :: v[String.t()] do
defun find_name(user_id :: v[String.t()]) :: v[nil | String.t()] do
defunp do_lookup(id :: v[String.t()]) :: v[nil | Terminal.t()] do
defunp classify(value :: v[String.t()]) :: v[:small | :large] do
v[] on single literal atom return types (e.g., :ok) — causes a compile warning:
defun pretty_print(str :: v[String.t()]) :: :ok do # Good
defun pretty_print(str :: v[String.t()]) :: v[:ok] do # Bad
v[] on types without Croma's valid?/1 (e.g., DateTime.t(), Keyword.t(), term()) — causes UndefinedFunctionError or RuntimeError:
defun process(dt :: DateTime.t()) :: v[String.t()] do # Good
defun process(dt :: v[DateTime.t()]) :: v[String.t()] do # Bad
defun process(arg :: v[{:ok, term()} | :timeout]) :: term() do # Good
defun process(arg :: v[{:ok, term()} | :timeout]) :: v[term()] do # Bad
{:ok, value} | {:error, reason}, use alias Croma.Result, as: R and R.t(value_type):
alias Croma.Result, as: R
defun validate(name :: v[String.t()]) :: v[R.t(map())] do
R.t().use Croma
defmodule MyApp.UserValidator do
alias Croma.Result, as: R
defun validate(username :: v[String.t()], age :: v[non_neg_integer()]) ::
v[R.t(map())] do
{:ok, %{username: username, age: age}}
end
defunp check_length(value :: v[String.t()]) :: v[:ok | {:error, String.t()}] do
if String.length(value) > 0, do: :ok, else: {:error, "empty"}
end
end
Source: access-company/antikythera — distributed by TomeVault.