elixir
Skill91 starsChanged 4 months agoApache-2.0View on GitHub
Ankole-specific Elixir, OTP, Ecto, Phoenix-shell, Rustler-boundary, and Torque guidance. Use when editing Elixir under app/control_plane, app/kernel, libs/feishu_openapi, or Elixir plugin code.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Mindrally/skillstheir own version, first seen Jan 23, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Mindrally/skills★ 266same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- rust-nifSkill
- phoenixSkill
- port-deep-research-playbookSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
44 rules. About 0 are common, 15 are distinctive, and 29 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
29
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 15
Use this skill when changing Elixir code, tests, docs, or examples in:
- Distinctive: line 28
Do not treat this skill as permission to introduce unrelated ecosystem pieces.
- Distinctive: line 29
Do not add LiveView, Tailwind, esbuild, Ash, Commanded, Broadway, Flow, GenStage, Nerves, Tauri, Membrane, Zigler, Credo, Dialyzer, …
- Distinctive: line 49
Do the requested change, not a broad cleanup.
- Distinctive: line 51
Prefer deletion and reuse over a new abstraction.
- Very specific: line 52
Keep public APIs small. Promote a private helper to def only when another module genuinely owns that call.
- Very specific: line 57
Treat old project code as reference material only.
- Distinctive: line 62
Use normal functional Elixir.
- Very specific: line 66
Use case for one result, with for two or more {:ok, _} / {:error, _} steps.
- Very specific: line 68
Use if only for simple boolean checks.
- Very specific: line 74
Use Enum, for, Map.new/2, Enum.into/2, and Enum.reduce_while/3 before hand-written recursion.
- Very specific: line 78
Use %{struct | field: value} for struct updates so unknown fields fail loudly.
- Very specific: line 80
Put @impl true on every callback implementation.
- Very specific: line 82
Put @derive before defstruct or schema.
- Very specific: line 83
Prefer alias and qualified calls.
- Very specific: line 85
Keep module order conventional: moduledoc, use/import/alias/require, module attributes, types, schema/struct, public functions, private …
- Very specific: line 92
Do not add Jason examples, dependencies, derives, or protocol assumptions.
- Very specific: line 100
Do not invent Torque.Encoder or Jason-style derive patterns.
- Distinctive: line 111
Keep Phoenix as the HTML shell plus backend control plane.
- Very specific: line 113
Do not reintroduce LiveView, Tailwind, or esbuild.
- Very specific: line 117
Keep AnkoleWeb.Assets responsible for dev-server versus manifest asset URLs.
- Very specific: line 119
Use open_api_spex patterns already present when changing JSON API surfaces.
- Very specific: line 123
Use changesets for external input.
- Very specific: line 125
Prefer context functions over direct Repo calls from controllers or web boundary modules.
- Very specific: line 127
Use Repo.transact/1 or Repo.transact/2 in this repo, matching nearby code.
- Very specific: line 128
Do not introduce new Repo.transaction/2 usage.
- Very specific: line 131
Use Postgres deliberately: constraints, indexes, JSONB, generated values, on_conflict, and locking are acceptable when they simplify the …
- Distinctive: line 133
Avoid get-then-insert races.
- Very specific: line 135
Do not preload inside loops.
- Very specific: line 136
Keep migrations narrow and reversible when practical.
- Distinctive: line 138
Treat migration metadata and generated DB artifacts as generated.
- Very specific: line 145
Use Registry + DynamicSupervisor for per-entity processes.
- Very specific: line 148
Prefer GenServer.call/3 with explicit timeouts when the caller needs a result.
- Distinctive: line 150
Do not block GenServer callbacks on long HTTP, DB, or native work.
- Very specific: line 152
Use handle_continue/2 for post-init work.
- Distinctive: line 154
Keep large read-heavy state out of a single GenServer.
- Distinctive: line 164
Test through public APIs. Do not expose private functions only for tests.
- Very specific: line 165
Use async: true unless the test mutates global state, named processes, Application env, Oban state, or shared DB assumptions.
- Very specific: line 167
Use SQL sandbox patterns from test/support for database tests.
- Very specific: line 168
Use start_supervised! for test-owned processes so ExUnit cleans them up.
- Very specific: line 169
Use assert_receive / refute_receive with explicit timeouts instead of Process.sleep/1.
- Distinctive: line 171
Prefer focused regression tests for the touched behavior.
- Distinctive: line 176
Run commands from the package you changed, after sourcing the 1.20 toolchain when needed.
- Distinctive: line 189
Do not read all reference files by default.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Ankole Elixir Skill
This is a project-local working guide, not a general Elixir manual. Start from
the live code, local tests, and current mix.exs files. If a linked reference
or generic Elixir habit conflicts with Ankole's live shape, Ankole wins.
When to Use This Skill
Use this skill when changing Elixir code, tests, docs, or examples in:
app/control_planeapp/kernellibs/feishu_openapiplugins/*/liborinternals/plugins/*/lib
Also load the more specific skill when the task is primarily about that surface:
- Phoenix routing/controllers/views/assets: use the
phoenixskill too. - Rustler/Rust NIF code: use the
rust-nifskill too. - Current library/API/CLI syntax: use Context7 per the repo instructions.
Do not treat this skill as permission to introduce unrelated ecosystem pieces. Do not add LiveView, Tailwind, esbuild, Ash, Commanded, Broadway, Flow, GenStage, Nerves, Tauri, Membrane, Zigler, Credo, Dialyzer, Sobelow, Archdo, Mox, ExMachina, or StreamData unless the dependency already exists for the touched package or the user explicitly asks.
Current Project Shape
app/control_planeis the main Phoenix 1.8 application. It is not API-only: Phoenix owns routing, auth/session state, the HTML shell, static asset serving, Ecto/Postgres, Oban, OpenAPI, plugins, and operator-facing endpoints. Vite owns the SPA entrypoints underapp/webapps.app/control_planeuses Torque through the localAnkole.JSONadapter for Phoenix/Plug compatibility. Phoenix expectsencode_to_iodata!/1; Torque's native API is not exactly that shape.app/kernelis the Rustler-facing kernel package. Elixir owns the API shape; Rust owns native mechanics. Keep maps crossing the NIF boundary explicit and boring.
Local Defaults
- Do the requested change, not a broad cleanup.
- Inspect the existing module and tests before adding patterns.
- Prefer deletion and reuse over a new abstraction.
- Keep public APIs small. Promote a private helper to
defonly when another module genuinely owns that call. - Comments and docs should explain Ankole-specific meaning, boundary choices, failure modes, or operator-visible behavior. Do not teach generic Elixir, Phoenix, CRUD, or pattern matching in code comments.
- Treat old project code as reference material only. Ankole's current code and docs are the source of truth.
Elixir Style
Use normal functional Elixir. The rules below are the default unless nearby code has a clear local convention.
- Dispatch on data shape with pattern matching and multi-clause functions.
- Use
casefor one result,withfor two or more{:ok, _}/{:error, _}steps. - Use
ifonly for simple boolean checks; do not build structural dispatch out of nestedif. - Return tagged tuples for expected failures. Reserve
raisefor programmer errors and startup/configuration failures. - Reserve
try/rescuefor real boundaries around unsafe external code. To guardGenServer.call/3to an optional or external process, catch exits explicitly. - Use
Enum,for,Map.new/2,Enum.into/2, andEnum.reduce_while/3before hand-written recursion. Use recursion for tree/graph traversal or state machines where it is the clearest tool. - Build strings as interpolation or IO data. Avoid repeated
<>in loops. - Use
%{struct | field: value}for struct updates so unknown fields fail loudly. UseMap.put/3only when the key is dynamic. - Put
@impl trueon every callback implementation. Use@impl Behaviourwhen a module implements multiple behaviours with overlapping callbacks. - Put
@derivebeforedefstructorschema. - Prefer
aliasand qualified calls. Use full imports only for intended DSLs such asEcto.Query,Ecto.Changeset, test helpers, and guard macros. - Keep module order conventional: moduledoc, use/import/alias/require, module attributes, types, schema/struct, public functions, private helpers.
JSON Rules
Ankole uses Torque, not Jason.
- Do not add
Jasonexamples, dependencies, derives, or protocol assumptions. - In
app/control_plane, preferAnkole.JSONat Phoenix/Plug/application boundaries. - In
libs/feishu_openapiandapp/kernel, follow nearby code: usuallyTorque.encode!/1,Torque.encode/1,Torque.decode!/1, orTorque.decode/1. - External JSON maps have string keys. Convert to atom-keyed structs/maps only at a deliberate boundary.
- Do not invent
Torque.Encoderor Jason-style derive patterns. Convert structs to boundary maps explicitly when JSON shape matters. - In
libs/feishu_openapi, keep Req response decoding explicit. The SDK setsdecode_body: false; decode response bodies before Feishu envelope or rate-limit handling when the body may be JSON.
Phoenix and Web Boundaries
For Phoenix-specific changes, load the Phoenix skill and then apply these local constraints:
- Keep Phoenix as the HTML shell plus backend control plane. Do not drift it toward API-only unless the user asks.
- Do not reintroduce LiveView, Tailwind, or esbuild. The frontend entrypoints
live under
app/webappsand are served through the Phoenix/Vite integration. - Controllers should route, authenticate, translate parameters, and call domain contexts. Put durable behavior in context modules.
- Keep
AnkoleWeb.Assetsresponsible for dev-server versus manifest asset URLs. - Preserve the React Refresh preamble order when touching Vite tag injection.
- Use
open_api_spexpatterns already present when changing JSON API surfaces.
Ecto and PostgreSQL
- Use changesets for external input. Use
change/2only for trusted internal data. - Prefer context functions over direct
Repocalls from controllers or web boundary modules. - Use
Repo.transact/1orRepo.transact/2in this repo, matching nearby code. Do not introduce newRepo.transaction/2usage. - Separate validations from constraints. Validations run before the DB write; constraints document and enforce DB truth.
- Use Postgres deliberately: constraints, indexes, JSONB, generated values,
on_conflict, and locking are acceptable when they simplify the system. - Avoid get-then-insert races. Prefer constraints and upserts where uniqueness matters.
- Do not preload inside loops. Batch with query preloads or
Repo.preload/2. - Keep migrations narrow and reversible when practical. Use
mix ecto.gen.migrationfor new migrations. - Treat migration metadata and generated DB artifacts as generated. Do not hand-edit generated metadata unless the user explicitly asks.
OTP and Runtime Processes
- Supervise long-running processes. Avoid bare
spawn/spawn_linkfor durable work. - Use
Registry+DynamicSupervisorfor per-entity processes. Address a Registry-registered process through the same{:via, Registry, ...}tuple or localvia/1helper it used at startup. - Prefer
GenServer.call/3with explicit timeouts when the caller needs a result. Usecastonly for fire-and-forget work where loss is acceptable. - Do not block GenServer callbacks on long HTTP, DB, or native work. Move slow work to a supervised task, Oban job, or a clearly isolated process.
- Use
handle_continue/2for post-init work. If that work calls another process, confirm supervision ordering and set explicit timeouts. - Keep large read-heavy state out of a single GenServer. Use ETS or the database when that is the simpler operational truth.
- Implement
format_status/1for processes holding secrets, credentials, tokens, or sensitive runtime state. - For actor-runtime work, keep Elixir as the owner of PG-backed durable state, admission, reconciliation, and operator-visible control. Rust/native code owns transport/protocol mechanics and should not grow direct Postgres ownership.
Testing
- Test through public APIs. Do not expose private functions only for tests.
- Use
async: trueunless the test mutates global state, named processes, Application env, Oban state, or shared DB assumptions. - Use SQL sandbox patterns from
test/supportfor database tests. - Use
start_supervised!for test-owned processes so ExUnit cleans them up. - Use
assert_receive/refute_receivewith explicit timeouts instead ofProcess.sleep/1. - Prefer focused regression tests for the touched behavior. Broaden coverage when changing shared runtime, schema, adapter, or web contracts.
Validation Commands
Run commands from the package you changed, after sourcing the 1.20 toolchain when needed.
For app/control_plane:
mix format
MIX_ENV=test mix compile --warnings-as-errors
MIX_ENV=test mix testOptional Reference Files
Do not read all reference files by default. Open the smallest relevant file only when the task needs it:
code-style.md: formatter, module/function ordering, readability patterns.architecture-reference.md: larger context or supervision boundary changes.ecto-reference.md: Ecto query, migration, custom type, and Repo details.otp-reference.md: OTP callback signatures, child specs, Registry, ETS.testing-reference.md: ExUnit, SQL sandbox, process tests.documentation.md: ExDoc,@doc,@spec, doctests.type-system.md: compiler type warnings and specs.debugging-profiling.md: tracing, memory, message queues, profiling.networking.md: only for TCP/UDP socket work.
Low-probability topics such as event sourcing, Broadway/Flow/GenStage, desktop, embedded, multimedia, and heavy static-analysis tools are intentionally absent from this entrypoint. Reintroduce them only when the project actually uses them or the user asks for them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

