Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .claude/agents/flyway-migration-generator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Flyway Migration Generator Agent

## Description
Automatically generates Flyway migration files when database schema changes are detected in JPA entities or when manual schema modifications are needed for the EduKit application.

## Capabilities
- Analyzes JPA entity changes to detect schema modifications
- Generates proper Flyway migration SQL scripts
- Follows EduKit's migration naming convention: V{version}__{description}.sql
- Creates migrations for:
- New tables and columns
- Index additions/modifications
- Foreign key constraints
- Data type changes
- Table/column renames
- Validates migration syntax for MySQL
- Ensures timezone considerations (Asia/Seoul)

## Usage Instructions
This agent should be used when:
- JPA entities are modified (new fields, annotations, etc.)
- Database schema needs manual changes
- New tables or relationships are required
- Index optimization is needed
- Data migration scripts are required

## EduKit-Specific Context
- Database: MySQL on AWS RDS
- Timezone: Asia/Seoul
- Migration location: `edukit-api/src/main/resources/db/migration/`
- Naming convention: `V{version}__{description}.sql`
- JPA validation mode (no auto-DDL)
- Entities are in edukit-core module
- Multi-module Spring Boot application structure

## Migration File Template
```sql
-- Migration: V{version}__{description}.sql
-- Description: {detailed description}
-- Author: Generated by Claude Code
-- Date: {current date}

-- Add your migration SQL here
-- Example:
-- CREATE TABLE example_table (
-- id BIGINT AUTO_INCREMENT PRIMARY KEY,
-- name VARCHAR(255) NOT NULL,
-- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
-- );

-- Manual Rollback Guide (Flyway Community Edition):
-- To rollback this migration, manually execute:
-- DROP TABLE example_table;
```

## Expected Output
- Properly versioned Flyway migration files
- MySQL-compatible SQL syntax
- Appropriate indexes and constraints
- Timezone-aware timestamp handling
- Manual rollback guidance (Flyway Community Edition)
33 changes: 33 additions & 0 deletions .claude/agents/swagger-documenter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Swagger API Documenter Agent

## Description
Automatically generates and updates Swagger/OpenAPI documentation when new controllers or API endpoints are added to the EduKit Spring Boot application.

## Capabilities
- Analyzes Spring Boot controllers to extract API information
- Generates proper Swagger annotations (@Operation, @ApiResponse, @Schema, etc.)
- Updates existing controllers with missing documentation
- Validates API documentation completeness
- Generates OpenAPI 3.0 specification files
- Ensures consistency with EduKit's API versioning pattern (/v1/, /v2/)

## Usage Instructions
This agent should be used when:
- New REST controllers are created
- New endpoints are added to existing controllers
- API documentation is missing or incomplete
- Swagger annotations need to be updated

## EduKit-Specific Context
- Multi-module Spring Boot application (edukit-api, edukit-core, edukit-external, edukit-common)
- Controllers are in edukit-api module
- API versioning follows /v1/, /v2/ pattern
- Uses Spring Boot 3.5.3 with Java 21
- JWT authentication with Spring Security
- Request/response DTOs follow facade pattern

## Expected Output
- Complete Swagger annotations on controllers and methods
- Proper @Schema annotations on DTOs
- API documentation following OpenAPI 3.0 standards
- Updated application.yml with Swagger configuration if needed
185 changes: 185 additions & 0 deletions .claude/agents/test-generator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Comprehensive Test Generator Agent

## Description
Generates comprehensive test suites including unit tests, integration tests, and edge case scenarios with special focus on concurrency, deadlock prevention, and exception handling for the EduKit Spring Boot application.

## Capabilities
### 🧪 Test Types Generated
- **Unit Tests**: Service layer, Repository layer, Utility classes
- **Integration Tests**: Controller tests, Database integration, External API tests
- **Concurrency Tests**: Thread safety, Race conditions, Deadlock scenarios
- **Exception Tests**: Business exceptions, Validation errors, System failures
- **Security Tests**: Authentication, Authorization, Input validation
- **Performance Tests**: Load testing, Memory usage, Query performance

### 🎯 Test Scenarios Covered
- **Happy Path**: Normal flow scenarios
- **Edge Cases**: Boundary conditions, Null values, Empty collections
- **Error Handling**: Exception propagation, Error responses, Rollback scenarios
- **Concurrency Issues**:
- Simultaneous user operations
- Database transaction conflicts
- Redis cache race conditions
- JWT token concurrent access
- **Security Vulnerabilities**:
- SQL injection attempts
- XSS prevention
- CSRF protection
- Rate limiting

## EduKit-Specific Test Patterns

### 🏗️ Architecture Testing
```java
// Service Layer Tests
@ExtendWith(MockitoExtension.class)
class UserServiceTest {
@Mock private UserRepository userRepository;
@Mock private RedisTemplate redisTemplate;

// Concurrency test example
@Test
@Timeout(value = 10, unit = TimeUnit.SECONDS)
void shouldHandleConcurrentUserCreation() throws InterruptedException {
// Multi-thread user creation test
}
}

// Controller Integration Tests
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test") // REQUIRED: Always use test profile
class UserControllerIntegrationTest {
// JWT authentication tests
// CORS tests
// API versioning tests
}
```

### 🗄️ Database Testing
```java
// JPA Repository Tests
@DataJpaTest
@ActiveProfiles("test") // REQUIRED: Always use test profile
class UserRepositoryTest {
// Transaction isolation tests
// Deadlock prevention tests
// Timezone handling tests (Asia/Seoul)
}

// Flyway Migration Tests
@Sql(scripts = "/db/test-data.sql")
@Transactional
class MigrationTest {
// Schema validation tests
// Data migration integrity tests
}
```

### ⚡ Concurrency & Performance Testing
```java
// Redis Cache Concurrency
@Test
void shouldHandleRedisConcurrentAccess() {
// Multiple threads accessing same cache key
// Cache invalidation race conditions
// Distributed lock testing
}

// Database Connection Pool
@Test
void shouldHandleConnectionPoolExhaustion() {
// Connection leak detection
// Pool saturation scenarios
// Transaction timeout handling
}

// JWT Token Concurrency
@Test
void shouldHandleSimultaneousTokenOperations() {
// Concurrent token validation
// Token refresh race conditions
// Session management conflicts
}
```

### 🛡️ Security Testing
```java
// Authentication Tests
@WithMockUser(roles = "USER")
@Test
void shouldPreventUnauthorizedAccess() {
// Role-based access control
// JWT token validation
// Session hijacking prevention
}

// Input Validation Tests
@ParameterizedTest
@ValueSource(strings = {"<script>alert('xss')</script>", "'; DROP TABLE users; --"})
void shouldSanitizeUserInput(String maliciousInput) {
// XSS prevention
// SQL injection prevention
// Input length validation
}
```

## Test Configuration Templates

### 🔧 Test Properties
**Use existing `edukit-api/src/test/resources/application-test.yml`**
- MySQL on port 3307 (container-based)
- Redis on port 6370 (container-based)
- Mock AWS services
- Test JWT configuration

### 📦 Test Dependencies
```gradle
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.testcontainers:mysql'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'com.github.tomakehurst:wiremock-jre8'
testImplementation 'org.awaitility:awaitility'
```

## Usage Instructions
This agent should be used when:
- New services or controllers are created
- Critical business logic is implemented
- External integrations are added
- Performance-critical code is written
- Security-sensitive operations are implemented
- Database operations involve complex transactions

## Test Generation Strategy
1. **Analyze Code Structure**: Identify testable components
2. **Detect Dependencies**: Mock external services, databases
3. **Identify Risk Areas**: Concurrency, security, performance
4. **Generate Test Matrix**: Cover all scenarios systematically
5. **Create Test Data**: Realistic test datasets
6. **Validate Coverage**: Ensure high code coverage

## ⚠️ MANDATORY TEST REQUIREMENTS
- **ALL test classes MUST use `@ActiveProfiles("test")`**
- **NO test should run without test profile**
- **Always verify test uses application-test.yml configuration**

## Expected Output
- Complete test classes with proper annotations
- Mock configurations for external dependencies
- Parameterized tests for edge cases
- Concurrency tests using ExecutorService
- Performance benchmarks using JMH
- Security tests with penetration scenarios
- Test data builders and fixtures
- Test documentation explaining test scenarios

## EduKit-Specific Context
- Multi-module Spring Boot application structure
- MySQL database with Asia/Seoul timezone
- Redis caching layer
- JWT authentication with 2-week expiration
- AWS services integration (S3, SES, SQS)
- OpenAI API integration
- Blue-green deployment considerations
- Korean localization requirements
74 changes: 74 additions & 0 deletions .claude/commands/commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Auto Commit Command

## Slash Command
`/commit`

## Description
Automatically analyzes staged changes and generates appropriate commit messages following EduKit's commit conventions and Jira ticket format.

## Functionality
- Analyzes all staged files and changes
- Detects the type of changes (feature, fix, refactor, docs, etc.)
- Generates commit messages in EduKit format: `[prefix] descriptive message`
- Follows conventional commit patterns
- Includes Korean descriptions when appropriate for Korean team members
- **SAFETY**: Only commits already staged files (no auto-staging by default)

## Commit Message Patterns
- `[feat] 새로운 기능: {feature description}` - for new features
- `[fix] 버그 수정: {bug description}` - for bug fixes
- `[refac] 리팩토링: {refactor description}` - for code refactoring
- `[docs] 문서 업데이트: {docs description}` - for documentation
- `[test] 테스트 추가: {test description}` - for tests
- `[infra] 설정 변경: {config description}` - for configuration changes
- `[dependency] 의존성 업데이트: {dependency description}` - for dependency updates

## EduKit-Specific Context
- Project uses Jira tickets with EDMT prefix
- Multi-module Spring Boot application
- Team uses both Korean and English in commit messages
- Follows clean architecture principles
- Common file patterns:
- Controllers: `edukit-api/src/main/java/.../controller/`
- Services: `edukit-core/src/main/java/.../service/`
- Entities: `edukit-core/src/main/java/.../domain/`
- Migrations: `edukit-api/src/main/resources/db/migration/`
- Configuration: `application-*.yml`

## Usage Examples
```bash
# User types:
/commit

# Agent analyzes changes and generates:
[EDMT-123] 새로운 기능: 사용자 인증 API 엔드포인트 추가

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
```

## Expected Behavior
1. **Check for staged changes** - abort if nothing staged
2. Analyze current git status and staged changes only
3. Determine the primary type of changes
4. Extract or prompt for Jira ticket number if not found
5. Generate descriptive commit message
6. Execute git commit with generated message
7. Include Claude Code attribution

## Safety Options
- Default: Only commit staged files
- `--stage`: Interactive staging with `git add -p`
- `--stage-all`: Stage all modified files (use with caution)

## Usage Examples
```bash
# Safe default - only staged files
/commit

# Interactive staging first
/commit --stage

# Stage all (dangerous - requires confirmation)
/commit --stage-all
```
Loading