fn-args-deps

Enforce explicit dependency injection in functions using the fn(args, deps) pattern.

3|1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/jagreehal/jagreehal-claude-skills --skill fn-args-deps
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fn-args-deps
Source: https://github.com/jagreehal/jagreehal-claude-skills/tree/main/skills/fn-args-deps
Command: npx skills add https://github.com/jagreehal/jagreehal-claude-skills --skill fn-args-deps

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Skill enforces the fn(args, deps) pattern to replace classes with pure, dependency-injected functions, improving testability and maintainability.

Core Features & Use Cases

  • Explicit dependency types per function to avoid god objects and hidden couplings.
  • Boundary composition: wire deps once at the edges and pass into functions.
  • Encourages writing small, testable functions that operate on per-call args.

Quick Start

Define a per-function deps type and implement a function using the fn(args, deps) signature, then wire it at the application boundary so handlers invoke the function with the correct deps.

Frequently Asked Questions about fn-args-deps

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce explicit dependency injection in TypeScript functions instead of classes?

Enforce explicit dependency injection in TypeScript by applying the fn(args, deps) pattern, which replaces business-logic classes with pure functions. This requires defining per-function dependency types and wiring collaborators at the boundary to ensure clear, testable inputs.

What is the best way to structure TypeScript functions for unit testing and maintainability?

The best way to structure TypeScript functions for unit testing is using the fn(args, deps) pattern. By passing per-call arguments and long-lived dependencies explicitly, you create small, pure functions that avoid hidden couplings and god objects, making them highly testable.

How do I wire dependencies at the application boundary for dependency-injected functions?

To wire dependencies at the application boundary, define a per-function deps type and implement the function using the fn(args, deps) signature. Compose these dependencies once at the edges of your application so request handlers invoke the function with the correct collaborators.

When do I need per-function dependency types in a TypeScript codebase?

You need per-function dependency types in TypeScript when replacing classes with pure functions. This approach applies to service boundaries, request handlers, and unit-tested functions, ensuring long-lived collaborators are explicitly injected per function rather than hidden inside class instances.

Why does replacing classes with dependency-injected functions improve testability?

Replacing classes with dependency-injected functions improves testability by eliminating god objects and hidden couplings. The fn(args, deps) pattern forces explicit dependency declaration, allowing unit tests to easily provide mocks or stubs directly to the function without instantiating complex class hierarchies.

Can I use the fn(args, deps) pattern for service boundaries and request handlers?

Yes, the fn(args, deps) pattern is ideal for service boundaries and request handlers. It supports codebases requiring per-call inputs and long-lived collaborators, allowing you to pass specific arguments alongside injected dependencies for clear, isolated, and testable service operations.