Add project-specific rules and conventions to the configured RULES.md artifact. Each invocation appends new rules. These rules are automatically loaded by /aif-implement before execution. Use when user says "add rule", "remember this", "convention", or "always do X".
78%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/aif-rules/SKILL.mdApply this contract whenever the workflow asks the user to decide:
AskUserQuestion and Questions below describe the intended interaction, not a required tool name. Use only a question tool actually exposed and permitted in the current session/mode, with its advertised schema. Do not guess aliases, probe unavailable tools, or assume questionnaire exists. A frontmatter entry alone does not make a tool available.HANDOFF_MODE=1), do not prompt the user directly. Use declared defaults only for optional preferences within the authorized scope and report assumptions. If a required decision, approval, or material scope/behavior choice remains unresolved, stop dependent work and return the missing decision and options to the parent/caller using its existing blocked/failure contract. Never invent consent or select a new scope to avoid blocking.This delivery policy applies to this skill and its linked references. Preserve workflow-specific question scope, required confirmations, approval boundaries, and blocked-result rules.
Before mode routing or work, read existing files relative to the current project root in this order (reuse them if already loaded):
.ai-factory/skill-context/global-skill-context.md — all bundled skills..ai-factory/skill-context/aif-rules/SKILL.md — this skill.Missing files are skipped; an existing unreadable file stops dependent work with its path.
Precedence: individual > build (when applicable) > global > skill defaults; retain non-conflicting instructions and check all outputs against the effective rules.
These layers customize workflow; they do not replace the project's rules/architecture hierarchy or relax explicit requirements, ownership, scope, safety/privacy, validation, or approval boundaries. Report conflicts with those boundaries instead of overriding them.
global is a project-local layer, not home-directory configuration. Custom/extension skills do not automatically use it.
Add short, actionable rules and conventions for the current project. Rules are saved to the configured RULES.md artifact (default: .ai-factory/RULES.md) and automatically loaded by /aif-implement before task execution.
AI Factory supports a three-level rules hierarchy:
RULES.md - Axioms (universal project rules)
/aif-rules)rules/base.md - Project-specific base conventions
/aif during project setuprules. - Area-specific conventions
.ai-factory/config.yaml as named keys such as rules.apiPriority: More specific rules win. rules.<area> > rules/base.md > RULES.md
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
paths.rules_file and paths.ruleslanguage.ui for prompts and summaries, language.artifacts for rules artifacts, and language.technical_terms for human-readable technical terminology in rulesIf config.yaml doesn't exist, use defaults:
.ai-factory/RULES.md.ai-factory/rules/ui_language: enartifact_language: entechnical_terms_policy: keepResolved language values:
ui_language = language.ui || "en"artifact_language = language.artifacts || language.ui || "en"technical_terms_policy = language.technical_terms || "keep"If technical_terms_policy is not one of keep, translate, or mixed, treat it as keep. Legacy values such as english also behave like keep.
All AskUserQuestion prompts, progress updates, confirmations, and next-step guidance MUST be written in ui_language.
Generated or updated rules artifacts under paths.rules_file and paths.rules/<area>.md MUST be written in artifact_language.
Templates and examples define structure, not fixed English output. If artifact_language is not en, translate human-readable headings, notes, rule text, labels, and confirmation prose before saving. Preserve markdown structure, paths, commands, config keys such as rules.<area>, area names, code identifiers, package names, API names, and raw errors unchanged. Apply technical_terms_policy to other human-readable terminology.
Read .ai-factory/skill-context/aif-rules/SKILL.md - MANDATORY if the file exists.
This file contains project-specific rules accumulated by /aif-evolve from patches,
codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
How to apply skill-context rules:
Enforcement: After generating any output artifact, verify it against all skill-context rules. If any rule is violated - fix the output before presenting it to the user.
Check $ARGUMENTS:
- Starts with "area:" or "area "? -> Mode C: Area rules
- Has text? -> Mode A: Direct add
- No arguments? -> Mode B: InteractiveUser provided rule text as argument:
/aif-rules Always use DTO classes instead of arraysSkip to Step 2 with the provided text as the rule.
No arguments provided:
/aif-rulesAsk via AskUserQuestion:
What rule or convention would you like to add?
Examples:
- Always use DTO classes instead of arrays for data transfer
- Routes must use kebab-case
- All database queries go through repository classes
- Never use raw SQL, always use the query builder
- Log every external API call with request/responseUser wants to create or update area-specific rules:
/aif-rules area:api
/aif-rules area frontendWorkflow:
Parse area name from argument (e.g., api, frontend, backend, database)
Resolve the area file path inside the configured rules directory.
Default: .ai-factory/rules/<area>.md
Check if area file exists:
Glob: <resolved rules dir>/<area>.mdIf file does NOT exist -> create it with header:
# <Area> Rules
> Area-specific conventions for <area>. Loaded after rules/base.md.
## Rules
- [first rule]If file exists -> ask user what rule to add:
AskUserQuestion: What rule would you like to add to <area>.md?
Current rules in <area>.md:
- [existing rule 1]
- [existing rule 2]
Options:
1. Add new rule - specify below
2. View full file
3. CancelAppend rule using Edit at the end of the ## Rules section.
Register the area in .ai-factory/config.yaml:
rules.<area> points to the resolved area rules file pathconfig.yaml does not exist yet, create a minimal config scaffold using defaults plus the new rules.<area> entryrules.base and any other named rules.<other-area> entriesConfirm:
Rule added to <resolved area rules file> and registered as `rules.<area>` in config.yaml:
- [the rule]
Total <area> rules: [count]STOP after Mode C completes.
paths.rules_file artifact.<resolved rules dir>/<area>.md plus the matching rules.<area> registration in config.yaml.Common areas:
api - REST/GraphQL API conventionsfrontend - UI components, state managementbackend - Services, business logicdatabase - Queries, migrations, schemastesting - Test patterns, coveragesecurity - Auth, validation, sanitizationCheck if the resolved RULES.md path exists:
Glob: <resolved RULES.md path>If file does NOT exist -> create it with the header and first rule:
# Project Rules
> Short, actionable rules and conventions for this project. Loaded automatically by /aif-implement.
## Rules
- [new rule here]If file exists -> read it, then append the new rule at the end of the rules list.
Use Edit to append the new rule as a - list item at the end of the ## Rules section.
Formatting rules:
- lineartifact_language; translate user-provided human-readable rule text when needed so the persisted artifact follows language.artifacts, while preserving stable technical tokens from Step 0.Rule added to <resolved RULES.md path>:
- [the rule]
Total rules: [count]paths.rules_file path (default: .ai-factory/RULES.md)config.yaml as rules.<area>rules.* subset of .ai-factory/config.yaml; other context artifacts stay read-only unless explicitly requested by the userlee-to/ai-factory
ebb5086
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.