RU

rule-making-skill

Automatically create domain-specific rules for AI coding agents.

Install

mkdir -p .claude/skills/rule-making-skill && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16288" && unzip -o skill.zip -d .claude/skills/rule-making-skill && rm skill.zip

Installs to .claude/skills/rule-making-skill

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Analyze a specific directory (e.g. frontend/, backend/, e2e/) and generate .claude/rules/ markdown files for it. Use when asked to create rules, analyze a folder for Claude Code, or set up domain memory for a specific part of the codebase.
239 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Check existing documentation in CLAUDE.md files
  • Detect concerns within a target directory based on patterns
  • Mine domain memory from planning boards and tasks
  • Generate focused markdown rule files for detected concerns
  • Create rule files for authentication, data, API, and validation
  • Generate rule files for state, components, styling, and charts

How it works

This skill analyzes a specified directory by globbing for folder patterns and grepping for keyword patterns to detect concerns. It then mines existing documentation and tasks to generate structured markdown rule files.

Inputs & outputs

You give it
Target directory path (e.g., frontend/, backend/, e2e/)
You get back
Markdown rule files in `.claude/rules/` for detected concerns

When to use rule-making-skill

  • Analyze directory for rules
  • Create domain memory
  • Setup rules for backend

About this skill

Rules Generator

Analyze a directory and generate .claude/rules/ files for Claude Code domain memory.

Core Concept

Generalized agents fail because they're "amnesiacs with a tool belt." Each session starts with no grounded sense of where we are.

Solution: Domain Memory - persistent structured representation containing:

  1. Goals - What we're trying to achieve, requirements, constraints
  2. State - What's passing/failing, what's been tried, what broke
  3. Scaffolding - How to run, test, extend the system

Rules files distill domain knowledge into quick-reference format.

When to Use

User asks to:

  • "Analyze frontend/ and create rules"
  • "Set up Claude rules for the backend"
  • "Create domain memory for e2e/"

Workflow

1. Check Existing Documentation

Read root CLAUDE.md and target directory CLAUDE.md. Pull down what's already documented. We don't want to duplicate everything, but the main CLAUDE.md still have to keep core overview of the application.

2. Detect Concerns

Scan the target directory to detect which concerns exist. Only generate rule files for concerns that are actually present.

3. Mine Domain Memory

Check planning board and tasks under /.tasks/ for decisions, gotchas, and patterns related to each detected concern.

Globpattern: ".task-board/done/*.md"

Use tasks older than #150

4. Generate Rule Files

Create focused .md files only for detected concerns.


Concern Detection Matrix

Scan for these patterns to detect which concerns exist:

ConcernDetection SignalsRule File
auth**/auth/**, AuthContext, AuthProvider, login, logout, session, token, OAuth, EasyAuthauth.md
data**/models/**, cosmosdb, database, mongoose, prisma, orm, migrations, Containerdata.md
api**/routes/**, **/controllers/**, router.get, router.post, express.Router, endpointsapi.md
validation**/validators/**, zod, yup, joi, schema, .parse(, .safeParse(validation.md
stateuseQuery, useMutation, QueryClient, zustand, redux, recoil, Context.Providerstate.md
components**/ui/**, **/components/**, .tsx files with Props interfaces, forwardRefcomponents.md
stylingtokens.css, theme, tailwind, styled-components, css modules, design system filesstyling.md
chartsd3, recharts, chart.js, victory, **/charts/**, <svg, useEffect with DOM manipulationcharts.md
forms**/forms/**, useForm, handleSubmit, <input, <form, form validation patternsforms.md
calculations**/calculation*, pure functions returning numbers, financial formulas, Math. heavy filescalculations.md
llmopenai, langchain, anthropic, agent, tool calls, completion, langfusellm.md
errors**/errors/**, AppError, ErrorBoundary, errorHandler, custom error classeserrors.md
testing*.spec.ts, *.test.ts, fixtures, beforeEach, describe(, it(, expect(testing.md
middleware**/middleware/**, app.use(, request/response interceptors, next()middleware.md
services**/services/**, business logic classes, dependency injection patternsservices.md
onboardingwizard, onboarding, setup, multi-step flows, Step*.tsxonboarding.md
integrationsThird-party SDK imports, API clients, webhooks, external service callsintegrations.md

Detection Algorithm

For each concern in matrix:
  1. Glob for folder patterns (**/auth/**, **/models/**, etc.)
  2. Grep for keyword patterns (AuthContext, useQuery, etc.)
  3. If matches found → concern is DETECTED
  4. If no matches → skip this concern

Threshold: A concern is detected if:

  • At least 1 folder pattern matches, OR
  • At least 3 keyword matches across files

Rule File Format

# [Concern] Rules

## Stack
[One line: key libs/frameworks for this concern]

## Structure
- `/path` - Purpose
- `/path` - Purpose

## Patterns
- Established pattern 1
- Established pattern 2

## Decisions
- Choice X because Y

## Gotchas
- Problem → Solution

## Commands
- `pnpm <command>` - What it does

Not every file needs all sections - include only what's relevant.


Example: Detected Concerns → Generated Files

Target: backend/

Detection results:

  • ✅ auth → middleware/auth.ts, routes/authRoutes.ts
  • ✅ data → config/cosmosdb.ts, models/*.ts
  • ✅ api → routes/*.ts, controllers/*.ts
  • ✅ validation → validators/*.ts, zod imports
  • ✅ services → services/*.ts
  • ✅ calculations → services/calculationService.ts
  • ✅ llm → services/importAgentService.ts, openai imports
  • ✅ errors → errors/AppError.ts, middleware/errorHandler.ts
  • ✅ middleware → middleware/*.ts
  • ❌ components → not found
  • ❌ styling → not found
  • ❌ charts → not found

Generated files:

backend/.claude/rules/
├── auth.md
├── data.md
├── api.md
├── validation.md
├── services.md
├── calculations.md
├── llm.md
├── errors.md
└── middleware.md

Target: components/

Detection results:

  • ✅ components → ui/**, cards/**, layout/**
  • ✅ styling → styles/tokens.css
  • ✅ charts → charts/*.tsx, d3 imports
  • ✅ forms → forms/*.tsx
  • ✅ errors → system/ErrorBoundary
  • ❌ auth → not found
  • ❌ data → not found
  • ❌ api → not found

Generated files:

components/.claude/rules/
├── components.md
├── styling.md
├── charts.md
├── forms.md
└── errors.md

Target: e2e/

Detection results:

  • ✅ testing → *.spec.ts, fixtures
  • ✅ auth → login helpers, auth fixtures
  • ❌ everything else → not found

Generated files:

e2e/.claude/rules/
├── testing.md
└── auth.md

Content Guidelines

What to Include

SectionSource
Stackpackage.json deps for this concern
StructureFolder layout for this concern only
PatternsCode analysis + task-board history
DecisionsTask-board "decided to..." entries
GotchasTask-board "had issues with..." entries
Commandspackage.json scripts for this concern

What NOT to Include

  • Anything in root CLAUDE.md (no duplication)
  • Generic patterns (only project-specific)
  • Obvious things (React uses JSX, etc.)

Example Rule Files

backend/.claude/rules/data.md

# Data Rules

## Stack
CosmosDB (NoSQL), @azure/cosmos SDK

## Structure
- `/config/cosmosdb.ts` - Connection, container getters
- `/models/` - Document type definitions

## Patterns
- Containers: `users` (partition: /id), `portfolios` (partition: /userId)
- Documents are denormalized (snapshots store full account data)
- Use singleton pattern for database instance

## Decisions
- Denormalized snapshots for historical accuracy (accounts change over time)
- Co-locate user data by userId partition for fast queries

## Gotchas
- Date strings "dd.MM.yyyy" don't sort correctly in CosmosDB
- Always sort dates in JS using `compareDatesAsc` from dateUtils.ts
- Zod strips unknown fields - add to schema or they're dropped

## Commands
- `pnpm --filter backend seed` - Seed demo data
- `pnpm --filter backend seed:reset` - Reset database

components/.claude/rules/charts.md

# Charts Rules

## Stack
D3.js for all visualizations

## Structure
- `/charts/AreaChart` - Single line/area
- `/charts/StackedAreaChart` - Multiple stacked areas
- `/charts/DonutChart` - Pie/donut charts

## Patterns
- SVG-based, responsive via viewBox
- Data prop: `{ date: string, value: number }[]`
- Colors from design tokens (--muted-sage, --pale-blue, etc.)
- Tooltips via D3 mouse events

## Gotchas
- D3 selections in useEffect with cleanup
- Don't mix D3 DOM manipulation with React state
- Mobile: increase touch targets for tooltips

e2e/.claude/rules/testing.md

# Testing Rules

## Stack
Playwright

## Structure
- `/tests/*.spec.ts` - Test files
- `/tests/fixtures.ts` - Shared helpers, constants

## Patterns
- `PROTECTED_PAGES` array for auth-required pages
- `login()` helper handles demo authentication
- `clearAuthState()` between tests

## Decisions
- Integration + E2E only, no unit tests
- Sanity checks over comprehensive coverage
- Test user flows, not implementation details

## Gotchas
- Demo login has rate limiting (5 req/min)
- Always clearAuthState() in beforeEach
- Mobile tests use fixtures/mobile-viewports.ts

## Commands
- `pnpm test:e2e` - Run all tests
- `pnpm test:e2e --ui` - Interactive mode

Best Practices

  1. Detect first - Only create files for concerns that exist
  2. Mine task-board - Decisions and gotchas are gold
  3. No duplication - If root CLAUDE.md has it, skip it
  4. Be specific - "Port 3000" not "default port"
  5. Keep short - Each file <50 lines
  6. Update on discovery - Rules are living documentation

When not to use it

  • When the user does not request rules generation
  • When the user does not ask to analyze a folder for Claude Code
  • When the user does not ask to set up domain memory

Limitations

  • Only generates rule files for concerns that are actually present
  • A concern is detected if at least 1 folder pattern matches OR at least 3 keyword matches
  • Rule files should be kept short, under 50 lines

How it compares

This skill automates the creation of domain-specific rule files for AI agents, providing persistent, structured memory grounded in the codebase, which differs from agents starting with no prior context.

Compared to similar skills

rule-making-skill side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
rule-making-skill (this skill)05moNo flagsIntermediate
skill-development179moReviewIntermediate
skill-writer279moReviewBeginner
microsoft-skill-creator65moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by diegosouzapw

View all by diegosouzapw

helm-chart-scaffolding-v2

diegosouzapw

Helm Chart Scaffolding workflow skill. Use this skill when the user needs Comprehensive guidance for creating, organizing, and managing Helm charts for packaging and deploying Kubernetes applications and the operator should preserve the upstream workflow, copied support files, and provenance before

00

cc-skill-coding-standards-v2

diegosouzapw

Coding Standards & Best Practices workflow skill. Use this skill when the user needs Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development and the operator should preserve the upstream workflow, copied support files, and provenance before

00

worktree-setup

diegosouzapw

Automatically invoked after `git worktree add` to create data/shared symlink and data/local directory. Required before starting work in any new worktree.

00

parsehub-automation

diegosouzapw

Automate Parsehub tasks via Rube MCP (Composio). Always search tools first for current schemas.

00

signalwire-agents-sdk

diegosouzapw

Expert assistance for building SignalWire AI Agents in Python. Automatically activates when working with AgentBase, SWAIG functions, skills, SWML, voice configuration, DataMap, or any signalwire_agents code. Provides patterns, best practices, and complete working examples.

00

agent-sales-engineer

diegosouzapw

Expert sales engineer specializing in technical pre-sales, solution architecture, and proof of concepts. Masters technical demonstrations, competitive positioning, and translating complex technology into business value for prospects and customers.

00

You might also like

skill-development

anthropics

This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.

17145

skill-writer

pytorch

Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.

27126

microsoft-skill-creator

MicrosoftDocs

Create agent skills for Microsoft technologies using Learn MCP tools. Use when users want to create a skill that teaches agents about any Microsoft technology, library, framework, or service (Azure, .NET, M365, VS Code, Bicep, etc.). Investigates topics deeply, then generates a hybrid skill storing essential knowledge locally while enabling dynamic deeper investigation.

626

cartographer

kingbootoshi

Maps and documents codebases of any size by orchestrating parallel subagents. Creates docs/CODEBASE_MAP.md with architecture, file purposes, dependencies, and navigation guides. Updates CLAUDE.md with a summary. Use when user says "map this codebase", "cartographer", "/cartographer", "create codebase map", "document the architecture", "understand this codebase", or when onboarding to a new project. Automatically detects if map exists and updates only changed sections.

37

creating-skills

letta-ai

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Letta Code's capabilities with specialized knowledge, workflows, or tool integrations.

37

add-pattern

langroid

Use this skill when you learn one or more design pattern(s) in the Langroid (multi) agent framework, and want to make a note for future reference for yourself. Use this either autonomously, or when asked by the user to record a new pattern.

10

Search skills

Search the agent skills registry