.cursorrules
Defines Elixir coding conventions and test structure rules for a library that recompiles code in AST form.
What this file does
Defines Elixir coding conventions and test structure rules for a library that recompiles code in AST form.
When to use it
- Writing an Elixir library that manipulates compiled AST
- Setting up a new Elixir project and want consistent code style
- Contributing to an existing Elixir codebase with established patterns
- Enforcing functional programming idioms across a team
Assumes this stack
This is an Elixir library that recompiles Elixir code in its AST form.
Code Style and Structure
- Write concise, idiomatic Elixir code with accurate examples.
- Use functional programming patterns and leverage immutability.
- Prefer higher-order functions and recursion over imperative loops.
- Use pattern matching directly in function clauses when needed for control flow.
- Prefer patterns in function arguments over case statements.
- Prefer one-line function syntax with no blank lines in between when all clauses fit on one line.
- Use descriptive variable and function names (e.g., user_signed_in?, calculate_total).
- Sort aliases alphabetically.
- Don't add comments to the code unless explicitly asked for.
- Calls to defd should not have parentheses.
Tests
- Structure test files to mirror the directory structure of the code under test.
- Module names in test files must be unique.
What's inside
6 code style rules, 2 test conventions, and 1 defd call syntax note
Change this for your project
- Replace
defdwith your own macro name if you don't use that library - Adjust the
user_signed_in?andcalculate_totalexamples to match your domain naming
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
dbt Core
Defines a complete dbt project setup with layered architecture, SQL style, Jinja best practices, and CI/CD workflow guidance.
HarmonyOS 主题与样式 - Cursor Rules
Defines HarmonyOS theming rules for dark/light mode, page brightness, and screen-on control with code examples.
Cursor Development Environment
Documents a Docker-based dev container setup with test commands and OpenClaw agent configuration for the ClawDrive project.
Journey from Concept to Code: Transforming Cursor into a Devin-like AI Assistant
Documents the creation of aicode.cursorrules, a set of rules that turns Cursor/Windsurf into a Devin-like AI assistant with automated planning and self-evolution.