agentleFS
yiouliyiouli/pixie-qa/CLAUDE.md

pixie-qa

CLAUDE.md7 starsChanged 8 months agoMITView on GitHub

pixie-qa is a Python package and coding-agent skill for automated quality assurance of AI applications. Published as pixie, it provides instrumentation, evaluation, and observability primitives for LLM-powered apps. Test file naming: prefix test_, mirror source directory structure, one file per source module. Never use pip install — all dependency changes go through uv. Always run tools through uv run. Commit uv.lock alongside pyproject.toml changes. Write or verify tests BEFORE implementing features. All tests for the pixie module must be in…

  • Installs packages

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

14 rules. About 0 are common, 8 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

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

    Always run tools through uv run.

    line 76
  2. Distinctive:

    Write test first → verify it fails (red)

    line 86
  3. Distinctive:

    Run all tests to check for regressions

    line 89
  4. Distinctive:

    Run manual e2e verification whenever changing:

    line 103
  5. Distinctive:

    Run the manual fixture:

    line 113
  6. Distinctive:

    Independent: no shared state or execution order dependency

    line 127
  7. Distinctive:

    All function signatures must have type annotations for parameters and return values

    line 146
  8. Very specific:

    Use | syntax for unions (not Optional or Union)

    line 147
  9. Very specific:

    Use from __future__ import annotations at top of files

    line 148
  10. Very specific:

    Avoid type: ignore, Any, and cast() unless absolutely necessary

    line 149
  11. Distinctive:

    Use frozen dataclasses for immutable span types

    line 150
  12. Distinctive:

    Never implement everything at once.

    line 173
  13. Very specific:

    Before writing new code, search the codebase for existing similar code.

    line 179
  14. Very specific:

    Every non-trivial feature or bug fix requires a file under changelogs/<feature>.md containing:

    line 200

≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md 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
CLAUDE.md

CLAUDE.md — pixie-qa

Project Overview

pixie-qa is a Python package and coding-agent skill for automated quality assurance of AI applications. Published as pixie, it provides instrumentation, evaluation, and observability primitives for LLM-powered apps.

Technology Stack

  • Python 3.11+ with type hints
  • uv for package management, virtual environments, and builds
  • pytest for testing
  • mypy for static type checking
  • ruff for linting and formatting
  • OpenTelemetry SDK and OpenInference for LLM call instrumentation

Package Structure

pixie/
  __init__.py
  assets/
    index.html           # compiled React scorecard (build artifact, gitignored)
  cli/
    test_command.py      # pixie test entry point
  evals/
    scorecard.py         # scorecard data models + template-based HTML generation
  instrumentation/
    __init__.py          # public API: init(), flush()
    spans.py             # ObserveSpan, LLMSpan, message/content types
    handler.py           # InstrumentationHandler ABC
    wrap.py              # wrap() API for data-object-based tracing
    processor.py         # LLMSpanProcessor (OTel SpanProcessor)
    queue.py             # _DeliveryQueue (background worker thread)
    instrumentors.py     # auto-discovers and activates OpenInference instrumentors
    py.typed

frontend/                # React scorecard SPA source
  src/                   # React components, types, styles
  package.json           # React 19, Vite 6, vite-plugin-singlefile
  vite.config.ts         # builds to ../pixie/assets/

tests/
  pixie/                 # automated tests (pytest)
    cli/
      test_test_command.py   # CLI unit tests
      e2e_fixtures/          # mock evaluators and datasets for e2e
    evals/
    instrumentation/
  manual/                # manual testing fixtures (not run by pytest)
    mock_evaluators.py
    datasets/
      sample-qa.json     # run with: pixie test tests/manual/datasets/sample-qa.json

specs/                   # design specs and architecture docs

Test file naming: prefix test_, mirror source directory structure, one file per source module.


Package Management (uv)

Never use pip install — all dependency changes go through uv.

uv sync                          # Install/sync all dependencies
uv add <package>                 # Add runtime dependency
uv add --dev <package>           # Add dev dependency
uv run pytest                    # Run tests
uv run mypy pixie/               # Type check
uv run ruff check .              # Lint
uv run ruff format .             # Format
uv build                         # Build package

Always run tools through uv run. Commit uv.lock alongside pyproject.toml changes.


Test-Driven Development (TDD)

Write or verify tests BEFORE implementing features.

Workflow:

  1. Write test first → verify it fails (red)
  2. Implement minimal code → verify it passes (green)
  3. Refactor if needed, keeping tests green
  4. Run all tests to check for regressions

All tests for the pixie module must be in tests/pixie/.

Running Tests

uv run pytest                                                      # All tests
uv run pytest tests/pixie/                                        # pixie tests only
uv run pytest --cov=pixie                                         # With coverage

E2E Verification for pixie test

Run manual e2e verification whenever changing:

  • pixie/cli/test_command.py
  • pixie/cli/main.py
  • pixie/harness/runner.py
  • pixie/evals/scorecard.py
  • pixie/evals/criteria.py

Agent verification protocol:

  1. Run the manual fixture:

    export PIXIE_ROOT=/tmp/pixie_e2e_verify
    uv run pixie test tests/manual/datasets/sample-qa.json --no-open
  2. Inspect console output — verify all 5 items appear with evaluator names and scores
  3. Inspect HTML scorecard with Playwright — verify evaluator names, scores, PASS/FAIL badges, and detail modals

Test Quality

  • Focused: one thing per test
  • Independent: no shared state or execution order dependency
  • Fast: mock external dependencies (OTel, LLM providers)
  • Clear: arrange-act-assert structure

Type Safety

Both mypy and Pylance must be clean (they catch different errors).

uv run mypy pixie/               # Type check pixie module
uv run mypy tests/pixie/         # Type check tests

Also check Pylance diagnostics in VS Code Problems panel — zero errors required before committing.

Rules:

  • All function signatures must have type annotations for parameters and return values
  • Use | syntax for unions (not Optional or Union)
  • Use from __future__ import annotations at top of files
  • Avoid type: ignore, Any, and cast() unless absolutely necessary
  • Use frozen dataclasses for immutable span types

Code Quality

uv run ruff check .              # Lint
uv run ruff format .             # Format

Incremental Development

Break large features into small, independent tasks. Before and after each task:

uv run pytest
uv run mypy pixie/
# Check Pylance Problems panel

Never implement everything at once. Fix issues between tasks, not at the end.


Code Reuse

Before writing new code, search the codebase for existing similar code. Extract shared helpers when the same logic appears in 2+ places. Keep span types in pixie/instrumentation/spans.py, base classes as ABCs.


Documentation Requirements

Documentation is part of implementation, not a follow-up.

README Scoping Rules

Change typeREADMEs to update
New top-level directoryCreate <dir>/README.md + update root README.md
New package directoryCreate <dir>/README.md + update docs/package.md
New test fixtures or test directoriesUpdate tests/README.md
CLI or scorecard changesUpdate docs/package.md + tests/README.md
Build process changesUpdate frontend/README.md + pixie/assets/README.md
API changesUpdate docs/package.md + relevant module docstrings

Changelog

Every non-trivial feature or bug fix requires a file under changelogs/<feature>.md containing:

  • What changed and why
  • Files affected
  • Migration notes (if API behavior changed)

Hard Completion Gate

A task is not complete until all of the following are updated in the same change set:

  1. Relevant README.md files
  2. Relevant specs/*.md (design/behavior/architecture)
  3. changelogs/<feature>.md
  4. tests/README.md (if test structure changed)

Error Handling Rules

  1. Never raise from LLMSpanProcessor.on_end() — wrap entire body in try/except
  2. Never raise from _DeliveryQueue._worker() — wrap each iteration
  3. Never raise from submit() — drop silently on full queue
  4. Handler method exceptions are silently swallowed — must not crash delivery thread
  5. Malformed JSON in span attributes — fall back to {} or None, never raise

Pre-Commit Checklist

  1. ✅ Write/update tests in tests/pixie/
  2. ✅ uv run pytest — all tests pass
  3. ✅ uv run mypy pixie/ — zero type errors
  4. ✅ Pylance Problems panel — zero errors
  5. ✅ uv run ruff check . — no linting errors
  6. ✅ Docstrings / README.md / specs/ updated
  7. ✅ changelogs/<feature>.md added/updated
  8. ✅ If touching pixie test/scorecard/evaluation harness/eval: run the agent verification protocol — run pixie test on the manual fixture and inspect console output + scorecard HTML with Playwright
  9. ✅ All relevant README.md files updated per scoping rules

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.