/prometheus-skill-pack:typescript-base-patternsfrom prometheus-skill-pack
Canonical TypeScript 6 patterns for Prometheus AGS projects. Covers strict type discipline (no any, no @ts-ignore), discriminated unions for domain modeling, Result types for error handling, branded types for IDs, zod for runtime validation, and module organization. Applies to all TypeScript code: React, MCP servers, Mastra agents, and Node.js scripts.
Ships in prometheus-skill-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
All Prometheus AGS TypeScript projects use strict: true with additional checks:
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
noUncheckedIndexedAccess is the most impactful — it forces arr[i] to return
T | undefined, eliminating a large class of runtime errors.
any — Use unknown and Narrowany disables type checking. Use unknown for truly unknown data and narrow with
type guards or zod parsing.
// ❌ Wrong
function processInput(data: any) { return data.value }
// ✅ Correct — narrow with zod
import { z } from 'zod'
const InputSchema = z.object({ value: z.string() })
function processInput(raw: unknown): string {
const parsed = InputSchema.parse(raw) // throws on invalid input
return parsed.value
}
// ✅ Correct — narrow with type guard
function isPost(value: unknown): value is Post {
return typeof value === 'object' && value !== null && 'title' in value
}
Model domain variants as discriminated unions, not class hierarchies or string enums.
// Agent event types
type AgentEvent =
| { type: 'thinking'; content: string }
| { type: 'tool_call'; toolName: string; args: Record<string, unknown> }
| { type: 'tool_result'; toolName: string; result: unknown }
| { type: 'complete'; output: string }
| { type: 'error'; message: string }
function handleEvent(event: AgentEvent) {
switch (event.type) {
case 'thinking': console.log(event.content); break
case 'tool_call': dispatch(event.toolName, event.args); break
case 'error': logError(event.message); break
}
}
TypeScript exhaustiveness checking will catch missed cases when you add a new variant.
Never throw in business logic. Return explicit Result<T, E> types.
type Result<T, E = Error> =
| { ok: true; value: T }
| { ok: false; error: E }
const ok = <T>(value: T): Result<T, never> => ({ ok: true, value })
const err = <E>(error: E): Result<never, E> => ({ ok: false, error })
async function fetchPost(id: string): Promise<Result<Post, 'not_found' | 'network_error'>> {
try {
const res = await fetch(`/api/posts/${id}`)
if (res.status === 404) return err('not_found')
if (!res.ok) return err('network_error')
return ok(await res.json() as Post)
} catch {
return err('network_error')
}
}
// Call site — exhaustive
const result = await fetchPost(id)
if (result.ok) {
render(result.value)
} else {
showError(result.error) // 'not_found' | 'network_error'
}
Prevent mixing IDs of different entity types at compile time.
type Brand<T, B extends string> = T & { __brand: B }
type PostId = Brand<string, 'PostId'>
type UserId = Brand<string, 'UserId'>
const toPostId = (id: string): PostId => id as PostId
const toUserId = (id: string): UserId => id as UserId
function getPost(id: PostId): Promise<Post> { /* ... */ }
const uid = toUserId('user-123')
getPost(uid) // ✅ Type error — UserId is not assignable to PostId
Use zod at all trust boundaries: API responses, user inputs, environment variables, message queue payloads, MCP tool arguments.
import { z } from 'zod'
// Environment
const Env = z.object({
DATABASE_URL: z.string().url(),
API_KEY: z.string().min(1),
PORT: z.coerce.number().default(3000),
})
export const env = Env.parse(process.env)
// MCP tool arguments
const RunInferenceArgs = z.object({
prompt: z.string().min(1),
model: z.string().default('qwen2.5-7b'),
})
export type RunInferenceArgs = z.infer<typeof RunInferenceArgs>
src/
domain/ ← types, interfaces, zod schemas (no runtime deps)
application/ ← use cases, service classes
infrastructure/ ← API clients, DB adapters
shared/ ← utilities: Result, branded types, cn()
Follow the CLEAN architecture skill for full layering rules.
any type — use unknown + narrowing or explicit types// @ts-ignore — fix the type erroras SomeType without validation — use zod parse() at trust boundariesinterface extending any — define explicit shapesthrow new Error() in business logic — return Resultconsole.log in production code — use a logger with structured outputWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
218 skills in this plugin
/actor-modelTokio-native actor model pattern for Prometheus AGS projects. Implements actors as tokio tasks communicating via mpsc channels with a typed message enum, enabling safe concurrent state management without shared locks. Used in UAR session management, pk-librarian event broadcasting, and parking-lot scheduler design. Use when a component needs to own state exclusively while serving concurrent callers.
/adversarial-reviewIsolated, cross-model adversarial review of KBD artifacts and change diffs. Dispatches a fresh-context LLM judge over an OpenAI-compatible REST gateway (openai-proxy or `liter-llm api`) with an explicit mandate to find problems — the model that produced an artifact or change is never the model that reviews it. Runs as a pipeline stage inside kbd-assess/analyze/plan (artifact mode) and kbd-execute's single phase-boundary QA step (diff mode, once over the whole phase diff). Findings are severity-bucketed (CRITICAL/WARNING/SUGGESTION) and the judge's own report is screened by sycophancy-correction before it is surfaced.
/agent-team-creatorCreate, revise, package, and deploy agent-team definitions with staged questions and native exports for UAR, Codex, Claude Code, Copilot, Kimi Code, MiniMax CLI, OpenCode and DeepSeek. Use for team definition and catalog lifecycle; use agent-team-manage for active runtime task state.npx claudepluginhub prometheus-ags/prometheus-skill-system --plugin prometheus-skill-pack2 plugins in one repository ship this exact skill · first indexed Nov 27, 2026