Foundatio Repositories logo

Foundatio Repositories

OrganizationPopular
exceptionless
foundatio-repositories

Query, aggregate, patch, or paginate Exceptionless data through its Elasticsearch repository abstractions.

Overview

Publisherexceptionless
RepositoryExceptionless
Skill namefoundatio-repositories
Stars
2.5K
Forks
508
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by exceptionless on GitHub. Read the source before you install it.

Installation

Install the Foundatio Repositories AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/exceptionless/Exceptionless/tree/main/.agents/skills/foundatio-repositories
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/exceptionless/Exceptionless.git /tmp/Exceptionless
mkdir -p .claude/skills
cp -r /tmp/Exceptionless/.agents/skills/foundatio-repositories .claude/skills/foundatio-repositories
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Foundatio Repositories in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Foundatio Repositories on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Foundatio Repositories is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Foundatio Repositories

Foundatio.Repositories provides a high-level Elasticsearch abstraction. Use repository methods for normal query, count, patch, and pagination work. Reserve raw IElasticClient for migrations or index maintenance that cannot be expressed through repositories.

Documentation: https://repositories.foundatio.dev / https://parsers.foundatio.dev

Repository Hierarchy

text
IRepository<T>                             — CRUD, Patch, Remove
  └─ ISearchableRepository<T>              — FindAsync, CountAsync, aggregations
       └─ IRepositoryOwnedByOrganization<T>
            └─ IRepositoryOwnedByProject<T>
                 └─ IRepositoryOwnedByOrganizationAndProject<T>
InterfaceEntityIndex Type
IEventRepositoryPersistentEventDailyIndex (date-partitioned)
IStackRepositoryStackVersionedIndex (single index)
IProjectRepositoryProjectVersionedIndex
IOrganizationRepositoryOrganizationVersionedIndex
IUserRepositoryUserVersionedIndex
ITokenRepositoryTokenVersionedIndex
IMigrationStateRepositoryMigrationStateVersionedIndex

Important: .Index(start, end) only routes to correct daily shards for DailyIndex (events). It is a no-op for VersionedIndex.

CountAsync + AggregationsExpression

CountAsync returns a CountResult with .Total (long) and .Aggregations (AggregationsHelper).

AggregationsExpression DSL

ExpressionMeaning
cardinality:fieldDistinct count
terms:fieldTerms aggregation
terms:(field~SIZE)Terms with bucket size limit
terms:(field~SIZE sub_agg)Terms with nested aggregation
terms:(field @include:VALUE)Terms with include filter
date:fieldDate histogram (auto interval)
date:field~1dDate histogram, daily interval
date:field~1MDate histogram, monthly interval
date:(field sub_agg)Date histogram with nested agg
sum:field~DEFAULTSum with default value
min:field / max:fieldMin/Max aggregation
avg:fieldAverage aggregation
-sum:field~1Sort descending by this agg (prefix -)

Multiple aggregations are space-separated: "cardinality:stack_id terms:type sum:count~1"

Accessing Aggregation Results

Naming convention: {type}_{field} — the aggregation type prefix + underscore + field name.

csharp
result.Aggregations.Cardinality("cardinality_stack_id").Value
result.Aggregations.Terms<string>("terms_type").Buckets       // .Key, .Total
result.Aggregations.DateHistogram("date_date").Buckets        // .Date, .Total
result.Aggregations.Sum("sum_count").Value
result.Aggregations.Min<DateTime>("min_date").Value
result.Aggregations.Max<DateTime>("max_date").Value
result.Aggregations.Average("avg_value").Value

// Nested aggs inside buckets
foreach (var bucket in result.Aggregations.Terms<string>("terms_stack_id").Buckets)
    bucket.Aggregations.Cardinality("cardinality_user").Value;

FilterExpression (Lucene-style)

FilterExpression accepts Lucene query syntax parsed by Foundatio Parsers:

csharp
.FilterExpression("type:error (status:open OR status:regressed)")
.FilterExpression($"project:{projectId}")
.FilterExpression($"stack:{stackId}")
.FilterExpression($"signature_hash:{signature}")
.FilterExpression("is_deleted:false")

Building OR filters from collections:

csharp
string filter = String.Join(" OR ", stackIds.Select(id => $"stack:{id}"));

Query Extension Methods

MethodPurposeFile
.Organization(id)Filter by organization_idOrganizationQuery.cs
.Organization(ids)Filter by multiple org IDsOrganizationQuery.cs
.Project(id)Filter by project_idProjectQuery.cs
.Stack(id) / .Stack(ids)Filter by stack_idStackQuery.cs
.ExcludeStack(id)Exclude stack_idStackQuery.cs
.AppFilter(sf)Apply app-level system filterAppFilterQuery.cs
.SystemFilter(query)Chain a pre-built queryFoundatio built-in
.EnforceEventStackFilter()Resolve stack filters to event IDsEventStackFilterQuery.cs
.DateRange(start, end, field)Date range filterFoundatio built-in
.Index(start, end)Route to daily shards (events only)Foundatio built-in
.FieldEquals(expr, value)Exact field matchFoundatio built-in
.SortExpression(sort)Sort expressionFoundatio built-in

Pagination

Use SearchAfterPaging() for deep pagination (never offset-based). NextPageAsync() returns Task<bool> and mutates results in-place.

csharp
var results = await _repository.GetAllAsync(o => o.SearchAfterPaging().PageLimit(500));
do
{
    foreach (var doc in results.Documents)
    {
        // process document
    }
} while (!cancellationToken.IsCancellationRequested && await results.NextPageAsync());

Key rules:

  • Never use while(true) { ... break; } — use do/while or while(condition)
  • Always check CancellationToken in the loop condition

PatchAllAsync / PatchAsync

Use PartialPatch for field-level updates, ScriptPatch for Painless scripts. Pass o => o.ImmediateConsistency() when write-then-read consistency is needed (tests). Use o => o.Notifications(false) to suppress change notifications.

csharp
await _tokenRepository.PatchAllAsync(
    q => q.Organization(orgId).FieldEquals(t => t.IsSuspended, false),
    new PartialPatch(new { is_suspended = true }),
    o => o.ImmediateConsistency());

Anti-Patterns

Avoid these in normal repository/query work:

  • Use _elasticClient.SearchAsync<T>(...) — use CountAsync or FindAsync
  • Use _elasticClient.MultiGetAsync(...) — use GetByIdsAsync
  • Use _elasticClient.DeleteByQueryAsync<T>(...) — use RemoveAllAsync
  • Use _elasticClient.UpdateByQueryAsync<T>(...) — use PatchAllAsync
  • Use _elasticClient.Indices.RefreshAsync(...) — use o => o.ImmediateConsistency()
  • Use while(true) { ... break; } for pagination — use do/while or while(condition)

Frequently asked questions

What does the Foundatio Repositories AI skill do?

Query, aggregate, patch, or paginate Exceptionless data through its Elasticsearch repository abstractions.

Why use Foundatio Repositories on TypingMind?

Because you install it once and use it with any model. Foundatio Repositories is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Foundatio Repositories in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/exceptionless/Exceptionless/tree/main/.agents/skills/foundatio-repositories. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Foundatio Repositories?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Foundatio Repositories?

As many as you like. As long as a model supports skills, you can use Foundatio Repositories with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Foundatio Repositories AI skill free?

Yes. It is published on GitHub by exceptionless under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇