skills/senior-backend/SKILL.md
When designing backend system architecture, choosing between API styles, or making database scaling decisions. When reviewing backend code for production readiness, performance bottlenecks, or architectural anti-patterns. Also when planning authentication architecture or error handling strategy across service boundaries. For code quality patterns use clean-code instead. For database-specific queries use database instead. For security reviews use security-best-practices instead. For containerization use docker-expert instead. For NestJS-specific work use nestjs-expert instead. For debugging errors use error-resolver instead.
npx skillsauth add sharkitect-solutions/sharkitect-claude-toolkit senior-backendInstall 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.
| File | Purpose | Load When | |------|---------|-----------| | SKILL.md | Architecture decision matrix, API style selection, database gotchas, scalability patterns, auth architecture, performance debugging, error handling | Always (auto-loaded) | | production-incident-patterns.md | Cascade failure anatomy (4 stages), retry amplification math, thundering herd scenarios (5), split-brain detection/recovery, incident severity classification, postmortem anti-patterns (5), on-call best practices | When debugging production issues, designing incident response, building runbooks, or analyzing system failures | | api-versioning-and-evolution.md | Versioning strategy decision matrix (5), breaking vs non-breaking change classification (8 types), deprecation lifecycle (4 phases with RFC 8594 headers), consumer-driven contract testing (Pact workflow), API lifecycle anti-patterns (5) | When designing API versioning, managing breaking changes, planning deprecation, or setting up contract testing | | observability-and-monitoring.md | Three pillars (what each actually solves), structured logging rules (5 with cost economics), OpenTelemetry distributed tracing (sampling by environment), SLO/SLI/SLA framework with error budget policy, alerting strategy (multi-window burn rate), four golden signals | When designing logging, implementing tracing, defining SLOs, or building monitoring dashboards |
| If the user wants... | Use instead | |----------------------|-------------| | Code readability, naming, SOLID principles | clean-code | | SQL query writing, schema design, specific DB engine tuning | database | | OWASP vulnerabilities, dependency scanning, threat modeling | security-best-practices | | Dockerfile optimization, compose orchestration, image layering | docker-expert | | NestJS modules, providers, guards, interceptors | nestjs-expert | | Stack traces, runtime errors, debugging sessions | error-resolver | | System-wide architecture across multiple services | senior-architect | | Backend system architecture, API style selection, scaling strategy | THIS skill |
First-match signal table. Stop at the first row where all signals match.
| Team size | Deploy frequency | Data coupling | Regulatory | Architecture | |-----------|-----------------|---------------|------------|-------------| | 1-5 devs | any | any | any | Modular monolith | | 5-15 devs | daily+ | loose between domains | none special | Modular monolith with extract-ready boundaries | | 5-15 devs | daily+ | loose between domains | PCI/HIPAA isolation needed | Microservices for regulated domain only | | 15-40 devs | multiple daily | domain-aligned teams own data | any | Microservices along team boundaries | | 40+ devs | continuous | each team owns its data store | any | Microservices with platform team | | any | any | tight cross-domain joins | any | Monolith (microservices will become distributed monolith) |
When microservices HURT (non-obvious):
First-match. Choose the first row that fits.
| Signal | Choose | NOT this (common mistake) | |--------|--------|--------------------------| | Browser clients + server clients + mobile, public API | REST with OpenAPI spec | GraphQL (client diversity makes schema evolution painful) | | Single frontend team, rapidly changing UI data needs | GraphQL | REST (avoids over/under-fetching churn) | | Internal service-to-service, high throughput, schema-strict | gRPC with protobuf | REST (serialization overhead matters at scale) | | TypeScript monorepo, frontend + backend same team | tRPC | REST (type-safe without code generation) | | Public API with paying customers | REST | tRPC (couples to TypeScript ecosystem) | | Multi-language microservices needing contracts | gRPC | GraphQL (schema stitching across languages is fragile) |
When GraphQL becomes a liability:
When gRPC is wrong:
Connection pooling (the #1 production surprise):
statement_cache_size=0 in Prisma). Session mode works but limits concurrency to pool sizenum_cpus * 2 + 1. In serverless with 50 concurrent functions, that is 50 separate pools = 550 connections against a database with max_connections=100. Solution: external pooler (PgBouncer/PgCat) or Prisma AccelerateQuery optimization beyond EXPLAIN:
CREATE INDEX idx ON orders(user_id) INCLUDE (status, total) -- 10-50x faster for narrow queriesCREATE INDEX idx ON orders(created_at) WHERE status = 'pending' -- index is 1% the size when 99% of orders are completedREFRESH MATERIALIZED VIEW CONCURRENTLY requires a unique index but avoids table lock. Schedule during low-traffic windows, not on every requestRead replica decisions:
Caching layers (in order of preference):
Message queue selection:
JWT vs sessions (the real trade-offs):
OAuth2/OIDC gotchas:
N+1 detection in ORMs:
include (eager load) not property access (lazy load). Enable query logging (log: ['query']) and count queries per request in middlewarerelations option on find, or explicit createQueryBuilder with leftJoinAndSelectConnection pool exhaustion:
statement_timeout at the database level, wrap all queries in try/finally that returns connections, monitor pg_stat_activity for idle-in-transactionNode.js memory leaks (the usual suspects):
emitter.on() in a request handler without removeListener. MaxListenersExceededWarning is your early signalAcross service boundaries:
{ type, title, status, detail, instance }. Every service speaks the same error languageX-Request-ID header across services for distributed tracingCircuit breaker implementation:
Retry patterns:
delay = min(base * 2^attempt + random(0, base), max_delay). Without jitter, retries from multiple clients synchronize and cause thundering herd| Content choice | Reasoning | |---------------|-----------| | Architecture decision matrix with team-size signals | Claude defaults to "it depends" -- first-match table forces concrete recommendations based on the actual signals that matter | | When microservices HURT section | Training data skews toward microservices advocacy. The distributed monolith anti-pattern, synchronous call chain multiplication, and organizational-vs-computational scaling distinction are practitioner knowledge | | Connection pooling gotchas with specific numbers | PgBouncer mode interactions, Prisma connection formula, serverless connection storms are production surprises not well-covered in documentation | | Exactly-once semantics myth + idempotency keys | Distributed systems literature says this but most tutorials present message queues as reliable-by-default. Idempotency key pattern is the practical solution | | JWT revocation problem framed as "session store with extra steps" | Most JWT tutorials present them as superior to sessions. The revocation problem and size trade-off are the actual decision factors | | N+1 detection as middleware query counting | ORM documentation shows eager loading syntax but not how to detect the problem systematically in existing codebases |
development
When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ad copy,' 'ad creative,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' or 'audience targeting.' This skill covers campaign strategy, ad creation, audience targeting, and optimization.
testing
--- name: using-sharkitect-methodology description: Use when starting any conversation in a Sharkitect workspace OR before any task involving NEW pricing, positioning, proposal, strategy, plan-execution, or schema-design work — mandates invocation of Sharkitect-specific methodology skills (pricing-strategy, marketing-strategy-pmm, smb-cfo, hq-revenue-ops, executing-plans, brainstorming) under the same anti-rationalization discipline as using-superpowers. Documentation has failed 4 times across H
testing
Use when user says 'end session', 'wrap up', 'stop for the day', 'done for today', 'close out', 'save session', 'wrapping up', or invokes /end-session. Runs the full 9-step end-of-session protocol: resource audit, MEMORY.md update, lessons capture, plan status, pending items, workspace checklist, .tmp/ audit, git commit+push, Supabase brain sync, session brief, summary. Final step schedules a detached self-kill of the current session ONLY (3s delay) so the window closes cleanly. Other claude.exe processes (active workspaces) are NOT touched -- orphan cleanup is handled separately by Claude-Orphan-Cleanup-Hourly with proper age safeguards. Do NOT use for: mid-session quick saves (use session-checkpoint), skill syncing (use sync-skills.py), brain memory queries (use supabase-sync.py pull), document freshness reviews (use document-lifecycle), resource gap detection (use resource-auditor).
testing
Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, passive voice, negative parallelisms, and filler phrases.