FA

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.zip

Installs 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.
158 chars✓ has a “when” trigger
Intermediate

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

You give it
Code containing mixed-concern factory functions
You get back
Refactored functions adhering to the Dependency-first / Options-second signature

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.

SkillInstallsUpdatedSafetyDifficulty
factory-function-composition (this skill)15moNo flagsIntermediate
project-principles19moNo flagsIntermediate
tldr-code110moReviewAdvanced
dry06moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry