Creates Claude Code rules (.claude/rules/*.md) with YAML frontmatter and path-specific scoping. Use when creating project rules, coding standards, or conditional guidelines for specific file types.
Creates Claude Code rules with YAML frontmatter and path-specific scoping for project guidelines.
npx claudepluginhub kkhys/claude-code-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/examples.mdCreate modular, focused rules for .claude/rules/ directory.
First, ask the user:
.claude/rules/ (project) or ~/.claude/rules/ (personal)?Then create a .md file:
---
paths: src/**/*.ts
---
# TypeScript Guidelines
- Use strict mode
- Prefer interfaces over type aliases for object shapes
- Use explicit return types for exported functions
Apply to all files:
# Code Style
- Use 2-space indentation
- Prefer const over let
- No unused variables
Apply only when Claude works with matching files:
---
paths: src/api/**/*.ts
---
# API Development Rules
- All endpoints must include input validation
- Use standard error response format
- Include OpenAPI documentation comments
paths FieldSingle pattern:
paths: src/**/*.ts
Multiple patterns with brace expansion:
paths: src/**/*.{ts,tsx}
Comma-separated patterns:
paths: {src,lib}/**/*.ts, tests/**/*.test.ts
| Pattern | Matches |
|---|---|
**/*.ts | All TypeScript files anywhere |
src/**/* | All files under src/ |
*.md | Markdown files in project root only |
src/components/*.tsx | React components in specific directory |
**/*.{ts,tsx} | TypeScript and TSX files |
{src,lib}/**/*.ts | TypeScript in src/ or lib/ |
.claude/rules/
├── code-style.md # General coding standards
├── testing.md # Testing conventions
└── security.md # Security requirements
.claude/rules/
├── frontend/
│ ├── react.md
│ └── styles.md
├── backend/
│ ├── api.md
│ └── database.md
└── general.md
All .md files are discovered recursively.
# Symlink shared rules directory
ln -s ~/shared-claude-rules .claude/rules/shared
# Symlink individual files
ln -s ~/company-standards/security.md .claude/rules/security.md
Keep rules focused (one topic per file):
# ✓ Good - testing.md
# Testing Conventions
- Use vitest for unit tests
- Place tests in __tests__ directory
- Name test files: *.test.ts
Use descriptive filenames:
api-validation.md not rules1.mdreact-components.md not frontend.mdBe specific:
# ✓ Good
- Use 2-space indentation
- Prefer `interface` over `type` for objects
# ✗ Bad
- Format code properly
- Use good naming
Use path scoping appropriately:
# ✓ Good - applies to specific files
paths: src/api/**/*.ts
# ✗ Bad - too broad for API-specific rules
# (no paths = applies to everything)
Don't create catch-all files:
# ✗ Bad - rules.md containing everything
# All Rules
## Coding
## Testing
## Deployment
## Security
Don't duplicate CLAUDE.md content:
Don't use time-sensitive info:
# ✗ Bad
- As of January 2025, use React 19 features
For detailed examples, see examples.md.
# Code Style
- Use ESLint/Prettier configuration
- No console.log in production code
- Prefer named exports
- Use absolute imports with @/ prefix
---
paths: **/*.test.{ts,tsx}
---
# Testing Standards
- Arrange-Act-Assert pattern
- Mock external dependencies
- Test edge cases explicitly
- Aim for 80%+ coverage on new code
---
paths: src/api/**/*.ts
---
# API Guidelines
- Validate all inputs with zod
- Return consistent error format: { error: string, code: string }
- Log all 5xx errors
- Include request ID in responses
# Security Requirements
- Never log sensitive data (passwords, tokens, PII)
- Sanitize user inputs before database queries
- Use parameterized queries only
- Validate file uploads: type, size, content
---
paths: src/components/**/*.tsx
---
# React Component Guidelines
- Prefer functional components with hooks
- Extract complex logic to custom hooks
- Use React.memo for expensive renders
- Props interface named: ComponentNameProps
CLAUDE.md: High-level project info, build commands, architecture patterns
Rules (.claude/rules/*.md): Specific coding guidelines, often conditional on file types
Use rules when:
Use CLAUDE.md when:
Before creating a rule:
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.