Repository Guidelines
Documents the structure, commands, and conventions for an Elixir umbrella app with Phoenix, a runner service, and frontend assets.
What this file does
Documents the structure, commands, and conventions for an Elixir umbrella app with Phoenix, a runner service, and frontend assets.
When to use it
- Onboarding to the Codebattle monorepo
- Setting up a new Elixir umbrella project with similar sub-apps
- Establishing coding style and testing guidelines for a team
- Defining build and test workflows for a multi-service Elixir app
Assumes this stack
Repository Guidelines
Project Structure & Module Organization
This is an Elixir umbrella app with multiple sub-apps under apps/.
apps/codebattle/: Phoenix app with Elixir code inapps/codebattle/lib/, tests inapps/codebattle/test/, and frontend assets inapps/codebattle/assets/.apps/runner/: task runner service and language images underapps/runner/images/.apps/phoenix_gon/,config/,priv/, and top-levelmix.exsprovide shared library/config and releases.
Main Contexts & Helpers
Core domains expose context modules for public APIs:
Codebattle.Game.Context(apps/codebattle/lib/codebattle/game/context.ex): game lifecycle, live game access, and player actions.Codebattle.Tournament.Context(apps/codebattle/lib/codebattle/tournament/context.ex): tournament CRUD, live supervision, and access checks.Codebattle.Tournament.Round.Context(apps/codebattle/lib/codebattle/tournament/round/context.ex): round construction and persistence.Codebattle.Playbook.Context(apps/codebattle/lib/codebattle/playbook/context.ex): game replay records and storage.Codebattle.Event.Context(apps/codebattle/lib/codebattle/event/context.ex): event stages and tournament bootstrapping.Codebattle.Bot.Context(apps/codebattle/lib/codebattle/bot/context.ex): bot selection and runtime start.
Helper modules live alongside their domains:
- Game helpers:
apps/codebattle/lib/codebattle/game/helpers.ex; tournament helpers:apps/codebattle/lib/codebattle/tournament/helpers.ex. - Operational utilities:
apps/codebattle/lib/codebattle/utils/(populate tasks/users/clans, release helpers).
Build, Test, and Development Commands
Use the Makefile targets for common workflows:
make format/make lint: format or check Elixir formatting.make credo: run Credo static analysis.make lint-js: OXC (oxlint) for frontend assets.make server: start Phoenix (iex -S mix phx.server).make test: ExUnit + coveralls JSON.make test-code-checkers: image executor tests withCODEBATTLE_EXECUTOR=local.
For frontend-only tasks in apps/codebattle/:
pnpm run dev: Vite dev server.pnpm run build: production build.pnpm run test: Jest tests.
Coding Style & Naming Conventions
- Elixir formatting is enforced via
mix format(see.formatter.exs). - Credo rules live in
.credo.exs(120-char line limit). - JavaScript/React linting uses OXC (
oxlint) viapnpm run lint. - Naming: descriptive Elixir modules;
camelCase/PascalCasefor JS files and components.
Testing Guidelines
- ExUnit tests live in
apps/*/test/; coverage uses ExCoveralls with a 60% threshold. - Frontend tests use Jest in
apps/codebattle/. - Name tests after the module/component under test (e.g.,
user_stats_test.exs,UserStats.test.jsx).
Commit & Pull Request Guidelines
- Recent commits use short, imperative summaries (e.g., "Fix editor", "Update logo").
- Keep commits focused; include test results when relevant.
- PRs should describe the change, list test commands run, and attach screenshots for UI updates.
Configuration & Runtime Notes
- Releases are defined in
mix.exsforcodebattleandrunner; runner images build via Makefiles inapps/runner/images/.
What's inside
6 sections: project structure, contexts/helpers, build commands, coding style, testing, and commit guidelines.
Change this for your project
- Replace
hexlet-codebattle/codebattlewith your own repository name - Replace
apps/codebattle/paths with your own app directory structure - Replace
Codebattle.Game.Contextand similar module names with your own context modules
Where it goes
Save as AGENTS.md in your repository root. Read by Codex, Cursor and other agents that follow the AGENTS.md convention.
Worth borrowing
- Organizing an umbrella app with separate context modules for each domain
- Using Makefile targets to unify Elixir and frontend commands
- Enforcing formatting and linting via mix format, Credo, and oxlint
Related Documents
Browser-only development
Guides AI assistants on an Electron + React + TypeScript desktop app for browsing and organizing AI-generated images locally.
Claude Agents — Reference & Recommendations
Catalogues 40+ Claude agents and marketing skills for building a cat adoption charity landing page, with a ready-to-paste prompt and backend API reference.
Golden DKG Prototype -- Master Plan
Defines an 8-phase implementation plan for a Rust prototype of the Golden non-interactive DKG protocol using BLS12-381 and tokio.
Swarms Examples Index
Lists 60+ example scripts for building single and multi-agent systems with the Swarms framework, organized by category and use case.