rimitive-module

Create Rimitive modules with defineModule for composition, dependencies, and lifecycle hooks.

Updated Jul 18, 2025
One-click install
npx skills add https://github.com/hejhi/rimitive --skill rimitive-module
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rimitive-module
Source: https://github.com/hejhi/rimitive/tree/main/plugins/rimitive-module/skills
Command: npx skills add https://github.com/hejhi/rimitive --skill rimitive-module

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill documents how to define modular, composable pieces of functionality for Rimitive so library and application authors can encapsulate setup, teardown, and shared infrastructure without leaking global state or coupling to frameworks.

Core Features & Use Cases

  • Composable module definitions: Use defineModule to expose a named API on the composed service that consumers call directly.
  • Dependency resolution: Declare module dependencies that are automatically resolved by compose(), including transitive dependencies.
  • Lifecycle and factory patterns: Support init and destroy hooks, plus factory modules for adapter-bound configuration, enabling adapters, HTTP clients, caching, and more.
  • Use Case: Build a reusable counter, logging, adapter, or API module that composes with signals and view modules and remains tree-shakeable in TypeScript builds.

Quick Start

Compose a module by using defineModule with a name, optional dependencies, and a create function that returns the module API and lifecycle hooks.

Frequently Asked Questions about rimitive-module

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

FAQPage Schema
How do I create composable modules in TypeScript without leaking global state?

To create composable modules without leaking global state, use defineModule to encapsulate setup, teardown, and shared infrastructure. This approach exposes a named API on the composed service while keeping modules tree-shakeable in TypeScript builds.

What is the best way to manage module dependencies and lifecycle hooks in JavaScript?

Managing module dependencies and lifecycle hooks involves declaring dependencies for automatic resolution by compose() and supporting init and destroy hooks. This mechanism handles transitive dependencies and factory patterns for adapter-bound configuration.

Can I use factory modules to configure adapters and HTTP clients in a composed service?

Yes, you can use factory modules to configure adapters and HTTP clients. Factory modules support adapter-bound configuration, enabling dynamic setup of HTTP clients, caching layers, and other service-level APIs within the composed architecture.

How do tree-shakeable composition and naming conventions work for composable services?

Tree-shakeable composition relies on defining modules with proper naming conventions and exportable TypeScript types. This ensures that unused modules are safely eliminated during JavaScript or TypeScript builds, reducing the final bundle size.

Does compose() automatically resolve transitive dependencies for modular services?

Yes, compose() automatically resolves transitive dependencies for modular services. When you declare module dependencies, the compose() function handles the entire resolution chain, ensuring that all required modules are initialized correctly.

When should I not use a factory module pattern for composable JavaScript modules?

You should avoid the factory module pattern when your composable modules do not require adapter-bound configuration or dynamic runtime setup. Standard module definitions with direct init and destroy hooks are sufficient for static, non-parameterized service APIs.