aif-rules-check
Skill261 starsChanged 2 months agoBSD-3-ClauseView on GitHub
Run a standalone read-only rules compliance gate against changed files or a git ref. Use when you need a dedicated project-rules check without a full review or verify pass.
3 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- letuhao/lore-weaveedited, first seen Oct 17, 2026
- lee-to/ai-factoryedited, first seen Sep 22, 2026
- maister-dev/maisteredited, first seen May 27, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- lee-to/ai-factory★ 1.2k76% same
- letuhao/lore-weave★ 3591% same
- maister-dev/maister★ 1091% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- aif-architectureSkill
- aif-archiveSkill
- aif-best-practicesSkill
- aif-build-automationSkill
- aif-ciSkill
- aif-commitSkill
- aif-docsSkill
- aif-evolveSkill
- aif-exploreSkill
- aif-fixSkill
- aif-groundedSkill
- aif-implementSkill
- aif-improveSkill
- aif-loopSkill
- aif-planSkill
- aif-qa-checkSkill
- aif-qaSkill
- aif-reviewSkill
- aif-roadmapSkill
- aif-rulesSkill
- aif-security-checklistSkill
- aif-skill-generatorSkill
- aifSkill
- aif-verifySkill
- golang-code-styleSkill
- golang-concurrencySkill
- golang-contextSkill
- golang-databaseSkill
- golang-design-patternsSkill
- golang-documentationSkill
- golang-error-handlingSkill
- golang-namingSkill
- golang-performanceSkill
- golang-securitySkill
- golang-testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. 12 are common, 0 are distinctive, and 15 are very specific to this project.
12
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Run a standalone read-only rules gate for project rules.
- Common: line 20
Treat it as the canonical source for verdict semantics and report structure.
- Common: line 21
If examples in this file drift from the reference, follow the reference.
- Very specific: line 25
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
- Very specific: line 39
Treat any unknown value as slug.
- Common: line 41
If config is missing or partial, use defaults:
- Very specific: line 51
If paths.rules_file is missing from config, default to .ai-factory/RULES.md instead of treating config as incomplete.
- Very specific: line 52
If git.base_branch is missing from config, resolve the repository default branch from git metadata when possible.
- Common: line 62
Treat them as project-level overrides for this skill's general instructions.
- Common: line 63
When a skill-context rule conflicts with a general rule in this file, the skill-context rule wins.
- Common: line 64
When there is no conflict, apply both.
- Common: line 67
Enforcement: Before presenting the final report, verify it against all skill-context rules and fix any drift.
- Common: line 106
If nothing is staged, fall back to working tree:
- Very specific: line 111
If there is still no local diff and git.enabled = true, fall back to branch diff:
- Very specific: line 117
If there are still no changed files, return WARN rather than a hard failure.
- Common: line 128
Use changed file paths, folder names, and optional plan context to judge relevance.
- Very specific: line 129
If relevance is ambiguous, mention the rule source as uncertain and keep the outcome at WARN, not FAIL.
- Very specific: line 131
If no rules sources resolve, return WARN rather than a hard failure.
- Very specific: line 144
when workflow.plan_id_format = sequential, glob both paths.plans/[0-9][0-9][0-9][0-9]_<branch_stem>.md and …
- Common: line 169
Read the changed files from the resolved scope and compare them against the resolved rules.
- Very specific: line 176
Only return FAIL when an explicit hard rule is clearly violated by the inspected diff or changed files.
- Very specific: line 180
If a rule sounds like a preference, is too vague, or cannot be verified confidently from the diff, do not escalate it past WARN.
- Common: line 187
If rules are missing, stale, or need refinement:
- Very specific: line 193
Use the exact verdict semantics and section order from references/RULES-CHECK-CONTRACT.md.
- Common: line 204
When useful, suggest the next best workflow:
- Very specific: line 213
Use "blocking": true|false.
- Very specific: line 217
Do not use /aif-review in the JSON suggested_next.command.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rules Compliance Gate
Run a standalone read-only rules gate for project rules. This command checks rule compliance only; it does not replace /aif-review or /aif-verify.
Step 0: Load Contract
- Read
references/RULES-CHECK-CONTRACT.mdfirst. - Treat it as the canonical source for verdict semantics and report structure.
- If examples in this file drift from the reference, follow the reference.
Step 1: Load Config
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
paths.rules_filepaths.rulespaths.planpaths.planslanguage.uigit.enabledgit.base_branchrules.base- named
rules.<area>entries workflow.plan_id_format(default:slug) — used by the optional branch-based plan-context lookup in Step 2.3. Active values:slugandsequential. Plan context may be a root full-plan file or direct child ultraindex.md; numbered lookup covers both shapes.timestampanduuidare reserved values and currently behave likeslug. Treat any unknown value asslug.
If config is missing or partial, use defaults:
paths.rules_file:.ai-factory/RULES.mdpaths.rules:.ai-factory/rules/paths.plan:.ai-factory/PLAN.mdpaths.plans:.ai-factory/plans/git.enabled:truegit.base_branch: detect the repo default branch from git metadata; fall back tomainonly when detection is unavailablerules.base:.ai-factory/rules/base.mdworkflow.plan_id_format:slug
If paths.rules_file is missing from config, default to .ai-factory/RULES.md instead of treating config as incomplete.
If git.base_branch is missing from config, resolve the repository default branch from git metadata when possible; use main only as the final fallback.
Step 1.1: Load Skill Context
Read .ai-factory/skill-context/aif-rules-check/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:
- Treat them as project-level overrides for this skill's general instructions.
- When a skill-context rule conflicts with a general rule in this file, the skill-context rule wins.
- When there is no conflict, apply both.
- Skill-context rules apply to all outputs of this skill, including verdict wording and report structure.
Enforcement: Before presenting the final report, verify it against all skill-context rules and fix any drift.
Step 2: Resolve Inputs
Resolve two inputs before checking any rule:
- Changed scope - the diff and file list you are evaluating
- Resolved rule sources - the rule artifacts that may apply to that scope
Step 2.1: Resolve Changed Scope
If the user provided a git ref:
- Validate it first:
git rev-parse --verify <argument> - If valid, use:
git diff --name-only <argument>...HEAD git diff <argument>...HEAD If invalid, ask:
AskUserQuestion: `<argument>` is not a valid git ref. What should I check instead? Options: 1. Check staged / working-tree changes 2. Cancel
Without arguments:
- Prefer staged work:
git diff --cached --name-only git diff --cached - If nothing is staged, fall back to working tree:
git diff --name-only git diff - If there is still no local diff and
git.enabled = true, fall back to branch diff:git diff --name-only <resolved-base-branch>...HEAD git diff <resolved-base-branch>...HEAD
If there are still no changed files, return WARN rather than a hard failure.
Step 2.2: Resolve Rule Sources
Load rule sources in this order:
- The resolved
paths.rules_fileartifact - The resolved
rules.basefile - Any named
rules.<area>files from config that clearly match the changed scope
Area rules are optional and scoped:
- Use changed file paths, folder names, and optional plan context to judge relevance.
- If relevance is ambiguous, mention the rule source as uncertain and keep the outcome at
WARN, notFAIL.
If no rules sources resolve, return WARN rather than a hard failure.
Step 2.3: Optional Plan Context
Optional plan context: use the active plan file only when it helps interpret scope or area relevance; absence of a plan is never a failure.
Plan resolution order:
- Compute the canonical branch stem the same way as
/aif-plan,/aif-implement, and/aif-improve:- get current branch via
git branch --show-current(git mode only); branch_stem= current branch with every/replaced by-(for examplefeature/user-auth→feature-user-auth).
- get current branch via
- Branch-based lookup using
<branch_stem>:- when
workflow.plan_id_format = sequential, glob bothpaths.plans/[0-9][0-9][0-9][0-9]_<branch_stem>.mdandpaths.plans/[0-9][0-9][0-9][0-9]_<branch_stem>/index.md; Read every directory candidate and retain it only when it contains exactly one<!-- aif:plan-mode:ultra -->, then pick the highest-numbered valid artifact and warn when multiple valid candidates exist; prefer ultra if both shapes share the highest prefix; - otherwise/fallback check
paths.plans/<branch_stem>/index.mdandpaths.plans/<branch_stem>.md; Read the directory entrypoint first, ignore it unless it contains exactly one ultra marker, and warn/prefer ultra if both valid shapes exist.
- when
- A single named artifact in
paths.plans: count root*.mdfull plans and direct child*/index.mdentrypoints containing<!-- aif:plan-mode:ultra -->; exclude the resolved fast-plan path and never count phase files. - The fast plan at
paths.plan.
For ultra, read index.md first and only the linked phase files relevant to the
changed area when extra scope detail is needed. Do not fail the rules check
because a plan artifact is missing or ambiguous.
An automatically discovered directory entrypoint counts only when it contains
exactly one <!-- aif:plan-mode:ultra -->; ignore unrelated */index.md files.
Step 3: Evaluate Rules
Read the changed files from the resolved scope and compare them against the resolved rules.
Classification rules:
PASSwhen at least one applicable rule was checked and no clear violations were found.WARNwhen no applicable rules were resolved, the evidence is ambiguous, or there are no changed files to evaluate.FAILwhen an explicit hard rule is clearly violated by the inspected diff or changed files.
Only return FAIL when an explicit hard rule is clearly violated by the inspected diff or changed files.
Evidence rules:
- Tie every blocking violation to specific rule text and at least one concrete file/path or diff hunk.
- If a rule sounds like a preference, is too vague, or cannot be verified confidently from the diff, do not escalate it past
WARN. - Missing optional files or partially configured rules hierarchy are
WARN, notFAIL.
Step 4: Read-Only Boundary
This command is read-only: do not edit RULES.md, rules/base.md, rules.<area>, plan files, or source code.
If rules are missing, stale, or need refinement:
- Suggest
/aif-rules <rule text>for axioms - Suggest
/aif-rules area:<name>for area-specific rules
Step 5: Output
Use the exact verdict semantics and section order from references/RULES-CHECK-CONTRACT.md.
Required content:
- overall verdict
- files checked
- gate results
- blocking violations
- suggested fixes
- suggested rule updates
- final machine-readable
aif-gate-resultfenced JSON block
When useful, suggest the next best workflow:
/aif-reviewfor broader code review/aif-verifyfor full plan-completeness verification/aif-ruleswhen the underlying rules need to be captured or corrected
Machine-readable gate result:
- Append one final fenced
aif-gate-resultJSON block after the human-readable rules report. - Use
"gate": "rules". - Map the human rules verdict exactly:
PASS->pass,WARN->warn, andFAIL->fail. - Use
"blocking": true|false; set it totrueonly for explicit hard-rule violations that produce a humanFAIL. - Include only hard-rule violations in
"blockers": [. - Include changed or inspected paths in
"affected_files": [. - Set
"suggested_next": {to/aif-ruleswhen rules should be added or clarified,/aif-fixwhen code must change, ornullwhen no allowed next command fits. - Do not use
/aif-reviewin the JSONsuggested_next.command; it may appear only in human-readable workflow suggestions.
{
"schema_version": 1,
"gate": "rules",
"status": "warn",
"blocking": false,
"blockers": [],
"affected_files": [],
"suggested_next": {
"command": "/aif-rules",
"reason": "Rules are missing or ambiguous for the changed scope."
}
}Schema reminder: "status": "pass|warn|fail", "blocking": true|false, "blockers": [, "affected_files": [, "suggested_next": {.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

