Toolverse
All skills

single-or-array-pattern

by EpicenterHQ

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.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Category
Security
Views
4

About this skill

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.

How to use

  1. Zdefiniuj parametr funkcji z typem unii: T | T[], gdzie T to typ pojedynczego elementu (np. Client | Client[]).

  2. Na początku funkcji normalizuj wejście do tablicy za pomocą Array.isArray() — jeśli otrzymasz pojedynczy element, zawiń go w tablicę: const items = Array.isArray(itemOrItems) ? itemOrItems : [itemOrItems].

  3. Napisz całą logikę biznesową pracując tylko na zmiennej items (tablicy) — iteruj pętlą for...of lub map() i wykonaj operacje na każdym elemencie.

  4. Nazwij parametr wejściowy zgodnie z konwencją: itemOrItems, clientOrClients, recordingOrRecordings — znormalizowaną zmienną nazwij formą liczby mnogiej (items, clients, recordings).

  5. Zastosuj wzorzec w operacjach CRUD (create, update, delete), funkcjach fabrycznych lub API, które powinny obsługiwać zarówno pojedyncze żądania, jak i przetwarzanie wsadowe.

  6. Unikaj tego wzorca, jeśli semantyka operacji na jednym elemencie różni się znacząco od operacji na tablicy, lub jeśli typ zwracany powinien być inny dla obu przypadków.

Related skills

better-auth-best-practices

by novuhq

Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.

Security
1148

ui-audit

by openclaw

AI skill for automated UI audits. Evaluate interfaces against proven UX principles for visual hierarchy, accessibility, cognitive load, navigation, and more. Based on Making UX Decisions by Tommy Geoco.

Security
1223

architect-review

by sickn33

Master software architect specializing in modern architecture patterns, clean architecture, microservices, event-driven systems, and DDD. Reviews system designs and code changes for architectural integrity, scalability, and maintainability. Use PROACTIVELY for architectural

Security
2773

llama-cpp

by zechenzhangAGI

Runs LLM inference on CPU, Apple Silicon, and consumer GPUs without NVIDIA hardware. Use for edge deployment, M1/M2/M3 Macs, AMD/Intel GPUs, or when CUDA is unavailable. Supports GGUF quantization (1.5-8 bit) for reduced memory and 4-10× speedup vs PyTorch on CPU.

Security
11252

software-security

by project-codeguard

A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.

Security
1678

security-compliance

by davila7

Guides security professionals in implementing defense-in-depth security architectures, achieving compliance with industry frameworks (SOC2, ISO27001, GDPR, HIPAA), conducting threat modeling and risk assessments, managing security operations and incident response, and embedding

Security
1172