agentleFS
MindrallyMindrally/skills/java-spring-development/SKILL.md

java-spring-development

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Java Spring Boot development guidelines with best practices for building robust, secure, and maintainable enterprise applications

The file

Show its rules and text

We split this skill into the rules it gives an agent

31 rules. About 0 are common, 30 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈30

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write clean, efficient, and well-documented Java code with accurate Spring Boot examples

    line 10
  2. Distinctive:

    Use Spring Boot 3.x with Java 17+ features (records, sealed classes, pattern matching)

    line 11
  3. Distinctive:

    Prefer constructor injection over field injection for better testability

    line 12
  4. Distinctive:

    Follow SOLID principles and RESTful API design patterns

    line 13
  5. Distinctive:

    Use constructor injection for required dependencies

    line 31
  6. Distinctive:

    Keep constructors simple and avoid logic in them

    line 33
  7. Very specific:

    Use @Qualifier when multiple implementations exist

    line 34
  8. Distinctive:

    Use appropriate HTTP methods (GET, POST, PUT, DELETE, PATCH)

    line 38
  9. Distinctive:

    Use DTOs to control API contract

    line 41
  10. Distinctive:

    Use lazy loading appropriately to avoid N+1 queries

    line 48
  11. Distinctive:

    Use query methods and @Query for custom queries

    line 50
  12. Distinctive:

    Use Flyway or Liquibase for schema migrations

    line 53
  13. Distinctive:

    Never modify existing migrations

    line 55
  14. Distinctive:

    Test migrations in development before production

    line 56
  15. Distinctive:

    Use BCrypt for password encoding

    line 62
  16. Distinctive:

    Use HTTPS in production

    line 65
  17. Distinctive:

    Avoid exposing sensitive information in responses

    line 70
  18. Distinctive:

    Use JUnit 5 for unit tests

    line 76
  19. Distinctive:

    Test business logic thoroughly

    line 78
  20. Distinctive:

    Use @SpringBootTest for integration tests

    line 82
  21. Distinctive:

    Use MockMvc for web layer testing

    line 83
  22. Distinctive:

    Test database operations with test containers

    line 84
  23. Distinctive:

    Use Spring Cache abstraction

    line 90
  24. Distinctive:

    Use @Async for non-blocking operations

    line 96
  25. Distinctive:

    Consider using reactive patterns for high concurrency

    line 99
  26. Distinctive:

    Use SLF4J with Logback

    line 104
  27. Distinctive:

    Avoid logging sensitive data

    line 107
  28. Distinctive:

    Use Spring Boot Actuator for health and metrics

    line 110
  29. Distinctive:

    Use Springdoc OpenAPI for API documentation

    line 117
  30. Distinctive:

    Document all endpoints with descriptions

    line 118
  31. Distinctive:

    Keep documentation up to date with code

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Java Spring Development Best Practices

Core Principles

  • Write clean, efficient, and well-documented Java code with accurate Spring Boot examples
  • Use Spring Boot 3.x with Java 17+ features (records, sealed classes, pattern matching)
  • Prefer constructor injection over field injection for better testability
  • Follow SOLID principles and RESTful API design patterns
  • Design for microservices architecture suitability

Project Structure

Organize code using the standard layered pattern:

project/
├── controllers/     # REST controllers
├── services/        # Business logic
├── repositories/    # Data access layer
├── models/          # Domain entities and DTOs
└── configurations/  # Spring configurations

Dependency Injection

  • Use constructor injection for required dependencies
  • Leverage @RequiredArgsConstructor with Lombok for cleaner code
  • Keep constructors simple and avoid logic in them
  • Use @Qualifier when multiple implementations exist

REST API Design

  • Use appropriate HTTP methods (GET, POST, PUT, DELETE, PATCH)
  • Return proper HTTP status codes
  • Implement consistent error response format
  • Use DTOs to control API contract
  • Version APIs when needed

Data Access

Spring Data JPA

  • Define proper entity relationships (@OneToMany, @ManyToOne, etc.)
  • Use lazy loading appropriately to avoid N+1 queries
  • Implement pagination for large result sets
  • Use query methods and @Query for custom queries

Database Migrations

  • Use Flyway or Liquibase for schema migrations
  • Version migration scripts properly
  • Never modify existing migrations
  • Test migrations in development before production

Security

Spring Security

  • Implement authentication and authorization properly
  • Use BCrypt for password encoding
  • Configure CORS appropriately
  • Protect endpoints based on roles/permissions
  • Use HTTPS in production

Secure Coding

  • Validate all user inputs
  • Sanitize data to prevent injection attacks
  • Avoid exposing sensitive information in responses
  • Use parameterized queries

Testing

Unit Testing

  • Use JUnit 5 for unit tests
  • Mock dependencies with Mockito
  • Test business logic thoroughly
  • Follow Given-When-Then pattern

Integration Testing

  • Use @SpringBootTest for integration tests
  • Use MockMvc for web layer testing
  • Test database operations with test containers
  • Test security configurations

Performance

Caching

  • Use Spring Cache abstraction
  • Configure appropriate cache providers (Redis, Caffeine)
  • Set proper TTL for cached data
  • Implement cache eviction strategies

Async Processing

  • Use @Async for non-blocking operations
  • Configure thread pools appropriately
  • Handle exceptions in async methods
  • Consider using reactive patterns for high concurrency

Logging and Monitoring

Logging

  • Use SLF4J with Logback
  • Log at appropriate levels
  • Include correlation IDs for tracing
  • Avoid logging sensitive data

Monitoring

  • Use Spring Boot Actuator for health and metrics
  • Export metrics to monitoring systems
  • Set up proper health checks
  • Monitor application performance

API Documentation

  • Use Springdoc OpenAPI for API documentation
  • Document all endpoints with descriptions
  • Include request/response examples
  • Keep documentation up to date with code

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.