<< All versions

Skill v1.0.0

currentAutomated scan100/100
darknecrocities/skillbuilder/ai
──Details
PublishedNovember 28, 2026 at 12:17 PM
Content Hashsha256:acc9c904c50ff273...
Git SHA170d96d79d4e
──Files
Files (1 file, 4.8 KB)
SKILL.md4.8 KBactive
SKILL.md · 103 lines · 4.8 KB

name: ai description: Architect, implement, and maintain production AI systems, Gemini API agents, Antigravity multi-agent orchestration, structured JSON outputs, reliable tool calling, and RAG retrieval pipelines. metadata: version: "1.0.0"


AI & LLM Systems Engineering (/ai)

Role: Principal AI Systems Engineer & Agent Architect
Philosophy: Deterministic boundaries on probabilistic models. Enforce strict JSON schemas. Ground assertions in verified citations. Guard token budgets. Never poll in loops.

This skill establishes production discipline for Generative AI, Large Language Models, and autonomous agent loops. It enforces the official google-genai SDK patterns, Antigravity subagent orchestration, strict schema-constrained outputs, defensive tool execution, and token budget optimization.


1. Quick Navigation & Progressive Disclosure

Resource TypeDocumentDescription
Referencereferences/gemini-sdk-and-models.mdOfficial google-genai SDK patterns, model selection matrix.
Referencereferences/structured-outputs-and-tools.mdGuaranteed JSON schemas, Pydantic type models, robust tool calling.
Referencereferences/rag-and-vector-search.mdChunking strategies, semantic embeddings, hybrid reranking, citation checks.
Referencereferences/token-optimization-and-caching.mdContext window management, prompt caching, token reduction heuristics.
Referencereferences/ai-error-catalog.mdCatalog of AI errors: schema failures, hallucinated tool calls, context overflows.
Templatetemplates/gemini_structured_agent.pyProduction Gemini agent implementation with typed JSON schemas.
Templatetemplates/gemini_rag_pipeline.pyComplete vector retrieval and citation-backed synthesis pipeline.
Utilityscripts/calculate_token_budget.pyCLI utility to estimate token consumption and optimize prompt payloads.

2. Gemini API Production SDK Standards (google-genai)

Always use the modern, unified google-genai SDK (do not use deprecated google-generativeai):

python
from google import genai
from google.genai import types
from pydantic import BaseModel, Field
client = genai.Client()
class AnalysisResult(BaseModel):
summary: str = Field(description="2-3 sentence technical overview")
confidence: float = Field(ge=0.0, le=1.0)
risk_factors: list[str]
# Strict Schema-Enforced Generation
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Analyze production database connection spikes",
config=types.GenerateContentConfig(
response_mime_type="application/json",
response_schema=AnalysisResult,
temperature=0.1, # Low entropy for structured output
),
)
data: AnalysisResult = response.parsed
print(f"Risk factors count: {len(data.risk_factors)}")

3. Antigravity Agent Orchestration & Reactive Wakeup

When coordinating autonomous multi-agent pipelines:

  1. Never Poll in Loops: The agent infrastructure automatically resumes parent agent context when subagents, background tasks, or schedules complete. Never call sleep() or query task status in a loop.
  2. Defensive Subagent Tool Handlers:
  • Every tool call must be wrapped in try/except.
  • Tool errors must return structured error objects ({"error": "FILE_NOT_FOUND", "path": path}) so the agent can reason and pivot, rather than crashing the loop.
  1. Context Preservation: Pass exact task parameters and isolation boundaries to subagents.

4. Grounded RAG & Citation Integrity

mermaid
flowchart LR
A["User Query"] --> B["Hybrid Search (BM25 + Dense Embeddings)"]
B --> C["Top K Chunks (Reranked)"]
C --> D["Context Injection with Chunk IDs"]
D --> E["Model Generation with Explicit [Chunk ID] Citations"]
E --> F["Automated Hallucination & Citation Verification"]

Citation Invariants:

  • Every factual claim must include a markdown reference: According to system spec [Spec: Section 4.2], the timeout is 15s.
  • Chunks must be sized between 500 and 1,000 tokens with 10% overlap.
  • Never feed unparsed PDFs or raw uncleaned HTML into the prompt; extract clean markdown text first.

5. Token Budget Calculator CLI

Estimate token consumption, character-to-token ratios, and cost estimates:

bash
python3 skills/ai/scripts/calculate_token_budget.py --text "User system prompt payload"

Verifies:

  • Payload fits within target context window.
  • Token count does not exceed prompt budget limits.
All versions