本文へ移動
cccskills
無料GitHub で公開

ai-bot-builder

Builds production AI bots with Python for support, sales, and custom domains. Use when designing conversation flows, personas, escalation, or LangGraph state.

インストール方法を見る

含まれるファイル(34)

  • SKILL.md25.8 KB
  • agents/openai.yaml382 B
  • assets/bot-safety-checklist.md3.4 KB
  • assets/conversation-flow-template.md3.2 KB
  • assets/handoff-protocol.md3.8 KB
  • assets/pricing-template.json690 B
  • assets/sales-bot-spec.md3.8 KB
  • assets/support-bot-spec.md2.6 KB
  • assets/templates/end-to-end-bot-recipe.md11.4 KB
  • data/sources.json9.1 KB
  • learnings.consolidated.md590 B
  • learnings.md611 B
  • references/bot-analytics-improvement.md15.9 KB
  • references/bot-memory-integration.md9.3 KB
  • references/channel-routing.md17.5 KB
  • references/conversation-design.md12.1 KB
  • references/framework-selection.md20.4 KB
  • references/graph-design-patterns.md11.5 KB
  • references/handoff-to-human.md13.1 KB
  • references/index.md3.5 KB
  • references/injection-and-jailbreak-defense.md13.9 KB
  • references/migration-from-n8n.md8.7 KB
  • references/persona-design.md11.1 KB
  • references/production-deployment.md22.8 KB
  • references/sales-bot-patterns.md19.7 KB
  • references/secret-rotation-and-model-fallback.md16.0 KB
  • references/state-checkpoints-and-hitl.md11.3 KB
  • references/stateful-rollout-and-blue-green.md14.7 KB
  • references/support-bot-patterns.md19.6 KB
  • references/testing-and-production.md6.5 KB
  • scripts/bot_cost_estimator.py16.5 KB
  • scripts/conversation_eval.py42.7 KB
  • scripts/red_team_pack.py21.0 KB
  • scripts/test_bot_scripts.py63.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

AI Bot Builder

Use this skill to build, ship, and iterate on conversational AI bots — support, sales, or domain-specific — using pure Python frameworks and AI coding agents.

This skill absorbs ai-langgraph-bots and is the single entry point for stateful bot implementation, including LangGraph graph design, checkpoints, and human-in-the-loop.

Default posture: explicit conversation state, typed tool contracts, deterministic escalation rules, guardrails before launch, compliance filtering before responses reach users, and analytics from day one. No visual workflow tools — code-first only.

When to Use This Skill

  • Building a support bot, sales bot, or domain-specific conversational agent
  • Designing conversation flows, fallback trees, and state machines
  • Choosing a Python bot framework (LangGraph, Claude Agent SDK, Pydantic AI); voice frameworks belong to ai-voice-bots
  • Migrating a bot from visual workflow tools (n8n, Langflow) to native Python
  • Integrating bots with ticketing, CRM, knowledge bases, or booking systems
  • Designing human handoff and escalation protocols
  • Adding post-generation compliance/safety filtering to bot responses
  • Planning bot analytics, A/B testing, and improvement loops
  • Implementing LangGraph graph state, checkpoints, and human approval for bots
  • Testing multi-turn conversation quality and regressions

When NOT to Use This Skill

NeedRoute to
Voice pipeline engineering (STT, TTS, telephony)../ai-voice-bots/SKILL.md
Agent architecture decisions (build-vs-not, shape)../ai-agents/SKILL.md
RAG / retrieval system design../ai-rag/SKILL.md
KB/vector-brain construction, ingest scripts, SQL, manifests, eval seeds../ai-vector-brain/SKILL.md
Prompt engineering and structured outputs../ai-prompt-engineering/SKILL.md
N8N / visual workflow automation../software-workflow-automation/SKILL.md
Help center content design../product-help-center/SKILL.md
Agent eval harnesses and red-team packs../qa-agent-testing/SKILL.md

Quick Reference

NeedDefaultNotes
Choose a bot frameworkreferences/framework-selection.mdPure Python: LangGraph, Claude Agent SDK, Pydantic AI; voice → ../ai-voice-bots/SKILL.md
Design conversation flowsreferences/conversation-design.mdState machines, fallback trees, slot filling, multi-turn
Define bot personalityreferences/persona-design.mdTone, brand voice, safety boundaries
Build a support botreferences/support-bot-patterns.mdZendesk/Intercom/Freshdesk, KB grounding, resolution tracking
Build a sales botreferences/sales-bot-patterns.mdCRM integration, lead qualification, demo booking
Add human handoffreferences/handoff-to-human.mdEscalation triggers, warm handoff, queue routing
Route across channelsreferences/channel-routing.mdWeb chat, WhatsApp, SMS, email, in-app
Wire persistent memoryreferences/bot-memory-integration.mdremember/recall loop, memory tier by bot type, anti-pattern blocks
Defend against injectionreferences/injection-and-jailbreak-defense.mdSpotlighting, canary, tool-output sanitization, red-team pack
Migrate from n8n / Langflowreferences/migration-from-n8n.mdNode mapping, secret hygiene, gap closure, before/after
Measure and improvereferences/bot-analytics-improvement.mdCSAT, containment rate, A/B, improvement loops
Deploy to productionreferences/production-deployment.mdServing, scaling, canary, cost per conversation
Roll out new bot versions without dropping sessionsreferences/stateful-rollout-and-blue-green.mdCohort canary, checkpoint migration, graceful drain, rollback
Rotate provider keys and survive provider outagesreferences/secret-rotation-and-model-fallback.mdTwo-key window, hot reload, fallback chain, circuit breakers
Pick a hosting platform (Vercel, Fly.io, Railway, Render, Cloudflare)../software-paas-hosting/references/agent-hosting-matrix.mdText-bot stacks B1–B4 with concrete platform choices
Design LangGraph statereferences/graph-design-patterns.mdState, nodes, edges, routers, subgraphs
Add checkpoints or HITLreferences/state-checkpoints-and-hitl.mdPersistence, replay, approval, recovery
Test graph workflowsreferences/testing-and-production.mdGraph testing, observability, handoff

Default Workflow

  1. Classify the bot type (support, sales, or custom domain) and identify the primary user task.
  2. Define persona — tone, brand voice, safety boundaries, and guardrailed behavior.
  3. Design conversation flow — state machine with happy path, fallbacks, slot filling, and escalation triggers.
  4. Choose framework — select from pure Python options based on state needs, tool integration, and deployment target.
  5. Integrate domain tools — ticketing, CRM, knowledge base, calendar, or custom APIs via MCP or direct SDK.
  6. Add guardrails — input validation, output filtering, PII handling, topic boundaries, and abuse prevention.
  7. Build evaluation suite — multi-turn evals, edge cases, adversarial inputs, and regression baselines.
  8. Deploy with analytics — instrument containment rate, CSAT, escalation rate, cost per conversation, and set up improvement loops.

Bot Type Decision Tree

What is the bot's primary job?
├── Answer questions / resolve issues
│   ├── Has a knowledge base or help center? → Support Bot (KB-grounded)
│   └── Needs to query live systems (orders, accounts)? → Support Bot (tool-using)
├── Qualify leads / book meetings / handle objections
│   └── Sales Bot
├── Execute workflows (approvals, scheduling, data entry)
│   └── Workflow Bot — consider LangGraph graph-shaped orchestration
└── Multi-domain or unclear
    └── Start with the dominant use case; add domains incrementally

Framework Selection

FrameworkBest forState modelStreamingVoice support
LangGraphComplex multi-step bots with branching, checkpoints, HITLExplicit typed graph stateYes (via callbacks)Via Pipecat/LiveKit integration
Claude Agent SDKTool-using bots with Anthropic modelsSDK-managed conversationYes (native)No (text-only)
Pydantic AILightweight bots with structured outputsPydantic modelsYesNo

Voice frameworks (Pipecat, LiveKit Agents) are owned by ../ai-voice-bots/SKILL.md — this skill is not voice/STT/TTS. Go there for framework choice, imports, and pipeline code; come back here for conversation state, persona, and guardrails once the graph/agent "brain" is decided.

Default: LangGraph for complex stateful bots, Claude Agent SDK for simpler tool-using bots, ai-voice-bots' pick when voice is primary. For linear decision cascades without cycles or checkpoints, consider plain async Python — LangGraph's dependency chain (langchain-core and its transitive packages) may not be worth the overhead.

Pydantic AI: its major-version rewrite moved extension points to a composable capabilities=[...] API and removed history_processors=, event_stream_handler= and prepare_tools= from the Agent constructor. Check which major version you have installed before copying an example, and read the current upgrade guide at ai.pydantic.dev. Migration notes → references/framework-selection.md.

Full comparison → references/framework-selection.md

LangGraph for Bots

Reach for LangGraph when the bot needs cycles, explicit state, checkpoints, or human approval — not as a default. For a linear cascade (spam → router → support → reply) with no cycles or HITL, plain async Python with if/elif routing is simpler and has zero framework overhead.

Key guardrails:

  • Python compatibility: look up the Python range your LangGraph release supports on the LangGraph releases page before upgrading Python. The framework ships minor releases often, so any "safe ceiling" copied from a doc goes stale within months; pin the version your CI tests.
  • Use START for new code. set_entry_point() is still documented as equivalent to add_edge(START, key), but the START edge is clearer and matches current examples. Import from langgraph.graph import StateGraph, START, END.
  • State before nodes. TypedDict with total=False, reducer-annotated fields for accumulated data.
  • Pure nodes. (state, *, clients) -> dict via functools.partial — testable without monkey-patching.
  • Place node boundaries around recoverable work and approval gates. With a checkpointer, LangGraph persists state at super-step boundaries; choose the required durability mode and make side effects idempotent. Put approval gates before destructive, financial, or irreversible actions. See references/state-checkpoints-and-hitl.md.

Full depth:

Conversation Design Principles

  1. State machine, not script. Model conversations as states with transitions, not linear scripts. Every state has: entry conditions, expected user inputs, bot actions, and exit transitions.
  2. Fallback hierarchy. Unknown input → clarify → rephrase → offer alternatives → escalate. Never dead-end.
  3. Slot filling over free chat. When collecting structured data, use explicit slots with validation. Confirm before committing.
  4. Escalation is not failure. Design escalation as a first-class path with context transfer, not a last resort.
  5. Turn budget. Set maximum turns before forced escalation from the p90 turns-to-resolution in your own logs, per bot type, and use the same number as max_turns in the conversation_eval.py rubric.

Full depth → references/conversation-design.md

Production Defaults

  • Language: Python, async by default. Pin whatever your CI actually tests, not whatever the docs said last quarter — see the LangGraph Python-compatibility note above.
  • Framework: FastAPI for serving, selected bot framework for orchestration
  • Streaming: SSE or WebSocket for real-time responses
  • Cost tracking: Token counting per conversation, cost per resolution metric
  • Prompt-prefix caching: the main multi-turn cost lever, because every turn resends the history. Keep the system prompt and tool definitions byte-stable and first (no timestamps or per-user values in them, tools in a fixed order) and put the cache breakpoint at the end of the history. Summarizing or rewriting history invalidates the cached prefix, so summarize only at a planned cache break. scripts/bot_cost_estimator.py --cache models this write-then-read pattern.
  • Guardrails: Input validation (max length, encoding, null bytes), output filtering, PII detection, topic boundaries
  • Bot-identity disclosure (EU AI Act Art. 50(1), applies from 2 Aug 2026): tell users they are talking to an AI at the latest at the first interaction, not only "when asked". The exception covers only cases where this is obvious to a reasonably well-informed, observant person given the context, so do not rely on it by default. See startup-compliance-enterprise-readiness/references/regulatory-overlays.md for the full obligation set and dates.
  • Compliance filter: Post-generation check before any response reaches the user — block investment advice, tipping-off language, unmasked PII. Use regex for fast checks; LLM call only for ambiguous cases. Essential for regulated industries (finance, healthcare).
  • PII scrubbing: Run card number regex before phone regex — phone patterns are greedy and consume card numbers if run first. Order: URLs → emails → card numbers → phone numbers.
  • Human escalation: Always-available path with context transfer. Prepare operator-facing summary (structured handoff) alongside user-facing confirmation.
  • Dedup: Redis TTL keys, not in-memory. Two levels: exact event ID, with a TTL at least the channel provider's maximum webhook redelivery window (look it up in that provider's webhook docs), and a text hash with a TTL about as long as the double-submit window you see in your logs. Survives restarts, scales across instances.
  • Rubric-graded outcomes (when output quality is load-bearing): for structured reports, formal/regulated responses, or document generation, add a revision loop — the task agent produces output, an isolated grader agent scores it against a rubric in its own context window (no access to the writer's chain-of-thought), the writer revises until the rubric passes or max_iterations is hit. See references/testing-and-production.md for the pattern, which is framework-agnostic; check whether your agent runtime has a native outcome or grader hook before building the loop yourself.
  • Conversation memory: Extract structured facts from each turn, not raw message logs (blocks anti-pattern A1 from ai-context-layer). Pick a memory pattern: P2 (support bots), P4 (sales bots with temporal facts), P6 (episodic-semantic for general bots) from ai-context-layer/patterns-catalog.md. Wire the remember / recall loop per references/bot-memory-integration.md. Load recalled facts only for support tiers — spam filter and router stay single-turn to avoid history-bias.
  • Domain knowledge: Keep curated knowledge retrieval separate from operational truth, memory, safety, and tone. If the bot uses SQL-backed RAG, stage database rollout before semantic retrieval: schema/RLS, minimal lexical search, content seed, ranking tuning, evals, then vector or full-text indexes after capability probes. Keep simple lexical retrieval when evals pass; defer embeddings, editor workflows, localization, and search infrastructure until traffic, corpus size, quality, or audit triggers justify them.
  • Testing: Three-tier test pyramid — unit tests for pure nodes, integration tests with mocked HTTP (respx), golden eval harness split into deterministic (regex/fast-path) and LLM tiers. Run deterministic tests in CI on every push; LLM eval on demand.
  • Analytics: Containment rate, CSAT, escalation rate, cost per conversation from day one. Write every decision to an analytics table (conversation_id, decision, route, confidence, tier, latency).
  • Docker: Non-root user, minimal base image (Alpine or distroless), read-only filesystem, no-new-privileges, secrets from manager not env files in production.
  • Model identifiers: Keep the model ID in config/env, not hardcoded in prompts or code samples — provider families rename and reprice on a cadence of months, not years (tiering, tier names, and prices have all shifted materially within a single year across major vendors). Pin the exact ID your CI tests in one place (MODEL_ID env var or a config file), and re-verify it against the vendor's current model list before every deploy, not from memory.

Intent Automation Gate

Classify each supported intent as answer, read, propose, mutate, or handoff, then give it an explicit tool allowlist, confirmation rule, fallback, and success signal. Unknown intents and failed preconditions must take the handoff or safe-answer path; they must not inherit the nearest intent's tools. Before launch, measure wrong-action and failed-handoff rates per intent alongside containment, because higher containment can hide harmful automation.

Known Traps

  • Treating escalation as a fallback only. Support and sales bots need an operator path that is designed upfront, instrumented, and tested like any other successful outcome.
  • Hiding orchestration inside one giant prompt or one giant LangGraph node. That makes handoff, retries, and root-cause analysis much harder when the bot misroutes or loops.
  • Letting curated knowledge, user memory, live account state, safety policy, and tone collapse into one prompt block. Mature bots assemble typed slices with evidence and trust levels so each concern can be tested separately.
  • Adding semantic search, long-term memory, or editorial workflow before the bot has eval failures, corpus pressure, real usage, or an operating team that needs those controls.
  • Sharing one conversation state model across web chat, email, SMS, and messaging channels without channel-specific limits. Attachment handling, latency expectations, and retry semantics differ materially.
  • Applying compliance, policy, or PII checks after tools have already fired or messages have already been queued. Guardrails must sit before side effects and before user-visible output.
  • Treating synthetic "happy path" transcripts as production proof. Multi-turn regressions usually appear in recovery paths, partial-tool failures, and human-handoff boundaries.
  • Treating prompt injection as a content-moderation problem instead of a security problem. The LLM is not a security boundary — defense lives in code around it: spotlighting, canary tokens, tool-output sanitization, privilege separation, and a red-team pack in CI. See references/injection-and-jailbreak-defense.md.
  • Wiring a managed memory vendor (Mem0, Zep, Letta, Cognee) directly into bot core logic with vendor-specific calls scattered across nodes/tools. Memory vendors churn on schema and pricing; put a thin MemoryService interface between the bot and the vendor SDK so a vendor swap is a one-file change, not a rewrite.

Common Anti-Patterns

  • Using LangGraph by default for short linear bots where plain async Python would be simpler, easier to test, and easier to operate.
  • Letting one prompt own routing, retrieval, tool planning, tone, and policy at the same time instead of separating those concerns.
  • Rebuilding ticketing, CRM, or booking semantics inside prompt text instead of using typed tool contracts and explicit field validation.
  • Measuring success only with aggregate CSAT or containment while ignoring escalation quality, incorrect automation, and cost per resolved conversation.

Navigation

References

Assets

Scripts

  • python3 scripts/conversation_eval.py --input conversations.jsonl [--min-pass-rate 1.0] [--warnings-fail] — Multi-turn conversation evaluator. Have the bot record each confirmation it asks for as a request_confirmation tool call ({"action": "issue_refund", "args": {"order_id": "55"}}). The evaluator then fails any state-changing call that no confirmed request covers, and exits 1 when the pass rate is below --min-pass-rate (default 1.0). Set require_confirmation_tool: true in the rubric once the bot emits the call, so a transcript without it fails instead of passing. Without the call, a text heuristic reports warnings only; pass --warnings-fail to make those warnings fail the gate too
  • python3 scripts/bot_cost_estimator.py --pricing rates.json --model <name> --avg-turns 8 — Per-conversation cost estimator. Ships no prices: copy assets/pricing-template.json, fill in rates from each provider's pricing page, and pass it with --pricing; without it the script exits 2 and prints no estimate. It also accepts the dated price file of ops-cost-optimization's cost_estimator.py (checked date plus models with input_per_1m/output_per_1m and optional cache rates), so one file can feed both the per-call and the per-conversation estimate
  • python3 scripts/red_team_pack.py --input responses.jsonl — Prompt-injection, PII-leak, and jailbreak detection against bot responses

Data

Related Skills

Learnings Loop

When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.

After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Configures Claude Code hooks and Codex hooks.json/notify. Use when adding PreToolUse guards, Stop hooks, managed hooks, format-on-save, preflight, audits, or worktree/budget hooks.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

Configures and hardens Claude Code and Codex MCP servers. Use when connecting databases, APIs, SaaS, building servers, or serving a clearance-filtered knowledge base.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

Owns instruction files: AGENTS.md, CLAUDE.md, personal and repo rules. Use when writing, pruning, auditing them, sharing rules across Claude and Codex, or fixing ignored rules.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

Creates and audits agent skills: SKILL.md, references, scripts, runtime metadata. Use when writing, validating, or security-reviewing a skill, or fixing truncated skill listings.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

Adds per-skill learnings loops for dated patterns, mistakes, and domain facts. Use when wiring skill memory, consolidation, or drift audits.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

Chooses subagent, team, workflow, or debate and launches it on Claude Code or Codex. Use when delegating, running agent review boards, or installing shared agents.

日本語の概要は準備中です。原文の説明を表示しています。

vasilyu1983/AI-Agents-public932026年10月12日 更新

vasilyu1983 のスキルをすべて見る

このスキルの問題を報告する