Create a custom mix task:
# lib/mix/tasks/mytask.ex
defmodule Mix.Tasks.MyTask do
  use Mix.Task
  @shortdoc "A simple mix task"
  def run(_) do
    IO.puts "YO!"
  end
endCompile and run it:
> mix compile
> mix my_task
"YO!"
mix helplists out all available mix tasks for the project.