Create and manage user rules that customize AI behavior. Use this skill when users want to create new rules, update existing rules, organize rules, or need guidance on writing effective rules for their projects or personal preferences.
Create effective user rules that customize AI behavior for projects and personal preferences.
User rules are custom instructions that modify how the AI assistant behaves. They can define:
Ask the user:
Common categories:
coding-style - Code formatting, syntax preferenceslanguage - Response language, communication styleproject - Framework-specific, architecture decisionsgit - Commit messages, branching, PR guidelinesnaming - Variable, function, file naming conventionssecurity - Authentication, secrets, input validationtesting - Test coverage, naming, mocking practicesdocumentation - Comments, README, JSDoc requirementsFor templates and examples, see references/rule-patterns.md.
Follow these principles:
For detailed writing guidelines, see references/best-practices.md.
Use this format:
## [Category]: [Short Title]
[Clear instruction in imperative form]
Example:
[Code or text example showing correct usage]
Exception: [When this rule doesn't apply, if any]
Check against this list:
## Coding: [Title]
[What to do and how to do it]
✅ Correct:
[good example]
❌ Avoid:
[bad example]
## Project: [Title]
Use [technology/pattern] for [purpose].
Configuration:
[relevant settings or file structure]
## Workflow: [Title]
[Step-by-step process or checklist]
1. [First step]
2. [Second step]
3. [Third step]
Create or append to the user's rules file. Group related rules under clear headers.
When updating, preserve existing rules unless explicitly asked to replace them.
Suggest organizing rules by:
Rules must be saved in the .agent/rules/ directory with one file per rule category:
.agent/rules/
├── git-commit.md # Git commit format rules
├── coding-style.md # Coding style rules
├── naming-conventions.md # Naming rules
├── security.md # Security rules
└── testing.md # Testing rules
{rule-name}.mdgit-commit.md, coding-style.md, api-design.mdEach rule file should include YAML frontmatter with activation mode, followed by the rule content:
---
activation: always_on # or: manual, model_decision, glob
description: Brief description for model decision mode
globs: ["*.ts", "src/**/*.tsx"] # only for glob activation
---
# [Rule Category Title]
Brief description of what this rule covers.
## Rule 1: [Title]
[Rule content with examples]
## Rule 2: [Title]
[Rule content with examples]
Rules can be activated in different ways:
| Mode | Frontmatter | Description |
|------|-------------|-------------|
| Manual | activation: manual | Activated via @mention in input (e.g., @git-commit) |
| Always On | activation: always_on | Always applied to all conversations |
| Model Decision | activation: model_decision | Model decides based on description field |
| Glob | activation: glob | Applied to files matching globs patterns |
Always On (recommended for general rules):
---
activation: always_on
---
Manual (for specific workflows):
---
activation: manual
---
Model Decision (context-dependent):
---
activation: model_decision
description: Apply when working with git commits or version control
---
Glob (file-type specific):
---
activation: glob
globs: ["*.ts", "*.tsx", "src/**/*.js"]
---
Reference other files in rules using @filename:
| Path Type | Example | Resolution |
|-----------|---------|------------|
| Relative | @../shared/common.md | Relative to rule file location |
| Absolute | @/docs/api.md | First tries true absolute path, then workspace-relative |
| Workspace | @app/types.ts | Relative to workspace/repository root |
Referencing shared documentation:
For API conventions, see @/docs/api-guidelines.md
Including type definitions:
All API responses must follow the types in @app/types/api.types.ts
Linking related rules:
See also: @coding-style.md for naming conventions
.agent/rules/ directory exists, create if notSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer