kit/plugins/memory-tools/skills/path-rules-advisor/SKILL.md
Creates path-specific rule files in .claude/rules/. Analyzes project structure and generates scoped rules for file types or directories. Use when the user wants to add path-specific rules.
npx skillsauth add shawn-sandy/agentics path-rules-advisorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze the project and CLAUDE.md to recommend and create path-specific rule files in .claude/rules/. Follow the mode determined by the user's message.
Does not create or overwrite global memory entries — use agentic-memory-doctor for that.
Use this mode when the user provides an argument in their message.
Argument format: <glob-pattern> - <rule description>
The - (space-hyphen-space) separates the glob pattern from the rule description.
Example: src/api/**/*.ts - All endpoints must validate input and return typed responses
Step 1 — Parse the argument
Split the argument on the first -. Left side = glob pattern. Right side = rule description.
If no - separator is found, stop and ask the user to re-enter in the format:
<glob-pattern> - <rule description>
Example: src/api/**/*.ts - All endpoints must validate input
Step 2 — Infer the output filename
Derive a filename from the glob pattern:
| Glob example | Filename |
|---|---|
| src/api/**/*.ts | api-rules.md |
| tests/**/*.test.ts | test-rules.md |
| components/**/*.tsx | component-rules.md |
| src/lib/** | lib-rules.md |
General rule: take the most specific directory segment from the glob and append -rules.md. Strip src/, **, *, and file extensions.
Step 3 — Check for conflicts
Check if .claude/rules/<filename> already exists. If it does, show the user the existing file path and ask:
"This file already exists. Overwrite it, or choose a different filename?"
Do not proceed until the user confirms or provides a new filename.
Step 4 — Check for the .claude/rules/ directory
Check if .claude/rules/ exists in the project root.
If it does not exist, tell the user and ask:
"The .claude/rules/ directory does not exist. Should I create it?"
Do not write any files until the user confirms.
Step 5 — Expand the description into rules
Take the user's description and expand it into 3–5 well-formed, actionable rule bullets. Each bullet should:
Step 6 — Show the generated file
Display the complete rule file in a code block:
---
paths:
- "<glob-pattern>"
---
# <Descriptive Title>
- Rule bullet 1
- Rule bullet 2
- Rule bullet 3
- Rule bullet 4 (if applicable)
- Rule bullet 5 (if applicable)
Step 7 — Confirm before writing
Ask: "Should I write this to .claude/rules/<filename>?"
Wait for explicit confirmation. Do not write the file until confirmed. After writing, confirm the file path to the user.
Use this mode when the user provides no argument.
Step 1 — Resolve the CLAUDE.md target
Use the same priority order as the agentic-memory-doctor skill:
CLAUDE.md in the current working directory.claude/CLAUDE.md in the current working directory~/.claude/CLAUDE.mdIf both CLAUDE.md and .claude/CLAUDE.md exist, analyze CLAUDE.md (root takes priority) and note that .claude/CLAUDE.md was skipped.
Tell the user which file will be analyzed (CLAUDE.md, .claude/CLAUDE.md, or ~/.claude/CLAUDE.md). If none found, report that no CLAUDE.md was located and offer to proceed with project structure analysis only.
Step 2 — Inventory .claude/rules/
Check whether .claude/rules/ exists. If it does not, note this prominently.
If it does exist, list every .md file found there along with their paths: frontmatter values (if any).
Step 3 — Scan CLAUDE.md for path-scoped content
Read CLAUDE.md and look for content that is specific to particular file types, directories, or frameworks:
*.ts, *.tsx, *.py, *.css, *.test.tssrc/, lib/, tests/, components/, api/Step 4 — Check project structure
Glob for the presence of these directories in the project root:
src/lib/tests/ or test/components/api/app/Note which ones exist — this informs starter template recommendations.
Step 5 — Report findings
If no path-scoped content found in CLAUDE.md:
Report that the CLAUDE.md looks clean from a path-scoping perspective.
List which directories were detected and offer starter templates based on them. For example:
The following directories were detected:
src/,tests/. Would you like starter rule files for any of these?
src-rules.md(paths:src/**) — general source file conventionstest-rules.md(paths:tests/**) — test authoring and assertion standards
If path-scoped content was found:
Report findings in a structured summary:
## Path-Rules Analysis
**CLAUDE.md analyzed:** [path]
**Existing .claude/rules/ files:** [list or "none"]
### Extractable sections found
| Section / content | Suggested rule file | Suggested paths |
|---|---|---|
| [description] | [filename] | [glob] |
Ask: "Which of these would you like me to create as rule files?"
Step 6 — Create approved rule files
For each rule file the user approves:
.claude/rules/ directory if it does not exist (ask first).claude/rules/<name>.md with paths: frontmatterShow each file in a code block before writing. Confirm after each write.
Step 7 — Offer to update CLAUDE.md
After writing each rule file, ask once:
"Should I remove this content from CLAUDE.md and replace it with a reference to .claude/rules/<name>.md?"
If confirmed, replace the extracted section in CLAUDE.md with:
# See .claude/rules/<name>.md
If the user declines, leave CLAUDE.md unchanged.
All generated rule files follow this structure:
---
paths:
- "<glob-pattern>"
---
# <Descriptive Title>
- Rule bullet 1
- Rule bullet 2
- Rule bullet 3
Brace expansion (from official docs: https://code.claude.com/docs/en/memory):
---
paths:
- "src/**/*.{ts,tsx}"
- "{src,lib}/**/*.ts"
---
This expands to match multiple extensions or directories in a single rule.
paths: frontmatter causes Claude Code to activate this rule file only when working with matching files.claude/rules/ files is better than one with everything in CLAUDE.mdpaths: entries are valid in a single rule file when the same rules apply to several patternsdata-ai
Craft-prompt: interviews users and assembles a structured AI prompt using Anthropic best-practice techniques. Use when the user runs /plan-agent:craft-prompt or asks to craft a prompt.
development
Generates a SOCIAL.md project sharing config by analyzing the codebase. Use when asked to set up social sharing preferences or create a SOCIAL.md file.
development
Explains how any project file, component, or concept works. Reads source files and synthesizes developer-friendly principles, social copy, and a dark-mode card. Use when asked 'how does X work' or 'explain X'.
development
Generate an HTML implementation-plan document. Produces a self-contained .html plan file with steps, acceptance criteria, and metadata. Use when the user asks to create a plan document, generate an HTML plan, or write a plan file — not for general planning questions.