Agent skill

bunjs-mastery-skill

Stars 4
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/mOdrA40/claude-codex-skills-directory/tree/main/backend-skills/bunjs-mastery-skill

SKILL.md

Bun.js + Docker Mastery

Operate

  • Confirm the goal, scope, Bun version, deployment target, Docker constraints, database choice, traffic profile, and definition of done.
  • Prefer small vertical slices with tests and explicit tradeoffs.
  • Use Bun-native capabilities when they simplify the system, but do not force Bun-specific APIs where the standard Web platform is already clear.
  • Optimize for operability: graceful shutdown, structured logs, health checks, timeouts, and safe defaults are part of the baseline.

The goal is not just “fast on benchmarks”. The goal is a service that stays easy to debug and safe to run in production.

Default Standards

  • Keep src/index.ts as bootstrap only; move app wiring to src/app.ts and business logic to services/use-cases.
  • Validate environment variables and request payloads at the boundary.
  • Prefer explicit error types and one global error mapping strategy.
  • Keep TypeScript strict; avoid any, hidden type assertions, and implicit runtime contracts.
  • Prefer idempotent handlers for side-effecting endpoints where retries can happen.
  • Treat database, cache, and outbound HTTP as failure-prone dependencies: always define timeouts and degradation behavior.

“Bad vs Good” (common production pitfalls)

typescript
// ❌ BAD: parsing untrusted input directly in the service layer.
const user = await userService.create(await c.req.json())

// ✅ GOOD: validate at the HTTP boundary before entering business logic.
const payload = c.req.valid("json")
const user = await userService.create(payload)
typescript
// ❌ BAD: fire-and-forget async work with no ownership or logging.
void sendWebhook(order)

// ✅ GOOD: await or queue the side effect with explicit failure handling.
await webhookPublisher.publish(order).catch((error) => {
  logger.error({ error, orderId: order.id }, "publish webhook failed")
  throw new AppError("Webhook publish failed", 503, "WEBHOOK_UNAVAILABLE")
})

Recommended Structure

text
src/
├── index.ts
├── app.ts
├── config/
├── routes/
├── controllers/
├── services/
├── repositories/
├── middlewares/
├── utils/
└── types/

Validation Commands

  • Run bun install --frozen-lockfile.
  • Run bun run test.
  • Run bunx tsc --noEmit if the project uses standalone TypeScript checks.
  • Run bunx @biomejs/biome check ..
  • Run bun run build before release.
  • Run Docker build validation for production images when Docker is part of the deliverable.

Runtime and API Guardrails

  • Use a single request ID / trace ID strategy and include it in logs and error responses where appropriate.
  • Set request body limits, timeouts, and rate limits for public endpoints.
  • Do not leak stack traces, secrets, or database errors to clients.
  • Prefer Bun.password for password hashing instead of legacy bcrypt stacks unless compatibility requires otherwise.
  • Make shutdown explicit: stop accepting traffic, drain in-flight work, and close DB/Redis clients.

Docker & Deployment Defaults

  • Use multi-stage Docker builds.
  • Run as non-root.
  • Pin Bun base image versions; avoid floating latest tags.
  • Add /health and /ready endpoints for orchestration environments.
  • Keep image contents minimal and deterministic.

Testing Defaults

  • Unit tests for pure logic and service policies.
  • Integration tests for database repositories and route behavior.
  • E2E tests only for critical user flows.
  • Keep mocks small and close to the consumer boundary.

References

  • Clean code patterns: references/clean-code-patterns.md
  • Debugging guide: references/debugging-guide.md
  • Docker patterns: references/docker-patterns.md
  • Library arsenal: references/library-arsenal.md
  • Auth and session security: references/auth-and-session-security.md
  • Background jobs and queues: references/background-jobs-and-queues.md
  • Database and transactions: references/database-and-transactions.md
  • Observability: references/observability.md
  • Security and outbound HTTP: references/security-and-outbound-http.md
  • Testing strategy: references/testing-strategy.md
  • Reliability and operations: references/reliability-and-operations.md

Scripts & Assets

  • scripts/init-project.sh - initialize a Bun project from the template.
  • scripts/healthcheck.ts - health endpoint template.
  • assets/project-template/ - project boilerplate.

Expand your agent's capabilities with these related and highly-rated skills.

mOdrA40/claude-codex-skills-directory

nuxt-tanstack-mastery

Panduan senior/lead developer 20 tahun pengalaman untuk Vue.js 3 + Nuxt 3 + TanStack Query development. Gunakan skill ini ketika: (1) Membuat project Nuxt 3 baru dengan arsitektur production-ready, (2) Integrasi TanStack Query untuk data fetching, (3) Debugging Vue/Nuxt yang kompleks, (4) Review code untuk clean code compliance, (5) Optimisasi performa aplikasi Vue/Nuxt, (6) Setup folder structure yang scalable, (7) Mencari library terpercaya untuk Vue ecosystem, (8) Menghindari common pitfalls dan bugs, (9) Implementasi state management patterns, (10) Security hardening aplikasi Nuxt. Trigger keywords: vue, vuejs, nuxt, nuxtjs, tanstack, vue-query, composition api, pinia, vueuse, vue router, clean code vue, debugging vue, folder structure nuxt.

4 0
Explore
mOdrA40/claude-codex-skills-directory

solidjs-solidstart-expert

Expert-level SolidJS and SolidStart development skill with 20+ years senior/lead engineer mindset. Comprehensive guidance for building production-ready, scalable web applications with fine-grained reactivity. Use when Claude needs to: (1) Create new SolidJS/SolidStart projects, (2) Implement TanStack Query/Router/Table/Form integration, (3) Build reactive components with signals/stores/resources, (4) Handle SSR/SSG/streaming with SolidStart, (5) Implement authentication and API routes, (6) Optimize bundle size and performance, (7) Debug reactivity issues and memory leaks, (8) Structure large-scale applications, (9) Implement type-safe patterns with TypeScript, (10) Handle error boundaries and suspense, (11) Build accessible UI components, (12) Deploy to Vercel/Netlify/Cloudflare. Triggers: "solid", "solidjs", "solidstart", "createSignal", "createStore", "createResource", "tanstack solid", "vinxi", "fine-grained reactivity".

4 0
Explore
mOdrA40/claude-codex-skills-directory

react-tanstack-senior

Expertise senior/lead React developer 20 tahun dengan TanStack ecosystem (Query, Router, Table, Form, Start). Gunakan skill ini ketika: (1) Membuat aplikasi React dengan TanStack libraries, (2) Review/refactor kode React untuk clean code, (3) Debugging React/TanStack issues, (4) Setup project structure yang maintainable, (5) Optimasi performa React apps, (6) Memilih library yang tepat untuk use case tertentu, (7) Mencegah common bugs dan memory leaks, (8) Implementasi best practices KISS dan less is more. Trigger keywords: React, TanStack, React Query, TanStack Router, TanStack Table, TanStack Form, TanStack Start, Vinxi, clean code, refactor, performance, debugging.

4 0
Explore
mOdrA40/claude-codex-skills-directory

clickhouse-principal-engineer

Principal/Senior-level ClickHouse playbook for analytical schema design, partitioning, ingestion, query performance, replication, storage strategy, and operating large-scale columnar systems. Use when: designing OLAP workloads, reviewing MergeTree layout, tuning analytical queries, building event analytics platforms, or operating ClickHouse in production.

4 0
Explore
mOdrA40/claude-codex-skills-directory

mysql-principal-engineer

Principal/Senior-level MySQL playbook for schema design, indexing, transactions, replication, operational reliability, online migrations, and production workload tuning. Use when: designing relational systems, reviewing query/index strategy, operating MySQL fleets, debugging contention or replication lag, or hardening MySQL-backed applications.

4 0
Explore
mOdrA40/claude-codex-skills-directory

mongodb-principal-engineer

Principal/Senior-level MongoDB playbook for document modeling, indexing, replication, sharding, query design, observability, and production reliability. Use when: designing document schemas, reviewing aggregation/query performance, operating replicas/shards, or hardening MongoDB-backed systems.

4 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results