implement-service

Implement device-local services with StorageService and LazySingleton DI in Flutter apps.

1|Updated Jun 27, 2023
One-click install
npx skills add https://github.com/andrelucassvt/Payplan --skill implement-service-andrelucassvt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implement-service
Source: https://github.com/andrelucassvt/Payplan/tree/main/.agents/skills/implement-service
Command: npx skills add https://github.com/andrelucassvt/Payplan --skill implement-service-andrelucassvt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implements a structured approach to building device-local services that encapsulate storage, gating, onboarding, and other local logic, keeping business rules out of UI or repositories.

Core Features & Use Cases

  • Abstraction: define a formal interface and a concrete implementation for device resources (storage flags, counters, onboarding, feature gating, biometrics).
  • Storage integration: all storage interactions go through StorageService, ensuring testability and consistency.
  • DI-friendly: registered with LazySingleton and injected into Cubits, not directly into views.
  • Clear contract: static storage keys and separation of concerns between interface and implementation.
  • File organization: supports a clear lib/common/services/<service>/ structure with optional subfolders for scripts/references/assets.

Quick Start

Create a new service following the specified templates, register it in the DI, and inject it into a Cubit to drive local-logic behavior.

Frequently Asked Questions about implement-service

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

FAQPage Schema
How do I encapsulate Flutter local storage and feature gating logic outside of Cubits?

Encapsulate Flutter local storage and feature gating by defining abstract interfaces and concrete implementations using StorageService, injecting them via LazySingleton into Cubits rather than directly into views.

What is the best way to structure onboarding logic in a Flutter app using dependency injection?

Structure onboarding logic by creating a Service with abstract interfaces and static storage keys, using registerLazySingleton for dependency injection and organizing files under lib/common/services/<service>/.

Why do I need a Service layer for onboarding and storage logic instead of using Repositories directly?

A Service layer for onboarding and storage logic keeps business rules out of UI and Repositories, ensuring testability and consistent storage interactions through a formal contract.

Can I use this service pattern for biometrics and feature gating in Flutter mobile apps?

Yes, you can use this service pattern for biometrics and feature gating in Flutter mobile apps by defining formal interfaces and concrete implementations for device resources to maintain separation of concerns.

How do I register a device-local service using DI in Flutter?

Register a device-local service using DI in Flutter by applying registerLazySingleton to inject the concrete implementation into Cubits, ensuring StorageService interactions remain consistent and testable.

When should I not use a Service for local logic in my Flutter application?

Avoid using a Service for local logic when rules can remain directly in Cubits or Repositories without compromising testability, or when storage interactions do not require a formal abstraction contract.