factory-function-composition
Standardizes factory functions for better testability and dependency management.
Install
mkdir -p .claude/skills/factory-function-composition && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4171" && unzip -o skill.zip -d .claude/skills/factory-function-composition && rm skill.zipInstalls to .claude/skills/factory-function-composition
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Factory function patterns to compose clients and services. Use when wrapping resources with domain methods or refactoring mixed client/service/method options.Key capabilities
- →Enforces two-argument factory signature
- →Separates resource injection from config
- →Standardizes return object structures
- →Decouples client creation from logic
How it works
Applies a specific structural refactoring rule that extracts client/service configuration to the top level and standardizes factory arguments.
Inputs & outputs
When to use factory-function-composition
- →Refactoring service creation
- →Implementing dependency injection
- →Wrapping external clients
About factory-function-composition
Enforces a consistent pattern for factory functions where dependencies are injected first and options follow. This promotes separation of concerns and improves function testability.
Apply factory function patterns to compose clients and services with proper separation of concerns. Use when creating functions that depend on external clients, wrapping resources with domain-specific methods, or refactoring code that mixes client/service/method options together.
When not to use it
- →Small scripts requiring quick prototypes
- →Functions with zero dependencies
Limitations
- →Requires refactoring existing function signatures
- →Strictness may feel verbose for simple functions
How it compares
It dictates a strict API architecture standard rather than just optimizing code style.
Compared to similar skills
factory-function-composition side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| factory-function-composition (this skill) | 1 | 5mo | No flags | Intermediate |
| project-principles | 1 | 9mo | No flags | Intermediate |
| tldr-code | 1 | 10mo | Review | Advanced |
| dry | 0 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by EpicenterHQ
View all by EpicenterHQ →You might also like
project-principles
vm0-ai
Core architectural and code quality principles that guide all development decisions in the vm0 project
tldr-code
parcadei
Token-efficient code analysis via 5-layer stack (AST, Call Graph, CFG, DFG, PDG). 95% token savings.
dry
chrisreddington
DRY — **Don't Repeat Yourself** — is one of the most misquoted principles in software engineering. It is *not* a rule about avoiding repeated lines of code. It is a rule about avoiding repeated **knowledge**.
solid
chrisreddington
SOLID is Robert C. Martin's five object-oriented design principles. In a TypeScript codebase like Flight School — which mixes a Next.js API surface, a Copilot SDK adapter layer, GitHub data fetching, and a streaming UI — SOLID is mostly a tool for keeping modules **swappable, tes
hexagonal-architecture
jssmy
Design, implement, and refactor Ports & Adapters systems with clear domain boundaries, dependency inversion, and testable use-case orchestration across TypeScript, Java, Kotlin, and Go services. Use for: new features needing long-term maintainability, decoupling domain logic from frameworks/DB/HTTP,
mcp-builder
anthropics
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).