skills/writing-elixir-docs/SKILL.md
Write documentation for Elixir modules, functions, types, and callbacks following official Elixir conventions. Use when asked to document Elixir code, add @moduledoc/@doc/@typedoc, write doctests, or improve Elixir documentation. Triggers on: document this elixir module, add elixir docs, write moduledoc, add doctests.
npx skillsauth add neodejack/skills writing-elixir-docsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write and improve documentation for Elixir applications following the official Elixir documentation conventions.
@moduledoc, @doc, and @typedoc.@moduledoc — Module documentationPlace at the top of the module, immediately after defmodule:
defmodule MyApp.Hello do
@moduledoc """
This is the Hello module.
"""
end
@doc — Function/macro documentationPlace immediately before the function definition:
@doc """
Says hello to the given `name`.
Returns `:ok`.
## Examples
iex> MyApp.Hello.world(:john)
:ok
"""
def world(name) do
IO.puts("hello #{name}")
end
@typedoc — Type documentationPlace immediately before @type or @opaque definitions:
@typedoc "A color represented as {red, green, blue} tuple"
@type color :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
Attach metadata by passing a keyword list to @moduledoc, @doc, or @typedoc:
:since — Version annotation@doc since: "1.3.0"
def world(name), do: IO.puts("hello #{name}")
:deprecated — Deprecation warning@doc deprecated: "Use Foo.bar/2 instead"
def old_function, do: :ok
To also emit a compile-time warning when the function is called, add @deprecated:
@deprecated "Use Foo.bar/2 instead"
def old_function, do: :ok
:group — Grouping in sidebar/autocomplete@doc group: "Query"
def all(query)
@doc group: "Schema"
def insert(schema)
`MyApp.Hello`, never `Hello`.`world/1``MyApp.Hello.world/1``c:world/1``t:values/0`## for section headers inside docs. Never use # — first-level headers are reserved for module/function names.:since metadata when adding new functions or modules to annotate the version.## Examples section whenever possible.The compiler infers argument names for documentation. If inference is suboptimal (e.g., shows map instead of a meaningful name), declare a function head:
def size(map_with_size)
def size(%{size: size}), do: size
Include interactive examples prefixed with iex> inside documentation. These are testable via ExUnit.DocTest:
@doc """
Adds two numbers.
## Examples
iex> MyApp.Math.add(1, 2)
3
"""
def add(a, b), do: a + b
In the corresponding test file:
defmodule MyApp.MathTest do
use ExUnit.Case, async: true
doctest MyApp.Math
end
Rules for writing doctests:
iex> and continuation lines with ...>==@moduledoc false to hide an entire module from documentation.@doc false to hide individual functions.@moduledoc false rather than scattering @doc false.__internal__/1) — the compiler won't import these.Important: @doc false and @moduledoc false do NOT make functions private. They only hide them from documentation. Use defp for truly private functions.
When asked to document Elixir code:
@moduledoc at the top of the module with a concise summary, then elaborate.@doc to every public function and macro with:
## Examples section with iex> doctests where feasible.@typedoc to every public @type and @opaque.:since, :deprecated, :group) where appropriate.@moduledoc false and internal public functions have @doc false or are moved to a hidden module.mix test.tools
Create, edit, and maintain `justfile` automation for any codebase using the `just` command runner. Trigger whenever a request involves creating a new `justfile`, modifying/updating an existing `justfile`, adding or changing recipes, refactoring `justfile` structure, or automating project commands via `just`.
tools
Update a Homebrew tap formula to the latest GitHub Release assets using gh CLI, including verifying the tap repo, locating the formula, computing sha256 for release binaries, and committing/pushing changes. Use when asked to bump a Homebrew formula version to the latest release in a personal tap.
development
Bootstrap or improve harness-engineering scaffolding for an existing software repository so agents can work safely and productively. Use when asked to make a repo more agent-friendly, adopt harness engineering, prepare a codebase for Codex or mixed human and agent coding, add or improve repo-local guidance such as `AGENTS.md` or `ARCHITECTURE.md`, establish canonical setup/lint/typecheck/test commands, or audit a repository for missing agent workflows and verification rails.
development
Generate or refine repository-local product specification documents for proposed features through interactive discussion with the user. Use when a user describes a feature, workflow, or product behavior they want to build and Codex should ask clarifying questions, define scope, goals, user flows, requirements, and acceptance criteria, then save the result under `docs/product-specs/` such as `docs/product-specs/feature-name.md`. Also use when asked to spec out a feature, write a product spec, turn an idea into a spec, or update an existing product-spec doc.