Skip to content

a-pavithraa/springboot-skills-marketplace / plugins/springboot-architecture/skills/creating-springboot-projects

creating-springboot-projects

Verified

Use when starting a new Spring Boot project or service: scaffolding or bootstrapping a backend, REST API, microservice or modular monolith; choosing how to structure it (layered, package-by-module, modular monolith, tomato, DDD-hexagonal); selecting Spring Boot 4 features; generating the base project with progen or Spring Initializr; or applying the bundled templates and references in this skill. Not for migrating existing projects or for isolated JPA/repository work without broader project-creation context.

assets/repository.java

View on GitHub
package {{PACKAGE}}.{{MODULE}}.domain;

import {{PACKAGE}}.{{MODULE}}.domain.vo.{{NAME}}Code;
import {{PACKAGE}}.{{MODULE}}.domain.vo.{{NAME}}Id;
import {{PACKAGE}}.shared.ResourceNotFoundException;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;

/**
 * Repository template - collection-like interface for aggregate root.
 *
 * Key principles:
 * - Only for aggregate roots
 * - Use @Query with JPQL for custom queries
 * - Use default methods for convenience (getBy* throws if not found)
 * - Return domain objects from write, ViewModels from read (via QueryService)
 */
interface {{NAME}}Repository extends JpaRepository<{{NAME}}Entity, {{NAME}}Id> {

    // ==================== CUSTOM QUERIES ====================

    @Query("""
            SELECT e FROM {{NAME}}Entity e
            WHERE e.code = :code
            """)
    Optional<{{NAME}}Entity> findByCode(@Param("code") {{NAME}}Code code);

    @Query("""
            SELECT e FROM {{NAME}}Entity e
            WHERE e.status = {{PACKAGE}}.{{MODULE}}.domain.{{NAME}}Status.ACTIVE
            ORDER BY e.createdAt DESC
            """)
    List<{{NAME}}Entity> findAllActive();

    // ==================== CONVENIENCE METHODS ====================

    default {{NAME}}Entity getById({{NAME}}Id id) {
        return findById(id)
            .orElseThrow(() -> new ResourceNotFoundException(
                "{{NAME}} not found with id: " + id.id()));
    }

    default {{NAME}}Entity getByCode({{NAME}}Code code) {
        return findByCode(code)
            .orElseThrow(() -> new ResourceNotFoundException(
                "{{NAME}} not found with code: " + code.code()));
    }
}

// ============================================================
// EXAMPLE: ProductRepository
// ============================================================

// interface ProductRepository extends JpaRepository<ProductEntity, ProductId> {
//
//     @Query("""
//             SELECT p FROM ProductEntity p
//             WHERE p.sku = :sku
//             """)
//     Optional<ProductEntity> findBySku(@Param("sku") ProductSKU sku);
//
//     @Query("""
//             SELECT p FROM ProductEntity p
//             WHERE p.status = com.example.products.domain.ProductStatus.ACTIVE
//             AND p.quantity.value > 0
//             ORDER BY p.createdAt DESC
//             """)
//     List<ProductEntity> findAvailable();
//
//     @Query("""
//             SELECT p FROM ProductEntity p
//             WHERE p.price.amount BETWEEN :min AND :max
//             """)
//     List<ProductEntity> findByPriceRange(@Param("min") BigDecimal min,
//                                          @Param("max") BigDecimal max);
//
//     default ProductEntity getBySku(ProductSKU sku) {
//         return findBySku(sku)
//             .orElseThrow(() -> new ResourceNotFoundException(
//                 "Product not found: " + sku.code()));
//     }
// }
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall