5. Add Banned Patterns
Purpose: Add a new regex pattern to the banned patterns list to catch and reject content quality violations during challenge generation.
Prerequisites:
- Bun installed with
bun installcompleted - The pattern must be a valid JavaScript regex
Cost / Duration: $0 | 5 minutes
Prompt
Add a new banned pattern to the Eko challenge content quality filters.
Pattern to add: [describe the pattern, e.g.,
"block phrases starting with 'Did you know'",
"reject content containing 'interesting fact'"]
Step 1 — Edit the banned patterns TypeScript data file:
Open `packages/ai/src/config/challenge-banned-patterns.ts` and
add a new entry to the exported array. Each entry needs:
- A regex pattern (valid JavaScript regex)
- A human-readable description of what it catches
- The violation category
Follow the shape of existing entries in the file.
Step 2 — Test the regex in isolation:
Before saving, verify the pattern works as expected:
```javascript
// Test in a JS console or script:
const pattern = new RegExp("your-pattern-here", "i");
console.log(pattern.test("example text that should match")); // true
console.log(pattern.test("example text that should NOT match")); // false
```
Step 3 — Verify TypeScript compiles:
```bash
bun run typecheck
```
Step 4 — Run challenge content rules tests:
```bash
bunx vitest run packages/ai/src/__tests__/challenge-content-rules.test.ts
```
This validates that existing content still passes and the new
pattern does not cause false positives on known-good content.
Step 5 — Run drift tests:
```bash
bunx vitest run packages/ai/src/drift/__tests__/
```
Key references:
- Banned patterns: `packages/ai/src/config/challenge-banned-patterns.ts`
- Challenge content rules: `packages/ai/src/challenge-content-rules.ts`
Verification
- New pattern entry added to
packages/ai/src/config/challenge-banned-patterns.ts - Regex tested in isolation -- matches intended violations, no false positives
-
bun run typecheckpasses - Challenge content rules tests pass
- Drift tests pass with no regressions
- Pattern uses word boundaries or anchors to avoid overly broad matching
Related Prompts
- Update Challenge Voice — Broader voice and style rule changes
- CQ002 Compliance Patch — Fix existing CQ violations
- Run Drift Detection — Full drift detection across all config