init-rules

init-rules is a command for Claude Code from anilcancakir/claude-code-plugin. It costs 34 tokens per session (1,704 once invoked), scanned B, original, MIT.

A command that analyzes a project and creates path-specific coding rules in .claude/rules/. These rules are automatically supplied when files in the matching parts of the project are edited.

In plain words
What is it for?
Detecting a project's technology stack and directory structure, then generating or updating coding conventions for areas such as applications, packages, and other source folders.
Why use it?
It reduces the need to repeat project conventions in every request and keeps guidance close to the code it applies to. It can be run again after the project changes while preserving rules added by hand.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Part of the ac plugin — 6 skills, 9 commands, 2 hooks shipped together

Good fit Detecting a project's technology stack and directory structure, then generating or updating coding conventions for areas such as applications, packages, and other source folders.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/anilcancakir/claude-code-plugin/init-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/anilcancakir/claude-code-plugin

Made for: Claude Code.

Or install ac, the plugin that ships this one along with the rest of its 6 skills, 9 commands, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for init-rules

README.md
[![agentmods](https://agentmods.dev/badge/commands/anilcancakir/claude-code-plugin/init-rules/github.svg)](https://agentmods.dev/commands/anilcancakir/claude-code-plugin/init-rules)
Your own site
<a href="https://agentmods.dev/commands/anilcancakir/claude-code-plugin/init-rules"><img src="https://agentmods.dev/badge/commands/anilcancakir/claude-code-plugin/init-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for init-rules

Your own site · 80×15
<a href="https://agentmods.dev/commands/anilcancakir/claude-code-plugin/init-rules"><img src="https://agentmods.dev/badge/commands/anilcancakir/claude-code-plugin/init-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,704 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.01704
Opus 5.5 $0.00014 $0.00682
Sonnet 5.5 $0.00007 $0.00341
Haiku 4.5 $0.00003 $0.00170

Measured 1mo ago against content hash fbbe7ed0bdff, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

init-rules scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat .claude/rules/*.md 2>/dev/null
plugins/ac/commands/init-rules.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Init Project Rules

Generate .claude/rules/*.md files for the active codebase — path-scoped instructions auto-injected when matching files are touched.

Authoring knowledge: Rule format, frontmatter, two-tier system, context layer stack, dedup checks, and anti-slop rules live in the rule-creator skill. Read it before writing any rule content. The claude-md-writer skill's dedup guide covers the project→rules boundary.


Phase 1: Discovery

Detect tech stacks, score directories, extract conventions. Use Glob, Grep, and Read directly in the main context — no subagents. Source code always takes priority over docs.

  1. Tech Stack Detection — Glob for package.json, composer.json, pubspec.yaml, Cargo.toml, go.mod, pyproject.toml, Gemfile. Read each to extract framework, version, key dependencies. Detect monorepo roots (workspaces fields, packages/, apps/). Assemble: stack | framework | version | root path.

  2. Directory Scoring — Run ls at depth 2-3, skipping vendor/, node_modules/, dist/, build/, .git/. For each significant directory: count files and subdirs (via Glob), detect own entry point (index.*, __init__.py, service providers, barrel exports), detect distinct patterns (contracts/, drivers/, concerns/, middleware/, migrations/). Assemble: directory | file count | subdir count | has entry | has patterns | total score.

  3. Convention Extraction — For each major directory, Read 3-5 source files and extract: import style, naming pattern, architectural pattern (facades, repos, controllers, middleware), API usage patterns, anti-patterns. Grep for DO NOT|NEVER|DEPRECATED comments. Read linter configs (.eslintrc*, phpstan.neon, analysis_options.yaml). Priority: source code over docs. Assemble: directory | conventions list | gotchas.

  4. Gather dedup context via Bash:

    ls -la .claude/rules/ 2>/dev/null
    cat .claude/rules/*.md 2>/dev/null
    cat CLAUDE.md 2>/dev/null | head -80
    cat ~/.claude/CLAUDE.md 2>/dev/null | head -80
    find . -maxdepth 3 -type f \( -name "*.dart" -o -name "*.php" -o -name "*.ts" -o -name "*.vue" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20
    

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 146 lines · 34 tokens per session scan B fbbe7ed0bdff

Subscribe to this mod's changes

init-rules is a command published in the GitHub repository anilcancakir/claude-code-plugin (2 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 1,704 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories

perf-difficult-conversation

Three-conversations framework rehearsal (Stone/Patton/Heen — Harvard Negotiation Project) for high-stakes conversations — termination, demotion, hard feedback, conflict surfacing. Produces three-conversations breakdown (what-happened / feelings / identity), conversation script with multiple opening choices, SCARF…

frankxai/Starlight-Intelligence-System · 93 tokens

culture-onboarding-90

Design a 90-day onboarding architecture for a role. First day (psychological safety + belonging activation), first week (relationship + role context + early wins), first month (skill ramp + integration + baseline), first quarter (autonomous performance + cultural integration check). Written-first elements for…

frankxai/Starlight-Intelligence-System · 101 tokens

perf-coaching-protocol

Generate a 60-minute solution-focused + CBT-grounded coaching session script for a manager-as-coach engagement. Coaches use questions, not advice. Produces session structure (check-in → focus → scaling → exception-finding → small-step → close), follow-up prompts, and the manager-as-coach training notes that name the…

frankxai/Starlight-Intelligence-System · 83 tokens

reclaim-knowledge

Organize scattered professional material into a domain-based second-brain architecture. Maps existing sources (Canva, Drive, local folders, Notion, screenshots) to functional domains. Non-technical-friendly — produces folder structure + drag-and-drop instructions, not CLI commands.

frankxai/Starlight-Intelligence-System · 58 tokens

design-regimen

Design an integrated weekly regimen — training, nutrition, sleep, stress, recovery — matched to the person's actual life. Composes with gym-training-expert and health-nutrition-expert for domain detail. Produces a sustainable architecture, not an extreme program. Not medical advice.

frankxai/Starlight-Intelligence-System · 60 tokens

hire-calibrate

Run the pre-loop calibration session — 60 minutes with ≥3 raters, review the rubric, score 2 anchor candidates the team has previously seen, surface inter-rater drift, agree on hire-bar examples. The calibration session itself is the deliverable. Without it, the loop runs on uncalibrated rulers. Per Project Oxygen …

frankxai/Starlight-Intelligence-System · 86 tokens