{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "failproofai-failproofai--write-a-custom-failproofai-policy",
 "repo": "FailproofAI/failproofai",
 "repo_url": "https://github.com/FailproofAI/failproofai",
 "repo_slug": "failproofai-failproofai",
 "title": "Write a custom policy in JavaScript",
 "page_title": "How to write a custom policy in JavaScript with Failproofai",
 "summary": "Drop a file into .failproofai/policies/ and use allow, deny or instruct to shape agent behaviour.",
 "who": "A developer with project-specific rules agents must follow.",
 "problem": "Built-in policies cannot know your repo's rules.",
 "outcome": "A policy file that loads automatically and enforces your rule.",
 "steps": [
  "Install with `npm install -g failproofai`",
  "Create a file in `.failproofai/policies/`",
  "Return allow(), deny(message) or instruct(message) from your policy, as in the README example",
  "It loads automatically with no flags needed"
 ],
 "agent_prompt": "Using FailproofAI/failproofai, write a policy file in .failproofai/policies/ that denies <my risky command> with a clear message back to the agent, following the README's allow, deny and instruct API.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "typescript",
 "requirements": [
  "Node.js with npm",
  "A coding agent installed on the machine"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "system",
   "notice": "A policy is code that runs on every agent action; test it before relying on it."
  }
 ],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/failproofai-failproofai/write-a-custom-failproofai-policy/",
 "md": "https://dedupedai.com/use-cases/failproofai-failproofai/write-a-custom-failproofai-policy/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/failproofai-failproofai--write-a-custom-failproofai-policy.json",
 "api_version": "v1"
}
