nyolo-write-rule

Write new nyolo permission rules for Claude Code safety guardrails. Use when the user wants to create, add, or write a nyolo rule to allow, deny, or ask confirmation for specific commands, file paths, URLs, or tool operations.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "nyolo-write-rule" with this command: npx skills add qdozaq/nyolo/qdozaq-nyolo-nyolo-write-rule

Write nyolo Permission Rule

You are helping the user create a new nyolo permission rule. nyolo is a PreToolUse hook for Claude Code that blocks or gates dangerous operations.

Step 1: Gather intent

Ask the user what they want the rule to do. You need:

  1. What to match — a command, file path, URL, or search query pattern
  2. Which toolBash, Edit, Write, WebFetch, WebSearch, or a combination (pipe-delimited, e.g. Write|Edit). Omit to match any tool.
  3. What actiondeny (block outright), ask (require confirmation), or allow (permit without prompt)
  4. Why — a short reason shown to Claude when the rule triggers

Step 2: Ask where to put the rule

Use AskUserQuestion to ask the user:

Where should this rule be saved?

OptionDescription
Project (./nyolo.config.js)Applies only to the current project. Defaults are auto-appended.
Global (~/.claude/nyolo.config.js)Applies to all projects. You compose the full rule set via imports.

Step 3: Write the rule

Rule format (declarative)

{
  name: "kebab-case-unique-name",       // required: unique identifier
  description: "Human-readable summary", // optional
  category: "custom",                    // optional: grouping label
  tool: "Bash",                          // optional: pipe-delimited tool filter
  match: {
    // field → pattern (AND logic across fields)
    command: "*pattern*",               // glob (default) — micromatch with extglob
    // file_path: "**/.env",            // glob with path semantics
    // url: "*example.com*",            // for WebFetch
    // query: "*secret*",              // for WebSearch
    // For complex matching, use regex instead of glob:
    // command: { pattern: "sudo\\s", parser: "regex", flags: "i" },
  },
  action: "deny",                        // "deny" | "ask" | "allow"
  reason: "Explanation shown to Claude",
}

Match field reference

ToolFieldNotes
BashcommandGlob: * matches /. Also tested against sub-commands (;, &&, ||, $())
Write / Editfile_pathStandard glob path semantics (use **/ for deep match)
WebFetchurlGlob pattern against the URL
WebSearchqueryGlob pattern against the search query

Pattern tips

  • Glob (preferred): "*dangerous*" — uses micromatch with extglob (@(), !(), *(), +(), ?())
  • Regex: { pattern: "sudo\\s", parser: "regex" } — only when glob can't express the match
  • Regex flags: { pattern: "DROP TABLE", parser: "regex", flags: "i" } — case-insensitive
  • For command fields, * matches / (relaxed path semantics)
  • For file_path fields, standard path glob semantics apply (* does NOT match /)
  • An empty match: {} matches everything (useful as a catch-all)
  • Multiple fields in match use AND logic — all must match

Callback rules (advanced)

For complex logic that can't be expressed declaratively:

(toolName, toolInput, { cwd }) => {
  if (toolName === "Bash" && /pattern/.test(toolInput.command)) {
    return { action: "deny", reason: "Explanation" };
  }
  return null; // null = skip, continue to next rule
}
  • Return { action, reason } to decide, or null/undefined to skip
  • Thrown errors → deny (fail-closed)
  • Async callbacks are NOT supported (denied immediately)

Step 4: Write the config file

Project config (./nyolo.config.js)

If the file doesn't exist, create it. The 35 recommended defaults are auto-appended after your rules (first-match-wins), so your rules take priority.

// nyolo.config.js
export default [
  // new rule goes here
];

To suppress defaults, add: export const noDefaults = true;

Global config (~/.claude/nyolo.config.js)

The global config IS the base rule set. Import categories from nyolo:

// ~/.claude/nyolo.config.js
import { recommended } from "nyolo";

export default [
  // new rule goes here — evaluated before recommended
  ...recommended,
];

Or pick specific categories:

import { filesystem, git, network } from "nyolo";
export default [
  // new rule
  ...filesystem,
  ...git,
  ...network,
];

Available category imports: recommended, filesystem, cloud, network, git, database, system, container, protection, sensitive, warnings, defineConfig.

Step 5: Verify

After writing the rule, tell the user to run npx nyolo test to verify their rules load and work correctly, or npx nyolo rules to list all active rules.

Important notes

  • First-match-wins: rule order matters. Project rules are evaluated before global rules.
  • Keep rules minimal: prefer a precise pattern over a broad one.
  • Rules should have unique name values.
  • Prefer ask over deny when the operation might be legitimately needed — ask lets Claude request approval rather than being blocked entirely.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated