refactor-backend-09-code-optimize

Installation
SKILL.md

Service & Repository Quality Pass — refactor-chain · backend lane · step 09/09

Bundle: refactor-chain (self-diagnosing, self-healing fix-it pipeline). Phase: do-the-work · Prerequisite: refactor-backend-08-common-extract · Next: refactor-code-principles (default final pass). Adaptivity / conditional: repo-agnostic — works on any layered backend project in any registry-detected stack. The logging framework and injection-hardening idioms adapt to what the project already uses (SLF4J/Lombok @Slf4j, JdbcTemplate, MyBatis, JPA, …).

Purpose

The last hands-on step of the backend lane: a severity-ranked quality pass over the classes that hold business and data-access logic — @Service and @Repository (and equivalent) classes. It repairs SQL-injection exposure (parameterize concatenated values, whitelist dynamic table names, pattern-validate dynamic column names), adopts structured logging (one class-level logger, entry and exception logging where it earns its keep), cleans redundant and dead code, and fixes leaky resource handling. It has a check mode (report only) and a fix mode (confirmed repairs). Class names, method signatures, existing log statements, and the algorithmic flow of business logic are untouchable.

When to use

  • After common extraction (08), as the lane's final code-touching step.
  • You say things like: "optimize service code", "fix SQL injection", "security pass on DAOs", "add logging", "clean up dead code", "code quality pass".
  • Review findings show concatenated SQL, silent catches, System.out debugging, commented-out code blocks, or unclosed resources in the service/repository layers.
Installs
5
GitHub Stars
3
First Seen
Jul 6, 2026
refactor-backend-09-code-optimize — ahmedbenaw/refactor-chain