jamestkelly

Path Scoped Rules — Documentation skill for Claude Code

Documentation community

OpenCode plugin that loads path-scoped Markdown instructions from .claude/rules and .agent as you work on matching files.

How to install Path Scoped Rules

This entry records only its repository, not the path inside it, so there is no exact command to give. Open jamestkelly/path-scoped-rules and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Path Scoped Rules does

OpenCode plugin that loads path-scoped Markdown instructions from .claude/rules and .agent as you work on matching files.

Alternatives in Documentation

  • Translate Doc Zh — Translate English documentation to Chinese 5.7k ★
  • Wiki Export Marp — Generate a Marp slide deck from wiki content matching a topic 375 ★
  • Token Goat — Token burn reducer and focus keeper for Claude Code, Codex, Copilot, Gemini CLI, and more: surgical read hints 107 ★

README

path-scoped-rules

Give [OpenCode](https://opencode.ai) the Markdown rules that apply to the file it’s working on. Reuse your existing `.claude/rules/` files: a backend logging rule can stay out of the conversation until the agent reads backend code.

Install

To use the plugin in **all your OpenCode projects**, install from the `v1` tag and check that it appears in the plugin list:

opencode plugin add github:jamestkelly/path-scoped-rules#v1
opencode plugin list

`v1` points to the newest compatible 1.x release. To check for and apply updates, use `opencode plugin check` and `opencode plugin update`. For a reproducible install, use a release commit as described below.

Quick start

Save this as `.claude/rules/logging.md`:

---
paths:
  - "backend/**/*.ts"
  - "!backend/**/deploy/**"
---
Use the project's structured logger in backend code.

After adding or editing a rule, run `/reload` in OpenCode and start a fresh session. For the rule above:

First file read Is the logging instruction in the next model request?
backend/orders/create.ts Yes
backend/orders/deploy/stack.ts No — explicitly excluded
frontend/orders/create.ts No — outside backend/

Once activated, the rule stays in that session. Reading a different file later does not remove it.

OpenCode’s **Instructions updated** notice shows a dotted path. For `.claude/rules/logging.md`, it displays `api/path-scoped-rules.claude.rules.logging.md`. OpenCode does not allow slashes inside the entry key; special characters in filenames are escaped. Start a fresh session after upgrading if you still see old hash-based entries.

In the OpenCode terminal, enter `/rules` to see the count and paths of the scoped rules applied in the current session. Each path appears once, regardless of how often it matched. The list excludes always-on guidance and rules that appear only in the startup index. “Applied” means delivered as a session instruction, not