be-spring-shared
Shared conventions for every backend-springboot-plugin agent and skill — tech stack, CQRS architecture, naming, coding standards, TDD, commit and build rules, state files. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- be-spring-shared
- description
- Shared conventions for every backend-springboot-plugin agent and skill — tech stack, CQRS architecture, naming, coding standards, TDD, commit and build rules, state files. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
- user-invocable
- false
03 SKILL.md 正文
Shared conventions (backend-springboot-plugin)
Agents receive this skill through skills: [be-spring-shared]. The plugin-root CLAUDE.md is maintainer notes and reaches no agent.
Tech Stack
Language & Build
- Java (version from config, default 21)
- Build: Gradle (Kotlin DSL or Groovy DSL, from config)
- Build command:
./gradlew build(configurable) - Test command:
./gradlew test(configurable) - Always set Bash tool timeout to 10 minutes (600000ms) for Gradle commands
Framework
- Spring Boot (version from config)
- Spring MVC (REST)
- Spring Validation
Database & ORM
- Database: configurable (default PostgreSQL)
- ORM: Spring Data JPA (Hibernate)
- Migration: configurable (default Flyway)
- JPA Auditing:
@EnableJpaAuditingfor automaticcreatedAt/updatedAt open-in-view: false(mandatory)
Utilities
- Lombok (configurable, default enabled)
- UUID Creator for UUID v7 generation
Testing
- JUnit 5 (no Mockito)
@SpringBootTest+TestRestTemplatefor API integration tests@DataJpaTestfor repository tests- AssertJ for assertions
@ParameterizedTest+@ValueSource/@MethodSourcefor multi-value scenarios
Code Quality
- Checkstyle (configurable, default enabled) with zero tolerance (maxErrors=0, maxWarnings=0)
Architecture: CQRS Pattern
Read architecture from .claude/backend-springboot-plugin.json. Default is cqrs.
Package Structure (CQRS)
{basePackage}/
├── {App}Application.java
├── command/ <- Request command DTOs (records)
│ └── Create{Entity}.java
├── commandmodel/ <- Command execution logic
│ └── Create{Entity}CommandExecutor.java
├── query/ <- Request query DTOs (records)
│ ├── Get{Entity}Page.java
│ └── Find{Entity}.java
├── querymodel/ <- Query processing logic
│ ├── Get{Entity}PageQueryProcessor.java
│ └── Find{Entity}QueryProcessor.java
├── view/ <- Response view DTOs (records)
│ └── {Entity}View.java
├── data/ <- Entities and repositories
│ ├── {Entity}.java
│ ├── {Entity}Repository.java
│ └── BaseEntity.java
├── config/ <- Spring configuration beans
├── {domain}/ <- Domain-specific business logic
│ ├── api/ <- REST controllers
│ │ └── {Entity}Controller.java
│ ├── {Description}Exception.java
│ └── {Entity}PropertyValidator.java
└── ...
Data Flow
HTTP Request
→ Controller (record class, DI via constructor)
→ Command/Query DTO
→ CommandExecutor / QueryProcessor (@Component record)
→ Repository (Spring Data JPA)
→ Entity
→ View DTO (response)
Naming Conventions
| Type | Pattern | Example |
|---|---|---|
| Entity | {Name} |
Employee |
| Repository | {Name}Repository |
EmployeeRepository |
| Command | {Action}{Name} |
CreateEmployee |
| Command Executor | {Command}CommandExecutor |
CreateEmployeeCommandExecutor |
| Query | {Action}{Name} |
GetEmployeePage |
| Query Processor | {Query}QueryProcessor |
GetEmployeePageQueryProcessor |
| View | {Name}View |
EmployeeView |
| Controller | {Name}Controller (record) |
EmployeeController |
| Exception | {Description}Exception |
DuplicateEmailException |
| Test | {HttpMethod}Tests |
PostTests |
Coding Standards
- Use
varwhen the type is obvious from context; avoid when it harms readability - Use Java
recordfor all DTO-like classes (Command, View, Query) - Use Lombok
@Getter @Setterfor entities (whenlombokEnabled: true) - Use
snake_casefor test method names:duplicate_email_returns_409_Conflict - Always add a final newline when creating a new code file
- Write self-explanatory code; avoid comments unless requested
- Work in the smallest possible increments
Entity Conventions
Unless explicitly overridden in the feature document:
- Extends
BaseEntity(createdAt,updatedAtvia JPA Auditing) sequence: Long,@GeneratedValue(IDENTITY)-- DB primary key (internal only)id: UUID v7, unique -- external identifier (immutable)@Table(name = "snake_case")-- table name matches entity name in snake_case- Column naming: Spring default
camelCasetosnake_case(implicit naming strategy) - Indexes and unique constraints: define per entity in feature document
DTO Conventions
public record CreateEmployee(String email, String displayName) {}
public record EmployeeView(UUID id, String email, String displayName) {}
Controller Conventions (Record-based DI)
@RestController
public record EmployeeController(
CreateEmployeeCommandExecutor createExecutor,
GetEmployeePageQueryProcessor pageProcessor,
FindEmployeeQueryProcessor findProcessor
) {
@PostMapping("/hr/employees")
@ResponseStatus(HttpStatus.CREATED)
public void create(@RequestBody CreateEmployee command) {
createExecutor.execute(command);
}
}
API Conventions
- RESTful style: HTTP methods define the action
POST-- create (201 Created)GET-- read (200 OK)PUT-- full replace (200 OK)PATCH-- partial update (200 OK)DELETE-- remove (204 No Content)
- URL: kebab-case, plural resources:
/hr/employees/{id}/profile-image - Error responses: domain exceptions mapped to HTTP status codes via
@ExceptionHandler
Test-Driven Development
TDD Process
- Write a list of the test scenarios you want to cover
- Turn exactly one item on the list into an actual, concrete, runnable test
- Change the code to make the test (and all previous tests) pass
- Optionally refactor to improve the implementation design
- Until the list is empty, go back to step 2
TDD Rules
- The list of test scenarios must be prepared in advance
- Do not write more than one test at a time
- Do not write code that is not required to pass a test (no speculative code)
- Never modify a failed test; if a test needs to change, update it manually
TDD Implementation Workflow
- Select one incomplete test scenario (
- [ ]item) - If the minimum method signature is not defined, add only the method(s) needed for that scenario (empty body or default return). Do not add methods for other scenarios.
- In an interactive session, if you defined a method signature in step 2, request a review
- Convert the selected scenario into a concrete, executable test
- Run the test and check the result
- Confirm that the test fails. If it passes unexpectedly, stop and request review
- Understand the failure cause and write minimum code to make the test pass
- Run the entire test class:
./gradlew test --tests {fullTestClassName}(10-minute timeout) - Do not run individual test methods -- always run the entire test class
- If the test does not pass after 3 attempts, stop and request review
- If the build fails, analyze and fix. Repeat until the build succeeds
- Mark the scenario as completed:
- [x] scenario description
Test Scenario Writing Rules
- Write one scenario at a time (most important first)
- Write in a single sentence
- Write in English
- Use the present tense
- Refer to the system under test as
sut - Do not start with a capital letter (usable as test method name)
- Write as concisely as possible while preserving meaning
- Write as a to-do item:
- [ ] scenario description
Test Structure
Test directory mirrors the API URL path:
API URL Test path
POST /hr/employees -> test/{basePackage}/hr/api/employees/PostTests.java
GET /hr/employees -> test/{basePackage}/hr/api/employees/GetTests.java
Test patterns:
@SpringBootTest(webEnvironment = RANDOM_PORT)+TestRestTemplate- No Mockito -- pure integration tests with real Spring context
- Test doubles:
@TestComponent @Primaryfakes (e.g.,FakeEmailSender) - Generators: atomic counter-based test data factories (
EmailGenerator, etc.)
Commit Standards
- Write in English
- Use present tense in the subject line ("Add feature" not "Added feature")
- Keep the subject line to 50 characters or less
- Add a blank line between the subject and body
- Keep the body to 72 characters or less per line
- Only break lines within a paragraph when exceeding 72 characters
- Do not mention test code in commit messages
- Do not use any prefix (fix:, feat:, docs:, etc.) in the subject line
- Start with an uppercase letter (exception: lowercase identifiers with justification)
- Do not include tool advertisements, branding, or promotional content
- Only operate on already-staged changes -- never stage additional files
- Ensure all intended changes are staged before invoking commit
- Use separate git commands to stage files before committing
Build Standards
- Execute build command with 10-minute Bash tool timeout (600000ms)
- Always run full build before committing changes
- Address all errors and warnings systematically
- Categorize errors: compilation, test failures, dependency issues, configuration problems, checkstyle violations
- Apply systematic error resolution with targeted fixes
Report a check's result from its output in this run. A check that did not run is reported as not run.
State Files
Running a skill from an earlier pipeline stage demotes the status. Skills must warn the user and obtain confirmation before demotion. For example, running be-code when status is verified resets the pipeline to implementing, discarding verification and review progress.
Lock file: Skills that modify progress files must acquire {workDocDir}/.progress/.lock before writing. Release on completion or failure. Stale locks (older than 30 minutes) are automatically removed.
Lock file format:
{ "lockedAt": "{ISO 8601}", "operation": "be-code", "feature": "{feature}" }
Communication Language
Skills read workingLanguage from config. All user-facing output (summaries, questions, feedback, next-step guidance) must be in the working language.
Language mapping: en = English, ko = Korean, vi = Vietnamese.
04 同仓库更多 Skills
hp-shared
Shared conventions for every homepage-plugin agent and skill — stack, code conventions, state-file writes, check commands and how to report them. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
fe-shared
Shared conventions for every frontend-react-plugin agent and skill — code conventions, state files and locks, accepted deviations, design principles, build working directory, router-mode command matrix, TypeScript check. Preloaded into agents through their `skills:` frontmatter; not meant to be invoked by hand.
pp-translate
Use after directly editing the working language spec to sync changes to other supported languages.
pp-sync-stitch
Use when wireframes were manually edited on the Stitch website and need to be re-fetched to the local project.
pp-sync-notion
Use when a specification needs to be published or re-synced to Notion after finalization or manual edits.
pp-spec
Use when starting a new feature or project that needs a functional specification before implementation.