Improve Your Agent Development Best Practices
This recipe acts as your expert AI engineering consultant. It audits how your team builds and operates the agent, compares it against best practices, delivers quick fixes, then guides you deeper.
Phase 1: Full Audit
Before suggesting anything, read EVERYTHING:
Code Audit
- Read the full codebase: every file, every function, every system prompt
- Study
git log --oneline -50 and read commit messages for WHY things changed. Bug fixes reveal edge cases. Refactors reveal design decisions. These are goldmines for what to test and evaluate.
- Read README, docs, comments for domain context
LangWatch Audit (via CLI)
langwatch trace search --limit 25 --format json to check trace quality (inputs/outputs populated? spans connected? labels present?)
langwatch scenario list --format json to see what scenarios exist. Are they comprehensive or shallow?
langwatch test-suite list --format json to see what test suites exist, and langwatch run-plan list --format json to see what run plans they are run under
langwatch evaluator list --format json to see what evaluators are configured
langwatch monitor list --format json to check for online evaluation monitors
langwatch prompt list --format json to check whether prompts are versioned (or all hardcoded in code)
langwatch analytics query --metric trace-count --format json and --metric total-cost, --metric avg-latency, --metric eval-pass-rate (each with --format json) for the current cost, latency, and error/pass rate baseline
Gap Analysis
Score the setup against the best-practices checklist:
- Observability: traces flowing, inputs/outputs populated, spans connected, metadata and labels present
- Prompt management: prompts versioned and reviewable, not hardcoded strings scattered in code
- Testing: scenario tests exist, cover the agent's real jobs and edge cases, run in CI
- Evaluation: evaluators measure the qualities that matter for the domain, datasets are domain-specific, not generic
- Production monitoring: online monitors watch quality signals on live traffic
- Iteration loop: experiments compare changes before they ship
Identify what's missing entirely, what exists but is weak, and what's working well (keep and build on).
Phase 2: Low-Hanging Fruit
Fix the easiest, highest-impact gaps first:
- Broken instrumentation: fix traces (see the
debug-instrumentation recipe)
- Hardcoded prompts: set up prompt versioning (
langwatch prompt init, see the prompts skill)
- No tests at all: create initial scenario tests (see the
scenarios skill)
- Generic datasets: generate domain-specific ones (see the
datasets skill)
Deliver working results. Show the user what improved.
Phase 3: Guide Deeper
After Phase 2, DON'T STOP. Suggest 2-3 specific improvements based on what you learned:
Domain-specific improvements: Based on the codebase domain, suggest targeted scenarios or evaluations. "I noticed your agent handles [X], should I add edge case tests for [Y]?"
Expert involvement: If the domain is specialized (medical, financial, legal), suggest involving domain experts. "For healthcare scenarios, you'd benefit from a medical professional reviewing the compliance criteria, want me to draft scenarios they can review?"
Data quality: If using synthetic data, suggest real data. "Do you have real customer queries or support tickets? Those would make much better evaluation datasets."
CI/CD integration: If no CI pipeline, suggest adding experiments. "Want me to set up experiments that run in CI to catch regressions?"
Production monitoring: If no online evaluation, suggest monitors. "Your traces show no quality monitoring, want me to set up faithfulness checks on production traffic with langwatch monitor create?"
Learn from production: If traces show real traffic, hand over to the production-insight skills: run /agent-performance for a full diagnosis of how the agent behaves in production, and /agent-improve to turn those findings into tested changes.
Ask light questions with options. Don't overwhelm: pick the top 2-3 most impactful.
Phase 4: Keep Iterating
After each improvement:
- Show what was accomplished
- Run any tests / re-query analytics to verify (
langwatch trace search, langwatch test-suite run <id|name> --target <type:id> --wait, etc.)
- Ask what to tackle next
- Stop when the user says "that's enough"
Common Mistakes
- Do NOT skip the audit; you can't suggest improvements without understanding the current state
- Do NOT give generic advice; every suggestion must be specific to this codebase
- Do NOT overwhelm with 10 suggestions; pick the top 2-3
- Do NOT skip running/verifying improvements
1---2name: agent-best-practices3description: Expert AI engineering consultant for your agent development practices. Audits your codebase, traces, evaluations, and scenarios against best practices, then guides you to close the gaps, starting from low-hanging fruit and going deeper. Use when you want to level up your agent's engineering quality.4license: MIT5---67# Improve Your Agent Development Best Practices89This recipe acts as your expert AI engineering consultant. It audits how your team builds and operates the agent, compares it against best practices, delivers quick fixes, then guides you deeper.1011## Phase 1: Full Audit1213Before suggesting anything, read EVERYTHING:1415### Code Audit16171. Read the full codebase: every file, every function, every system prompt182. Study `git log --oneline -50` and read commit messages for WHY things changed. Bug fixes reveal edge cases. Refactors reveal design decisions. These are goldmines for what to test and evaluate.193. Read README, docs, comments for domain context2021### LangWatch Audit (via CLI)22234. `langwatch trace search --limit 25 --format json` to check trace quality (inputs/outputs populated? spans connected? labels present?)245. `langwatch scenario list --format json` to see what scenarios exist. Are they comprehensive or shallow?256. `langwatch test-suite list --format json` to see what test suites exist, and `langwatch run-plan list --format json` to see what run plans they are run under267. `langwatch evaluator list --format json` to see what evaluators are configured278. `langwatch monitor list --format json` to check for online evaluation monitors289. `langwatch prompt list --format json` to check whether prompts are versioned (or all hardcoded in code)2910. `langwatch analytics query --metric trace-count --format json` and `--metric total-cost`, `--metric avg-latency`, `--metric eval-pass-rate` (each with `--format json`) for the current cost, latency, and error/pass rate baseline3031### Gap Analysis3233Score the setup against the best-practices checklist:3435- **Observability**: traces flowing, inputs/outputs populated, spans connected, metadata and labels present36- **Prompt management**: prompts versioned and reviewable, not hardcoded strings scattered in code37- **Testing**: scenario tests exist, cover the agent's real jobs and edge cases, run in CI38- **Evaluation**: evaluators measure the qualities that matter for the domain, datasets are domain-specific, not generic39- **Production monitoring**: online monitors watch quality signals on live traffic40- **Iteration loop**: experiments compare changes before they ship4142Identify what's missing entirely, what exists but is weak, and what's working well (keep and build on).4344## Phase 2: Low-Hanging Fruit4546Fix the easiest, highest-impact gaps first:4748- Broken instrumentation: fix traces (see the `debug-instrumentation` recipe)49- Hardcoded prompts: set up prompt versioning (`langwatch prompt init`, see the `prompts` skill)50- No tests at all: create initial scenario tests (see the `scenarios` skill)51- Generic datasets: generate domain-specific ones (see the `datasets` skill)5253Deliver working results. Show the user what improved.5455## Phase 3: Guide Deeper5657After Phase 2, DON'T STOP. Suggest 2-3 specific improvements based on what you learned:58591. **Domain-specific improvements**: Based on the codebase domain, suggest targeted scenarios or evaluations. "I noticed your agent handles \[X], should I add edge case tests for \[Y]?"60612. **Expert involvement**: If the domain is specialized (medical, financial, legal), suggest involving domain experts. "For healthcare scenarios, you'd benefit from a medical professional reviewing the compliance criteria, want me to draft scenarios they can review?"62633. **Data quality**: If using synthetic data, suggest real data. "Do you have real customer queries or support tickets? Those would make much better evaluation datasets."64654. **CI/CD integration**: If no CI pipeline, suggest adding experiments. "Want me to set up experiments that run in CI to catch regressions?"66675. **Production monitoring**: If no online evaluation, suggest monitors. "Your traces show no quality monitoring, want me to set up faithfulness checks on production traffic with `langwatch monitor create`?"68696. **Learn from production**: If traces show real traffic, hand over to the production-insight skills: run `/agent-performance` for a full diagnosis of how the agent behaves in production, and `/agent-improve` to turn those findings into tested changes.7071Ask light questions with options. Don't overwhelm: pick the top 2-3 most impactful.7273## Phase 4: Keep Iterating7475After each improvement:76771. Show what was accomplished782. Run any tests / re-query analytics to verify (`langwatch trace search`, `langwatch test-suite run <id|name> --target <type:id> --wait`, etc.)793. Ask what to tackle next804. Stop when the user says "that's enough"8182## Common Mistakes8384- Do NOT skip the audit; you can't suggest improvements without understanding the current state85- Do NOT give generic advice; every suggestion must be specific to this codebase86- Do NOT overwhelm with 10 suggestions; pick the top 2-387- Do NOT skip running/verifying improvements