agentleFS
LeostrukaLeostruka/devin-bundle/skills/observability-quality/SKILL.md

observability-quality

Skill0 starsChanged 4 months agoMITView on GitHub

Use when adding logging, metrics, distributed tracing, error monitoring, linting, architecture testing, or test infrastructure to a project. Covers OpenTelemetry, Sentry/Datadog/Grafana, Biome/ESLint, ArchUnit, commitlint, Knip, Playwright, and coverage strategy. Infrastructure and tooling quality only; writing feature tests goes to testing or e2e-testing.

  • Installs packages

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every function call (tracing overhead compounds)

    line 67
  2. Distinctive:

    Treat high coverage as quality proof

    line 157
  3. Distinctive:

    When test suite quality matters more than CI speed

    line 167
  4. Very specific:

    When the user names a specific library version or asks about current APIs, invoke the context7 skill before proposing code.

    line 200
  5. Distinctive:

    If a tool's current documentation contradicts this skill, prefer the Context7 result and note the conflict.

    line 202

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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 and Code Quality

Evidence-based guidance for three quality pillars. Synthesized from academic research (Microsoft Research, Google, ICSE, FSE, OOPSLA) and industry standards (CNCF, OpenTelemetry, Playwright).

When to apply

These practices are NOT universal. Apply based on project context:

Project typeObservabilityLintTests
Production service (multi-user)Full (OTel + backend)Full toolchainFull pyramid
Internal toolSentry (errors only)Lint + formatUnit + integration
Prototype / MVPConsole loggingLint onlySmoke tests
Library / packageMinimalFull toolchainFull + mutation testing
Solo scriptNoneNoneNone

Observability overhead is real: tracing adds 16-180% latency (Google: 16.3% avg, Facebook: 1.16 GB/s trace data). Don't add tracing to prototypes or low-traffic services.

Pillar 1: Observability

Foundation: OpenTelemetry (OTel)

OTel is the CNCF industry standard. 217% growth among Fortune 500 (2024). 90+ vendor backends. Vendor-neutral — no lock-in.

Three signals (in order of priority):

  1. Logs — structured, with consistent fields (timestamp, level, traceId, service, message)
  2. Metrics — counters (requests, errors), histograms (latency), gauges (queue depth)
  3. Traces — end-to-end request flow across services (highest overhead, apply last)

Backend selection

BackendBest forCostLimitation
SentryError tracking, stack traces, session replayFree tier generousNo infra monitoring
Grafana CloudMetrics + logs + traces (self-host or cloud)$0-300/moRequires config effort
DatadogFull-stack, 700+ integrations, best UXExpensive at scalePer-host pricing punishes growth
New RelicAPM, 100GB/mo free tierFree tierUX loses to Datadog

Recommended combo for small teams: Sentry (errors) + Grafana Cloud (metrics/logs) = $50-300/mo.

Recommended for enterprises: OTel collection layer + Datadog backend (if budget allows).

What to instrument

PriorityWhatSignal
1Unhandled errors, exceptionsSentry / log ERROR
---------
2Request latency (p50, p95, p99)Metric histogram
3Error rate (4xx, 5xx)Metric counter
4Request flow across servicesTrace (only if multi-service)
5Business metrics (signups, conversions)Metric counter

What NOT to instrument

  • Prototypes and MVPs (overhead > value)
  • Single-process scripts (no distributed tracing needed)
  • Low-traffic internal tools (console.log is fine)
  • Every function call (tracing overhead compounds)

Pillar 2: Code quality and linting

Toolchain (by category)

CategoryRecommended toolAlternativeWhen to use alt
Linter + formatterBiomeESLint + PrettierNeed type-aware rules or 2400+ plugins
Architecture contractsArchUnit (Java/.NET)dependency-cruiser (JS)JS/TS projects
Commit lintingcommitlint—If using conventional commits
Dead codeKnip (JS/TS)ts-pruneJS/TS projects
Type checkingtsc / biome check—All TS projects

Biome vs ESLint

FactorBiomeESLint
Speed10-56x fasterBaseline
Rules502 rules, ~94% of common ESLint2400+ plugins
Type-awarePartial (~75-85%)Full
Plugin ecosystemNone (all-in-one)Massive
ConfigSingle file, simpleComplex, plugin conflicts

Choose Biome for: new projects, speed-critical CI, simplicity. Choose ESLint for: complex TypeScript, type-aware rules, existing plugin dependencies.

Architecture testing

ArchUnit enforces architectural boundaries at test time. Prevents layer violations (e.g., controllers calling DB directly).

// ArchUnit (Java) example
noClasses().that().resideInAPackage("..controller..")
    .should().dependOnClassesThat().resideInAPackage("..repository..");

For JS/TS: dependency-cruiser provides similar capability.

When to use: projects with defined layers (controller/service/repository). Skip for prototypes or single-file modules.

Commitlint

Enforces conventional commit format. Add to CI as a gate:

npm install --save-dev @commitlint/cli @commitlint/config-conventional
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js

Husky hook: commitlint --edit $1 on commit-msg.

Pillar 3: Testing

Test strategy

LayerProportionToolSpeed
Static analysisBaseBiome/tscInstant
Unit testsManyVitest/Jest/pytest<100ms each
Integration testsSomeVitest/pytest<1s each
E2E testsFewPlaywright5-30s each

Testing Trophy (Kent C. Dodds) — integration-heavy — is preferred for web apps. Test Pyramid — unit-heavy — is preferred for libraries and complex domain logic.

Playwright (E2E)

Industry standard (Microsoft-backed). Auto-waiting, web-first assertions, multi-browser, mobile emulation.

Flakiness expectation: Google reports ~16% of E2E tests are flaky. This is inherent, not a tooling failure. Mitigate with:

  • page.waitForURL() / page.waitForSelector() (auto-wait)
  • expect(locator).toBeVisible() (web-first assertions)
  • Retry in CI (1-2 retries, not more)
  • Quarantine flaky tests, don't delete

Coverage: screen, not gate

Research findings:

  • Microsoft Research: coverage has insignificant correlation with post-release bugs at project level
  • UC Irvine: weak negative correlation with bug-fixes
  • TU Delft: >80% of engineers ignore failing coverage checks

Use coverage to:

  • Find untested code paths
  • Identify critical paths lacking tests
  • Track trends over time

Do NOT use coverage to:

  • Enforce arbitrary percentage thresholds (80%, 90%)
  • Gate PRs on coverage percentage
  • Treat high coverage as quality proof

Binary threshold that works: covered vs not-covered. Code with tests has ~50% fewer bug-fixes than untested code. The binary matters; the percentage doesn't.

Mutation testing (conditional)

Mutation testing is more reliable than coverage but expensive. Use testing skill for the full workflow.

When to use:

  • Critical systems (security, financial, safety)
  • When test suite quality matters more than CI speed
  • Educational settings

When to skip:

  • Rapid iteration / prototypes
  • Limited CI resources
  • Large existing test suites (cost compounds)

Integration with existing skills

This skill coversExisting skillUse both
Test strategy overviewtestingYes — tdd for implementation, this for infrastructure
Mutation testing guidancetestingYes — this for when, that for how
Verification gatesgatesYes — this for setup, that for per-task check
Code reviewcode-reviewIndependent
CI debuggingdebuggingIndependent

Setup checklist (new project)

  • Biome configured (biome init)
  • TypeScript strict mode
  • commitlint + husky
  • Knip in CI (knip --production)
  • Vitest/Jest for unit + integration
  • Playwright for E2E (if web app)
  • Sentry for error tracking (if production)
  • OTel SDK if multi-service (logs + metrics first, traces last)
  • Coverage reporting (Codecov/Coveralls) as screen, not gate
  • ArchUnit/dependency-cruiser if layered architecture

Up-to-date docs

When the user names a specific library version or asks about current APIs, invoke the context7 skill before proposing code. Good candidates: OpenTelemetry, Sentry, Datadog, Grafana, Biome, ESLint, Prettier, Knip, Playwright, ArchUnit.

If a tool's current documentation contradicts this skill, prefer the Context7 result and note the conflict.

Sources

Download now (ZIP)

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.