Agent skill

Springboot Patterns

by affaan-m in affaan-m/ECC

Spring Boot架构模式、REST API设计、分层服务、数据访问、缓存、异步处理和日志记录。用于Java Spring Boot后端工作。

MITAuto-check passedBackend & APIs

Install Springboot Patterns

skills CLI
$ npx skills add affaan-m/ECC --skill springboot-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC springboot-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/zh-CN/skills/springboot-patterns .claude/skills/springboot-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
springboot-patterns
GitHub stars
275k
Used in
3 other repos
Token cost
~2.2k tokens
SKILL.md length
132 words
Files
1
Skills in repo
645
Repo updated
First seen
Licence
MIT

At a glance

Spring Boot架构模式、REST API设计、分层服务、数据访问、缓存、异步处理和日志记录。用于Java Spring Boot后端工作。

  • Works in 4 steps: 您的应用程序位于可信的反向代理(nginx、AWS ALB 等)之后 → 您已将 ForwardedHeaderFilter 注册为 bean → 您已在应用属性中配置了… → …
  • Tasks that involve Backend development
  • SKILL.md covers 何时激活, REST API 结构, 仓库模式 (Spring Data JPA) and 带事务的服务层, plus 12 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Springboot Patterns is an agent skill from affaan-m/ECC. Spring Boot架构模式、REST API设计、分层服务、数据访问、缓存、异步处理和日志记录。用于Java Spring Boot后端工作。

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Backend development and REST APIs. It works with Spring Boot and Java. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Tasks that involve Backend development
  • Tasks that involve REST APIs

Example prompts

  • “/springboot-patterns”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 您的应用程序位于可信的反向代理(nginx、AWS ALB 等)之后
  2. 您已将 ForwardedHeaderFilter 注册为 bean
  3. 您已在应用属性中配置了 server.forward-headers-strategy=NATIVE 或 FRAMEWORK
  4. 您的代理配置为覆盖(而非追加)X-Forwarded-For 头

What it can do on your machine

Read from SKILL.md and the folder at commit ef648e0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Springboot Patterns loads about 2.2k tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 132 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~23
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit ef648e0, republished under its MIT licence (© affaan-m). 132 words, ~2,171 tokens.

Download SKILL.mdSave it as .claude/skills/springboot-patterns/SKILL.md (or your agent's skills folder).
name
springboot-patterns
description
Spring Boot架构模式、REST API设计、分层服务、数据访问、缓存、异步处理和日志记录。用于Java Spring Boot后端工作。
origin
ECC

Spring Boot 开发模式

用于可扩展、生产级服务的 Spring Boot 架构和 API 模式。

何时激活

  • 使用 Spring MVC 或 WebFlux 构建 REST API
  • 构建控制器 → 服务 → 仓库层结构
  • 配置 Spring Data JPA、缓存或异步处理
  • 添加验证、异常处理或分页
  • 为开发/预发布/生产环境设置配置文件
  • 使用 Spring Events 或 Kafka 实现事件驱动模式

REST API 结构

java
@RestController
@RequestMapping("/api/markets")
@Validated
class MarketController {
  private final MarketService marketService;

  MarketController(MarketService marketService) {
    this.marketService = marketService;
  }

  @GetMapping
  ResponseEntity<Page<MarketResponse>> list(
      @RequestParam(defaultValue = "0") int page,
      @RequestParam(defaultValue = "20") int size) {
    Page<Market> markets = marketService.list(PageRequest.of(page, size));
    return ResponseEntity.ok(markets.map(MarketResponse::from));
  }

  @PostMapping
  ResponseEntity<MarketResponse> create(@Valid @RequestBody CreateMarketRequest request) {
    Market market = marketService.create(request);
    return ResponseEntity.status(HttpStatus.CREATED).body(MarketResponse.from(market));
  }
}

仓库模式 (Spring Data JPA)

java
public interface MarketRepository extends JpaRepository<MarketEntity, Long> {
  @Query("select m from MarketEntity m where m.status = :status order by m.volume desc")
  List<MarketEntity> findActive(@Param("status") MarketStatus status, Pageable pageable);
}

带事务的服务层

java
@Service
public class MarketService {
  private final MarketRepository repo;

  public MarketService(MarketRepository repo) {
    this.repo = repo;
  }

  @Transactional
  public Market create(CreateMarketRequest request) {
    MarketEntity entity = MarketEntity.from(request);
    MarketEntity saved = repo.save(entity);
    return Market.from(saved);
  }
}

DTO 和验证

java
public record CreateMarketRequest(
    @NotBlank @Size(max = 200) String name,
    @NotBlank @Size(max = 2000) String description,
    @NotNull @FutureOrPresent Instant endDate,
    @NotEmpty List<@NotBlank String> categories) {}

public record MarketResponse(Long id, String name, MarketStatus status) {
  static MarketResponse from(Market market) {
    return new MarketResponse(market.id(), market.name(), market.status());
  }
}

异常处理

java
@ControllerAdvice
class GlobalExceptionHandler {
  @ExceptionHandler(MethodArgumentNotValidException.class)
  ResponseEntity<ApiError> handleValidation(MethodArgumentNotValidException ex) {
    String message = ex.getBindingResult().getFieldErrors().stream()
        .map(e -> e.getField() + ": " + e.getDefaultMessage())
        .collect(Collectors.joining(", "));
    return ResponseEntity.badRequest().body(ApiError.validation(message));
  }

  @ExceptionHandler(AccessDeniedException.class)
  ResponseEntity<ApiError> handleAccessDenied() {
    return ResponseEntity.status(HttpStatus.FORBIDDEN).body(ApiError.of("Forbidden"));
  }

  @ExceptionHandler(Exception.class)
  ResponseEntity<ApiError> handleGeneric(Exception ex) {
    // Log unexpected errors with stack traces
    return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
        .body(ApiError.of("Internal server error"));
  }
}

缓存

需要在配置类上使用 @EnableCaching。

java
@Service
public class MarketCacheService {
  private final MarketRepository repo;

  public MarketCacheService(MarketRepository repo) {
    this.repo = repo;
  }

  @Cacheable(value = "market", key = "#id")
  public Market getById(Long id) {
    return repo.findById(id)
        .map(Market::from)
        .orElseThrow(() -> new EntityNotFoundException("Market not found"));
  }

  @CacheEvict(value = "market", key = "#id")
  public void evict(Long id) {}
}

异步处理

需要在配置类上使用 @EnableAsync。

java
@Service
public class NotificationService {
  @Async
  public CompletableFuture<Void> sendAsync(Notification notification) {
    // send email/SMS
    return CompletableFuture.completedFuture(null);
  }
}

日志记录 (SLF4J)

java
@Service
public class ReportService {
  private static final Logger log = LoggerFactory.getLogger(ReportService.class);

  public Report generate(Long marketId) {
    log.info("generate_report marketId={}", marketId);
    try {
      // logic
    } catch (Exception ex) {
      log.error("generate_report_failed marketId={}", marketId, ex);
      throw ex;
    }
    return new Report();
  }
}

中间件 / 过滤器

java
@Component
public class RequestLoggingFilter extends OncePerRequestFilter {
  private static final Logger log = LoggerFactory.getLogger(RequestLoggingFilter.class);

  @Override
  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
      FilterChain filterChain) throws ServletException, IOException {
    long start = System.currentTimeMillis();
    try {
      filterChain.doFilter(request, response);
    } finally {
      long duration = System.currentTimeMillis() - start;
      log.info("req method={} uri={} status={} durationMs={}",
          request.getMethod(), request.getRequestURI(), response.getStatus(), duration);
    }
  }
}

分页和排序

java
PageRequest page = PageRequest.of(pageNumber, pageSize, Sort.by("createdAt").descending());
Page<Market> results = marketService.list(page);

容错的外部调用

java
public <T> T withRetry(Supplier<T> supplier, int maxRetries) {
  int attempts = 0;
  while (true) {
    try {
      return supplier.get();
    } catch (Exception ex) {
      attempts++;
      if (attempts >= maxRetries) {
        throw ex;
      }
      try {
        Thread.sleep((long) Math.pow(2, attempts) * 100L);
      } catch (InterruptedException ie) {
        Thread.currentThread().interrupt();
        throw ex;
      }
    }
  }
}

速率限制 (过滤器 + Bucket4j)

安全须知:默认情况下 X-Forwarded-For 头是不可信的,因为客户端可以伪造它。 仅在以下情况下使用转发头:

  1. 您的应用程序位于可信的反向代理(nginx、AWS ALB 等)之后
  2. 您已将 ForwardedHeaderFilter 注册为 bean
  3. 您已在应用属性中配置了 server.forward-headers-strategy=NATIVE 或 FRAMEWORK
  4. 您的代理配置为覆盖(而非追加)X-Forwarded-For 头

当 ForwardedHeaderFilter 被正确配置时,request.getRemoteAddr() 将自动从转发的头中返回正确的客户端 IP。 没有此配置时,请直接使用 request.getRemoteAddr()——它返回的是直接连接的 IP,这是唯一可信的值。

java
@Component
public class RateLimitFilter extends OncePerRequestFilter {
  private final Map<String, Bucket> buckets = new ConcurrentHashMap<>();

  /*
   * SECURITY: This filter uses request.getRemoteAddr() to identify clients for rate limiting.
   *
   * If your application is behind a reverse proxy (nginx, AWS ALB, etc.), you MUST configure
   * Spring to handle forwarded headers properly for accurate client IP detection:
   *
   * 1. Set server.forward-headers-strategy=NATIVE (for cloud platforms) or FRAMEWORK in
   *    application.properties/yaml
   * 2. If using FRAMEWORK strategy, register ForwardedHeaderFilter:
   *
   *    @Bean
   *    ForwardedHeaderFilter forwardedHeaderFilter() {
   *        return new ForwardedHeaderFilter();
   *    }
   *
   * 3. Ensure your proxy overwrites (not appends) the X-Forwarded-For header to prevent spoofing
   * 4. Configure server.tomcat.remoteip.trusted-proxies or equivalent for your container
   *
   * Without this configuration, request.getRemoteAddr() returns the proxy IP, not the client IP.
   * Do NOT read X-Forwarded-For directly—it is trivially spoofable without trusted proxy handling.
   */
  @Override
  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
      FilterChain filterChain) throws ServletException, IOException {
    // Use getRemoteAddr() which returns the correct client IP when ForwardedHeaderFilter
    // is configured, or the direct connection IP otherwise. Never trust X-Forwarded-For
    // headers directly without proper proxy configuration.
    String clientIp = request.getRemoteAddr();

    Bucket bucket = buckets.computeIfAbsent(clientIp,
        k -> Bucket.builder()
            .addLimit(Bandwidth.classic(100, Refill.greedy(100, Duration.ofMinutes(1))))
            .build());

    if (bucket.tryConsume(1)) {
      filterChain.doFilter(request, response);
    } else {
      response.setStatus(HttpStatus.TOO_MANY_REQUESTS.value());
    }
  }
}

后台作业

使用 Spring 的 @Scheduled 或与队列(如 Kafka、SQS、RabbitMQ)集成。保持处理程序是幂等的和可观察的。

可观测性

  • 通过 Logback 编码器进行结构化日志记录 (JSON)
  • 指标:Micrometer + Prometheus/OTel
  • 追踪:带有 OpenTelemetry 或 Brave 后端的 Micrometer Tracing

生产环境默认设置

  • 优先使用构造函数注入,避免字段注入
  • 启用 spring.mvc.problemdetails.enabled=true 以获得 RFC 7807 错误 (Spring Boot 3+)
  • 根据工作负载配置 HikariCP 连接池大小,设置超时
  • 对查询使用 @Transactional(readOnly = true)
  • 在适当的地方通过 @NonNull 和 Optional 强制执行空值安全

记住:保持控制器精简、服务专注、仓库简单,并集中处理错误。为可维护性和可测试性进行优化。

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in docs/zh-CN/skills/springboot-patterns of affaan-m/ECC.

Open the folder on GitHubat commit ef648e0

Used in 3 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in affaan-m/ECC, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Springboot Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Springboot Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Springboot Patterns this skillaffaan-m/ECC275k3 repos~2.2kAutomated safety check: PassMIT
Dr Jskilljdubois/dr-jskill342—~4.6kAutomated safety check: NotesApache-2.0
Progensivaprasadreddy/sivalabs-agent-skills188—~2.7kAutomated safety check: NotesMIT
Spring Boot Crud Patternsgiuseppe-trisciuoglio/developer-kit355—~2.5kAutomated safety check: NotesMIT
Spring Boot EngineerJeffallan/claude-skills12k—~1.9kAutomated safety check: PassMIT
302 Frameworks Spring Boot RESTjabrena/plinth4461 repos~1kAutomated safety check: PassApache-2.0

Similar skills

  • Dr Jskill

    jdubois/dr-jskill

    Creates Java + Spring Boot projects: Web applications, full-stack apps with Vue.js or Angular or React or vanilla JS, PostgreSQL, REST APIs, and Docker.

    342 GitHub stars~4.6k tokensUpdated 8 days ago
    Backend & APIsAuto-check: notes
  • Progen

    sivaprasadreddy/sivalabs-agent-skills

    A skill your agent uses when the user wants to create/generate/scaffold a new Spring Boot project (Maven or Gradle, REST API / Web App / Spring Boot + Angular full stack).

    188 GitHub stars~2.7k tokensUpdated 3 days ago
    Backend & APIsAuto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    355 GitHub stars~2.5k tokensUpdated 28 days ago
    Backend & APIsAuto-check: notes
  • Spring Boot Engineer

    Jeffallan/claude-skills

    Builds Spring Boot 3.x services with REST controllers, Spring Data JPA, Spring Security 6, WebFlux and Spring Cloud, verified by tests and Actuator health checks.

    12k GitHub stars~1.9k tokensUpdated 4 days ago
    Backend & APIsAuto-check passed
  • A skill your agent uses when you need to design, review, or improve REST APIs with Spring Boot — including HTTP methods, resource URIs, status codes, DTOs, versioning, deprecation and sunset…

    446 GitHub starsUsed in 1 repo~1k tokens
    Backend & APIsAuto-check passed
  • Senior Java

    benchflow-ai/skillsbench

    World-class Java and Spring Boot development skill for enterprise applications, microservices, and cloud-native systems.

    1.8k GitHub stars~5k tokensUpdated 2 mo ago
    Backend & APIsAuto-check passed

More from affaan-m/ECC

All 645 skills in this repo
  • Videodb

    affaan-m/ECC

    Ingest, index, search, edit, and monitor video and audio with the VideoDB Python SDK — upload from files, URLs, or RTSP feeds, build spoken and scene indexes with timestamped search and playable…

    275k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    275k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    275k GitHub stars~2.9k tokensUpdated 3 days ago
    Auto-check passed
  • Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.

    275k GitHub starsUsed in 1 repo~623 tokens
    Auto-check passed
  • Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

    275k GitHub stars~3.5k tokensUpdated 3 days ago
    Auto-check passed
  • Adds one optional external Codex critique that tries to break a council's decision draft, sent to OpenAI only after you consent.

    275k GitHub stars~1.5k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Springboot Patterns

What does Springboot Patterns do?

Spring Boot架构模式、REST API设计、分层服务、数据访问、缓存、异步处理和日志记录。用于Java Spring Boot后端工作。. Springboot Patterns is an agent skill from affaan-m/ECC.

When should I use Springboot Patterns?

Springboot Patterns fits situations like: tasks that involve Backend development; tasks that involve REST APIs.

How do I install Springboot Patterns in Claude Code?

Run `npx skills add affaan-m/ECC --skill springboot-patterns -a claude-code`. Or copy the skill folder (docs/zh-CN/skills/springboot-patterns in affaan-m/ECC) into .claude/skills/springboot-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Springboot Patterns in Codex?

Run `npx skills add affaan-m/ECC --skill springboot-patterns -a codex`. Or copy the skill folder (docs/zh-CN/skills/springboot-patterns in affaan-m/ECC) into .agents/skills/springboot-patterns in your project. Codex loads it when a task matches its description.

Can I use Springboot Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill springboot-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/springboot-patterns, .gemini/skills/springboot-patterns, .github/skills/springboot-patterns and .opencode/skills/springboot-patterns in your project.

What does Springboot Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Springboot Patterns is instructions for the agent only.

Does Springboot Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Springboot Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Springboot Patterns use?

Springboot Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Springboot Patterns use?

About 2.2k tokens (SKILL.md is roughly 8.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Springboot Patterns?

Skills that share tags, products or a category with Springboot Patterns: Dr Jskill (jdubois/dr-jskill, 342 stars), Progen (sivaprasadreddy/sivalabs-agent-skills, 188 stars), Spring Boot Crud Patterns (giuseppe-trisciuoglio/developer-kit, 355 stars) and Spring Boot Engineer (Jeffallan/claude-skills, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Springboot Patterns?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 275,023 GitHub stars. The repository holds 645 skills in this directory. The repository was last updated on October 5, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.