Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.
90
90%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
@Service
public class AdminService {
public void deleteUser(Long userId) {
// Delete logic without security check
repository.deleteById(userId);
}
}@Service
public class AdminService {
@PreAuthorize("hasRole('ADMIN')")
public void deleteUser(Long userId) {
// Delete logic with security check
repository.deleteById(userId);
}
}
// Test
@Test
@WithMockUser(roles = "ADMIN")
void shouldAllowAdminToDeleteUser() {
assertThatCode(() -> adminService.deleteUser(1L))
.doesNotThrowAnyException();
}
@Test
@WithMockUser(roles = "USER")
void shouldDenyUserFromDeletingUser() {
assertThatThrownBy(() -> adminService.deleteUser(1L))
.isInstanceOf(AccessDeniedException.class);
}@Service
public class AdminService {
private final UserRepository userRepository;
public void deleteUser(Long userId, User currentUser) {
// Manual security check in business logic
if (currentUser.hasRole("ADMIN")) {
repository.deleteById(userId);
} else {
throw new AccessDeniedException("Not authorized");
}
}
}@Service
public class AdminService {
@PreAuthorize("hasRole('ADMIN')")
public void deleteUser(Long userId) {
// Business logic only, security is declarative
repository.deleteById(userId);
}
}
// Test verifies security enforcement
@Test
@WithMockUser(roles = "ADMIN")
void shouldExecuteDelete() {
service.deleteUser(1L);
verify(repository).deleteById(1L);
}
@Test
@WithMockUser(roles = "USER")
void shouldNotExecuteDeleteDueToSecurity() {
assertThatThrownBy(() -> service.deleteUser(1L))
.isInstanceOf(AccessDeniedException.class);
verify(repository, never()).deleteById(anyLong());
}@RestController
@RequestMapping("/api")
public class UserController {
@GetMapping("/users/{id}")
public ResponseEntity<User> getUser(@PathVariable Long id) {
return ResponseEntity.ok(service.findById(id));
}
@DeleteMapping("/users/{id}")
public ResponseEntity<Void> deleteUser(@PathVariable Long id) {
service.deleteUser(id);
return ResponseEntity.ok().build();
}
}@RestController
@RequestMapping("/api/admin")
public class AdminController {
@GetMapping("/users/{id}")
@PreAuthorize("hasRole('ADMIN')")
public ResponseEntity<User> getUser(@PathVariable Long id) {
return ResponseEntity.ok(service.findById(id));
}
@DeleteMapping("/users/{id}")
@PreAuthorize("hasRole('ADMIN')")
public ResponseEntity<Void> deleteUser(@PathVariable Long id) {
service.deleteUser(id);
return ResponseEntity.ok().build();
}
}
// Tests
@SpringBootTest
@AutoConfigureMockMvc
class AdminControllerSecurityTest {
@Autowired
private MockMvc mockMvc;
@Test
@WithMockUser(roles = "ADMIN")
void shouldAllowAdminToGetUser() throws Exception {
mockMvc.perform(get("/api/admin/users/1"))
.andExpect(status().isOk());
}
@Test
@WithMockUser(roles = "USER")
void shouldDenyUserFromGettingUser() throws Exception {
mockMvc.perform(get("/api/admin/users/1"))
.andExpect(status().isForbidden());
}
@Test
void shouldDenyAnonymousAccess() throws Exception {
mockMvc.perform(get("/api/admin/users/1"))
.andExpect(status().isUnauthorized());
}
}@Service
public class DocumentService {
private final DocumentRepository repository;
public Document getDocument(Long docId, User currentUser) {
Document doc = repository.findById(docId)
.orElseThrow(() -> new NotFoundException());
// Inline permission check
if (!doc.getOwner().equals(currentUser.getUsername()) &&
!currentUser.hasRole("ADMIN")) {
throw new AccessDeniedException("Access denied");
}
return doc;
}
}@Service
public class DocumentService {
@PreAuthorize("hasPermission(#docId, 'Document', 'READ')")
public Document getDocument(Long docId) {
return repository.findById(docId)
.orElseThrow(() -> new NotFoundException());
}
}
// Custom Permission Evaluator
@Component
public class DocumentPermissionEvaluator implements PermissionEvaluator {
@Override
public boolean hasPermission(Authentication authentication,
Serializable targetId,
String targetType,
Object permission) {
// Permission logic extracted and reusable
Document doc = repository.findById(targetId).orElse(null);
if (doc == null) return false;
return doc.getOwner().equals(authentication.getName()) ||
hasRole(authentication, "ADMIN");
}
}
// Test
@SpringBootTest
class DocumentServiceSecurityTest {
@Autowired
private DocumentService service;
@Test
@WithMockUser(username = "alice")
void shouldAllowOwnerToReadDocument() {
Document doc = service.getDocument(1L);
assertThat(doc.getOwner()).isEqualTo("alice");
}
@Test
@WithMockUser(username = "alice")
void shouldDenyNonOwnerFromReadingDocument() {
assertThatThrownBy(() -> service.getDocument(2L))
.isInstanceOf(AccessDeniedException.class);
}
@Test
@WithMockUser(roles = "ADMIN")
void shouldAllowAdminToReadAnyDocument() {
Document doc = service.getDocument(2L);
assertThat(doc).isNotNull();
}
}@Service
public class ProfileService {
public UserProfile updateProfile(Long userId, ProfileUpdate update, User currentUser) {
// Multiple manual checks
if (!currentUser.getId().equals(userId) &&
!currentUser.hasRole("ADMIN") &&
!currentUser.hasRole("MODERATOR")) {
throw new AccessDeniedException("Access denied");
}
if (update.isPublic() && !currentUser.isVerified()) {
throw new AccessDeniedException("Verified users only");
}
return repository.update(userId, update);
}
}@Service
public class ProfileService {
@PreAuthorize("#userId == authentication.principal.id or " +
"hasAnyRole('ADMIN', 'MODERATOR')")
public UserProfile updateProfile(Long userId, ProfileUpdate update) {
return repository.update(userId, update);
}
@PreAuthorize("isVerified() and hasRole('USER')")
public void makePublic(Long userId) {
repository.setPublic(userId, true);
}
}
// Test
@SpringBootTest
class ProfileServiceSecurityTest {
@Autowired
private ProfileService service;
@Test
@WithMockUser(username = "alice", id = "1")
void shouldAllowUserToUpdateOwnProfile() {
ProfileUpdate update = new ProfileUpdate("Alice Updated");
assertThatCode(() -> service.updateProfile(1L, update))
.doesNotThrowAnyException();
}
@Test
@WithMockUser(username = "alice", id = "1")
void shouldDenyUserFromUpdatingOtherProfile() {
ProfileUpdate update = new ProfileUpdate("Hacked");
assertThatThrownBy(() -> service.updateProfile(2L, update))
.isInstanceOf(AccessDeniedException.class);
}
@Test
@WithMockUser(roles = "ADMIN")
void shouldAllowAdminToUpdateAnyProfile() {
ProfileUpdate update = new ProfileUpdate("Admin Update");
assertThatCode(() -> service.updateProfile(2L, update))
.doesNotThrowAnyException();
}
@Test
@WithMockUser(roles = "USER")
void shouldDenyUnverifiedUserFromMakingProfilePublic() {
assertThatThrownBy(() -> service.makePublic(1L))
.isInstanceOf(AccessDeniedException.class);
}
}@WithMockUser for most cases, custom setup for complex scenariosdocs
plugins
developer-kit-ai
developer-kit-aws
agents
docs
skills
aws
aws-cli-beast
aws-cost-optimization
aws-drawio-architecture-diagrams
aws-sam-bootstrap
aws-cloudformation
aws-cloudformation-auto-scaling
aws-cloudformation-bedrock
aws-cloudformation-cloudfront
aws-cloudformation-cloudwatch
aws-cloudformation-dynamodb
aws-cloudformation-ec2
aws-cloudformation-ecs
aws-cloudformation-elasticache
references
aws-cloudformation-iam
references
aws-cloudformation-lambda
aws-cloudformation-rds
aws-cloudformation-s3
aws-cloudformation-security
aws-cloudformation-task-ecs-deploy-gh
aws-cloudformation-vpc
references
developer-kit-core
agents
commands
skills
developer-kit-devops
developer-kit-java
agents
commands
docs
skills
aws-lambda-java-integration
aws-rds-spring-boot-integration
aws-sdk-java-v2-bedrock
aws-sdk-java-v2-core
aws-sdk-java-v2-dynamodb
aws-sdk-java-v2-kms
aws-sdk-java-v2-lambda
aws-sdk-java-v2-messaging
aws-sdk-java-v2-rds
aws-sdk-java-v2-s3
aws-sdk-java-v2-secrets-manager
clean-architecture
graalvm-native-image
langchain4j-ai-services-patterns
references
langchain4j-mcp-server-patterns
references
langchain4j-rag-implementation-patterns
references
langchain4j-spring-boot-integration
langchain4j-testing-strategies
langchain4j-tool-function-calling-patterns
langchain4j-vector-stores-configuration
references
qdrant
references
spring-ai-mcp-server-patterns
spring-boot-actuator
spring-boot-cache
spring-boot-crud-patterns
spring-boot-dependency-injection
spring-boot-event-driven-patterns
spring-boot-openapi-documentation
spring-boot-project-creator
spring-boot-resilience4j
spring-boot-rest-api-standards
spring-boot-saga-pattern
spring-boot-security-jwt
assets
references
scripts
spring-boot-test-patterns
spring-data-jpa
references
spring-data-neo4j
references
unit-test-application-events
unit-test-bean-validation
unit-test-boundary-conditions
unit-test-caching
unit-test-config-properties
references
unit-test-controller-layer
unit-test-exception-handler
references
unit-test-json-serialization
unit-test-mapper-converter
references
unit-test-parameterized
unit-test-scheduled-async
references
unit-test-service-layer
references
unit-test-utility-methods
unit-test-wiremock-rest-api
references
developer-kit-php
developer-kit-project-management
developer-kit-python
developer-kit-specs
commands
docs
hooks
test-templates
tests
skills
developer-kit-tools
developer-kit-typescript
agents
docs
hooks
rules
skills
aws-cdk
aws-lambda-typescript-integration
better-auth
clean-architecture
drizzle-orm-patterns
dynamodb-toolbox-patterns
references
nestjs
nestjs-best-practices
nestjs-code-review
nestjs-drizzle-crud-generator
nextjs-app-router
nextjs-authentication
nextjs-code-review
nextjs-data-fetching
nextjs-deployment
nextjs-performance
nx-monorepo
react-code-review
react-patterns
shadcn-ui
tailwind-css-patterns
tailwind-design-system
references
turborepo-monorepo
typescript-docs
typescript-security-review
zod-validation-utilities
references
github-spec-kit