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
- Very specific: line 30
Ask which features to add.
- Distinctive: line 38
Ask for confirmation of which to apply before making changes.
- Very specific: line 42
Read pyproject.toml to find PACKAGE.
- Very specific: line 49
Add RequestIDMiddleware class to server.py
- Distinctive: line 51
No new env vars needed
- Very specific: line 58
Add SlowRequestMiddleware class to server.py, threshold read from config
- Very specific: line 59
Add SLOW_REQUEST_THRESHOLD_MS field to config.py with default 1000
- Very specific: line 60
Add SLOW_REQUEST_THRESHOLD_MS=1000 to .env.example
- Very specific: line 68
Add prometheus-client to [project.dependencies] in pyproject.toml
- Very specific: line 69
Create src/PACKAGE/routes/metrics.py with a GET /metrics route
- Very specific: line 71
Add a CounterMiddleware or use prometheus-client multiprocess support as appropriate
- Distinctive: line 81
Test the metrics endpoint manually if added:
- Distinctive: line 89
Update the middleware table in the Structured logging section to document any new middleware added.
“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.
Files
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
/metricsendpoint is required - The current JSON log output needs additional structured fields
Baseline
The project already includes:
ErrorHandlingMiddleware— catches unhandled exceptionsTimingMiddleware— measures request durationStructuredLoggingMiddleware— JSON request logs whenLOG_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.
| # | Feature | What it adds |
| A | Request ID middleware | Injects a X-Request-ID header and attaches it to every log record |
| B | Slow-request logger | Logs a warning when a request exceeds a configurable threshold (ms) |
| C | Prometheus /metrics endpoint | Exposes 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
RequestIDMiddlewareclass toserver.py - Register it via
mcp.add_middleware(RequestIDMiddleware())— place it outermost (beforeErrorHandlingMiddleware) - No new env vars needed
Step 4 — Apply: Slow-request logger (if selected)
See ./references/middleware-examples.md for the implementation.
Changes:
- Add
SlowRequestMiddlewareclass toserver.py, threshold read from config - Add
SLOW_REQUEST_THRESHOLD_MSfield toconfig.pywith default1000 - Add
SLOW_REQUEST_THRESHOLD_MS=1000to.env.example - Register via
mcp.add_middleware(SlowRequestMiddleware())— place afterErrorHandlingMiddleware, beforeTimingMiddleware
Step 5 — Apply: Prometheus metrics endpoint (if selected)
See ./references/middleware-examples.md for the implementation.
Changes:
- Add
prometheus-clientto[project.dependencies]inpyproject.toml - Create
src/PACKAGE/routes/metrics.pywith aGET /metricsroute - Add
from PACKAGE.routes import metrics # noqa: F401to__main__.py - Add a
CounterMiddlewareor useprometheus-clientmultiprocess support as appropriate
Step 6 — Validate
uv pip install -e ".[dev]"
ruff check .
pytest -vTest the metrics endpoint manually if added:
fastmcp-blueprint &
curl http://localhost:8000/metricsStep 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.
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- proflead/codex-skills-library★ 153same name
- navikt/copilot★ 60same name
- jaskirat1616/grok-skills★ 22same name
- Indium-AI-Labs/indium-agentkit★ 18same name
- Ionate-Technologies/indium-agentkit★ 17same name
- JayRHa/agent-skills★ 12same name
- JayRHa/AgentSkills★ 12same name
- navikt/hovmester★ 2same name
- jpoindexter/theft-kit★ 1same name
- 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.
arndvsSkillcompliance-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
MicrosoftSkillapi-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
SentrySkillsecurity-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.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-resourceSkill
- add-routeSkill
- add-toolSkill
- auth-setupSkill
- bootstrap-personalizeSkill
- deployment-profileSkill
- docs-syncSkill
- release-readinessSkill
- rename-projectSkill
- test-scaffoldSkill
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
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.

