{
  "skill_name": "java-best-practices",
  "evals": [
    {
      "id": 1,
      "prompt": "My Java class has a constructor with 6 parameters. It's hard to read at call sites. How should I refactor it?",
      "expected_output": "Use the Builder pattern for 4+ parameters. Inner static Builder class with fluent setters. Constructor becomes private. Ensures named, readable construction.",
      "assertions": [
        { "id": "a1", "description": "Recommends Builder pattern", "type": "contains", "value": "Builder" },
        { "id": "a2", "description": "Mentions 4+ param threshold", "type": "contains", "value": "4" },
        { "id": "a3", "description": "Shows fluent API", "type": "contains", "value": "fluent" }
      ]
    },
    {
      "id": 2,
      "prompt": "My Java method can return null when it finds no result. A colleague says I should use Optional. Is that right?",
      "expected_output": "Yes — return Optional<T> instead of null. Use Optional.of(), Optional.empty(), or Optional.ofNullable(). Never use Optional as a field or parameter. Chain with map/filter/orElseThrow.",
      "assertions": [
        { "id": "a1", "description": "Recommends Optional", "type": "contains", "value": "Optional" },
        { "id": "a2", "description": "Rejects null returns", "type": "contains", "value": "null" },
        { "id": "a3", "description": "Warns against Optional as field", "type": "contains", "value": "field" }
      ]
    },
    {
      "id": 3,
      "prompt": "Should I extend my base class EmailNotification to add SMS support, or is there a better way in Java?",
      "expected_output": "Favor composition over inheritance. Create a NotificationService interface, inject different notification strategies (EmailNotifier, SmsNotifier) via constructor. Avoid deep inheritance hierarchies.",
      "assertions": [
        { "id": "a1", "description": "Recommends composition", "type": "contains", "value": "composition" },
        { "id": "a2", "description": "Mentions interface", "type": "contains", "value": "interface" },
        { "id": "a3", "description": "Rejects inheritance", "type": "contains", "value": "inherit" }
      ]
    }
  ],
  "should_not_trigger": [
    "How do I write a JUnit 5 test with Mockito for my UserService?",
    "Configure Spotless to enforce Google Java format in my Gradle build",
    "Use Java Virtual Threads instead of a cached thread pool for my HTTP server",
    "How do I use pattern matching in a switch expression in Java 21?",
    "Set up structured concurrency with StructuredTaskScope in Java",
    "My Maven build has a dependency version conflict — how do I resolve it?",
    "Convert my Java class to a Kotlin data class",
    "Add @ParameterizedTest with CSV source for boundary value testing",
    "How do I use records as DTOs in a Spring Boot REST API?",
    "Configure SpotBugs to fail CI builds on high-severity findings"
  ]
}
