一键导入
logging-observability-standards
When setting up telemetry, debugging distributed systems, or standardizing application output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
When setting up telemetry, debugging distributed systems, or standardizing application output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
When improving read performance and reducing database load.
When designing loosely coupled systems that react to state changes asynchronously.
When creating or extending an HTTP API for client consumption.
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
When designing how a system recovers from and reports failures.
When asynchronously reviewing peer code before merging into the main branch.
| name | logging-observability-standards |
| description | When setting up telemetry, debugging distributed systems, or standardizing application output. |
| version | 2.0.0 |
| category | architecture |
| tags | ["architecture","observability","logging","backend"] |
| skill_type | architecture |
| author | skiLLM |
| license | MIT |
| compatible_agents | ["claude-code","cursor","copilot","codex"] |
| estimated_context_tokens | 2000 |
| dangerous | false |
| requires_review | false |
| security_level | review-required |
| dependencies | ["error-handling-architecture"] |
| triggers | ["logging","observability","debugging","monitoring","tracing"] |
| permissions | {"filesystem":{"read":true,"write":true},"network":{"outbound":true},"shell":{"execute":false}} |
| input_requirements | ["backend service","logging infrastructure"] |
| output_contract | ["structured json logs","correlation ids","no sensitive data leaked"] |
| failure_conditions | ["plaintext logs","no trace context","pii in logs"] |
| last_updated | "2026-05-15T00:00:00.000Z" |
Logs are the black box recorder of your system. When failures happen at 2 AM in production, logs are your only witness. This skill ensures application state and failures are highly searchable, machine-readable, and traceable across system boundaries WITHOUT leaking sensitive user data.
console.log or print statementscorrelation_id (or trace_id) at HTTP entry point and pass through all downstream callslogger.info("User " + userId + " failed to login") (unqueryable)❌ Anti-pattern (String concatenation, no context, no redaction):
// BAD: Unstructured, concatenated
console.log('User ' + req.user.id + ' logged in at ' + new Date());
// BAD: No correlation ID
logger.info('Processing order');
logger.info('Order processed');
// BAD: Leaking PII and secrets
logger.error('Failed to connect: ' + process.env.DB_PASSWORD);
logger.info('User email: ' + user.email + ' password hash: ' + user.passwordHash);
// BAD: Expected error logged as ERROR
try {
const user = await User.findById(userId);
} catch (e) {
logger.error('User not found'); // WRONG level
}
✅ Correct pattern (Structured JSON, correlation IDs, redacted):
// CORRECT: Structured JSON with context
logger.info('User login successful', {
userId: 'user_123', // Anonymized or hashed
correlationId: req.id,
duration: Date.now() - req.startTime,
timestamp: new Date().toISOString()
});
// CORRECT: Correlation ID flows through system
const requestId = req.headers['x-request-id'] || uuid();
req.correlationId = requestId;
// Pass to downstream calls
await orderService.process(order, { correlationId: requestId });
// CORRECT: Redaction middleware
logger.addRedaction([
process.env.DB_PASSWORD,
/\d{4}-\d{4}-\d{4}-\d{4}/, // Credit card pattern
/@\w+\.\w+/, // Email pattern
]);
// CORRECT: Proper error logging with stack trace
try {
const user = await User.findById(userId);
} catch (error) {
logger.warn('User not found', {
userId,
correlationId: req.correlationId,
message: error.message
// Stack trace logged by error handler, not here
});
}
// CORRECT: Full context on errors
logger.error('Database connection failed', {
error: error.message, // Not the password!
code: error.code,
stack: error.stack,
correlationId: req.correlationId,
timestamp: new Date().toISOString(),
severity: 'critical'
});