<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yevhen Shaforostov</title>
    <description>The latest articles on DEV Community by Yevhen Shaforostov (@yevhen_shaforostov_5a73a4).</description>
    <link>https://dev.to/yevhen_shaforostov_5a73a4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4099553%2F93c1723f-3c25-462f-b068-e41c2dc56086.png</url>
      <title>DEV Community: Yevhen Shaforostov</title>
      <link>https://dev.to/yevhen_shaforostov_5a73a4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yevhen_shaforostov_5a73a4"/>
    <language>en</language>
    <item>
      <title>Building an 84-Skill JIT Architecture for AI Agents (Without Context Degradation)</title>
      <dc:creator>Yevhen Shaforostov</dc:creator>
      <pubDate>Mon, 31 Aug 2026 13:24:23 +0000</pubDate>
      <link>https://dev.to/yevhen_shaforostov_5a73a4/building-an-84-skill-jit-architecture-for-ai-agents-without-context-degradation-4kg8</link>
      <guid>https://dev.to/yevhen_shaforostov_5a73a4/building-an-84-skill-jit-architecture-for-ai-agents-without-context-degradation-4kg8</guid>
      <description>&lt;p&gt;When building autonomous AI agents for large, real-world codebases (using Claude Code, LangGraph, or custom agent harnesses), developers almost immediately hit a wall: &lt;strong&gt;Context Window Decay&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As your system prompt accumulates business rules, database schemas, coding standards, and multi-file instructions (often climbing to 30k–50k+ tokens upfront), three critical problems arise:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Inference Latency Spikes:&lt;/strong&gt; Every tool call and user query must process the massive static prompt overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attention Rot &amp;amp; Hallucinations:&lt;/strong&gt; Large language models struggle to maintain strict adherence across 50,000 tokens of static rules, often hallucinating API parameters or ignoring negative constraints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escalating Token COGS:&lt;/strong&gt; You pay for tens of thousands of unused instruction tokens on every single execution step.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To solve this in production, I designed a &lt;strong&gt;Just-in-Time (JIT) Modular Skill Architecture&lt;/strong&gt; covering 84+ specialized production domains.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏗️ The Architectural Pattern
&lt;/h2&gt;

&lt;p&gt;Instead of dumping every instruction into a monolithic system prompt, we decouple instructions into lightweight domain bundles loaded strictly on demand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmjgwap1n64koujvgwbn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmjgwap1n64koujvgwbn.jpg" alt=" " width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>architecture</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How to Build a Production-Grade RAG Agent with Hybrid Search in 30 Minutes</title>
      <dc:creator>Yevhen Shaforostov</dc:creator>
      <pubDate>Sat, 29 Aug 2026 16:46:20 +0000</pubDate>
      <link>https://dev.to/yevhen_shaforostov_5a73a4/how-to-build-a-production-grade-rag-agent-with-hybrid-search-in-30-minutes-31of</link>
      <guid>https://dev.to/yevhen_shaforostov_5a73a4/how-to-build-a-production-grade-rag-agent-with-hybrid-search-in-30-minutes-31of</guid>
      <description>&lt;p&gt;Most Retrieval-Augmented Generation (RAG) tutorials stop at a naive vector lookup: embed text with OpenAI, store it in Pinecone or Chroma, and perform cosine similarity search.&lt;br&gt;
In production environments, this naive approach quickly fails. Vector embeddings excel at semantic similarity, but they consistently stumble on exact keywords, acronyms, product SKUs, UUIDs, and domain-specific error codes.&lt;br&gt;
To build an enterprise-grade RAG agent, you need &lt;strong&gt;Hybrid Search with Reciprocal Rank Fusion (RRF)&lt;/strong&gt; combined with a deterministic multi-agent harness.&lt;/p&gt;

&lt;h2&gt;
  
  
  In this guide, we will construct a production RAG system in under 30 minutes using &lt;strong&gt;PostgreSQL (&lt;code&gt;pgvector&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;Reciprocal Rank Fusion (RRF)&lt;/strong&gt;, and &lt;strong&gt;LangGraph&lt;/strong&gt;.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Why Pure Vector Search Fails in Production
&lt;/h2&gt;

&lt;p&gt;Consider a developer searching an enterprise knowledge base for:&lt;br&gt;
&lt;code&gt;"Fix CVE-2024-38077 Windows Netlogon RPC buffer overflow"&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dense Vector Search:&lt;/strong&gt; Understands the general concept of "Windows vulnerabilities" and returns general security advisories, often missing the exact patch document.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sparse Keyword Search (BM25):&lt;/strong&gt; Finds the exact token &lt;code&gt;"CVE-2024-38077"&lt;/code&gt;, but misses related contextual documentation that uses synonyms like &lt;code&gt;"Netlogon remote elevation vulnerability"&lt;/code&gt;.
### The Solution: Hybrid Search + Reciprocal Rank Fusion (RRF)
Hybrid search executes both retrieval pipelines concurrently and merges the candidate rankings using the mathematical RRF formula:
$$\text{RRF Score}(d) = \sum_{m \in M} \frac{1}{60 + r_m(d)}$$
Where:&lt;/li&gt;
&lt;li&gt;$r_m(d)$ is the rank of document $d$ in retrieval method $m$ (Dense vs Sparse).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - $60$ is a smoothing constant that prevents top-heavy outliers from dominating the result set.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  2. PostgreSQL Schema Setup (&lt;code&gt;pgvector&lt;/code&gt; + &lt;code&gt;tsvector&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;You don't need a separate vector database. PostgreSQL handles dense vector embeddings and sparse full-text search within a single atomic ACID transaction.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sql
-- Enable vector extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Create enterprise knowledge documents table
CREATE TABLE enterprise_documents (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    tenant_id VARCHAR(64) NOT NULL,
    title TEXT NOT NULL,
    content TEXT NOT NULL,
    search_vector TSVECTOR GENERATED ALWAYS AS (to_tsvector('english', title || ' ' || content)) STORED,
    embedding VECTOR(1536), -- Compatible with text-embedding-3-small
    metadata JSONB DEFAULT '{}'::jsonb,
    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Fast approximate nearest neighbor index (HNSW)
CREATE INDEX ON enterprise_documents USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 64);
-- High-performance GIN index for sparse full-text search
CREATE INDEX ON enterprise_documents USING gin(search_vector);
3. The SQL Reciprocal Rank Fusion (RRF) Query
Here is the single SQL query that executes both dense and sparse retrieval in parallel and merges them via RRF:

sql
WITH dense_candidates AS (
    SELECT id, content, metadata,
           rank() OVER (ORDER BY embedding &amp;lt;=&amp;gt; $1) as d_rank
    FROM enterprise_documents
    WHERE tenant_id = $3
    LIMIT 50
),
sparse_candidates AS (
    SELECT id, content, metadata,
           rank() OVER (ORDER BY ts_rank_cd(search_vector, plainto_tsquery($2)) DESC) as s_rank
    FROM enterprise_documents
    WHERE tenant_id = $3 AND search_vector @@ plainto_tsquery($2)
    LIMIT 50
)
SELECT 
    COALESCE(d.id, s.id) as id,
    COALESCE(d.content, s.content) as content,
    COALESCE(d.metadata, s.metadata) as metadata,
    (COALESCE(1.0 / (60 + d.d_rank), 0.0) + COALESCE(1.0 / (60 + s.s_rank), 0.0)) as fusion_score
FROM dense_candidates d
FULL OUTER JOIN sparse_candidates s ON d.id = s.id
ORDER BY fusion_score DESC
LIMIT 10;
4. Connecting the Retrieval Engine to LangGraph
Now we wrap the hybrid search function inside an autonomous LangGraph Supervisor Agent that can analyze the retrieved context and verify facts before generating an answer.

typescript
import { StateGraph, END, START } from '@langchain/langgraph';
import { HybridSearchEngine } from './tools/hybridSearch';
export async function createRAGAgent() {
  const searchEngine = new HybridSearchEngine(process.env.DATABASE_URL!);
  const workflow = new StateGraph({
    // Define state channels
    channels: {
      query: { value: (x, y) =&amp;gt; y ?? x, default: () =&amp;gt; '' },
      retrievedContext: { value: (x, y) =&amp;gt; y ?? x, default: () =&amp;gt; [] },
      finalAnswer: { value: (x, y) =&amp;gt; y ?? x, default: () =&amp;gt; '' },
    }
  });
  // Step 1: Hybrid Retrieval Node
  workflow.addNode('retrieve', async (state) =&amp;gt; {
    const embedding = await generateEmbedding(state.query);
    const results = await searchEngine.search(state.query, embedding, 5);
    return { retrievedContext: results };
  });
  // Step 2: Answer Generation Node (Claude 3.5 Sonnet)
  workflow.addNode('synthesize', async (state) =&amp;gt; {
    const answer = await generateGroundedAnswer(state.query, state.retrievedContext);
    return { finalAnswer: answer };
  });
  workflow.addEdge(START, 'retrieve');
  workflow.addEdge('retrieve', 'synthesize');
  workflow.addEdge('synthesize', END);
  return workflow.compile();
}
5. Architectural Checklist for Production RAG
Before rolling this out to production users, enforce these 4 guardrails:

Strict Multi-Tenant Row-Level Security (RLS): Ensure tenant IDs are parameterized at the DB connection level.
Context Window Truncation: Dynamically budget token usage with tiktoken to prevent context overflow.
Cross-Encoder Re-ranking: For legal/medical data, add a secondary cross-encoder re-ranking pass (cohere.rerank or bge-reranker-large).
Hallucination Tripwires: Measure output faithfulness against retrieved &amp;lt;context&amp;gt; chunks using an automated LLM-as-a-Judge pass.
🚀 Complete Production Starter Kits &amp;amp; Resources
If you are building autonomous AI agents or production RAG systems, explore our battle-tested templates:

⭐️ Open-Source Claude Skills Starter Kit — Free on GitHub
📦 LangGraph Multi-Agent Production Starter Kit ($29) — Full TypeScript + Python code with Redis &amp;amp; pgvector memory
📋 Claude Code &amp;amp; Agent Prompt Templates Pack ($19) — 50 battle-tested production prompts
🛠️ Claude AI Engineering Skills Pack — 84 Skills ($49) — (Use coupon LAUNCH20 for 20% off)
How are you currently handling hybrid search and agent orchestration in your stack? Let's discuss in the comments!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>postgres</category>
      <category>python</category>
    </item>
    <item>
      <title>5 Claude Code Skills That Saved Me 10 Hours a Week (With Real Code &amp; Architecture)</title>
      <dc:creator>Yevhen Shaforostov</dc:creator>
      <pubDate>Sat, 29 Aug 2026 16:19:43 +0000</pubDate>
      <link>https://dev.to/yevhen_shaforostov_5a73a4/5-claude-code-skills-that-saved-me-10-hours-a-week-with-real-code-architecture-c4f</link>
      <guid>https://dev.to/yevhen_shaforostov_5a73a4/5-claude-code-skills-that-saved-me-10-hours-a-week-with-real-code-architecture-c4f</guid>
      <description>&lt;p&gt;When building software with Claude Code and autonomous agent harnesses, relying solely on generic conversational prompts quickly creates bottlenecks. As codebases scale, agents without structured instructions tend to make breaking changes, skip edge-case testing, or hallucinate non-existent API parameters.&lt;br&gt;
To turn Claude Code into a production-ready engineering partner, I developed a modular architecture of &lt;strong&gt;custom agent skills&lt;/strong&gt;. Each skill acts as a focused operational manual with strict constraints, schema validations, and verification loops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here are the &lt;strong&gt;5 foundational skills&lt;/strong&gt; that save me over 10 hours every week in production engineering—complete with real architectural blueprints and implementation code.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;tdd-workflow&lt;/code&gt; — Enforcing Red-Green-Refactor Loops
&lt;/h2&gt;

&lt;p&gt;Autonomous agents often rush to write application logic first, leading to subtle regressions and untracked edge cases. The &lt;code&gt;tdd-workflow&lt;/code&gt; skill forces the agent to follow a strict 3-phase Red-Green-Refactor loop.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Workflow Operates:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Red Phase:&lt;/strong&gt; Claude creates test files under &lt;code&gt;tests/&lt;/code&gt; and executes the test runner (&lt;code&gt;vitest&lt;/code&gt;, &lt;code&gt;pytest&lt;/code&gt;, or &lt;code&gt;bun test&lt;/code&gt;) to confirm failure before writing any business logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Green Phase:&lt;/strong&gt; The agent writes the minimal implementation code necessary to turn all tests green.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refactor Phase:&lt;/strong&gt; Performs AST-level cleanup, eliminates duplicate abstractions, and ensures 80%+ branch coverage.&lt;/li&gt;
&lt;/ol&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
// Example: Test-first contract generated by the tdd-workflow skill
import { describe, it, expect, vi } from 'vitest';
import { executeAgentTask } from '../src/agentRunner';
describe('executeAgentTask', () =&amp;gt; {
  it('should enforce idempotency and reject duplicate task IDs', async () =&amp;gt; {
    const taskId = 'task-uuid-1234';
    const payload = { type: 'RAG_QUERY', query: 'PostgreSQL HNSW tuning' };
    const firstRun = await executeAgentTask(taskId, payload);
    expect(firstRun.status).toBe('SUCCESS');
    // Duplicate execution with same idempotency key must be rejected
    await expect(executeAgentTask(taskId, payload)).rejects.toThrow('DuplicateTaskIdError');
  });
});
2. api-and-interface-design — Schema-First Contract Stability
Before introducing REST endpoints, tRPC routers, or MCP remote tools, this skill parses existing type definitions and Zod/Pydantic schemas. It prevents breaking public interface contracts and enforces strict runtime validation.

Strict Schema Definition:
typescript
import { z } from 'zod';
export const AgentExecutionRequestSchema = z.object({
  executionId: z.string().uuid(),
  tenantId: z.string().min(3),
  actionType: z.enum(['HYBRID_SEARCH', 'DATA_EXTRACT', 'DOCUMENT_OCR']),
  parameters: z.record(z.unknown()),
  idempotencyKey: z.string().min(16),
  maxBudgetUsd: z.number().positive().max(5.0),
});
export type AgentExecutionRequest = z.infer&amp;lt;typeof AgentExecutionRequestSchema&amp;gt;;
3. doubt-driven-development — Adversarial Self-Review
Before marking any task as complete or creating a pull request, this skill triggers an internal adversarial review pass. It stress-tests the code for silent failure modes:

Resource Leaks: Are database connections, file handles, and stream readers properly released in finally blocks?
Concurrency Hazards: Are there race conditions during state updates?
Security Boundaries: Does user input pass through strict sanitization before reaching SQL queries or shell executions?
4. hybrid-rag-vector-search — Production RAG Architecture
Standard vector search frequently misses exact keyword queries (SKUs, UUIDs, error codes, domain terminology). This skill provides the blueprint for combining dense semantic embeddings with sparse BM25 full-text search using Reciprocal Rank Fusion (RRF) inside PostgreSQL (pgvector).

sql
-- Hybrid Vector Search with Reciprocal Rank Fusion (RRF)
WITH dense_search AS (
  SELECT id, rank() OVER (ORDER BY embedding &amp;lt;=&amp;gt; $1) as r_rank
  FROM enterprise_documents
  LIMIT 50
),
sparse_search AS (
  SELECT id, rank() OVER (ORDER BY ts_rank_cd(search_vector, plainto_tsquery($2)) DESC) as k_rank
  FROM enterprise_documents
  WHERE search_vector @@ plainto_tsquery($2)
  LIMIT 50
)
SELECT 
  COALESCE(d.id, s.id) as id,
  COALESCE(1.0 / (60 + d.r_rank), 0.0) + COALESCE(1.0 / (60 + s.k_rank), 0.0) as fusion_score
FROM dense_search d
FULL OUTER JOIN sparse_search s ON d.id = s.id
ORDER BY fusion_score DESC
LIMIT 10;
5. observability-and-instrumentation — Real-Time Agent Telemetry
This skill automatically instruments every LLM execution step with structured JSON logging, token cost metering, and latency tracking.

Sample Structured Log Output:
json
{
  "timestamp": "2026-08-29T16:15:30.120Z",
  "level": "INFO",
  "agent_id": "langgraph-lead-qualifier",
  "step": "TOOL_EXECUTION",
  "tool_name": "pgvector_hybrid_search",
  "latency_ms": 42,
  "tokens_in": 1240,
  "tokens_out": 380,
  "cost_usd": 0.0048,
  "status": "SUCCESS"
}
🚀 Get Started (Open Source &amp;amp; Full Pack)
⭐️ Open-Source Starter Kit (5 Foundation Skills): Grab the open-source repository on GitHub at github.com/yevhens-hue/claude-skills-starter-kit
📦 Complete 84-Skill Production Engineering Pack: Access the full collection on Gumroad at shaforostov5.gumroad.com/l/njzfuo (Use discount code LAUNCH20 for 20% off).
What custom skills or architectural guardrails are you using in your daily agent workflows? Share your setup in the comments!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I Architected 84 Custom Skills for Claude Code to Automate My Daily Engineering</title>
      <dc:creator>Yevhen Shaforostov</dc:creator>
      <pubDate>Fri, 28 Aug 2026 22:28:35 +0000</pubDate>
      <link>https://dev.to/yevhen_shaforostov_5a73a4/how-i-architected-84-custom-skills-for-claude-code-to-automate-my-daily-engineering-3fap</link>
      <guid>https://dev.to/yevhen_shaforostov_5a73a4/how-i-architected-84-custom-skills-for-claude-code-to-automate-my-daily-engineering-3fap</guid>
      <description>&lt;p&gt;I've been using Anthropic's &lt;strong&gt;Claude Code&lt;/strong&gt; and autonomous coding agents in production daily as an AI Product Manager &amp;amp; Full-Stack AI Engineer at a B2B SaaS platform.&lt;/p&gt;

&lt;p&gt;Like many engineers, my initial workflow consisted of pasting massive, 50-line system prompts into every new session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;"Remember to enforce strict TDD with 80%+ coverage..."&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"When designing REST endpoints, enforce idempotency keys and RFC 7807 error schemas..."&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"When evaluating AI agent failures, follow systematic failure injection rather than trial-and-error..."&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach quickly broke down. Monolithic prompts lead to &lt;strong&gt;context window degradation&lt;/strong&gt;, token bloat, and subtle hallucinations where the LLM forgets critical constraints halfway through a refactor.&lt;/p&gt;

&lt;p&gt;To solve this, I designed a &lt;strong&gt;Modular Skill Architecture&lt;/strong&gt;. Today, I want to break down how it works, the anatomy of a skill file, and how you can implement this in your own projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 The Architecture: Just-in-Time Context Loading
&lt;/h2&gt;

&lt;p&gt;Instead of loading all domain rules at once, we partition our engineering knowledge into isolated, self-contained &lt;strong&gt;Domain Skills&lt;/strong&gt; stored in &lt;code&gt;~/.claude/skills/&lt;/code&gt; (or &lt;code&gt;~/.gemini/config/skills/&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Each skill contains:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;YAML Frontmatter:&lt;/strong&gt; Defines the skill name, trigger keywords, and domain description.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Markdown Instruction Body:&lt;/strong&gt; Specifies deterministic workflows, safety guardrails, and validation protocols.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When Claude detects you are tackling a specific domain (e.g., writing unit tests or debugging an agent), it dynamically indexes and injects only the necessary skill into active memory.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>claude</category>
    </item>
  </channel>
</rss>
