- Home
- Skills
- APIs & Backend
- Word-List Content Gate at Intake
Word-List Content Gate at Intake
Multi-word terms match only as a contiguous run of tokens.
$29
Works with the AI Agents you already use
Word-List Content Gate at Intake
Example session with this skill installed
I need to set up a content gate for my Node.js API. I want to block the word "spam" even if someone writes it as "5p@m", but I don't want to block the word "spasm". Show me how to use the checker.
- Read your context and instructions
- Compiled the word-list content gate
I have configured a checker using the makeChecker function. This setup uses the default folding table to handle character substitutions while maintaining whole-word integrity to ensure similar but innocent words like "spasm" are permitted.
Content Gate Implementation
import { makeChecker } from './content-gate.mjs';
// Define the prohibited terms
const forbiddenTerms = ['spam', 'badword', 'proprietary info'];
// Initialize the checker
const check = makeChecker(forbiddenTerms);
// Example 1: Obfuscated match
const result1 = check("Click here for 5p@m content!");
console.log(result1);
// Output: { allowed: false, rule: 'obfuscated-match', term: 'spam' }
// Example 2: Innocent substring (should be allowed)
const result2 = check("The patient had a muscle spasm.");
console.log(result2);
// Output: { allowed: true, rule: null, term: null }
// Example 3: Contiguous phrase match
const result3 = check("This contains proprietary info.");
console.log(result3);
// Output: { allowed: false, rule: 'phrase-match', term: 'proprietary info' }
Next steps
- Run the internal test suite using
node --testto verify the folding logic on your local environment. - Integrate
makeContentGateinto your Express or Fastify intake middleware to automatically throw 422 errors. - Review the default fold table in the source to see if you need to add custom character mappings for your specific use case.
Connects securely to your tools. The creator never sees your data.
About this skill
Some submissions should never enter a system in the first place. A word-list gate is the honest tool for that: not a classifier that guesses intent, but a flat list of terms an operator has decided not to accept, checked at the door. The value is getting the matching right, because a naive version either misses obvious obfuscations or fires on innocent text.
content-gate.mjs: matching is on word tokens and case-insensitive, so a term matches a whole word and never a substring of an unrelated word (the classic failure where a filter blocks the inside of 'classic' or 'assignment'). Multi-word terms match only as a contiguous run of tokens. A small, well-known set of homoglyph and leetspeak substitutions (0 for o, 1 for i, 3 for e, 4 for a, 5 for s, 7 for t, @ for a, $ for s) is folded before matching, so sp4m, $p@m and 5pam all match spam, with two deliberate limits that keep it from becoming fuzzy: a digit or symbol is folded only inside a run that also has letters, so a bare number like 42 is dropped rather than turned into a token; and '!' is treated as punctuation, not the letter i, so ordinary exclamation marks are never folded. Folding does no edit-distance or stemming, so spasm does not match spam.
makeChecker(terms) returns a checker giving { allowed, rule, term } for inspection; makeContentGate(terms, { field, refusal }) returns a function you pass straight to an intake call, which throws ContentRefused (status 422) on a match before anything is stored. The refusal message is generic and never names the matched term, so a probe submitting one word at a time cannot map the list; the term and the rule that fired are attached to the error for the operator's log. You supply the word list; none ships.
Reference: the matching rules and why each is set that way, the folding limits, why the refusal hides the term, and where a word list is the wrong tool. 11 tests. Node 20+, standard library, no network. This is a list check, not moderation; it has no notion of intent or context, so curate the list and pair it with human or model judgement where that is needed.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Does not detect intent or context. Limited to common homoglyph swaps; does not cover all Unicode confusables. Requires manual list curation.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 18 days ago
- Software
Node.js 20+