agentleFS
kumaran-iskumaran-is/claude-code-onboarding/.claude/skills/agentic-ai-dev/SKILL.md

agentic-ai-dev

Skill36 starsChanged 6 months agoMITView on GitHub

This skill provides patterns and templates for building production AI agents with Python 3.14, LangChain v1.2.8, LangGraph v1.0.7, and FastAPI 0.135.2. Use when creating AI agents, RAG systems, graph workflows, tools, memory systems, or agent tests.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before generating code, consult these sources for current syntax and APIs:

    line 69
  2. Distinctive:

    LLM provider errors: Use retry with exponential backoff + fallback model chain.

    line 121
  3. Very specific:

    Graph infinite loops: Always include iteration_count in state and check it in the routing function.

    line 125
  4. Distinctive:

    After writing agentic AI code, dispatch these reviewer agents:

    line 129

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

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Iron Law

NO AGENT GRAPH WITHOUT AN ITERATION LIMIT AND A HUMAN-IN-THE-LOOP CHECKPOINT — unbounded loops and silent runaway agents are production incidents

Agentic AI Development Skill — Python 3.14 + LangChain + LangGraph + FastAPI

Quick Scaffold

uv init my-agent-service && cd my-agent-service
uv add "langchain-core>=1.2.8" "langchain-anthropic>=1.3.0" "langchain-openai>=1.1.0" "langgraph>=1.0.7" \
  "fastapi>=0.135.2" "uvicorn[standard]" pydantic pydantic-settings \
  langsmith prometheus-client structlog httpx asyncpg \
  "langgraph-checkpoint-postgres>=3.0.0"
uv add --dev pytest pytest-asyncio httpx ruff mypy

Process

  1. Scaffold — uv init + install dependencies
  2. Configure — core/config.py with pydantic-settings, .env, structured logging
  3. Define State — TypedDict with Annotated[list, add_messages] for each agent
  4. Build Graph — StateGraph with typed nodes, conditional edges, checkpointing
  5. Define Tools — @tool with docstrings, Pydantic input schemas, error handling
  6. Add Memory — Checkpointing (PostgresSaver), semantic memory (vector store)
  7. Add Guardrails — Input validation, prompt injection detection, output validation
  8. Expose API — FastAPI routes for invoke/stream with thread_id propagation
  9. Write Tests — Basic invoke, tool usage, iteration limit, error recovery, RAG quality
  10. Deploy — Docker multi-stage, gunicorn + uvicorn, health checks, Prometheus

Key Patterns

PatternImplementationReference
Agent GraphsStateGraph + typed nodes + conditional edgesagentic-templates-basic.md
Tools@tool + docstring + Pydantic input + try/exceptagentic-templates-tools.md
LLM BindingFactory function per provider, .bind_tools()agentic-llm-routing.md
RoutingCommand(goto=...) pattern (LangGraph)agentic-templates-advanced.md
CheckpointingPostgresSaver (prod) / MemorySaver (test)agentic-memory-systems.md
Streamingastream() + stream_mode + FastAPI SSEagentic-streaming-hitl.md
Human-in-the-Loopinterrupt_before + approval nodeagentic-streaming-hitl.md
RAGEmbeddings → Vector Store → Retriever → Rerankeragentic-templates-rag.md
Guardrails12-layer pipeline: input → process → outputagentic-guardrails-security.md
Structured Output.with_structured_output(PydanticModel)agentic-prompt-engineering.md
Error RecoveryRetry node + fallback model + graceful degradationagentic-templates-resilience.md
Configpydantic-settings + fail-fast validatorsagentic-config-project.md
Caching4-tier Q1→Q2→Q3→L3 with backfill; @cached_tool decoratoragentic-caching-patterns.md

Conventions & Rules

For package layout, LangGraph rules, and FastAPI integration rules, read reference/agentic-conventions.md

Documentation Sources

Before generating code, consult these sources for current syntax and APIs:

SourceURL / ToolPurpose
LangGraphhttps://langchain-ai.github.io/langgraph/llms-full.txtStateGraph, nodes, edges, checkpointing APIs
Pydantic v2https://docs.pydantic.dev/latest/llms-full.txtModel validation, settings, Field constraints
FastAPI / LangChainContext7 MCPLatest LangChain tools, FastAPI patterns

Reference Files

FileContentWhen to Use
agentic-agent-variant-ladder.mdCapability tier pattern, deterministic shadow agents, NDJSON replayMulti-agent architecture
agentic-config-project.mdpyproject.toml, .env, config, Docker, ruff/mypyProject setup
agentic-templates-core.mdFastAPI app, main.py, routes, middleware, base stateCreating API layer
agentic-templates-basic.mdReAct Agent, Multi-Agent Collaborative patternsBuilding basic agents
agentic-templates-advanced.mdHierarchical Supervisor, Command, Sub-Graph patternsBuilding complex agents
agentic-templates-resilience.mdError Recovery Agent, key design decisionsAgent error handling
agentic-templates-rag.md6 RAG architectures + document ingestion pipelineBuilding RAG systems
agentic-templates-tools.md@tool patterns, MCP integration, retry/timeoutDefining agent tools
agentic-guardrails-security.md12-layer security frameworkAdding safety layers
agentic-memory-systems.md7-layer memory hierarchy, practical implementationsAdding memory to agents
agentic-streaming-hitl.mdStreaming + Human-in-the-Loop patternsReal-time responses, approval flows
agentic-llm-routing.mdMulti-provider routing, cost calculation, fallback chainsMulti-model setups
agentic-observability.mdLangSmith, Prometheus, structured loggingMonitoring and debugging
agentic-testing.mdAgent testing patterns, mocks, fixturesWriting agent tests
agentic-deployment.mdDocker, docker-compose, production configDeploying agents
agentic-debugging.mdDebugging playbook, common issuesTroubleshooting agents
agentic-cost-optimization.mdCost management, budget caps, prompt optimizationReducing LLM costs
agentic-prompt-engineering.mdAdvanced prompting, structured output, templatesWriting better prompts
agentic-error-handling.mdAgent, tool, LLM provider, and API error handling patternsError handling in agents
agentic-review-checklist.mdAgentic AI review checklist (used by agentic-ai-reviewer agent)Code reviews
agentic-prompt-optimization.mdConstitutional AI, Tree-of-Thoughts, model-specific templates (Claude/Gemini/GPT), prompt versioning registry, canary rollout, LLM-as-judgeOptimizing prompt quality; multi-model deployments; production prompt lifecycle
llm-judge-advanced.mdProduction LLM-as-Judge: bias taxonomy (position, length, self-enhancement), position swap protocol, rubric generation, PoLL ensemble, hierarchical evalEvaluating agent outputs with reliability; high-stakes eval decisions
agentic-caching-patterns.md4-tier cache (Q1 LRU→Q2 Redis→Q3 semantic→L3 Anthropic), backfill, @cached_tool decorator, cache key generation, Prometheus metricsAdding caching to LangGraph agents
agentic-makefile-patterns.md40+ Makefile commands for setup, testing, RAG, memory, evaluation, Docker, observability — reference patterns for agentic AI servicesSetting up developer workflow automation

Common Commands

uvicorn src.main:app --reload                          # Run dev server (hot reload)
pytest -q                                              # Run tests (quiet output)
pytest -q --cov=src --cov-report=term-missing          # Tests with coverage
ruff check --fix .                                     # Lint and auto-fix
ruff format .                                          # Format code
mypy src/                                              # Type check

Error Handling

For error handling patterns and code examples, read reference/agentic-error-handling.md

LLM provider errors: Use retry with exponential backoff + fallback model chain. Never let provider errors crash the graph.

Tool execution errors: Wrap all @tool functions in try/except. Return structured error messages the LLM can reason about.

Graph infinite loops: Always include iteration_count in state and check it in the routing function.

Post-Code Review

After writing agentic AI code, dispatch these reviewer agents:

  • agentic-ai-reviewer — graph correctness, guardrails, iteration limits, cost efficiency
  • security-reviewer — tool input validation, prompt injection defense

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.