factory-observability

factory-observability is a skill for Claude Code from nonlinear-xyz/factory-kit. It costs 96 tokens per session (2,364 once invoked), scanned A, original, MIT.

A set of rules for adding monitoring to software from the start. It covers product usage, errors, request tracing, audit records, and structured logs using tools such as PostHog and Sentry.

In plain words
What is it for?
Use it when setting up monitoring for a new application or standardising monitoring across builds. It helps plan usage tracking, error reporting, audit logs, request IDs, and searchable log data.
Why use it?
It prevents teams from missing important usage and error history, which is difficult to recover after a product launches. It also makes problems easier to trace across services.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the factory-kit plugin — 37 skills, 8 commands, 12 agents, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nonlinear-xyz/factory-kit/factory-observability
Any agent
npx skills add nonlinear-xyz/factory-kit --skill factory-observability
Clone the repo
git clone --depth 1 https://github.com/nonlinear-xyz/factory-kit

Made for: Claude Code.

Or install factory-kit, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 12 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for factory-observability

README.md
[![agentmods](https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-observability.svg)](https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-observability)
Your own site
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-observability"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-observability.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,364 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00096 $0.02364
Opus 5 $0.00048 $0.01182
Sonnet 5 $0.00019 $0.00473
Haiku 4.5 $0.00010 $0.00236

Measured 6d ago against content hash 6d90a1974707, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

factory-observability scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/factory-observability/SKILL.md · 228 lines

How it starts

The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Factory observability

Each section leads with Principle (one sentence, stack-agnostic), then Why (constraint → option → tradeoff), then Recipe (the PostHog / Sentry / pino / structlog shape we use), and Failure mode when there's one to name.

Day-one stack — observability before features

Principle. PostHog + Sentry + trace IDs + structured logs go in on day one, before the first feature ships.

Why. Observability is the build's most asymmetric cost-vs-value: cheap on day one (an SDK install and a config block), expensive to backfill (every event needs a redeploy, session-replay data starts empty, six months of usage history is lost). The trap is treating it as "we'll add when we need it" — by the time you need it, the data you'd want doesn't exist.

Recipe.

Layer Tool Purpose
Product analytics PostHog Per-feature usage, funnels, session replay
Error tracking Sentry Exceptions, performance, source maps
Audit log DB table (admin_actions or audit_log) Mutation provenance, regulatory compliance
Request tracing Trace ID middleware + logs Cross-service debugging
Structured logs pino (Node) / structlog (Python) Searchable, machine-parseable

PostHog — client setup with ingest rewrite

Principle. PostHog ingest goes through your own domain via Next.js rewrites; ad-blockers drop direct PostHog calls.

Why. Browser-level ad-blockers (uBlock, Brave's shield) recognize i.posthog.com and drop ~30% of events in aggregate. Routing through /ingest on your own domain bypasses the blocklist — the events arrive, the analytics are accurate. The cost is one rewrite block; the savings are ~30% of every funnel calculation you'll ever do.

Recipe.

// src/components/PostHogProvider.tsx
'use client';

import posthog from 'posthog-js';
import { PostHogProvider } from 'posthog-js/react';
import { useEffect } from 'react';

if (typeof window !== 'undefined') {
  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
    api_host: '/ingest',                  // proxied — see rewrites below
    capture_pageview: false,              // we call manually with route context
    person_profiles: 'identified_only',
  });
}

export function PHProvider({ children }: { children: React.ReactNode }) {
  return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}

Read the full file on GitHub · 228 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 228 lines · 96 tokens per session scan A 6d90a1974707

Subscribe to this mod's changes

factory-observability is a skill published in the GitHub repository nonlinear-xyz/factory-kit (9 stars, last pushed 1mo ago), licensed MIT. It adds 96 tokens to every session and 2,364 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

hook-template

Generate hook script from template. Use when adding a new hook, wiring a PreToolUse/PostToolUse/Stop/Notification hook, or scaffolding hook config for settings.json.

claude-world/director-mode-lite · 39 tokens

agent-template

Generate custom agent from template. Use when creating a new subagent from scratch, or scaffolding an agent file with correct frontmatter.

claude-world/director-mode-lite · 30 tokens

workflow

Run the complete 5-step development workflow: focus problem → prevent over-development → test-first (TDD) → document → smart commit. Use when starting a new feature, or when the user runs /workflow or asks for the full development flow.

claude-world/director-mode-lite · 52 tokens

check-environment

Verify Claude, Codex, and Grok availability plus Director guidance, relay, agents, and skills. Audit optional hooks only when selected. Use after installation or when a native surface misbehaves.

claude-world/director-mode-lite · 44 tokens

doc-writer

Documentation templates and standards: README structure, API reference format, changelog (Keep a Changelog), and comment guidelines. Use when creating or updating documentation. Loaded automatically by the doc-writer agent.

claude-world/director-mode-lite · 44 tokens

smart-commit

Create clean Conventional Commits: inspect the diff, group related changes, run quality checks, and write type(scope) messages. Use when committing work, or when the user runs /smart-commit or asks to commit changes.

claude-world/director-mode-lite · 49 tokens