Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Server Context

ASecurity

How to use @owlmeans/server-context — makeServerContext() as the base of a server makeContext(), the ServerConfig shape, config() to build one, and the fileConfigReader middleware. Auto-invoked when building a server context or asking what a bare server context already carries.

3 stars
0 votes
0 copies
0 views
Added 9/22/2026
developmenttypescriptrustapibackend

Works with

cliapi

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add owlmeans/common --skill server-context --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Server Context?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Server Context
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/owlmeans-server-context/badge)](https://www.skillsdirectory.com/skills/owlmeans-server-context)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: server-context
description: How to use @owlmeans/server-context — makeServerContext() as the base of a server makeContext(), the ServerConfig shape, config() to build one, and the fileConfigReader middleware. Auto-invoked when building a server context or asking what a bare server context already carries.
user-invocable: false
---

# @owlmeans/server-context

**Layer:** Server
**Install:** `"@owlmeans/server-context": "^0.1.18-rc.29"` in `dependencies`

## Key Exports

| Export | Description |
|--------|-------------|
| `makeServerContext(cfg)` | Server context factory — the base your `makeContext` builds on |
| `config(service, cfg?)` | Build a `ServerConfig` for `service` — app type `Backend`, `trusted` defaulted to an empty list |
| `ServerContext<C>` | Server-side context interface — a basic context plus the config-resource accessors |
| `ServerConfig` | Server config shape — the server and client config bases plus `services: Record<string, ServiceRoute>` |

## Subpath Exports

- `./utils` — `fileConfigReader`, the config-reading middleware

## What a bare server context already carries

`makeServerContext` is not an empty container. Before it returns it registers:

- `fileConfigReader` — a `Config`/`Configuration`-stage middleware that walks the whole config tree
  and replaces every writable string starting with `/` by that file's trimmed contents (through
  `readConfigValue` from `@owlmeans/server-config`, so mount secrets at absolute paths). This is how
  a mounted secret becomes a plain config value.

  **Read converted values after `init()`, never straight after `configure()`.** `configure()` is not
  an async function: it starts the `Config`/`Configuration` middlewares in a detached promise and
  returns the context immediately, so nothing in the tree is converted yet when it returns. The
  ordering guarantee comes from `waitForConfigured()`, and from `init()`, which awaits it first.

  That detachment also decides how a bad path fails. `readConfigValue` is synchronous and unguarded,
  and the middleware runner is a bare `Promise.all` with no catch, so a config string that looks
  like a path but names no file does **not** throw out of `configure()` — the `ENOENT` escapes as an
  unhandled rejection. The stage is never advanced past `Configuration` either, so the promise
  `init()` awaits never resolves and the boot hangs instead of failing. Read an unhandled `ENOENT`
  at boot as a missing mount, and install an `unhandledRejection` handler that exits non-zero if the
  boot has to be loud.
- Three config resources — the default record store, one keyed on `trusted`, and one keyed on
  `plugins` — reachable through `getConfigResource(alias?)`.
- The basic Ed25519 guard over the `trusted` list, which is what authenticates service-to-service
  calls.
- `authMiddleware`, which wraps the `invoke` of every guarded backend entrypoint so outbound calls
  carry an authentication header.

So a downstream factory adds its own services on top rather than assembling these again.

## Usage

A downstream `backend` package wraps `makeServerContext` and exports its own `makeContext`. It calls
the factory below it, applies its own idempotent `append*(context)` mixins and service
registrations, and returns that same context — the process gets one context, built once:

```typescript
// src/context.ts
import { makeServerContext } from '@owlmeans/server-context'
import type { ServerConfig, ServerContext } from '@owlmeans/server-context'

export const makeBackendContext = <C extends ServerConfig, T extends ServerContext<C>>(cfg: C): T => {
  const context = makeServerContext<C, T>(cfg)
  // ... register shared services
  return context
}
```

An application server usually starts from `@owlmeans/server-app#makeContext` instead, which builds on
this and adds the API server, API client, sockets, the static resource and auth.

## Depends On

Declared: `@owlmeans/context`, `@owlmeans/config`, `@owlmeans/client-config`,
`@owlmeans/server-config`, `@owlmeans/route`.

Imported but **not** declared in this package's manifest: `@owlmeans/auth-common` (the Ed25519
guard and the outbound-auth middleware registered above) and `@owlmeans/server-route` (the
`ServiceRoute` type `ServerConfig` is built from). A workspace resolves them anyway; a standalone
install has to name them in its own dependencies.

Attribution

owlmeansowlmeans
View sourceMore from owlmeans →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284072 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →