francescovallone/serinus/serinus-providers-and-di

Claude Code and agent skill by francescovallone/serinus

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when defining Serinus providers, dependency injection, module exports, lifecycle hooks, or custom provider registrations such as Provider.composed, Provider.forClass, and Provider.forValue.

Install

npx vskill@latest install francescovallone/serinus/serinus-providers-and-di

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

Serinus Providers and DI

Guidelines

  • Put reusable business logic and shared state in Provider classes, not in controllers.
  • Register providers in a module's providers list.
  • Resolve providers and values from contexts with context.use<T>() or context.use<T>('name') for named values.
  • Use Provider.composed<T>(..., inject: [...]) when a provider must be assembled from other providers or values during initialization.
  • Use Provider.forClass<T>(useClass: ...) when registering one implementation under another provider token.
  • Use Provider.forValue<T>(value, name: ...) for configuration and other non-provider injectables.
  • Prefer named value providers when more than one value of the same type may exist. Unnamed duplicates of the same type are rejected.
  • Export only what another module must consume. Use Export.value<T>('name') for named values.
  • Implement lifecycle mixins such as OnApplicationInit, OnApplicationBootstrap, OnApplicationReady, and OnApplicationShutdown on providers when startup or teardown work is required.

Prefer This Pattern

dart
import 'package:serinus/serinus.dart';
class UsersService extends Provider {
UsersService(this.apiBaseUrl);
final String apiBaseUrl;
}
class UsersModule extends Module {
UsersModule()
: super(
providers: [
Provider.forValue<String>('https://api.example.com', name: 'API_URL'),
Provider.composed<UsersService>(
(context) async => UsersService(context.use<String>('API_URL')),
inject: [ValueToken.of<String>('API_URL')],
),
],
exports: [UsersService, Export.value<String>('API_URL')],
);
}

Class Provider Pattern

dart
final paymentProvider = Provider.forClass<PaymentService>(
useClass: StripePaymentService(),
);

Use this when a module should inject PaymentService while the concrete implementation stays replaceable.

Lifecycle Pattern

dart
class CacheProvider extends Provider with OnApplicationInit, OnApplicationShutdown {
@override
Future<void> onApplicationInit() async {}
@override
Future<void> onApplicationShutdown() async {}
}

Avoid

  • Do not access providers through global state if the context can inject them.
  • Do not register multiple unnamed ValueProviders for the same type.
  • Do not export internal-only providers by default.
  • Do not use Provider.composed for simple providers that have no dependencies.

References

  • references/providers-and-di.md for the documented provider, value provider, class provider, export, and lifecycle-hook patterns.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
107
Repository forks
11
7-day trend score
23

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/francescovallone/serinus/serinus-providers-and-di/badge)](https://verified-skill.com/skills/francescovallone/serinus/serinus-providers-and-di)

Something wrong with this skill or its page? Tell us.