go-create-validator

Generate Go validator implementations with port interfaces and Fx wiring.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-validator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-create-validator
Source: https://github.com/cristiano-pacheco/ai-rules/tree/main/skills/go-create-validator
Command: npx skills add https://github.com/cristiano-pacheco/ai-rules --skill go-create-validator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generate Go validator implementations following modular architecture conventions (interface-first design, Fx DI, stateless validation). Use when creating validation logic in internal/modules/<module>/validator/ - password validation, email validation, input sanitization, business rule validation, or any domain validation that encapsulates validation rules and returns typed errors.

Core Features & Use Cases

  • Two-file pattern: Port interface at internal/modules/<module>/ports/<validator_name>_validator.go and implementation at internal/modules/<module>/validator/<validator_name>_validator.go.
  • Fx wiring and dependency management: ready for DI and modular wiring.
  • Typed errors: integrates with module errs for domain-specific error handling.
  • Use Case: quickly scaffold validation layers for new domain modules.

Quick Start

Create a new validator for a module by generating the port interface and the validator implementation following the two-file pattern.

Frequently Asked Questions about go-create-validator

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

FAQPage Schema
How do I generate a Go validator for a modular architecture?

To generate a Go validator for modular architecture, automate the creation of a two-file pattern: a port interface in the ports directory and a concrete validator implementation in the validator directory. This enforces interface-first design and stateless validation.

What is the two-file pattern for Go domain validation?

The two-file pattern for Go domain validation separates interfaces from implementations. It places the port interface at internal/modules/<module>/ports/ and the concrete validator at internal/modules/<module>/validator/ to ensure clean dependency boundaries.

Can I use Fx dependency injection with custom Go validators?

Yes, you can use Fx dependency injection with custom Go validators. The generated validator includes Fx wiring, ensuring the module is ready for dependency injection and modular wiring within the Fx framework.

How do I handle typed errors in Go email and password validation?

To handle typed errors in Go email and password validation, the generated validator integrates with the module's errs package. This ensures domain-specific error handling by returning typed errors directly from the validation logic.

Does the generated Go validator support context-based validation for I/O operations?

Yes, the generated Go validator supports context-based validation for I/O operations. It includes optional context-based validation features, allowing validators to handle I/O dependencies safely when required by the domain logic.

What's the best way to scaffold a validation layer for a new Go module?

The best way to scaffold a validation layer for a new Go module is to generate the port interface and concrete implementation simultaneously. This enforces an interface assertion and ensures the constructor returns the correct pointer type.