package-layer

Validate shared Go packages in the pkg/ directory for interface design, constructors, error handling, context, and security.

Updated Feb 22, 2026
One-click install
npx skills add https://github.com/YangTaeyoung/go-clean-arch-toolkit --skill package-layer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: package-layer
Source: https://github.com/YangTaeyoung/go-clean-arch-toolkit/tree/main/skills/package-layer
Command: npx skills add https://github.com/YangTaeyoung/go-clean-arch-toolkit --skill package-layer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enforces best practices for shared Go packages (pkg/), ensuring they are reusable, maintainable, and adhere to strict interface design, error handling, and security standards.

Core Features & Use Cases

  • Interface Design Validation: Verifies that all services are defined as interfaces.
  • Constructor Pattern Enforcement: Ensures New() functions return interface types.
  • Error Handling & Context Propagation: Checks for consistent error wrapping and context usage.
  • Security Audits: Detects hardcoded secrets and direct environment variable access.
  • Use Case: When developing a new microservice, this skill automatically audits the pkg/ directory to guarantee that shared components like HTTP clients, queue producers, or utility functions are implemented according to the project's established clean architecture principles.

Quick Start

Run the package-layer skill to audit the shared packages in the current project.

Frequently Asked Questions about package-layer

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

FAQPage Schema
How do I validate shared Go package interface design in my microservice?

Validating shared Go package interface design involves auditing the `pkg/` directory to verify services are defined as interfaces and constructors return interface types. This enforces clean architecture principles for reusable infrastructure components.

How do I enforce constructor patterns and error handling in Go packages?

Enforcing constructor patterns and error handling in Go packages requires auditing `New()` functions for interface return types and checking for consistent error wrapping. This validates context propagation and coding conventions across shared infrastructure and cloud integrations.

Can this clean architecture audit detect hardcoded secrets in Go code?

Yes, a clean architecture audit can detect hardcoded secrets in Go code by scanning the `pkg/` directory for direct environment variable access and embedded credentials. This security audit prevents sensitive data exposure in external API clients and utility packages.

What is the best way to audit context propagation in Go shared packages?

The best way to audit context propagation in Go shared packages is to validate consistent context usage across core infrastructure and AI components. This ensures external API clients and queue producers handle requests correctly without breaking clean architecture conventions.

Does this package design audit work for cloud integrations and external API clients?

Yes, this package design audit works for cloud integrations and external API clients by validating their implementation within the `pkg/` directory. It checks interface design, error handling, and security standards to ensure adherence to clean architecture principles.

Why should shared Go packages use interfaces for all services?

Shared Go packages should use interfaces for all services to ensure maintainability, reusability, and adherence to clean architecture. Defining services as interfaces with proper `New()` constructors allows infrastructure and utility packages to remain decoupled and testable.