Guidelines for backend development in C++ and Elixir/Phoenix, covering modern language features, best practices, and production-ready patterns.
Install
npx skills add https://github.com/mindrally/skills --skill backend-developmentSKILL.md
Backend Development
You are an expert in backend development with C++ and Elixir/Phoenix.
C++ Development
Naming Conventions
- Use PascalCase for classes and structs
- Use camelCase for variables and methods
- Use SCREAMING_SNAKE_CASE for constants and macros
Memory Management
- Prefer smart pointers (
std::unique_ptr,std::shared_ptr) over raw pointers - Use
std::unique_ptrfor exclusive ownership - Use
std::shared_ptronly when shared ownership is required - Implement RAII for all resource management
- Avoid unnecessary heap allocations
Modern C++ Features
- Use
autofor type inference where it improves readability - Leverage range-based for loops
- Use
std::optionalfor values that may not exist - Use
std::variantfor type-safe unions - Apply structured bindings for cleaner code
- Use
std::movefor move semantics
Error Handling
- Use exceptions for error handling
- Define custom exception types for domain-specific errors
- Catch exceptions at appropriate boundaries
- Ensure exception safety in all code
Best Practices
- Enforce const-correctness throughout
- Avoid C-style casts; use
static_cast,dynamic_cast, etc. - Write unit tests with Google Test or Catch2
- Document with Doxygen comments
Elixir and Phoenix Best Practices
Core Philosophy
- Follow domain-driven design with PragDave philosophy
- Use functional programming with explicit error handling
- Embrace the "let it crash" principle
Code Organization
- Organize code around business domains using Phoenix contexts
- Keep contexts focused on single domains
- Use bounded contexts to prevent coupling
- Implement clear public APIs for each context
Pattern Matching and Control Flow
- Use pattern matching extensively for data extraction
- Apply "railway-oriented programming" with
withstatements - Chain operations cleanly with the pipe operator
- Handle all pattern match cases explicitly
Error Handling
- Return tagged tuples (
{:ok, result}or{:error, reason}) - Use
withstatements to chain fallible operations - Implement proper supervision trees
- Handle expected errors explicitly
Phoenix Contexts
- Group related functionality in contexts
- Define clear boundaries between contexts
- Use contexts as the API layer for business logic
- Keep controllers thin, delegate to contexts
LiveView
- Use LiveView as primary UI technology
- Implement function components for reusable UI
- Handle events in LiveView modules
- Manage state appropriately in assigns
Data Validation
- Validate at boundaries using
Ecto.Changeset - Use changesets even outside database contexts
- Define clear validation rules
- Return helpful error messages
Related skills
entra-app-registrationmicrosoft606KGuides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.azure-messagingmicrosoft595KTroubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, servicentra-agent-idmicrosoft328KProvision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmi_path, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmi_path token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registsupabasesupabase298KUse when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); deb