Ideal for Golang Agents requiring advanced validation capabilities with static typing and generics Golang validation framework based on static typing and generics
The validation-add-constraint skill by muonsoft is an open-source community AI agent skill for
Claude Code and other IDE workflows, helping agents execute tasks with better context,
repeatability, and domain-specific guidance.
Ideal Agent Persona
Ideal for Golang Agents requiring advanced validation capabilities with static typing and generics
Core Value
Empowers agents to enforce custom constraints using a comprehensive validation framework, including message constants, translations, and tests, leveraging Golang's static typing and generics for robust validation
↓ Capabilities Granted for validation-add-constraint
Adding custom validation constraints for specific data types
Creating translations for error messages in multiple languages
Writing tests for validation constraints to ensure correctness
! Prerequisites & Limits
Requires Golang environment
Limited to static typing and generics
Mandatory steps include adding message constants, translations, and tests
Labs Demo
Browser Sandbox Environment
⚡️ Ready to unleash?
Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.
Install validation-add-constraint, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command...
SKILL.md
Readonly
Adding a New Constraint to the Validation Library
Follow this workflow when adding a new constraint. Mandatory steps: constraint in it, message constant, translations (english + russian), tests, examples, godoc. Optional: validate and is when useful for standalone validation (e.g. string codes, identifiers).
1. Message and Error (mandatory)
1.1 Add message constant
In message/messages.go add a new constant (English default text):
go
1const (
2 // ... existing
3 InvalidMyFormat = "This value is not a valid my format."
4)
Use existing style: InvalidXxx, NotXxx, TooXxx, etc.
Text is the default (English) template; placeholders like {{ value }}, {{ limit }} are allowed.
Key is always the message constant from message package.
Value: Russian text; same placeholders as in the message constant (e.g. {{ value }}).
For plurals use plural.Selectf(1, "", plural.One, "...", plural.Few, "...", plural.Other, "...") — Russian has Few. See reference.md.
3. Constraint in package it (mandatory)
Choose the right file: it/string.go, it/identifiers.go, it/web.go, it/comparison.go, it/basic.go, it/iterable.go, it/date_time.go, it/choice.go, it/barcodes.go.
3.1 Simple string constraint (func(string) bool)
If the check is a pure func(string) bool, use OfStringBy and the is helper:
go
1// IsMyFormat validates whether the value is in my format.
2// See [link] for specification.
3func IsMyFormat() validation.StringFuncConstraint {
4 return validation.OfStringBy(is.MyFormat).
5 WithError(validation.ErrInvalidMyFormat).
6 WithMessage(validation.ErrInvalidMyFormat.Message())
7}
3.2 Custom struct constraint
When you need options (e.g. versions, formats), define a struct and implement ValidateString:
Empty/nil: Usually skip (return nil); use it.IsNotBlank() (or similar) to reject empty.
Violation: Use validator.BuildViolation(ctx, c.err, c.messageTemplate).WithParameters(...).Create(). Do not use CreateViolation for translatable constraints — use BuildViolation so the message is translated.
Godoc: Document the constraint type and constructor; document options; add See ... for specs if applicable.
4. Tests (mandatory)
In test/constraints_*_cases_test.go (create or extend the right file, e.g. constraints_identifiers_cases_test.go):
Define a slice of ConstraintValidationTestCase.
Use name, isApplicableFor: specificValueTypes(stringType) (or other type), stringValue: stringValue("..."), constraint: it.IsMyFormat(), assert: assertNoError or assertHasOneViolation(validation.ErrInvalidMyFormat, message.InvalidMyFormat).
Add the slice to validateTestCases in test/constraints_test.go via mergeTestCases(...) so the shared test runners pick it up.
5. Examples (mandatory)
In it/example_test.go add testable examples:
go
1func ExampleIsMyFormat_valid() {
2 err := validator.Validate(context.Background(), validation.String("valid-value", it.IsMyFormat()))
3 fmt.Println(err)
4 // Output:
5 // <nil>
6}
78func ExampleIsMyFormat_invalid() {
9 err := validator.Validate(context.Background(), validation.String("invalid", it.IsMyFormat()))
10 fmt.Println(err)
11 // Output:
12 // violation: "This value is not a valid my format."
13}
Use // Output: so go test runs them. Prefer ExampleXxx_valid / ExampleXxx_invalid naming.
6. Optional: package validate
Add when the constraint is useful for standalone validation (e.g. string codes, identifiers), without the full validator.
File: validate/identifiers.go or new file (e.g. validate/myformat.go).
Signature: func MyFormat(value string) error (or with options).
Return: nil if valid; otherwise a sentinel error from validate package (e.g. ErrTooShort, or custom).
Godoc: Describe when it returns which error.
Tests: validate/*_test.go table or cases.
Examples: validate/example_test.go with ExampleMyFormat and // Output:.
If the it constraint needs options, define option types and funcs in validate (e.g. validate.MyOptions, validate.AllowXxx()), and use them from it and is.
7. Optional: package is
Add when useful for standalone boolean checks (e.g. in conditions, or for OfStringBy).
File: is/identifiers.go or same area as related validate logic.
These questions and steps mirror the structured data on this page for better search understanding.
? Frequently Asked Questions
What is validation-add-constraint?
Ideal for Golang Agents requiring advanced validation capabilities with static typing and generics Golang validation framework based on static typing and generics
How do I install validation-add-constraint?
Run the command: npx killer-skills add muonsoft/validation/validation-add-constraint. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.
What are the use cases for validation-add-constraint?
Key use cases include: Adding custom validation constraints for specific data types, Creating translations for error messages in multiple languages, Writing tests for validation constraints to ensure correctness.
Which IDEs are compatible with validation-add-constraint?
This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.
Are there any limitations for validation-add-constraint?
Requires Golang environment. Limited to static typing and generics. Mandatory steps include adding message constants, translations, and tests.
↓ How To Install
1. Open your terminal
Open the terminal or command line in your project directory.
2. Run the install command
Run: npx killer-skills add muonsoft/validation/validation-add-constraint. The CLI will automatically detect your IDE or AI agent and configure the skill.
3. Start using the skill
The skill is now active. Your AI agent can use validation-add-constraint immediately in the current project.
Related Skills
Looking for an alternative to validation-add-constraint or another community skill for your workflow? Explore these related open-source skills.
f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.
flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.
The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.
The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.