Best of Design PatternsJune 2025

  1. 1
    Article
    Avatar of telerikTelerik·51w

    React Design Patterns and Best Practices for 2025

    Comprehensive guide covering modern React development patterns for 2025, including function components, custom hooks, Context API, TypeScript integration, and React 19 features like useOptimistic and Server Components. Explores ecosystem tools like Next.js, Remix, Vite, and Tailwind CSS, plus enterprise UI solutions like KendoReact for building scalable, maintainable applications.

  2. 2
    Article
    Avatar of yegor256Yegor's Blog·48w

    remove(42) vs. find(42).remove()

    Compares two approaches for removing objects from collections: direct removal methods versus retrieving the object first then calling remove. The retrieve-then-remove approach offers better object-oriented design through improved extensibility via decorators, more flexible error handling with null objects, and stronger encapsulation by keeping data wrapped within objects rather than exposing it as parameters.

  3. 3
    Article
    Avatar of codemotionCodemotion·49w

    AI-Ready Frontend Architecture

    Frontend architecture is evolving to accommodate AI tools that generate, parse, and interpret code. The approach involves creating AI guidelines files to establish conventions, using component-driven development with tools like V0.dev and shadcn/ui, implementing the Use Case pattern to decouple business logic from UI, and employing middleware chains for cross-cutting concerns like logging and error handling. This architecture enables both humans and AI agents to collaborate effectively while maintaining code quality, testability, and scalability.

  4. 4
    Article
    Avatar of rubylaRUBYLAND·51w

    Railway Pattern

    The Railway Pattern enables fault-tolerant function composition by chaining operations that can either succeed or fail gracefully. Using Ruby gems like Dry Monads and Pipeable, developers can build robust pipelines where each step produces either a Success or Failure result, allowing errors to bubble up without breaking the entire flow. The pattern is demonstrated through building an API client that handles HTTP requests, JSON parsing, validation, and data modeling as a single composable pipeline, making code more resilient to network issues and data problems.

  5. 5
    Article
    Avatar of simonwillisonSimon Willison·49w

    Design Patterns for Securing LLM Agents against Prompt Injections

    A comprehensive research paper by 11 authors from IBM, Google, Microsoft and other organizations presents six design patterns to mitigate prompt injection attacks in LLM agents. The patterns include Action-Selector, Plan-Then-Execute, LLM Map-Reduce, Dual LLM, Code-Then-Execute, and Context-Minimization approaches. Each pattern trades some agent flexibility for security by constraining actions and preventing untrusted input from triggering arbitrary tasks. The paper includes ten detailed case studies covering practical applications like SQL agents, email assistants, and customer service chatbots, providing threat models and mitigation strategies for each scenario.