agent-authoring

Enforces the canonical Python agent pattern for creating, modifying, and debugging FastAPI backend agents.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/rymqan/staple-tech --skill agent-authoring-rymqan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-authoring
Source: https://github.com/rymqan/staple-tech/tree/main/.claude/skills/agent-authoring
Command: npx skills add https://github.com/rymqan/staple-tech --skill agent-authoring-rymqan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When building a multi-agent AI marketing platform, inconsistent agent implementations lead to unmaintainable code, untracked costs, and unpredictable behavior. This Skill enforces a single canonical pattern so every agent follows the same base class contract, prompt structure, I/O schema, and instrumentation rules. ## Core Features & Use Cases - Standardized Agent Structure: Every agent subclasses a common Agent base class with a single run(input) -> output method, nested Pydantic Input/Output models with strict config, and a four-section system prompt (Role, Constraints, Output Format, Anti-goals). - Brand Brain RAG Injection: Retrieves top-3 brand guideline chunks via pgvector cosine similarity and injects them as a <brand_context> XML block before every Anthropic call. - Cost and Observability Instrumentation: Writes AgentLog rows on run start and completion, tracking token usage and cost per call with a budget target under $0.05 per call. - Use Case: When adding a new content-generation agent to the marketing platform, apply this Skill to scaffold the class, prompt, Pydantic schemas, RAG injection, logging, and a mocked pytest suite in one consistent pass. ## Quick Start Create a new agent for generating Instagram captions following the project's canonical agent pattern with tests and cost logging.

Frequently Asked Questions about agent-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new AI agent with the Anthropic SDK in Python?

Subclass the shared Agent base class and implement a single async run method that accepts a nested Pydantic Input model and returns an Output model. Call anthropic.AsyncAnthropic messages.create with a four-section system prompt and validate the JSON response with Output.model_validate_json.

How to structure a system prompt for a Claude agent?

Define a module-level constant with four required sections: Role, Constraints, Output Format, and Anti-goals. The Output Format section must describe each field of the Pydantic Output schema so the model returns conforming JSON.

How do I inject brand context into LLM calls using pgvector?

Retrieve the top-3 chunks from the brands.guidelines_embedding table using pgvector cosine similarity before each Anthropic call. Inject the results as a <brand_context> XML block inside the user message alongside the user's goal.

How do I test an Anthropic-based agent without live API calls?

Mock anthropic.AsyncAnthropic with AsyncMock and configure messages.create to return a MagicMock containing JSON text and token usage. Assert the run method returns a valid Output model instance and never make live API calls in tests.

When should I switch from Claude Sonnet to Claude Haiku for agents?

Use claude-sonnet-4-6 as the default for all agents and only switch to claude-haiku-4-5-20251001 after Langfuse cost data justifies it. Track cost per call via AgentLog with a budget target under $0.05 per agent call at MVP scale.