Configuration

From andresdiegolanda/design-first-ai · View interactive version

Configuration is an AI agent skill from the GitHub repository andresdiegolanda/design-first-ai. Type-safe validated configuration properties from application.yml. Use when adding any externalisable value.

How to use this skill

Skill file

Skill: Configuration

When to load it: When adding any new configurable value or environment-specific

behaviour to a feature.


What This Skill Does

Produces type-safe, validated configuration properties bound from application.yml.

Enforces fail-fast validation at startup and keeps configurable values out of Java source.


Rules

  1. All configurable values go in application.yml. Never hardcoded in Java source.
  2. Group related properties under a @ConfigurationProperties class. Do not use @Value

for more than one related property.

  1. Validate at startup with @Validated. Fail fast — a misconfiguration discovered at

runtime is worse than a failed startup.

  1. Provide sensible defaults for non-critical values. Do not require configuration for

things with an obvious default.

  1. Document each property in application.yml with a comment.

Pattern

@ConfigurationProperties(prefix = "[feature]")
@Validated
public record [Feature]Properties(
    @NotBlank String [requiredProperty],
    @Min(1) @Max(100) int [boundedProperty],
    @Positive double [positiveProperty]
) {}
# application.yml
[feature]:
  # [What this property controls. Required.]
  [required-property]: [value]
  # [What this property controls. Range: 1–100. Default: 10.]
  [bounded-property]: 10
  # [What this property controls. Must be positive.]
  [positive-property]: 0.7

Register in Spring Boot:

@Configuration
@EnableConfigurationProperties([Feature]Properties.class)
public class [Feature]Config {}

Design Constraints

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.