agentleFS
BufferoverflovvBufferoverflovv/FastMCP-Blueprint/.github/skills/observability-setup/SKILL.md

observability-setup

Skill0 starsChanged 7 months agoApache-2.0View on GitHub

Add production observability to a FastMCP server: request IDs, slow-request logging, structured log fields, and optional Prometheus metrics. Use when: hardening logging for production, adding request tracing or correlation IDs, setting up slow-request alerts, adding a /metrics endpoint, or improving structured log output beyond the base middleware.

  • Reads credentials
  • Installs packages

We split this skill into the rules it gives an agent

13 rules. 0 are common, 4 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Ask which features to add.

    line 30
  2. Distinctive:

    Ask for confirmation of which to apply before making changes.

    line 38
  3. Very specific:

    Read pyproject.toml to find PACKAGE.

    line 42
  4. Very specific:

    Add RequestIDMiddleware class to server.py

    line 49
  5. Distinctive:

    No new env vars needed

    line 51
  6. Very specific:

    Add SlowRequestMiddleware class to server.py, threshold read from config

    line 58
  7. Very specific:

    Add SLOW_REQUEST_THRESHOLD_MS field to config.py with default 1000

    line 59
  8. Very specific:

    Add SLOW_REQUEST_THRESHOLD_MS=1000 to .env.example

    line 60
  9. Very specific:

    Add prometheus-client to [project.dependencies] in pyproject.toml

    line 68
  10. Very specific:

    Create src/PACKAGE/routes/metrics.py with a GET /metrics route

    line 69
  11. Very specific:

    Add a CounterMiddleware or use prometheus-client multiprocess support as appropriate

    line 71
  12. Distinctive:

    Test the metrics endpoint manually if added:

    line 81
  13. Distinctive:

    Update the middleware table in the Structured logging section to document any new middleware added.

    line 89

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Observability Setup

Adds production-grade observability features to the FastMCP server on top of the base middleware already configured in server.py.

When to use

  • The server is heading toward a production or staging deployment
  • Logs need correlation IDs for request tracing
  • Slow requests need to be flagged automatically
  • A Prometheus-compatible /metrics endpoint is required
  • The current JSON log output needs additional structured fields

Baseline

The project already includes:

  • ErrorHandlingMiddleware — catches unhandled exceptions
  • TimingMiddleware — measures request duration
  • StructuredLoggingMiddleware — JSON request logs when LOG_FORMAT=json

This skill adds on top of that baseline.

Step 1 — Interview the user

Ask which features to add. Use vscode_askQuestions if available.

#FeatureWhat it adds
ARequest ID middlewareInjects a X-Request-ID header and attaches it to every log record
BSlow-request loggerLogs a warning when a request exceeds a configurable threshold (ms)
CPrometheus /metrics endpointExposes request count and latency histograms via prometheus-client

Ask for confirmation of which to apply before making changes.

Step 2 — Detect the package name

Read pyproject.toml to find PACKAGE.

Step 3 — Apply: Request ID middleware (if selected)

See ./references/middleware-examples.md for the implementation.

Changes:

  • Add RequestIDMiddleware class to server.py
  • Register it via mcp.add_middleware(RequestIDMiddleware()) — place it outermost (before ErrorHandlingMiddleware)
  • No new env vars needed

Step 4 — Apply: Slow-request logger (if selected)

See ./references/middleware-examples.md for the implementation.

Changes:

  • Add SlowRequestMiddleware class to server.py, threshold read from config
  • Add SLOW_REQUEST_THRESHOLD_MS field to config.py with default 1000
  • Add SLOW_REQUEST_THRESHOLD_MS=1000 to .env.example
  • Register via mcp.add_middleware(SlowRequestMiddleware()) — place after ErrorHandlingMiddleware, before TimingMiddleware

Step 5 — Apply: Prometheus metrics endpoint (if selected)

See ./references/middleware-examples.md for the implementation.

Changes:

  • Add prometheus-client to [project.dependencies] in pyproject.toml
  • Create src/PACKAGE/routes/metrics.py with a GET /metrics route
  • Add from PACKAGE.routes import metrics # noqa: F401 to __main__.py
  • Add a CounterMiddleware or use prometheus-client multiprocess support as appropriate

Step 6 — Validate

uv pip install -e ".[dev]"
ruff check .
pytest -v

Test the metrics endpoint manually if added:

fastmcp-blueprint &
curl http://localhost:8000/metrics

Step 7 — Update AGENTS.md

Update the middleware table in the Structured logging section to document any new middleware added.

Step 8 — Report

Tell the user what was added, which env vars are new, and how to verify each feature is working.

Download now (ZIP)

  • Other versions11 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 11

    1. proflead/codex-skills-library★ 153same name
    2. navikt/copilot★ 60same name
    3. jaskirat1616/grok-skills★ 22same name
    4. Indium-AI-Labs/indium-agentkit★ 18same name
    5. Ionate-Technologies/indium-agentkit★ 17same name
    6. JayRHa/agent-skills★ 12same name
    7. JayRHa/AgentSkills★ 12same name
    8. navikt/hovmester★ 2same name
    9. jpoindexter/theft-kit★ 1same name
    10. njt2810/claude-code-framework★ 1same name

    1 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use compliance-audit, api-design and 1 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • arndvsSkill

      compliance-audit

      Auto-invoke after any do-work, tdd, systematic-debugging, or review-pr-copilot task completes to review the diff against active rules and skills, flag violations, update the skill if a gap is found, and close the loop between 'rule was loaded' and 'rule was followed'.

      Also in 3 projects that use this

    • MicrosoftSkill

      api-design

      Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

      Also in 4 projects that use this

    • SentrySkill

      security-review

      Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

      Also in 4 projects that use this

  • In this repository12 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.