-
Notifications
You must be signed in to change notification settings - Fork 3
[FEAT]: gemini 코드 리뷰 설정 및 AI 에이전트를 위한 가이드라인 추가 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Disable playful or humorous responses in review comments | ||
| have_fun: false | ||
|
|
||
| code_review: | ||
| disable: false | ||
| # Only comment on meaningful issues to reduce noise | ||
| comment_severity_threshold: MEDIUM | ||
|
|
||
| # Prevent excessive comments on large PRs | ||
| max_review_comments: 50 | ||
|
|
||
| pull_request_opened: | ||
| help: false | ||
| summary: true | ||
| code_review: true | ||
|
|
||
| ignore_patterns: | ||
| # Gradle wrapper files | ||
| - "gradlew" | ||
| - "gradlew.bat" | ||
| - "gradle/wrapper/**" | ||
|
|
||
| # Database initialization script | ||
| - "src/main/resources/init.sql" | ||
|
|
||
| # Documentation | ||
| - "docs/**" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,246 @@ | ||
| # CrewWiki Backend Style Guide | ||
|
|
||
| This file provides instructions for AI coding agents (Claude Code, Codex, etc.) working on the CrewWiki backend project. | ||
|
|
||
| **Always respond and write comments in Korean.** | ||
|
|
||
| --- | ||
|
|
||
| ## Project Overview | ||
|
|
||
| - **Language**: Java | ||
| - **Framework**: Spring Boot | ||
| - **Build tool**: Gradle | ||
| - **Test**: JUnit 5, RestAssured, AssertJ | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Package Structure | ||
|
|
||
| Each domain must follow this layered structure: | ||
|
|
||
| ``` | ||
| {domain}/ | ||
| ├── controller/ | ||
| ├── dto/ | ||
| ├── repository/ | ||
| └── service/ | ||
| ``` | ||
|
|
||
| Shared code belongs under: | ||
|
|
||
| ``` | ||
| common/ | ||
| ├── config/ | ||
| ├── entity/ | ||
| ├── exception/ | ||
| ├── infrastructure/ | ||
| ├── log/ | ||
| └── utils/ | ||
| ``` | ||
|
|
||
| Do not place domain-specific logic inside `common/`. | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Test Code | ||
|
|
||
| ### 2.1 Naming | ||
|
|
||
| - `@Nested` classes must be named after the **production method** they test, in **UpperCamelCase**. | ||
| - Test method names must follow this format: | ||
| - `productionMethod_success_condition` | ||
| - `productionMethod_fail_condition` | ||
|
|
||
| ```java | ||
| @Nested | ||
| class Login { | ||
| @Test | ||
| void login_success_byValidCredentials() { } | ||
|
|
||
| @Test | ||
| void login_fail_byInvalidCredentials() { } | ||
| } | ||
| ``` | ||
|
|
||
| ### 2.2 BDD Pattern | ||
|
|
||
| ```java | ||
| // given (omit if not needed) | ||
| // when | ||
| // then | ||
| ``` | ||
|
|
||
| ### 2.3 Fixtures | ||
|
|
||
| Use static factory methods. Do not instantiate test objects with constructors directly. | ||
|
|
||
| ```java | ||
| CrewDocument doc = DocumentFixture.createDefaultCrewDocument(); | ||
| ``` | ||
|
|
||
| ### 2.4 Test Strategy | ||
|
|
||
| - Controller tests: use `RestAssured` when authentication/authorization is required. | ||
| - Service tests: use `@SpringBootTest(webEnvironment = MOCK or NONE)`. Do not start Tomcat. | ||
| - Use `assertSoftly` for multiple assertions. | ||
| - Prefer **state verification** over behavior (mock) verification. | ||
| - Service tests are **mandatory**. Controller tests are optional. | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Naming Conventions | ||
|
|
||
| - **Methods**: start with a verb. Do not include the entity name. | ||
| - Correct: `findById(Long id)` | ||
| - Incorrect: `getMember(Long id)` | ||
|
|
||
| - **Path variables**: be specific. | ||
| - Correct: `/api/{documentId}` | ||
| - Incorrect: `/api/{id}` | ||
|
|
||
| - **DTOs**: use `Request` / `Response` suffixes. `Register` / `Update` are also acceptable for mutations. | ||
| - Examples: `DocumentSearchResponse`, `DocumentUpdateRequest` | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Object-Oriented Principles | ||
|
|
||
| Follow these rules strictly when writing or modifying code: | ||
|
|
||
| 1. Only one level of indentation per method. | ||
| 2. No `else`. Use early returns. | ||
| 3. Wrap primitives and strings in meaningful types. | ||
| 4. One dot per line — avoid chaining across objects. | ||
| 5. No abbreviations. | ||
| 6. Keep classes small and focused. | ||
| 7. Aim to minimize instance variables per class. JPA entities and DTOs may exceed this when necessary (e.g., audit fields, associations). | ||
| 8. Wrap collections in first-class collection classes. | ||
| 9. Avoid getters and setters unless strictly needed. | ||
|
|
||
| --- | ||
|
|
||
| ## 5. Exception Handling | ||
|
|
||
| - Do not throw generic exceptions (`RuntimeException`, `Exception`). | ||
| - Use project-defined exception types that include an error code. | ||
| - All error responses must include a `code` field. | ||
|
|
||
| ```json | ||
| { | ||
| "code": "DOCUMENT_NOT_FOUND", | ||
| "message": "..." | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 6. Annotation Order | ||
|
|
||
| When adding annotations, always use this order (top to bottom): | ||
|
|
||
| 1. Logging (`@Slf4j`) | ||
| 2. Lombok (`@Getter`, `@NoArgsConstructor`, `@Builder`, etc.) | ||
| 3. Spring meta (`@EntityListeners`, etc.) | ||
| 4. Spring component (`@Entity`, `@Table`, `@Service`, `@RestController`, etc.) | ||
|
|
||
| ```java | ||
| @Slf4j | ||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| @EntityListeners(AuditingEntityListener.class) | ||
| @Entity | ||
| @Table(name = "...") | ||
| public class SampleEntity { } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 7. Domain Exposure | ||
|
|
||
| - Entities must **not** be returned from controllers or exposed outside the service layer. | ||
| - Use DTOs at all boundaries. | ||
|
|
||
| ```java | ||
| // Correct | ||
| public ApiResponse<SuccessBody<DocumentResponse>> getByUuid(...) { } | ||
|
|
||
| // Incorrect | ||
| public Document getByUuid(...) { } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 8. API and DTO Mapping | ||
|
|
||
| - Each API endpoint must map to its own DTO (1:1). | ||
| - Separate DTOs for admin and general endpoints. | ||
|
|
||
| ``` | ||
| Admin document search → AdminDocumentSearchResponse | ||
| General document search → DocumentSearchResponse | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 9. Code Style | ||
|
|
||
| - Add one blank line before each class declaration. | ||
| - If a method has 2 or more parameters, place each on a new line. | ||
| - No restriction on method length; prioritize readability. | ||
|
|
||
| --- | ||
|
|
||
| ## 10. Validation Placement | ||
|
|
||
| - **Behavior validation** (business rules, authorization): service layer. | ||
| - **State validation** (field constraints, invariants): domain layer. | ||
|
|
||
| --- | ||
|
|
||
| ## 11. Import Rules | ||
|
|
||
| - No wildcard imports (`import com.example.*`). | ||
| - Follow IntelliJ IDEA default ordering. | ||
| - Static imports are allowed. | ||
|
|
||
| --- | ||
|
|
||
| ## 12. Miscellaneous | ||
|
|
||
| - Use `final` for fields and constants. | ||
| - Prefer static factory methods over constructors. | ||
| - Constants: `UPPER_SNAKE_CASE`. | ||
| - Member ordering: `public` → `protected` → `private`. Getters go at the bottom. | ||
| - Do not introduce Value Objects (VO) without team agreement. | ||
|
|
||
| --- | ||
|
|
||
| ## 13. DTO Policy | ||
|
|
||
| - Use `record` for DTOs by default. | ||
| - Use `class` only when `record` is incompatible (e.g., `@ModelAttribute` binding). | ||
|
|
||
| --- | ||
|
|
||
| ## 14. Shared Naming (Do Not Rename) | ||
|
|
||
| These names are standardized across the project. Do not rename or create alternatives: | ||
|
|
||
| | Type | Name | | ||
| |------|------| | ||
| | Paged response wrapper | `PagedResponse` | | ||
| | Paging request | `PagingRequest` | | ||
| | Token info response | `TokenInfoResponse` | | ||
| | Auth tokens response | `AuthTokensResponse` | | ||
|
|
||
| --- | ||
|
|
||
| ## 15. Agent Behavior Guidelines | ||
|
|
||
| - Before making changes, read the relevant domain's existing code to understand patterns in use. | ||
| - Do not introduce new libraries or dependencies without explicit instruction. | ||
| - When creating a new class, always check if a similar one already exists in `common/`. | ||
| - When writing tests, always add a corresponding fixture if one does not exist. | ||
| - Do not modify `build.gradle` unless explicitly asked. | ||
| - If uncertain about a design decision, leave a `// TODO:` comment explaining the ambiguity rather than guessing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.