| name | rules |
| description | Command-based rule management. Use "/rules global <request>" to add/update global rules in ~/agent-rules/.rulesync/rules/ and regenerate AGENTS.md/CLAUDE.md. Use "/rules project <request>" to add/update project rules in .rulesync/rules/ and regenerate project configs. |
Rules Management Skill
Command-based rule management for AGENTS.md and CLAUDE.md.
Commands
/rules global <request>
Add or update global rules in ~/agent-rules/.rulesync/rules/ and regenerate configs.
Examples:
/rules global add a rule about using bun instead of npm
/rules global create a new category for database conventions
/rules global update the tooling section to include rtk
/rules global add a rule about always using TypeScript
What it does:
- Parses your request to understand what rule you want
- Determines the appropriate category/file (10-workflow.md, 20-tooling.md, etc.)
- Adds or updates the rule in the correct file
- Runs
cd ~/agent-rules && ./build.sh to regenerate AGENTS.md and CLAUDE.md
- Confirms the changes
/rules project <request>
Add or update project-specific rules in .rulesync/rules/ and regenerate project configs.
Examples:
/rules project add a rule about using our custom API client
/rules project create conventions for our database schema
/rules project add a rule about always using our error handling utility
/rules project update the testing section for our project structure
What it does:
- Parses your request to understand what project-specific rule you want
- Creates or updates
.rulesync/rules/50-project.md (or appropriate file)
- Runs
rulesync generate --targets '*' to regenerate project configs
- Updates project AGENTS.md if it exists
- Confirms the changes
How It Works
Global Rules Flow
- Request parsing - Understand what rule you want to add/update
- Category detection - Determine if it's workflow, tooling, infra, platform, etc.
- File selection - Choose the right file (10-workflow.md, 20-tooling.md, etc.)
- Rule creation - Add the rule in proper format with frontmatter
- Config regeneration - Run
~/agent-rules/build.sh
- Deployment - Copies to
~/.claude/AGENTS.md and ~/.claude/CLAUDE.md
Project Rules Flow
- Request parsing - Understand what project-specific rule you want
- File creation - Create/update
.rulesync/rules/50-project.md
- Config regeneration - Run
rulesync generate --targets '*'
- Project updates - Update project AGENTS.md if it exists
- Confirmation - Report what was changed
Rule Format
Rules are automatically formatted with proper structure:
---
name: category-name
description: Description of what this rule covers
---
# Category Name
## Rule Name
Description of the rule and when to apply it.
Category Detection
The skill automatically categorizes rules based on keywords:
| Keywords | Category | File |
|---|
| workflow, discipline, process, testing, verification | Workflow | 10-workflow.md |
| tool, cli, command, package, bun, npm, rtk, git | Tooling | 20-tooling.md |
| infra, deployment, docker, server, cloud, vps, dokploy | Infrastructure | 30-infra.md |
| platform, macos, windows, linux, signing, permissions | Platform | 40-platform.md |
| project-specific, custom, local | Project | 50-project.md |
Examples
Adding a global tooling rule
User: /rules global add a rule about always using rtk for shell commands
Skill: I'll add a tooling rule about rtk usage.
[Creates/updates ~/agent-rules/.rulesync/rules/20-tooling.md]
[Runs cd ~/agent-rules && ./build.sh]
[Updates ~/.claude/AGENTS.md and ~/.claude/CLAUDE.md]
✓ Added rtk rule to 20-tooling.md
✓ Regenerated AGENTS.md and CLAUDE.md
✓ Deployed to ~/.claude/
Adding a project-specific rule
User: /rules project add a rule about using our custom API client
Skill: I'll add a project-specific rule about the API client.
[Creates/updates .rulesync/rules/50-project.md]
[Runs rulesync generate --targets '*']
[Updates project AGENTS.md if it exists]
✓ Added API client rule to 50-project.md
✓ Regenerated project configs
Creating a new category
User: /rules global create a new category for database conventions
Skill: I'll create a new database category.
[Creates ~/agent-rules/.rulesync/rules/25-database.md]
[Adds category frontmatter and structure]
[Runs cd ~/agent-rules && ./build.sh]
✓ Created 25-database.md
✓ Regenerated AGENTS.md and CLAUDE.md
Error Handling
If the skill encounters issues:
- Missing rulesync - Will prompt to install it
- Permission denied - Will report the specific file/permission issue
- Invalid category - Will ask for clarification or use default
- Build failure - Will report the specific error and suggest fixes
Best Practices
The skill follows these conventions:
- Clear rule names - Descriptive and specific
- Action-oriented - Rules should be actionable
- Context included - When to apply the rule
- Examples added - Code examples where helpful
- Proper formatting - Consistent with existing rules
Integration
After running commands:
- Global rules take effect immediately after AI assistant restart
- Project rules take effect when working in that project
- Changes are persistent across sessions
- Global rules sync to VPSes via chezmoi (if configured)