lfe-diagnose

lfe-diagnose is a skill for Claude Code, Codex from StChiotis/Library-First-Engineering. It costs 42 tokens per session (774 once invoked), scanned A, original, MIT.

A bug-diagnosis workflow that reproduces a failing behavior, forms a hypothesis, applies a minimal fix, and sends the result back for verification.

In plain words
What is it for?
Use it when an inspection finds a failure that needs a reproducible test or script, a targeted fix, and another verification pass.
Why use it?
It keeps debugging focused on the first failed inspection and avoids unrelated refactoring.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

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/stchiotis/library-first-engineering/lfe-diagnose
Any agent
npx skills add StChiotis/Library-First-Engineering --skill lfe-diagnose
Clone the repo
git clone --depth 1 https://github.com/StChiotis/Library-First-Engineering

Made for: Claude Code, Codex.

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 lfe-diagnose

README.md
[![agentmods](https://agentmods.dev/badge/skills/stchiotis/library-first-engineering/lfe-diagnose.svg)](https://agentmods.dev/skills/stchiotis/library-first-engineering/lfe-diagnose)
Your own site
<a href="https://agentmods.dev/skills/stchiotis/library-first-engineering/lfe-diagnose"><img src="https://agentmods.dev/badge/skills/stchiotis/library-first-engineering/lfe-diagnose.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 774 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.00042 $0.00774
Opus 5 $0.00021 $0.00387
Sonnet 5 $0.00008 $0.00155
Haiku 4.5 $0.00004 $0.00077

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

Security

Grade A, and why

lfe-diagnose 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.

.agents/skills/lfe-diagnose/SKILL.md · 67 lines

How it starts

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

LFE Diagnose

Position in Pipeline

  • Phase: 3 (Inspector sub-pipeline, Step 3 — conditional)
  • Persona: Inspector (triggers), Builder (fixes)
  • Trigger: Called by Inspector when /lfe-inspector verification fails
  • Input: Failing behavior identified during inspection
  • Output: Fix applied → returns to Builder sub-pipeline for re-verification

Hard Rules

  1. First-failure only: Diagnose may only run on the first failed inspection of a slice. The Inspector's Cycle Guard (lfe-inspector/SKILL.md Cycle Guard step) is responsible for blocking re-entry on the second failure. If you discover that .plans/inspection_report.md already records a status: failed for the same slice:, halt immediately, leave the existing report as-is, and bounce back to Inspector for Brain triage (see LOOP_ARCHITECTURE.md Scenario 2.2). This is a defensive belt-and-braces check; the Cycle Guard should have prevented this entry.
  2. Minimal fix only: Solve the diagnosed problem, nothing more. No opportunistic refactors.

Process

  1. Feedback Loop: Build a deterministic repro (test/script) that reliably demonstrates the failure.
  2. Reproduce: Run the loop and witness the failure. Confirm it matches the Inspector's reported issue.
  3. Hypothesise: Generate 3-5 ranked, falsifiable hypotheses for the root cause.
  4. Instrument: Add targeted probes to test hypotheses one at a time. Eliminate hypotheses until the root cause is confirmed.
  5. Fix: Write a regression test that captures the bug → Apply the minimal fix → Watch the test pass.
  6. Persist Diagnosis: Write .plans/diagnosis_report.md so the why of the fix survives a session crash. Schema below.
  7. Handoff: Return to Builder sub-pipeline. The Builder runs the full test suite, then the Inspector re-verifies.

Coordination File Output

Per the contract in COORDINATION_FILES.md:

---
phase: inspector
step: diagnose
status: complete
timestamp: <ISO-8601>
source: .plans/tdd_report.md
slice: <copied from active_plan.md — used by /lfe-builder to detect a stale report>
---

Read the full file on GitHub · 67 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 · 67 lines · 42 tokens per session scan A f1b01bb2a1b6

Subscribe to this mod's changes

lfe-diagnose is a skill published in the GitHub repository StChiotis/Library-First-Engineering (43 stars, last pushed 1mo ago), licensed MIT. It adds 42 tokens to every session and 774 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

sensitive-logging-audit

Audit and fix sensitive-data exposure through Python runtime logging in openai-agents-python. Use when reviewing logging, print, warnings, stderr, traceback, MCP names, model or tool exceptions, redaction flags, or any diagnostic path that may retain user data.

openai/openai-agents-python · 59 tokens

credit-note-fixer

Fix the tiny credit-note formatting bug and rerun the exact targeted test command.

openai/openai-agents-python · 21 tokens

code-review

Reviews code for bugs, security issues, and best practices.

promptfoo/promptfoo · 11 tokens

bug-reproducer

Find likely software bugs in a codebase, rank concrete bug candidates, and prove or reject them with focused regression tests before proposing a fix. Also turn bug reports, stack traces, screenshots, failing behavior, support tickets, and regressions into minimal reproducible cases with red-to-green evidence. Use when…

AnastasiyaW/codex-claude-code-config · 147 tokens

code-complexity

Keep each unit comprehensible while the code grows: deep modules over shallow ones, information hiding, honest names, small functions with one job, error handling that does not lose the error, DRY and orthogonality, design by contract, and not leaving broken windows. Merges module-complexity management with…

AnastasiyaW/codex-claude-code-config · 252 tokens

refactoring-safely

Change the structure of code that already exists without changing what it does: smells as triggers, the named transformations (extract/inline, move feature, organise data, simplify conditionals), and above all the workflow that makes it safe — characterization tests first, one transformation at a time, green between…

AnastasiyaW/codex-claude-code-config · 221 tokens