Agent Guidelines for atex#
Commands#
- Test:
mix test(all),mix test test/path/to/file_test.exs(single file),mix test test/path/to/file_test.exs:42(single test at line) - Format:
mix format(auto-formats all code) - Lint:
mix credo(static analysis, TODO checks disabled) - Compile:
mix compile - Docs:
mix docs
Code Style#
- Imports: Use
aliasfor modules (e.g.,alias Atex.Config.OAuth, as: Config), import macros sparingly - Formatting: Elixir 1.18+, auto-formatted via
.formatter.exswithimport_deps: [:typedstruct, :peri, :plug] - Naming: snake_case for functions/variables, PascalCase for modules,
descriptive names (e.g.,
authorization_metadata, notauth_meta) - Types: Use
@typeand@specfor all public functions; leverage TypedStruct for structs - Moduledocs: All public modules need
@moduledoc, public functions need@docwith examples- When writing lists in documentation, use
-as the list character.
- When writing lists in documentation, use
- Error Handling: Return
{:ok, result}or{:error, reason}tuples; use pattern matching in case statements - Pattern Matching: Prefer pattern matching over conditionals; use guards when appropriate
- Macros: Use
deflexiconmacro for lexicon definitions; usedefschema(from Peri) for validation schemas - Tests: Async by default (
use ExUnit.Case, async: true), use doctests where applicable - Dependencies: Core deps include Peri (validation), Req (HTTP), JOSE (JWT/OAuth), TypedStruct (structs)
Important Notes#
- DO NOT modify
lib/atproto/**/- autogenerated from official AT Protocol lexicons - Update CHANGELOG.md when adding features, changes, or fixes