Agent Skillslangwatch/langwatch › agent-best-practices

agent-best-practices

GitHub

作为专家级AI工程顾问,审计Agent代码库、追踪记录与评估场景,对比最佳实践以识别差距。提供从快速修复到深度优化的指导,涵盖可观测性、提示词管理及测试等核心领域。

skills/_compiled/native/agent-best-practices/SKILL.md langwatch/langwatch

Trigger Scenarios

需要提升Agent工程质量和规范性时 希望审计现有Agent开发流程并获取改进建议时

Install

npx skills add langwatch/langwatch --skill agent-best-practices -g -y
More Options

Non-standard path

npx skills add https://github.com/langwatch/langwatch/tree/main/skills/_compiled/native/agent-best-practices -g -y

Use without installing

npx skills use langwatch/langwatch@agent-best-practices

指定 Agent (Claude Code)

npx skills add langwatch/langwatch --skill agent-best-practices -a claude-code -g -y

安装 repo 全部 skill

npx skills add langwatch/langwatch --all -g -y

预览 repo 内 skill

npx skills add langwatch/langwatch --list

SKILL.md

Frontmatter
{
    "name": "agent-best-practices",
    "license": "MIT",
    "metadata": {
        "category": "recipe"
    },
    "description": "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.",
    "user-prompt": "Where can I improve our agent development best practices?",
    "compatibility": "Requires the `langwatch` CLI with a valid `LANGWATCH_API_KEY`. Works with Claude Code and similar coding agents."
}

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

  1. Read the full codebase: every file, every function, every system prompt
  2. 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.
  3. Read README, docs, comments for domain context

LangWatch Audit (via CLI)

  1. langwatch trace search --limit 25 --format json to check trace quality (inputs/outputs populated? spans connected? labels present?)
  2. langwatch scenario list --format json to see what scenarios exist. Are they comprehensive or shallow?
  3. 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
  4. langwatch evaluator list --format json to see what evaluators are configured
  5. langwatch monitor list --format json to check for online evaluation monitors
  6. langwatch prompt list --format json to check whether prompts are versioned (or all hardcoded in code)
  7. 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:

  1. 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]?"

  2. 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?"

  3. 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."

  4. CI/CD integration: If no CI pipeline, suggest adding experiments. "Want me to set up experiments that run in CI to catch regressions?"

  5. 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?"

  6. 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:

  1. Show what was accomplished
  2. Run any tests / re-query analytics to verify (langwatch trace search, langwatch test-suite run "<id|name>" --target <type:id> --wait, etc.)
  3. Ask what to tackle next
  4. 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

Version History

  • c106e86 Current 2026-09-22 23:38

    更新LangWatch CLI命令:将'suite list'更正为'test-suite list';在analytics查询中增加--format json参数。

  • 6f9d4a4 2026-08-28 21:09

    更新LangWatch审计步骤,将suite list改为查看run plans;优化UI标签命名、按钮样式、颜色语义及布局细节。

  • 12615f1 2026-08-20 10:00

Same Skill Collection

.claude/skills/browser-pair/SKILL.md
.claude/skills/browser-test/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/feature-map/SKILL.md
.claude/skills/haven-setup/SKILL.md
.claude/skills/langwatch-kanban/SKILL.md
plugins/langwatch/skills/langwatch/SKILL.md
services/langy-agent/skills/github/SKILL.md
skills/_compiled/native/agent-performance/SKILL.md
skills/_compiled/native/code-changes/SKILL.md
skills/_compiled/native/context-sweet-spot/SKILL.md
skills/_compiled/native/dashboard-widgets/SKILL.md
skills/_compiled/native/datasets/SKILL.md
skills/_compiled/native/debug-instrumentation/SKILL.md
skills/_compiled/native/debug-with-langwatch/SKILL.md
skills/_compiled/native/drive-the-ui/SKILL.md
skills/_compiled/native/eval-triage/SKILL.md
skills/_compiled/native/evaluate-multimodal/SKILL.md
skills/_compiled/native/evaluations/SKILL.md
skills/_compiled/native/experiments/SKILL.md
skills/_compiled/native/find-traces/SKILL.md
skills/_compiled/native/generate-rag-dataset/SKILL.md
skills/_compiled/native/github/SKILL.md
skills/_compiled/native/guided-onboarding/SKILL.md
skills/_compiled/native/level-up/SKILL.md
skills/_compiled/native/lwql-charts/SKILL.md
skills/_compiled/native/online-evaluations/SKILL.md
skills/_compiled/native/prompt-optimization/SKILL.md
skills/_compiled/native/prompts/SKILL.md
skills/_compiled/native/provider-cost-comparison/SKILL.md
skills/_compiled/native/setup-lw/SKILL.md
skills/_compiled/native/test-cli-usability/SKILL.md
skills/_compiled/native/test-compliance/SKILL.md
skills/_compiled/native/tracing/SKILL.md
skills/_compiled/native/connect-agent/SKILL.md
skills/_compiled/native/scenarios/SKILL.md

Metadata

Files
0
Version
c106e86
Hash
8d322ebc
Indexed
2026-08-20 10:00

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 19:43
浙ICP备14020137号-1