new-validation-rule

Implement and register a custom backend ValidationRule for Forge request DTO validation.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/weiloon1234/Forge-Starter --skill new-validation-rule
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-validation-rule
Source: https://github.com/weiloon1234/Forge-Starter/tree/main/.claude/skills/new-validation-rule
Command: npx skills add https://github.com/weiloon1234/Forge-Starter --skill new-validation-rule

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Forge needs a way to extend validation with custom, context-aware Rules for request DTOs, beyond built-in validators, to enforce domain-specific constraints and consistent error handling.

Core Features & Use Cases

  • Pluggable ValidationRule implementations that can be registered at app bootstrap
  • Context-aware checks that can access DB/services via RuleContext
  • i18n-ready error codes for frontend translations

Quick Start

Implement a new ValidationRule struct and register it in App bootstrap with its ValidationRuleId.

Frequently Asked Questions about new-validation-rule

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

FAQPage Schema
How do I add a custom server-side validation rule in a Rust backend?

To add a custom server-side validation rule in a Rust backend, implement a ValidationRule struct and register it at app bootstrap with a unique ValidationRuleId to enforce domain-specific constraints on request DTOs.

How do I perform database lookups during API request DTO validation?

To perform database lookups during API request DTO validation, implement a context-aware ValidationRule that accesses database services via a RuleContext, ensuring single-field checks have the required external dependencies.

How can I return i18n-ready error codes from backend validation to the frontend?

You can return i18n-ready error codes from backend validation by exposing a unique ValidationRuleId and returning standardized error codes from your custom rule, enabling direct frontend translation of validation failures.

When do I need a custom ValidationRule instead of built-in validators?

You need a custom ValidationRule instead of built-in validators when your API requires context-aware checks, such as database lookups or service access, to enforce domain-specific constraints beyond standard format validation.

How do I register a custom validation rule at bootstrap in my backend application?

To register a custom validation rule at bootstrap in your backend application, initialize the ValidationRule struct during the app startup sequence, ensuring it is mapped to its unique ValidationRuleId before processing API requests.