This document provides guidelines for AI assistants (Claude, Cursor, etc.) when working with this codebase.
Jido Messaging is part of the Jido ecosystem - a framework for building intelligent agent systems. It provides messaging and notification infrastructure.
- Always use conventional commits - Follow
type(scope): descriptionformat - Never add "ampcode" as contributor - Do not include ampcode in commit messages or author trailers
- Follow existing patterns - Match the code style in existing modules
- Write documentation first - Add
@moduledocand@docbefore implementation - Include examples - Use iex code blocks in documentation
- All public functions need
@docwith examples - All modules need
@moduledoc - All functions with multiple clauses should have
@spec - Test coverage must be >= 90%
- Code must pass
mix quality
defmodule Jido.Messaging.MyModule do
@moduledoc """
Brief description of this module.
## Overview
Detailed explanation of what this module does and why.
## Examples
iex> Jido.Messaging.MyModule.some_function(:input)
{:ok, :result}
"""
@doc """
Brief description of the function.
## Examples
iex> some_function(:input)
{:ok, :result}
"""
@spec some_function(atom()) :: {:ok, atom()} | {:error, term()}
def some_function(input) do
# implementation
end
end- Place unit tests in
test/jido_messaging/with_test.exssuffix - Use
describe/blocks to organize related tests - Use
setup/blocks for fixtures - Use
assertand pattern matching for assertions
Use result tuples and pattern matching:
defmodule Jido.Messaging.Handler do
def process(message) do
with {:ok, validated} <- validate(message),
{:ok, result} <- execute(validated) do
{:ok, result}
else
{:error, reason} -> {:error, reason}
end
end
end- lib/jido_messaging.ex - Main public API
- lib/jido_messaging/application.ex - OTP supervisor
- lib/jido_messaging/ - Feature modules (one per file)
- test/jido_messaging/ - Test files mirroring lib structure
- Run
mix formatto format code - Run
mix qualityto check all standards - Run
mix test(core lane) to ensure fast feedback - Run
mix test.allbefore merging broad runtime changes - Run
mix coveralls.htmland verify coverage >= 90% - Review git diff for quality
- Write in Markdown
- Include
## Examplessections with actual iex code - Use
## Parametersfor function arguments - Use
## Returnsfor return value descriptions - Link to related modules with backticks: `Jido.Messaging.Other`
- Add
@specannotations to functions - Use proper
@typedefinitions - Handle nil cases explicitly
- Use
| nilin type specs when appropriate
- Use
Logger.debug/1for debug output - Never use
IO.inspect/1in production code - Use
dbg/1only in development/tests (Credo will warn) - Include context in log messages
Do not add dependencies without discussion. Current dependencies:
- jason - JSON support
- zoi - Schema validation
- credo, dialyxir, ex_doc, excoveralls - Dev tools
- Test both success and error cases
- Test edge cases (empty input, nil, etc.)
- Use descriptive test names
- Use the right lane/tag (
:integration,:story,:flaky) for non-core tests - Coverage report shows >= 90%
- No flaky tests (mark with
@tag :flakyif unavoidable)