本文へ移動
cccskills
無料GitHub で公開

services-and-interfaces

Define and implement services that encapsulate business logic with proper constructor-based dependency injection.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authulaスター 273(GitHub 273 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(2)

  • SKILL.md2.2 KB
  • examples/todo_service.go1.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Services & Interface Design

When to use this skill

  • Create services that encapsulate business logic
  • Implement business operations that delegate to repositories for data access (Database)
  • Add authentication or domain-specific features as services

Key principles

  1. Concrete struct design: Services are defined as interfaces and implemented by concrete structs with the same name lowercase and with a constructor (e.g., TodoService and todoService with NewTodoService constructor)
  2. Constructor-based injection: Dependencies passed at construction
  3. Single responsibility: Each service handles one domain concern
  4. Repository delegation: Services delegate all data access to repositories
  5. Context-aware: All public methods accept context.Context
  6. Interface return types: Constructors return interfaces, not concrete types
  7. Single File Exports: Each service implementation is in its own file. However, all service interfaces are exported from interfaces.go under the services/ folder.

Pattern

Services handle business logic:

  • Define interface for service with methods representing business operations
  • Implement as concrete struct with repository dependencies
  • Constructor function injects all dependencies
  • Methods are thin wrappers that validate, transform, and delegate to repositories
  • Return interfaces from constructors

Example

See examples/todo_service.go for:

  • TodoService interface definition
  • todoService implementation with constructor
  • Validation and repository delegation patterns

Common mistakes

  1. Service-to-service direct calls without interfaces
  2. Putting queries in services (repositories own data access)
  3. Missing context parameter
  4. Exporting implementation struct instead of interface
  5. Not testing with mocks

References

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Wire dependencies using constructor-based dependency injection throughout services, repositories, and handlers.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

Use this skill when answering questions, explaining concepts, writing technical responses, reviewing code, or helping with development tasks. Communicate in clear, simple, standard English. Keep answers concise and focused, remove unnecessary filler and repetition, explain technical ideas in plain language, and structure information so it is easy to read and understand. When showing code, present it clearly with enough context for the developer to understand what it does and where it belongs.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

grill-me

無料

A relentless interview to sharpen a plan or design.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

grilling

無料

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

Implement HTTP handlers that parse requests, invoke use cases, and format responses following REST conventions.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

handoff

無料

Compact the current conversation into a handoff document for another agent to pick up.

日本語の概要は準備中です。原文の説明を表示しています。

Authula/authula2732026年10月24日 更新

Authula のスキルをすべて見る

このスキルの問題を報告する