agentsclimarketplace

Llm qa

Skill manastalukdar/ai-devstudio/skills/llm-qa

Investigate LLM output quality issues — trace hallucination root causes across context, retrieval, prompts, tool use, and workflow designFrom its SKILL.md

Install
npx -y skills add manastalukdar/ai-devstudio --skill llm-qa

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.8 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it

LLM QA — Output Quality Investigation

Root-cause analysis for LLM output failures: hallucinations, refusals, format errors, incomplete answers, and regression in answer quality.

Usage

/llm-qa "<description of the quality issue>"   # investigate a specific failure
/llm-qa --regression                           # compare output quality before/after a change
/llm-qa --prompts <path>                       # audit prompt files for known quality anti-patterns

Behavior

Step 1 — Classify the failure type

Identify which category the quality issue falls into:

Failure typeSymptomsPrimary suspects
HallucinationConfident wrong facts, invented citationsContext gap, stale retrieval, no grounding
RefusalUnexpected "I can't help with that"System prompt over-restriction, safety over-triggering
Format errorMalformed JSON, missing fields, wrong structureNo output schema, inconsistent instructions
Incomplete answerTruncated, missing steps, dropped contextmax_tokens too low, context window overflow
Quality regressionCorrect before, wrong after recent changePrompt changed, model changed, retrieval changed
InconsistencyDifferent answers to the same questionTemperature too high, no seed, non-deterministic retrieval

Step 2 — Reconstruct the failing call

Ask for (or locate in code):

  1. The exact system prompt used
  2. The user input that triggered the failure
  3. The retrieved context (if RAG)
  4. The model and parameters (temperature, max_tokens, top_p)
  5. The actual vs expected output
# Find where the failing call is constructed
grep -rn "system_prompt\|systemPrompt\|messages\s*=" --include="*.py" --include="*.ts" -n . | head -20

Step 3 — Audit context quality

Check whether the model had the information it needed:

  • Context gap: Was the correct information present in the retrieved chunks or conversation history?
  • Context relevance: Were irrelevant chunks crowding out relevant ones? Check similarity scores.
  • Context recency: Is the retrieved information current? Check timestamps or version markers.
  • Context length: Was the context near the model's limit? Truncation causes hallucination at boundaries.
# Estimate tokens in context (rough: 1 token ≈ 4 chars)
wc -c context.txt | awk '{print int($1/4), "approx tokens"}'

Step 4 — Audit the prompt

Check the system prompt and user message for known quality failure patterns:

Anti-patternExampleFix
Contradictory instructions"Be concise" + "explain in detail"Remove one; make priority explicit
Ambiguous output format"Return JSON" without schemaProvide exact JSON schema or use structured output
Missing grounding instructionNo "only use provided context"Add explicit grounding constraint
Persona over-restriction"Never discuss X" too broadNarrow to specific harmful case
Missing failure instructionNo "if unsure, say so"Add explicit uncertainty handling
Long system prompt noise2,000+ token system prompt with irrelevant rulesTrim to minimum necessary

Step 5 — Audit model parameters

ParameterRisk if wrongCheck
temperature> 0.7 increases inconsistencySet 0–0.3 for factual tasks
max_tokensToo low truncates responseCheck against expected output length
top_pCombined with high temp amplifies randomnessUse one of temp or top_p, not both
seedAbsent means non-deterministicSet for reproducibility in tests

Step 6 — Identify root cause and fix

Map the failure to its root cause layer:

Root cause layers (in order of likelihood):
  1. Context gap / retrieval miss → fix retrieval query or chunk strategy
  2. Prompt instruction conflict → remove or clarify conflicting rule
  3. Missing output schema → add structured output / response format
  4. Context overflow → reduce chunk count or trim system prompt
  5. Model parameter → adjust temperature or max_tokens
  6. Model capability limit → switch to a more capable model for this task

Step 7 — Propose regression test

For each root cause fixed, generate a test case to prevent recurrence:

# Regression test template
def test_llm_no_hallucination_on_unknown_topic():
    response = llm_call(
        system="Only answer based on the provided context. If unsure, say 'I don't know'.",
        user="What is the capital of Zorbania?",
        context=""  # empty context — model must refuse, not hallucinate
    )
    assert "don't know" in response.lower() or "not sure" in response.lower()

Edge Cases

  • No access to logs or prompt: Guide the user to capture the failing call; provide a logging snippet to add.
  • Regression after model upgrade: Check for model-specific behavior changes; test with previous model version if possible.
  • Non-English output failure: Check tokenization differences for the target language; consider language-specific prompts.
  • Tool call failures in agentic loop: Trace the tool result that re-entered the context and check if it introduced confusion.

Token Optimization

Expected range: 400–1,500 tokens (full investigation); 200–500 tokens (--prompts audit mode)

Patterns used: Grep-before-Read (locate prompt files before reading), progressive disclosure (classification → audit → root cause → fix), early exit

Early exit: If the failure type is immediately obvious from the description (e.g., "max_tokens too low causing truncation"), skip to Step 6 and propose the fix directly.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.