skills/debugging/SKILL.md
Diagnose and resolve Java/Spring Boot bugs, exceptions, and runtime issues using systematic debugging strategies. Use this skill whenever the user shares an error, stack trace, or unexpected behavior in Java/Spring Boot, or says things like "I have an error", "this throws an exception", "my Spring app won't start", "why is this returning null", "getting a 500 error", "my bean is not found", "LazyInitializationException", "transaction not working". Always use this skill to guide systematic diagnosis of any Java or Spring Boot issue.
npx skillsauth add jyjeanne/ai-setup-forge debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Systematically diagnose Java/Spring Boot issues using pattern recognition, stack trace analysis, and targeted investigation strategies.
Always follow this sequence:
NoSuchBeanDefinitionException
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com.example.UserService' available
→ Causes & fixes:
@Service / @Component annotation → add it@SpringBootApplication package@Service@Primary or @Qualifier → add qualifierBeanCreationException
Error creating bean with name 'dataSource': ...
→ Causes:
pom.xmlapplication.ymlapplication.yml, DB is running, driver on classpathUnsatisfiedDependencyException
→ Circular dependency: A → B → A
// Fix with @Lazy on one injection point
public ClassA(@Lazy ClassB classB) { ... }
// Or restructure to remove the cycle
NullPointerException
java.lang.NullPointerException at UserService.java:42
→ Debug strategy:
@Service/@Autowired// Add defensive logging before NPE
log.debug("user={}, user.address={}", user, user != null ? user.getAddress() : "N/A");
LazyInitializationException
org.hibernate.LazyInitializationException: failed to lazily initialize a collection
→ Cause: accessing lazy collection outside a transaction → Fixes (pick one):
// Option 1: Use JOIN FETCH in the query
@Query("SELECT u FROM User u LEFT JOIN FETCH u.orders WHERE u.id = :id")
// Option 2: Use @Transactional on the calling method
// Option 3: Use @EntityGraph
@EntityGraph(attributePaths = "orders")
Optional<User> findById(Long id);
// ❌ DO NOT: open-in-view: true (anti-pattern)
OptimisticLockException / StaleObjectStateException
→ Cause: two threads updated the same entity simultaneously
→ Fix:
@Version
private Long version; // Add to entity for optimistic locking
// Handle in service
try {
return repository.save(entity);
} catch (OptimisticLockException e) {
throw new ConflictException("Resource was modified by another user, please retry");
}
DataIntegrityViolationException
→ Cause: unique constraint, FK constraint, or NOT NULL violation
→ Debug: read the nested ConstraintViolationException message for the constraint name
→ Fix: validate before save, or catch and throw a domain exception:
try {
return userRepository.save(user);
} catch (DataIntegrityViolationException e) {
if (e.getMessage().contains("users_email_key")) {
throw new ConflictException("Email already in use");
}
throw e;
}
TransactionRequiredException
→ Cause: modifying entity outside transaction
→ Fix: add @Transactional to the service method
400 Bad Request (unexpected)
→ Check order:
@Valid on @RequestBody parameter?Content-Type: application/json header?404 Not Found (for existing endpoint)
→ Check:
@RequestMapping base path correct?@GetMapping vs @PostMapping)@PathVariable Long id vs /{id}application.yml?500 Internal Server Error
→ Always check the server logs — the stack trace is in the logs, not in the response body (by design)
→ Enable detailed error output for dev:
server:
error:
include-message: always
include-binding-errors: always
HttpMessageNotReadableException
→ Jackson can't deserialize the JSON body
→ Check: LocalDate/LocalDateTime needs @JsonFormat or Jackson JavaTime module:
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
spring:
jpa:
show-sql: true
properties.hibernate.format_sql: true
logging:
level:
org.hibernate.SQL: DEBUG
org.hibernate.type.descriptor.sql: TRACE # Show bind parameters
logging:
level:
org.springframework.web: DEBUG # HTTP requests/responses
org.springframework.security: DEBUG # Security filter chain
org.springframework.transaction: DEBUG # Transaction boundaries
// Add to pom.xml: spring-boot-starter-actuator
// Check bean context
GET /actuator/beans
// Check env and config
GET /actuator/env
// Check health
GET /actuator/health
When a bug is hard to isolate:
@SpringBootTest test that reproduces the issueException in thread "main" java.lang.NullPointerException ← Exception type
at com.example.service.UserService.findUser(UserService.java:42) ← YOUR code (root cause)
at com.example.controller.UserController.getUser(UserController.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ← Framework code (ignore)
...
Rule: Find the first line in YOUR package — that's where to start investigating. Ignore framework lines (Spring, Hibernate, JDK) unless your code has no visible lines.
development
Generate breadboard circuit mockups and visual diagrams using HTML5 Canvas drawing techniques. Use when asked to create circuit layouts, visualize electronic component placements, draw breadboard diagrams, mockup 6502 builds, generate retro computer schematics, or design vintage electronics projects. Supports 555 timers, W65C02S microprocessors, 28C256 EEPROMs, W65C22 VIA chips, 7400-series logic gates, LEDs, resistors, capacitors, switches, buttons, crystals, and wires.
development
Apply lean thinking to UX: hypothesis-driven design, collaborative sketching, and rapid experiments instead of heavy deliverables. Use when the user mentions "Lean UX", "design hypothesis", "UX experiment", "collaborative design", or "outcome over output". Covers hypothesis statements, MVPs for UX, and cross-functional collaboration. For Build-Measure-Learn, see lean-startup. For usability audits, see ux-heuristics.
development
Design MVPs, validated learning experiments, and pivot-or-persevere decisions using Build-Measure-Learn. Use when the user mentions "MVP scope", "validated learning", "pivot or persevere", "vanity metrics", or "test assumptions". Covers innovation accounting and actionable metrics. For 5-day prototype testing, see design-sprint. For customer motivation analysis, see jobs-to-be-done.
tools
Instrument, trace, evaluate, and monitor LLM applications and AI agents with LangSmith. Use when setting up observability for LLM pipelines, running offline or online evaluations, managing prompts in the Prompt Hub, creating datasets for regression testing, or deploying agent servers. Triggers on: langsmith, langchain tracing, llm tracing, llm observability, llm evaluation, trace llm calls, @traceable, wrap_openai, langsmith evaluate, langsmith dataset, langsmith feedback, langsmith prompt hub, langsmith project, llm monitoring, llm debugging, llm quality, openevals, langsmith cli, langsmith experiment, annotate llm, llm judge.