본문으로 건너뛰기
cccskills
무료GitHub에 공개

dependency-injection

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

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Authula/authula스타 273(GitHub 273 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(2)

  • SKILL.md2.1 KB
  • examples/di_todo_example.go1.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Dependency Injection & Construction

When to use this skill

  • Wire services, repositories, and handlers with their dependencies
  • Initialize core services during application bootstrap
  • Pass dependencies to plugins during initialization
  • Create dependency graphs that are testable and mockable
  • Avoid service locators and global state

Key principles

  1. Constructor-based: Dependencies passed via function parameters
  2. Explicit over implicit: Dependencies visible in constructor signatures
  3. Interface-based: Depend on interfaces, not concrete implementations
  4. Single responsibility: Each constructor handles one entity's wiring
  5. Bootstrap concentrated: Wiring happens in bootstrap.go and plugin Init

Pattern

Dependency injection flow:

  • Repositories accept bun.IDB and return interface
  • Services accept repositories and return interface
  • Use cases accept services and return struct
  • Handlers accept use cases and return struct
  • Plugins accept PluginContext, retrieve services, create dependencies
  • No global state or service locators

Example

See examples/di_todo_example.go for:

  • BuildTodosPlugin demonstrating complete DI chain
  • Bottom-up wiring (Database ??? Repository ??? Service ??? UseCase ??? Handler)
  • Dependency graph diagram
  • Unidirectional dependency flow

Common mistakes

  1. Circular dependencies (Service A ??? Service B ??? Service A)
  2. Lazy initialization instead of bootstrap-time
  3. Depending on concrete types instead of interfaces
  4. Creating service instances multiple times
  5. Service retrieval without type assertion
  6. Not checking ok flag on type assertion

References

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

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일 업데이트

Build pluggable authentication features using the plugin system with initialization, migrations, routes, and service registration.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Authula/authula2732026년 10월 24일 업데이트

Authula의 스킬 모두 보기

이 스킬의 문제 신고