LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

single-or-array-pattern

Pattern for functions that accept either a single item or an array. Use when creating CRUD operations, batch processing APIs, or factory functions that should flexibly handle one or many inputs.

3,933stars263forksUpdated 1/21/2026
Web Development#api-design#crud-operations#typescript#batch-processing#javascript

Security Assessment

Safe(100/100)
Security Score100/100

About single-or-array-pattern

The single-or-array-pattern skill is designed for functions that need to accept either a single item or an array of items, providing a flexible interface for various operations. This pattern is particularly beneficial in scenarios such as CRUD operations, batch processing APIs, and factory functions, enabling developers to create more versatile and user-friendly APIs. By allowing both single and multiple inputs, it simplifies the implementation and enhances code maintainability, ensuring that users can work with a consistent interface regardless of the number of items being processed.

FAQ

How do I implement the single-or-array-pattern in my functions?

You can implement this pattern by checking if the input is an array using Array.isArray() and normalizing it to always handle arrays internally.

Can this pattern be used in any JavaScript or TypeScript project?

Yes, it is compatible with any project where functions need to handle single or multiple items, especially in CRUD and batch processing scenarios.

Are there any limitations to using this pattern?

This pattern is not suitable when single and batch operations have significantly different semantics or return types.

Install single-or-array-pattern

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

EpicenterHQ/epicenter

Related Skills

short-form-video

14

multi-asset-morning-briefing

7,907

content-strategy

2,901

doherty-threshold

2,901