backend-anti-patterns

Document backend anti-patterns and correct alternatives across layers.

Updated Jan 20, 2023
One-click install
npx skills add https://github.com/doncan-orozco/papyro --skill backend-anti-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-anti-patterns
Source: https://github.com/doncan-orozco/papyro/tree/main/.ai/skills/backend-anti-patterns
Command: npx skills add https://github.com/doncan-orozco/papyro --skill backend-anti-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers avoid common pitfalls and anti-patterns in backend development, leading to more maintainable, secure, and efficient codebases.

Core Features & Use Cases

  • Pattern Identification: Clearly outlines what NOT to do and provides correct alternatives for various backend layers (Models, Operations, Controllers, etc.).
  • Best Practice Enforcement: Serves as a guide for code reviews and new feature development to ensure adherence to established best practices.
  • Use Case: When reviewing a new feature, a developer can consult this Skill to quickly identify if models contain business logic instead of just persistence, or if authorization is misplaced in operations instead of controllers.

Quick Start

Use the backend-anti-patterns skill to understand the correct pattern for handling authorization in controllers versus operations.

Frequently Asked Questions about backend-anti-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are common backend anti-patterns in Ruby on Rails?

Common backend anti-patterns in Ruby on Rails include placing business logic in models instead of persistence, and misplacing authorization in operations rather than controllers. This skill documents these issues to guide developers toward cleaner, more maintainable code.

How do I handle authorization correctly in Rails controllers versus operations?

Authorization in Rails should be performed at the controller level, not within operations. By separating concerns and keeping authorization in controllers, you ensure more secure and maintainable backend code, avoiding common architectural anti-patterns.

How do I use code reviews to enforce backend best practices?

You can use code reviews to enforce backend best practices by checking if models contain business logic instead of persistence, or if authorization is misplaced. This skill serves as a guide to quickly identify violations and apply correct architectural alternatives.

Should I use contracts for validation in Rails backend development?

Using contracts for validation is a recommended best practice for Rails backend development. This skill outlines correct alternatives to anti-patterns, guiding you to separate concerns and use contracts to ensure robust and maintainable code.

When do I need to separate concerns in backend models and operations?

You need to separate concerns in backend models and operations when models start containing business logic instead of persistence. This skill helps identify such anti-patterns and provides correct alternatives to ensure secure and maintainable code.