Knowledge Base System Explained
Knowledge Base System Explained
Section titled “Knowledge Base System Explained”TEA skills load testing patterns from a shared knowledge base.
The skill selects fragments for the task and supplies them to the model before it generates or reviews tests. Testing as Engineering explains the testing process these patterns support.
The tea-index.csv Manifest
Section titled “The tea-index.csv Manifest”skills/bmod-tea/knowledge/tea-index.csv is the manifest.
One row per fragment:
id,name,description,tags,tier,fragment_filefixture-architecture,Fixture Architecture,"Composable fixture patterns (pure function → fixture → merge) and reuse rules","fixtures,architecture,playwright,cypress",core,fixture-architecture.mdnetwork-first,Network-First Safeguards,"Intercept-before-navigate workflow, HAR capture, deterministic waits, edge mocking","network,stability,playwright,cypress,ui",core,network-first.mdtest-quality,Test Quality Definition of Done,"Execution limits, isolation rules, green criteria","quality,definition-of-done,tests",core,test-quality.mdtier is one of core, extended, or specialized.
The 59 fragments split 24 / 19 / 16 across those tiers.
There is one copy of the knowledge base, in the bmod-tea skill, and fragment_file is relative to its knowledge/ folder.
The agent and every skill find it as a sibling skill folder: step frontmatter declares knowledgeIndex: '{tea-knowledge}/tea-index.csv', where {tea-knowledge} is {skill-root}/../bmod-tea/knowledge.
If bmod-tea is not installed, the skill says so and offers to install it.
A skill reads the manifest, selects the fragments its task needs, and loads only those.
Running Automate red mode on an authentication feature might pull test-quality.md, auth-session.md, network-first.md, data-factories.md, and email-auth.md if the auth is email-based, and can skip unrelated fragments such as contract-testing.md, feature-flags.md, and file-utils.md.
The set is an illustration; each run selects from the index by its task, tags, and tier.
The selected fragments supply a shared reference across runs.
Model outputs still need review and execution.
%%{init: {'theme':'base', 'themeVariables': { 'fontSize':'14px'}}}%%
flowchart TD
User([User: automate red]) --> Workflow[TEA Skill<br/>Triggered]
Workflow --> Read[Read Manifest<br/>tea-index.csv]
Read --> Identify{Identify Relevant<br/>Fragments for Automate red}
Identify -->|Needed| L1[✓ test-quality.md]
Identify -->|Needed| L2[✓ network-first.md]
Identify -->|Needed| L3[✓ component-tdd.md]
Identify -->|Needed| L4[✓ data-factories.md]
Identify -->|Needed| L5[✓ fixture-architecture.md]
Identify -.->|Skip| S1[✗ contract-testing.md]
Identify -.->|Skip| S2[✗ burn-in.md]
Identify -.->|Skip| S3[+ 47 other fragments]
L1 --> Context[AI Context<br/>5 fragments loaded]
L2 --> Context
L3 --> Context
L4 --> Context
L5 --> Context
Context --> Gen[Generate Tests<br/>Following patterns]
Gen --> Out([Consistent Output<br/>Shared testing patterns])
style User fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
style Read fill:#fff3e0,stroke:#e65100,stroke-width:2px
style L1 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
style L2 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
style L3 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
style L4 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
style L5 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px
style S1 fill:#e0e0e0,stroke:#616161,stroke-width:1px
style S2 fill:#e0e0e0,stroke:#616161,stroke-width:1px
style S3 fill:#e0e0e0,stroke:#616161,stroke-width:1px
style Context fill:#f3e5f5,stroke:#6a1b9a,stroke-width:3px
style Out fill:#4caf50,stroke:#1b5e20,stroke-width:3px,color:#fff
| Skill | Fragments loaded | Purpose |
|---|---|---|
framework | fixture-architecture, playwright-config, fixtures-composition | Infrastructure patterns |
test-design | test-quality, test-priorities-matrix, risk-governance | Planning standards |
automate red mode | test-quality, component-tdd, network-first, data-factories | TDD patterns |
automate expand mode | test-quality, test-levels-framework, selector-resilience | Test generation |
test-review | All quality, resilience, and debugging fragments | Full audit patterns |
framework CI phase | ci-burn-in, burn-in, selective-testing | CI/CD optimization |
Anatomy of a Fragment
Section titled “Anatomy of a Fragment”Every fragment follows the same shape:
- Principle. One sentence: what is this pattern?
- Rationale. The problems it solves and when to apply it.
- Pattern examples. Runnable code, basic through advanced, each with a short explanation.
- Anti-patterns. The bad version, what breaks, and why.
- Related patterns. Links to neighbouring fragments.
What the Fragments Buy You
Section titled “What the Fragments Buy You”test-quality.md, network-first.md, and api-request.md give Automate red mode a common API testing pattern:
import { expect } from '@playwright/test';import { test } from '@seontechnologies/playwright-utils/api-request/fixtures';import { UsersSchema } from './schemas'; // your own schema (JSON Schema, Zod, YAML, or OpenAPI)
test('should fetch users', async ({ apiRequest }) => { const { status, body } = await apiRequest({ method: 'GET', path: '/api/users', }).validateSchema(UsersSchema); // chained validation
expect(status).toBe(200); expect(body).toBeInstanceOf(Array);});When Playwright Utils is enabled and installed, TEA uses apiRequest with the { status, body } result shape.
The schema import is yours to supply.
The recurse.md fragment supplies a bounded polling pattern for background jobs:
import { expect, mergeTests } from '@playwright/test';import { test as apiRequestTest } from '@seontechnologies/playwright-utils/api-request/fixtures';import { test as recurseTest } from '@seontechnologies/playwright-utils/recurse/fixtures';
const test = mergeTests(apiRequestTest, recurseTest);
test('job completion', async ({ apiRequest, recurse }) => { const { body: job } = await apiRequest({ method: 'POST', path: '/api/jobs', });
// recurse(command, predicate, options) const result = await recurse( () => apiRequest({ method: 'GET', path: `/api/jobs/${job.id}` }), (response) => response.body.status === 'completed', // response.body comes from apiRequest { timeout: 30000, interval: 2000, log: 'Waiting for job to complete', }, );
expect(result.body.status).toBe('completed');});test-review applies the criteria registry and the patterns those criteria reference.
Finding severity and score arithmetic are fixed; identifying findings still requires model judgment.
Update a fragment to change the guidance future skill runs load. Existing tests still need their own migration.
Maintaining the Knowledge Base
Section titled “Maintaining the Knowledge Base”Add a fragment when the pattern spans multiple skills, the standard is non-obvious, the same question keeps getting asked, or you are integrating a new tool. Do not add one for a one-off pattern (document it in the test file), something everyone already knows, or something still experimental.
A good fragment states its principle in one sentence, explains the rationale clearly, carries three or more code examples, shows the anti-patterns, and stands alone with minimal dependencies. Optimal size is 10-30 KB.
Update a fragment when the pattern evolves, the tool ships a new API, feedback says it is unclear, or an example has a bug.
Edit the markdown, update the examples, test against the affected skills, and check nothing downstream breaks.
tea-index.csv only needs touching when the description or tags change.
Related
Section titled “Related”- Knowledge Base Index: all 59 fragments, categorized
- Testing as Engineering: the context engineering argument
- Test Quality Standards: what
test-quality.mdencodes - Network-First Patterns: what
network-first.mdencodes - Extend TEA with Custom Skills: adding fragments for your own stack
- TEA Configuration: config keys that affect fragment loading