.cursor/skills/monitor/SKILL.md
Add structured logging and error tracking for observability
npx skillsauth add washingtonguilhardes/example.hr-module monitorInstall 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.
Persona: Execute this task as the @developer subagent.
Load the persona characteristics from .rulesync/subagents/developer.md before proceeding.
Add structured logging and error tracking to improve observability, debugging, monitoring.
Discovery: - Ask: Code to monitor? (file/function/feature), Monitoring level? (basic logging/detailed tracing/error tracking), Specific error scenarios?, Error boundaries for frontend?
Review existing: - Check console.log/console.error usage - Review error handling in tRPC procedures - Examine TRPCError patterns
Add structured logging (tRPC): - Log at entry: console.log("[procedure] Starting", {userId, input}) - Log success: console.log("[procedure] Success", {result}) - Log errors: console.error("[procedure] Failed", {error, context}) - Use TRPCError with appropriate codes
Error boundaries (React): - Create ErrorBoundary component: getDerivedStateFromError, componentDidCatch with logging - Use: <ErrorBoundary name="ComponentName" fallback={...}>{children}</ErrorBoundary>
TRPCError usage: - NOT_FOUND: Channel/user not found - FORBIDDEN: Not authorized - BAD_REQUEST: Validation error - INTERNAL_SERVER_ERROR: Operation failed (with cause)
Logging points: - Procedure entry (with input), Database operations, Business logic decisions, Errors/exceptions, Procedure exit (with results)
Security: - Never log: passwords, API tokens - Caution with: user data in logs - Log: error codes, not sensitive details - Use structured logging (JSON objects)
Performance monitoring: - Track execution time for slow operations - Log duration, flag if > threshold
Test error scenarios: - Add tests to verify error handling - Test error paths ensure handled correctly
Quality checks: - pnpm lint && pnpm typecheck && pnpm test
Summary: - Procedures/components instrumented - Error boundaries added - Logging added (entry/exit/errors/performance) - Security considerations - Testing coverage - Log analysis examples
/monitor app/api/trpc/routers/channels.ts --level detailed - Adds structured entry/exit/error logging to each procedure, tracks execution duration, and uses TRPCError codes consistently./monitor app/ --level basic --error-boundaries - Adds ErrorBoundary components around key UI sections with meaningful fallback UI and error logging to console.{procedure, userId, duration}) not string concatenation// warn if > 500ms)/audit - Identifies observability gaps and missing error handling/review - Checks logging quality and security of log statementstesting
Analyze distributed traces to find blocking queries, N+1 patterns, and missing tRPC encapsulation, then produce prioritized fixes
testing
required reading for all test/spec files or test related queries.
testing
Transform Product Brief into Technical Specification
development
Detect drift between code implementations and specification documents