Code style conventions and PR review guidelines for GraphQL Java projects. Covers import policies, testing requirements, and breaking change protocols.
This skill provides code style conventions and pull request review guidelines for GraphQL Java implementation projects, based on the official graphql-java/graphql-java repository standards.
When working on GraphQL Java projects, follow these guidelines:
1. **Import Style**
- NEVER use fully qualified names for Java, Kotlin, or Groovy classes
- Always add proper imports at the top of the file
- NEVER use wildcard imports (e.g., `import java.util.*`)
- Import items one by one explicitly
- Configure your IDE to disable wildcard imports
2. **Code Formatting**
- Follow the code style defined in `graphql-java-code-style.xml`
- Apply consistent formatting across all Java, Kotlin, and Groovy files
- Maintain consistency with existing codebase patterns
3. **Testing Requirements**
- Every new functionality MUST include corresponding tests
- Every bug fix MUST include a test that verifies the fix
- Tests ensure code works correctly in the future and prevents regressions
4. **Performance Improvements**
- If the PR includes performance improvements, check in a JMH (Java Microbenchmark Harness) test
- JMH tests verify performance claims objectively
- Performance tests will be run on isolated performance environments for verification
5. **Breaking Changes**
- Clearly flag any breaking changes to public APIs in the PR description
- Document breaking changes so they can be called out in release notes
- Consider deprecation paths before introducing breaking changes
**When adding a new feature:**
```java
// ✅ Good: Explicit imports, new feature with test
import graphql.schema.GraphQLSchema;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLFieldDefinition;
public class NewFeature {
// Implementation with corresponding test in NewFeatureTest.java
}
```
**When fixing a bug:**
```java
// ✅ Good: Bug fix with regression test
import graphql.execution.ExecutionContext;
import graphql.language.Field;
public class BugFix {
// Fix implementation with test in BugFixTest.java proving it works
}
```
**Performance improvement:**
```java
// ✅ Good: Performance optimization with JMH benchmark
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
@BenchmarkMode(Mode.Throughput)
public class PerformanceBenchmark {
@Benchmark
public void measurePerformance() {
// Benchmark code
}
}
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/graphql-java-development-guidelines/raw