
Create Atomic Context Provider
Build a `BaseDynamicContextProvider` that injects a named, titled block into an agent's...
Install
npx skills add Eigenwise/atomic-agents --skill create-atomic-context-provider -g -a claude-code -y- Repository
- Eigenwise/atomic-agents6.3k
- Category
- AI and agents
- Updated
- 6d ago
- License
- MIT
- Context cost
- Mediumabout 1,772 tokens
- Runs scripts
- No, instructions only
What it does
Build a `BaseDynamicContextProvider` that injects a named, titled block into an agent's system prompt at every `run()`, current time, user identity, retrieved RAG docs, session state, cached DB schema. Use when the user asks to "add a context provider", "inject X into the prompt", "give the agent dynamic context", "wire up RAG", "make a `BaseDynamicContextProvider`", or runs `/atomic-agents:create-atomic-context-provider`.
Create an Atomic Agents Context Provider
A context provider injects a named, titled block into the agent's system prompt at every run(). The base prompt stays static; the context is what changes between calls.
For deep material (caching strategies, async data sources, multi-agent sharing patterns), the authority is ../framework/references/context-providers.md. This skill is the action-oriented path: clarify → write → register.
When this fires vs the umbrella framework skill
- This skill: the user wants to add a provider, "inject the user's name", "make the agent see the current time", "feed retrieved docs into the prompt", "share session state across two agents".
frameworkskill: questions about Atomic Agents in general, or about something other than authoring a provider.
Phase 1, Clarify
Bundle into one message:
- What goes into the prompt? One sentence. Defines the provider's job.
- Where does the data come from? In-memory state mutated by your code? A vector DB lookup? A REST call? A clock?
- How fresh must it be? Per-
run()(default), every N seconds (cache), or refreshed externally before each call (async data). - Which agent(s)? One agent, or shared across multiple agents?
Skip what's already obvious from context.
Phase 2, Plan
Confirm in one short block:
- File:
<project>/context_providers.py(or alongside the agent that owns it). - Class:
<Topic>Ctx(BaseDynamicContextProvider). - Title (rendered as the section header in the prompt), must be unique across providers on the same agent.
- Update mechanism: mutate fields between
run()calls (most common), set via a method, orawait refresh()for async sources.
Phase 3, Implement
Skeleton
from atomic_agents.context import BaseDynamicContextProvider
class UserCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="User Context")
self.name: str = ""
self.role: str = ""

