agentsclimarketplace

Create client

Skill anoopsg/agent_rules/src/exclusive/skills/create-client

Behavioral blueprints for agents.

Install
npx -y skills add anoopsg/agent_rules --skill create-client

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Creates low-level wrappers around third-party plugins or system APIs in the infrastructure/_clients/ directory. Use when the user asks to create or modify an infrastructure client, implement a plugin wrapper, or add a service to the client barrel file.

SKILL.md

2.4 KB, as published. Nobody here has run it

Client Creation Skill

This skill defines the process for creating a new low-level client in the infrastructure/_clients/ directory.

1. Overview

Clients are high-level wrappers around third-party plugins or system APIs (e.g., shared_preferences, dio, package_info). They encapsulate the configuration and complexity of these tools, providing a clean interface for the rest of the infrastructure layer.

2. Directory Structure

Clients are stored in lib/src/infrastructure/_clients/:

lib/src/infrastructure/_clients/
├── _clients.dart        # Barrel file
├── my_plugin_client.dart # The client implementation
└── ...

3. Implementation Pattern

Follow these rules when creating a client:

  • Naming: Use PascalCase + Client (e.g., LocationClient).
  • DI: Provide the client via a Riverpod provider with keepAlive: true.
  • Encapsulation: Hide plugin-specific types behind your own methods where possible.
  • Error Handling: Use try/catch blocks and log errors using dart:developer.

3.1 Example Implementation

import 'dart:developer' as developer;
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:my_plugin/my_plugin.dart';

part 'my_plugin_client.g.dart';

@Riverpod(keepAlive: true)
MyPluginClient myPluginClient(Ref ref) => MyPluginClient();

class MyPluginClient {
  final _plugin = MyPlugin();

  Future<bool> doSomething() async {
    try {
      await _plugin.execute();
      return true;
    } on Object catch (e, st) {
      developer.log(
        'MyPluginClient.doSomething failed',
        name: 'MyPluginClient',
        error: e,
        stackTrace: st,
      );
      return false;
    }
  }
}

4. Barrel File

Always export your new client in lib/src/infrastructure/_clients/_clients.dart:

export 'my_plugin_client.dart';

5. Usage in Repositories

Clients are injected into repositories via their constructors. Repositories then use the client's clean methods to perform data operations.

class MyRepository {
  MyRepository({required MyPluginClient client}) : _client = client;
  final MyPluginClient _client;
}

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.