p3c-exception-logging

Apply Alibaba P3C exception handling and SLF4J logging standards to Java code.

36|10|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/jie023/trae-setting --skill p3c-exception-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: p3c-exception-logging
Source: https://github.com/jie023/trae-setting/tree/main/skills/p3c-exception-logging
Command: npx skills add https://github.com/jie023/trae-setting --skill p3c-exception-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides authoritative guidelines from the P3C Java development manual for exception handling and logging. It helps teams prevent NullPointerExceptions, write robust try-catch-finally blocks, and establish consistent SLF4J-based logging and log management practices.

Core Features & Use Cases

  • Exception handling guidance: defines when to catch, which exceptions to swallow, and how to structure finally blocks.
  • Logging standards: enforces SLF4J usage, proper message formatting, and log retention practices.
  • NPE prevention and safe coding: promotes safe access patterns and Optional usage.
  • Code quality and reviews: serves as a reference during code reviews to ensure compliance with P3C rules.
  • Use Case: when reviewing or refactoring a Java method to align with P3C exception and logging standards.

Quick Start

Apply the P3C exception and logging guidelines to an existing Java method, converting brittle try-catch blocks into robust patterns and updating logging statements accordingly.

Frequently Asked Questions about p3c-exception-logging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the Alibaba P3C standards for Java exception handling and logging?

The Alibaba P3C standards for Java exception handling and logging define rules for NPE prevention, proper try-catch-finally structure, and SLF4J-based logging discipline. They ensure robust error handling and consistent log management.

How do I prevent NullPointerException in Java code reviews?

To prevent NullPointerException in Java code reviews, enforce P3C safe access patterns and Optional usage. This skill provides guidelines to identify brittle code and promote null-safe coding practices during refactoring.

How do I structure try-catch-finally blocks according to P3C guidelines?

To structure try-catch-finally blocks according to P3C guidelines, follow rules defining when to catch, which exceptions to swallow, and how to organize finally blocks. This skill consolidates these patterns for robust Java error handling.

What is the correct way to use SLF4J for Java logging?

The correct way to use SLF4J for Java logging involves enforcing proper message formatting and log retention practices. The P3C logging standards establish consistent SLF4J usage to ensure reliable log management.

Can I use P3C exception and logging standards for onboarding engineers?

You can use P3C exception and logging standards for onboarding engineers to standardized error handling and log patterns. This skill serves as a reference during code reviews to ensure compliance with Java P3C rules.

Do I need external tools to apply P3C logging and exception rules?

You do not need external tools to apply P3C logging and exception rules. This skill requires no external tooling, allowing you to enforce SLF4J usage and NPE prevention guidelines directly during code reviews and refactoring.