ai-system-review
Skill1 starsChanged 7 months agoMITView on GitHub
Review LLM application code for context assembly quality, retrieval integration, prompt construction, output validation, cost controls, and failure handling
In this repository206 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-healthSkill
- skill-validatorSkill
- accessibilitySkill
- agent-debugSkill
- agent-evaluateSkill
- ai-governanceSkill
- api-docs-generateSkill
- api-examplesSkill
- api-mockSkill
- api-test-generateSkill
- api-validateSkill
- architecture-diagramSkill
- ask-mattSkill
- assumption-mapSkill
- boilerplateSkill
- brainstormSkill
- branch-finishSkill
- briefingSkill
- browser-testing-with-devtoolsSkill
- bundle-analyzeSkill
- cache-strategySkill
- canarySkill
- carefulSkill
- cavemanSkill
- changelog-autoSkill
- chaos-testSkill
- ci-setupSkill
- ci-sweepSkill
- cleanprojectSkill
- click-path-auditSkill
- codebase-designSkill
- code-review-checklistSkill
- code-tourSkill
- commitSkill
- completion-verifySkill
- complexity-reduceSkill
- component-librarySkill
- config-cleanupSkill
- config-generateSkill
- conflict-resolveSkill
- container-optimizeSkill
- context-budgetSkill
- context-engineeringSkill
- context-restoreSkill
- context-saveSkill
- continuous-learningSkill
- contributingSkill
- cost-trackSkill
- councilSkill
- create-todosSkill
- cross-modal-reviewSkill
- database-connectSkill
- db-diagramSkill
- ddd-modelSkill
- debug-root-causeSkill
- debug-sessionSkill
- debug-systematicSkill
- decision-logSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Check how context is built before each LLM call:
- Distinctive: line 135
Multiple providers: Check each client independently.
- Distinctive: line 137
Streaming: Verify error handling works mid-stream (not just at call start).
- Distinctive: line 146
Early exit: If no LLM client imports detected in the target path, report "No LLM integration found" and exit.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
AI System Review
Evaluate LLM-powered application code for reliability, quality, and cost. Covers context assembly, retrieval pipelines (RAG), prompt design, output validation, error handling, and spend controls.
Usage
/ai-system-review # review staged changes
/ai-system-review <path> # review a specific directory or file
/ai-system-review --prompts # focus only on prompt quality
/ai-system-review --costs # focus only on token cost controlsBehavior
Step 1 — Map the LLM system boundary
# Find model client calls
grep -rn "openai\|anthropic\|bedrock\|vertexai\|litellm\|langchain\|llamaindex" \
--include="*.ts" --include="*.py" --include="*.js" -l . | head -20
# Find prompt templates
find . -name "*.txt" -o -name "*.md" -o -name "*.jinja" | xargs grep -l "{{.*}}\|\${.*}\|<user>\|<system>" 2>/dev/null | head -10Step 2 — Review context assembly
Check how context is built before each LLM call:
| Concern | What to look for | Risk |
| Context window overflow | No token counting before call | Truncation silently corrupts prompt |
| Injection risk | User input concatenated directly into system prompt | Prompt injection |
| Stale context | No timestamp or recency check on retrieved chunks | Outdated information presented as current |
| Missing metadata | Retrieved chunks lack source / date | Hallucination is unverifiable |
| Token waste | Entire documents passed when only sections needed | Unnecessary cost |
Step 3 — Review retrieval pipeline (if RAG)
grep -rn "similarity_search\|retrieve\|vectorstore\|embed\|chromadb\|pinecone\|weaviate\|qdrant" \
--include="*.ts" --include="*.py" -l . 2>/dev/nullCheck:
- Chunking strategy: Fixed-size vs semantic; chunk size vs model context window
- Retrieval quality signals: Is
score/distancechecked before including chunks? - Top-k threshold: Hard cap on retrieved chunks regardless of relevance score?
- Re-ranking: Any cross-encoder re-ranking before context assembly?
- Hybrid search: BM25 + dense retrieval or dense-only?
Step 4 — Review prompt construction
For each prompt template:
- System prompt scope: Is it the minimum necessary? Bloated system prompts cost on every call.
- Few-shot examples: Are they hardcoded or dynamically selected? Hardcoded examples may be irrelevant.
- Output format instructions: Does the prompt specify JSON/structured output? Is it enforced with tool use / response format?
- Role separation: System vs user vs assistant boundaries respected?
- Instruction conflict: Contradictory instructions in system + user turns?
Step 5 — Review output validation
grep -rn "JSON.parse\|json.loads\|parse\|validate\|schema\|zod\|pydantic" \
--include="*.ts" --include="*.py" -l . 2>/dev/null | head -10Check:
- Is LLM output parsed and validated before use?
- Is there a fallback when output is malformed?
- Are numeric/boolean outputs range-checked?
- For agentic workflows: are tool call results validated before passing back to model?
Step 6 — Review cost controls
grep -rn "max_tokens\|maxTokens\|stream\|usage\|cost\|budget" \
--include="*.ts" --include="*.py" -l . 2>/dev/null | head -10Check:
max_tokens/max_completion_tokensset on every call?- Streaming used for long outputs (reduces TTFB)?
- Token usage logged per request?
- Monthly spend cap or alert configured?
- Caching for repeated identical prompts (
cache_control,prompt_caching)?
Step 7 — Review error handling
- What happens when the LLM API returns 429 (rate limit)?
- What happens on 500 or timeout?
- Is there a retry with exponential backoff?
- Does the application surface a graceful degradation to the user?
Step 8 — Report findings
AI SYSTEM REVIEW — <path>
Context Assembly (2 issues)
src/chat/context.py:34 No token counting — long conversations will silently truncate
src/search/rag.py:78 User query concatenated directly into system prompt (injection risk)
Retrieval (1 issue)
src/rag/retriever.py:55 Retrieved chunks used regardless of similarity score — low-relevance
context degrades answer quality
Prompt Quality (2 issues)
prompts/system.txt System prompt is 1,800 tokens — costs $0.002/call at current volume
prompts/extract.txt No structured output format specified — JSON parsing will fail intermittently
Output Validation (1 issue)
src/api/handler.py:92 LLM JSON parsed with json.loads, no schema validation — malformed
output propagates to downstream service
Cost Controls (2 issues)
src/llm/client.py No max_tokens set — runaway responses possible
No prompt caching Repeated system prompt costs money on every call (enable cache_control)
Error Handling (1 issue)
src/llm/client.py:18 No retry logic — single API error returns 500 to userEdge Cases
- Multiple providers: Check each client independently; flag inconsistent error handling across providers.
- Agentic / multi-step: Trace the full loop — check that tool results are validated before re-entry.
- Streaming: Verify error handling works mid-stream (not just at call start).
- No RAG: Skip Step 3 and note it was not applicable.
Token Optimization
Expected range: 500–2,000 tokens (grep-driven analysis); 200–400 tokens (single-focus mode with --prompts or --costs)
Patterns used: Grep-before-Read, git diff scope, progressive disclosure, early exit
Early exit: If no LLM client imports detected in the target path, report "No LLM integration found" and exit.
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.

