When designing and implementing web interfaces to ensure they are usable by everyone.
日本語の概要は準備中です。原文の説明を表示しています。
When setting up telemetry, debugging distributed systems, or standardizing application output.
インストール方法を見るインストールする前に、エージェントに与えられる指示の中身を確認できます。
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'
});
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
When designing and implementing web interfaces to ensure they are usable by everyone.
日本語の概要は準備中です。原文の説明を表示しています。
When creating or extending an HTTP API for client consumption.
日本語の概要は準備中です。原文の説明を表示しています。
When improving read performance and reducing database load.
日本語の概要は準備中です。原文の説明を表示しています。
When configuring automated build, test, and deployment workflows for a repository.
日本語の概要は準備中です。原文の説明を表示しています。
When asynchronously reviewing peer code before merging into the main branch.
日本語の概要は準備中です。原文の説明を表示しています。
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
日本語の概要は準備中です。原文の説明を表示しています。