skills/aif-rules-check/SKILL.md
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.
npx skillsauth add lee-to/ai-factory aif-rules-checkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
references/RULES-CHECK-CONTRACT.md first.FIRST: Read .ai-factory/config.yaml if it exists to resolve:
paths.rules_filepaths.rulespaths.planpaths.planslanguage.uigit.enabledgit.base_branchrules.baserules.<area> entriesworkflow.plan_id_format (default: slug) — used by the optional branch-based plan-context lookup in Step 2.3.
Active values: slug and sequential. When sequential, the resolver globs
<paths.plans>/[0-9]{4}_<branch_stem>.md first and falls back to
<paths.plans>/<branch_stem>.md only if no numbered match is found.
timestamp and uuid are reserved values and currently behave like slug.
Treat any unknown value as slug.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 to main only when detection is unavailablerules.base: .ai-factory/rules/base.mdworkflow.plan_id_format: slugIf 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.
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:
Enforcement: Before presenting the final report, verify it against all skill-context rules and fix any drift.
Resolve two inputs before checking any rule:
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:
git diff --cached --name-only
git diff --cached
git diff --name-only
git diff
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.
Load rule sources in this order:
paths.rules_file artifactrules.base filerules.<area> files from config that clearly match the changed scopeArea rules are optional and scoped:
WARN, not FAIL.If no rules sources resolve, return WARN rather than a hard failure.
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:
/aif-plan,
/aif-implement, and /aif-improve:
git branch --show-current (git mode only);branch_stem = current branch with every / replaced by -
(for example feature/user-auth → feature-user-auth).<branch_stem>:
workflow.plan_id_format = sequential, glob first
paths.plans/[0-9][0-9][0-9][0-9]_<branch_stem>.md and pick the
highest-numbered match; emit a WARN [aif-rules-check] multiple sequential plans for <branch>: <list>; using <chosen> if more than one matches;paths.plans/<branch_stem>.md.paths.plans (the leading NNNN_ prefix
counts as a match) when no branch-based plan resolves.paths.plan.Do not fail the rules check because a plan file is missing or ambiguous.
Read the changed files from the resolved scope and compare them against the resolved rules.
Classification rules:
PASS when at least one applicable rule was checked and no clear violations were found.WARN when no applicable rules were resolved, the evidence is ambiguous, or there are no changed files to evaluate.FAIL when 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:
WARN.WARN, not FAIL.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:
/aif-rules <rule text> for axioms/aif-rules area:<name> for area-specific rulesUse the exact verdict semantics and section order from references/RULES-CHECK-CONTRACT.md.
Required content:
aif-gate-result fenced JSON blockWhen useful, suggest the next best workflow:
/aif-review for broader code review/aif-verify for full plan-completeness verification/aif-rules when the underlying rules need to be captured or correctedMachine-readable gate result:
aif-gate-result JSON block after the human-readable rules report."gate": "rules".PASS -> pass, WARN -> warn, and FAIL -> fail."blocking": true|false; set it to true only for explicit hard-rule violations that produce a human FAIL."blockers": [."affected_files": [."suggested_next": { to /aif-rules when rules should be added or clarified, /aif-fix when code must change, or null when no allowed next command fits./aif-review in the JSON suggested_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": {.
data-ai
Archive completed plans and roadmap milestones. Moves finished plans to the archive directory and optionally trims closed milestones from ROADMAP.md. Use when user says "archive plans", "clean up plans", "archive completed", or "trim roadmap".
tools
Set up agent context for a project. Analyzes tech stack, installs relevant skills from skills.sh, generates custom skills, and configures MCP servers. Use when starting new project, setting up AI context, or asking "set up project", "configure AI", "what skills do I need".
development
Verify completed implementation against the plan. Checks that all tasks were fully implemented, nothing was forgotten, code compiles, tests pass, and quality standards are met. Use after "/aif-implement" completes, or when user says "verify", "check work", "did we miss anything".
data-ai
Plan implementation for a feature or task. Two modes — fast (single quick plan) or full (richer plan with optional git branch/worktree flow). Use when user says "plan", "new feature", "start feature", "create tasks".