Agent skill

Aif Evolve

by unxed in unxed/f4

Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns.

BSD-3-ClauseAuto-check passed

Install Aif Evolve

skills CLI
$ npx skills add unxed/f4 --skill aif-evolve -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install unxed/f4 aif-evolve --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/unxed/f4.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/aif-evolve .claude/skills/aif-evolve && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
aif-evolve
GitHub stars
241
Token cost
~7.2k tokens
SKILL.md length
3,309 words
Files
1
Skills in repo
36
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns.

  • Works in 9 steps: Resolve Target & Load Context → Collect Intelligence → Read Target Skills → …
  • You want to make AI smarter for your project
  • SKILL.md covers Core Idea, Patch Consumption Policy, Critical: Never Edit Built-in… and Workflow, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Aif Evolve is an agent skill from unxed/f4. Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns. Analyzes what went wrong, what works, and enhances skills to prevent future issues. Use when you want to make AI smarter for your project.

Its SKILL.md is about 7.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: dual pane like a charm. The licence is BSD-3-Clause.

When your agent uses it

  • You want to make AI smarter for your project

Example prompts

  • “/aif-evolve”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep, Bash(git *), AskUserQuestion, Questions

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Resolve Target & Load Context
  2. Collect Intelligence
  3. Read Target Skills
  4. Check for Stale Rules in Skill-Context
  5. Present & Resolve Stale Rules
  6. Analyze Gaps
  7. Generate Improvements
  8. Present & Apply
  9. Suggest Next Actions

What it can do on your machine

Read from SKILL.md and the folder at commit e4d719a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep
    • Bash(git *)
    • AskUserQuestion
    • Questions

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are json, bash and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Aif Evolve loads about 7.2k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 3,309 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~7.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from unxed/f4 at commit e4d719a, republished under its BSD-3-Clause licence (© unxed). 3,309 words, ~7,246 tokens.

Download SKILL.mdSave it as .claude/skills/aif-evolve/SKILL.md (or your agent's skills folder).
name
aif-evolve
description
Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns. Analyzes what went wrong, what works, and enhances skills to prevent future issues. Use when you want to make AI smarter for your project.
allowed-tools
Read, Write, Edit, Glob, Grep, Bash(git *), AskUserQuestion, Questions
argument-hint
[skill-name or "all"]
disable-model-invocation
true

Evolve - Skill Self-Improvement

Analyze project context, patches, and codebase to improve existing skills. Makes AI Factory smarter with every run.

Core Idea

patches (past mistakes) + project context + codebase patterns
    ↓
analyze recurring problems, tech-specific pitfalls, project conventions
    ↓
enhance skills with project-specific rules, guards, and patterns

Patch Consumption Policy

Use a two-layer learning model:

  1. Raw patches (paths.patches, default: .ai-factory/patches/*.md) are the source material.
  2. Skill-context rules (.ai-factory/skill-context/*) are the compact, reusable output.

Policy across workflow skills:

  • /aif-evolve is the primary raw-patch analyzer. It processes patches incrementally using a cursor.
  • /aif-implement, /aif-fix, and /aif-improve should prefer skill-context first; raw patches are fallback context only.
  • Force full re-analysis only when needed (e.g., reset cursor and rerun evolve).

Critical: Never Edit Built-in Skills Directly

NEVER modify any files inside built-in aif-* skill directories (skills/aif-*/). All files in these directories are owned by ai-factory and will be overwritten on update — any direct edits will be lost.

ALWAYS write project-specific rules to skill-context:

.ai-factory/skill-context/<skill-name>/SKILL.md

This is the ONLY correct target for built-in skill improvements. No exceptions.

Workflow

Step 0: Resolve Target & Load Context
Step 0.1: Resolve Target

Normalize skill name from $ARGUMENTS:

User inputResolved skill name
planaif-plan
aif-planaif-plan
/aif-planaif-plan
my-custom-skillmy-custom-skill

Rule: first, strip any leading / from the argument. Then: if the argument does not start with aif- AND a skill named aif-<argument> exists — use aif-<argument>. Otherwise use as-is.

After resolving the skill name: verify that the resolved skill actually exists (check .agents/skills/<resolved-name>/SKILL.md or skills/<resolved-name>/SKILL.md). If the skill is not found → report an error to the user and stop: "Skill '<resolved-name>' not found. Use /aif-evolve without arguments to evolve all skills, or specify a valid skill name."

Determine which skills to evolve from $ARGUMENTS:

  • If $ARGUMENTS contains a specific skill name → evolve only that skill
  • If $ARGUMENTS is "all" or empty → evolve all installed skills
Step 0.2: Load Context

FIRST: Read .ai-factory/config.yaml if it exists to resolve:

  • Paths: paths.description, paths.architecture, paths.rules_file, paths.rules, paths.patches, and paths.evolutions
  • Language: language.ui for prompts and language.artifacts for generated reports
  • Rules hierarchy: rules.base plus any named rules.<area> entries

If config.yaml doesn't exist, use defaults:

  • DESCRIPTION.md: .ai-factory/DESCRIPTION.md
  • ARCHITECTURE.md: .ai-factory/ARCHITECTURE.md
  • RULES.md: .ai-factory/RULES.md
  • rules/: .ai-factory/rules/
  • patches/: .ai-factory/patches/
  • evolutions/: .ai-factory/evolutions/
  • Language: en (English)

Note: .ai-factory/skill-context/ remains a fixed internal AI Factory path in the current schema. Patch and evolution-log locations are configurable via paths.patches and paths.evolutions.

THEN: Read .ai-factory/DESCRIPTION.md (use path from config) to understand:

  • Tech stack
  • Architecture
  • Conventions

Also read .ai-factory/ARCHITECTURE.md (use path from config) and the configured rules hierarchy when present. This context informs convention analysis and gap detection but does not change artifact ownership.

Read skill-context files for target skills:

  • If evolving a specific skill (e.g., /aif-evolve plan) → read only:
    1. .ai-factory/skill-context/aif-plan/SKILL.md (target skill's context)
    2. .ai-factory/skill-context/aif-evolve/SKILL.md (evolve's own context, if exists and target skill is not aif-evolve itself)
  • If evolving all skills (/aif-evolve or /aif-evolve all) → read all context files: Glob: .ai-factory/skill-context/*/SKILL.md (this already includes evolve's own context — do NOT read it separately)

These contain previously accumulated project-specific rules for built-in skills. Keep them in memory — they affect gap analysis in Step 5.

Skill-context rules are project-level overrides — when they conflict with the base SKILL.md of the target skill, skill-context wins (same principle as nested CLAUDE.md files).

How to apply evolve's own skill-context rules (aif-evolve):

  • Treat them as project-level overrides for this skill's general instructions
  • When a skill-context rule conflicts with a general rule written in this SKILL.md, the skill-context rule wins (more specific context takes priority — same principle as nested CLAUDE.md files)
  • When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
  • Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults — they exist because the project's experience proved the default insufficient
  • CRITICAL: skill-context rules apply to ALL outputs of this skill — including the evolution report, proposed improvements, skill-context file edits, and stale rule analysis. If a skill-context rule says "evolve MUST prioritize X" or "report MUST include Y" — you MUST comply. Producing evolution output that ignores skill-context rules is a bug.

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.

Step 1: Collect Intelligence

1.1: Read patches incrementally (cursor-based)

Glob: <resolved patches dir>/*.md

Cursor file:

<resolved evolutions dir>/patch-cursor.json

Recommended shape:

json
{
  "last_processed_patch": "YYYY-MM-DD-HH.mm.md",
  "updated_at": "YYYY-MM-DD HH:mm"
}

Processing rules:

  1. Glob patch files and sort by filename ascending (timestamp format is lexical-friendly).
  2. If no cursor file exists → first run: read all patches.
  3. If cursor file exists and referenced patch is present → read only patches with filename > last_processed_patch.
  4. If cursor file exists but referenced patch is missing (deleted/renamed) → emit WARN [evolve] and do a full rescan.
  5. Historical edits/deletes for patches older than cursor are not reliably detectable without a saved baseline (snapshot/hash manifest). Do NOT emit this warning by default.
  6. Emit WARN [evolve] for historical drift only when a reliable baseline exists and drift is actually detected.
  7. Full rescan procedure: delete <resolved evolutions dir>/patch-cursor.json, then run /aif-evolve again.
  8. Do not advance cursor in Step 1.1. Cursor is updated only after successful apply/log write in Step 7.3.

Overlap window (anti-miss guard):

LLMs may miss prevention points on a single pass. To reduce the chance of "permanently skipping" a patch when running incrementally:

  1. When running in incremental mode (cursor exists and referenced patch is present), ALSO read the newest 5 patches by filename (tail-5 of the sorted patch list), then de-duplicate by filename.
  2. Track these separately in your own notes:
  • "New patches" = patches with filename > last_processed_patch
  • "Overlap patches" = tail-5 patches
  • "Processed patches" = union(New, Overlap)
  1. Cursor updates in Step 7.3 MUST be based on "New patches" only (never advance cursor when only overlap patches were processed).

Read every patch. For each one, extract:

  • Problem categories (null-check, async, validation, types, API, DB, etc.)
  • Root cause patterns (what classes of mistake were made)
  • Prevention points — each independent actionable rule from the Prevention/Solution section. A single patch often contains multiple independent prevention points targeting different skills. Extract EACH one separately with its target skill(s). Do NOT treat a patch as a single unit.
  • Tags

Build a Prevention Point Registry — a flat list of ALL extracted prevention points across the processed patch set in this run. This registry is the primary input for Step 5 gap analysis.

| # | Patch | Prevention Point (specific action) | Target Skill(s) |
|---|-------|------------------------------------|-----------------|
| 1 | <patch-file> | <concrete action to enforce> | <skill-1> |
| 2 | <patch-file> | <different action from same patch> | <skill-1>, <skill-2> |
| 3 | <other-patch> | <action> | <skill-3> |

CRITICAL: A patch with 5 prevention points produces 5 rows, not 1. If a prevention point targets 2 skills, it appears once but with both skills listed — and EACH skill must be checked independently in Step 5.

When the run is incremental, this registry reflects the processed patch set for this run (new + overlap). Use full rescan when you need full historical backfill.

1.2: Aggregate patterns

Group patches by tags and categories. Identify:

  • Recurring problems — same tag appears 3+ times? This is a systemic issue
  • Tech-specific pitfalls — problems tied to the stack (e.g., React re-renders, Laravel N+1)
  • Missing guards — what checks/patterns could have prevented these bugs

1.3: Read codebase conventions

Scan the project for patterns:

  • Linter configs (.eslintrc, phpstan.neon, ruff.toml, etc.)
  • Existing test patterns (test file structure, assertions used)
  • Error handling patterns (try/catch style, error types)
  • Logging patterns (logger used, format, levels)
  • Import conventions, file structure

When evolving a specific skill, focus convention scanning on areas relevant to that skill (e.g., for /aif-plan — focus on file structure and naming; for /aif-fix — error handling and testing).

Step 2: Read Target Skills

Read ONLY the base SKILL.md files for target skills — not all skills.

  • If evolving a specific skill (e.g., /aif-evolve plan) → read only that one: Read: .agents/skills/aif-plan/SKILL.md (or skills/aif-plan/SKILL.md if not installed)
  • If evolving all skills (/aif-evolve or /aif-evolve all) → read all: Glob: .agents/skills/*/SKILL.md (or Glob: skills/*/SKILL.md if not installed)

Keep loaded SKILL.md content in memory — Step 3 needs it for comparison (do NOT re-read).

Step 3: Check for Stale Rules in Skill-Context

When: Run this step for every target aif-* skill that has a skill-context file.

For each rule in .ai-factory/skill-context/<skill-name>/SKILL.md:

Scope constraint: Step 3 can ONLY modify or remove skill-context files. It must NEVER propose editing, deleting, or reverting base skills/aif-*/ files. Even if the base file contains errors or incomplete rules — that is outside evolve's scope.

  1. Use the base SKILL.md already loaded in Step 2 (do NOT re-read the file).

  2. Compare each skill-context rule against the base SKILL.md content:

    Case A — Base fully covers skill-context rule (equivalent or superset): The base SKILL.md now contains a rule that is equivalent to or MORE complete than the skill-context rule. This includes:

    • Exact equivalent — same rule, same content
    • Base is a superset — base has everything skill-context has, plus more (e.g., skill-context has Wave 1+3, base now has Wave 1+2+3) → Do NOT auto-remove. Do NOT ask the user yet. → Collect for the report in Step 4 — include both rules and mark as "Fully covered by base — recommend removing from skill-context". Note: if user chooses to keep the skill-context rule, this is valid — skill-context has priority over base, so keeping it acts as a guarantee that the complete/correct version is always applied.

    Case B — Contradicting rule found in base SKILL.md: The base skill now has a rule that directly contradicts the skill-context rule. → Do NOT auto-remove. Do NOT ask the user yet. → Collect this conflict for the report in Step 4 — include both rules and mark as "Conflict — user decision required".

    Case C — Partial overlap (in either direction): The base SKILL.md and skill-context rule overlap, but NEITHER fully covers the other. This includes:

    • Base covers part of skill-context, but skill-context has unique parts too
    • Skill-context covers part of base, but base has unique parts too (e.g., skill-context has A→B→C, base has A→C→D — both have unique parts) → Do NOT auto-narrow. Analyze whether parts depend on each other (ordering, prerequisites, data flow). → Collect this overlap for the report in Step 4 — include both rules, analysis, and mark as "Partial overlap — user decision required". Priority warning: skill-context has priority over base on the same topic. If user keeps skill-context as-is, the base's unique parts will likely be LOST (AI uses skill-context version, ignores base version of the same rule). Always explain this consequence in option descriptions.

    Case D — No overlap: The rule is still unique to the project context. → Keep as-is, no action needed.

Step 4: Present & Resolve Stale Rules

Skip this step if no Case A/B/C rules were found in Step 3.

Present all stale rule findings using the stale rules report format (Case A/B/C sections with base vs skill-context comparison).

IMPORTANT: All decisions here affect ONLY skill-context files. Never propose editing, deleting, or reverting base skills/aif-*/ files — they are outside of evolve's scope.

Stale Rules Report Format

For each stale rule, present:

/aif-plan — Fully covered: [Rule Name]
  • Base SKILL.md says: [base rule text]
  • Skill-context says: [project rule text]
  • Decision required: Keep in skill-context (has priority over base — ensures the complete version is always applied) / Remove from skill-context (trust base) / Rewrite skill-context rule
/aif-plan — Conflict: [Rule Name]
  • Base SKILL.md says: [base rule text]
  • Skill-context says: [project rule text]
  • Decision required: Keep skill-context rule (has priority — base version will be ignored) / Remove skill-context rule (trust base) / Rewrite skill-context rule
/aif-fix — Partial overlap: [Rule Name]
  • Base SKILL.md says: [base rule text]
  • Skill-context says: [project rule text]
  • Analysis: [explain overlap and whether parts are independent or sequential]
  • Decision required: Rewrite skill-context to include both unique parts (recommended when parts are sequential) / Keep skill-context as-is (WARNING: base's unique parts will be lost — skill-context has priority) / Narrow skill-context to uncovered part / Remove from skill-context (trust base — skill-context's unique parts will be lost)
Collecting Decisions

Use AskUserQuestion to collect stale rule decisions. Process in batches of up to 3 decisions per AskUserQuestion call:

  • Present first batch (up to 3 stale rules) → AskUserQuestion
  • Get answers → apply decisions
  • If more stale rules remain → present next batch → AskUserQuestion
  • Repeat until all stale rules are resolved

Do NOT proceed to Step 5 until all stale rule decisions are collected and applied. This determines the actual skill-context state for gap analysis.

Show full SKILL.md (1,360 more words)Show less
Step 5: Analyze Gaps

Before analyzing gaps: re-read skill-context files for target skills that were modified in Step 4 (stale rule removals/rewrites). Do NOT use the version loaded in Step 0.2 — it is outdated after Step 4 changes.

For each skill, consider the base SKILL.md AND its current skill-context file (after stale rule decisions from Step 4 have been applied). A gap only exists if NEITHER source covers it.

For each skill, identify what's missing based on collected intelligence:

5.1: Patch-driven gaps (prevention-point-exhaustive)

CRITICAL: Check each prevention point × each target skill independently.

Iterate over the Prevention Point Registry built in Step 1.1. For each row:

  1. For EACH target skill listed in that row:
    • Check if the base SKILL.md already covers this specific prevention action
    • Check if the skill-context already has a rule covering this specific prevention action
  2. A prevention point is "covered" for a skill ONLY when there is a rule that addresses the specific action described — not merely when the same patch filename appears in a Source field.
  3. Mark uncovered (prevention_point, skill) pairs as gaps → these become inputs for Step 6.

Common trap — Source reference ≠ full coverage: Finding Source: <patch-filename> in a skill-context rule means ONE rule was derived from that patch. It does NOT mean ALL prevention points from that patch are covered. A patch with 5 prevention points may have only 1 covered. Always verify the content of the existing rule against each prevention point individually.

Verification: After completing the registry scan, count: total prevention points, covered, uncovered. If uncovered > 0 — these are gaps for Step 6.

Note: in incremental mode, counts represent this run's processed patch set. For full historical recount, run a full rescan.

5.2: Tech-stack gaps

Compare project tech stack against skill instructions:

  • Skills reference generic patterns but project uses specific framework? → Add framework-specific guidance
  • Project uses TypeScript but skills show JS examples? → Update examples
  • Project uses specific ORM (Prisma, Eloquent)? → Add ORM-specific patterns

5.3: Convention gaps

Compare project conventions against skill instructions:

  • Project has specific error handling pattern? → Skills should enforce it
  • Project uses specific logger? → Skills should reference it
  • Project has specific file structure? → Skills should follow it
Step 6: Generate Improvements

For each gap found, create a concrete improvement:

Quality rules for improvements:

  • One prevention point = one rule. A single patch may contain multiple independent prevention items. Each one becomes a separate rule — do NOT merge them into a single vague summary.
  • Preserve concrete formats and patterns from patches. If a patch specifies an exact format, syntax, or template — the rule MUST include it verbatim. Do NOT paraphrase specifics into vague descriptions.
  • Each improvement must be traceable to a patch, convention, or tech-stack fact
  • No generic advice — only project-specific enhancements
  • Improvements must be minimal and focused — don't rewrite entire skills
  • Preserve existing skill structure — add, don't replace
Step 7: Present & Apply

7.1: Present improvements to user

Each improvement MUST explicitly state the target file path. Use the following target labels:

  • skill-context → .ai-factory/skill-context/<skill-name>/SKILL.md
  • SKILL.md → direct edit of the skill's own SKILL.md (only for custom/non-aif skills)
  • Nested file → if the skill directory contains additional files (e.g., templates/, checklists/), specify the exact relative path within the skill directory

Format:

## Skill Evolution Report

Based on:
- X patches analyzed
- Y recurring patterns found
- Z tech-stack specific insights

### Proposed Improvements

#### /aif-fix (N rules)
**Target:** `.ai-factory/skill-context/aif-fix/SKILL.md`

1. **Add null-check guard**
   - **Source:** patch-2026-02-10.md, patch-2026-02-12.md (5 patches involved null references)
   - **Why:** Recurring null-reference errors on optional DB relations
   - **Rule:** "Check for optional/nullable fields before accessing nested properties"

2. **Add async/await pattern**
   - **Source:** patch-2026-02-11.md (3 patches involved unhandled promises)
   - **Why:** Unhandled promise rejections in API layer
   - **Rule:** "Always use try/catch with async/await"

#### /aif-implement (N rules)
**Target:** `.ai-factory/skill-context/aif-implement/SKILL.md`

1. **Add Prisma-specific warning**
   - **Source:** patch-2026-02-13.md (2 patches from incorrect Prisma queries)
   - **Why:** Silent data loss from wrong Prisma query methods
   - **Rule:** "Log all Prisma queries in DEBUG mode"

#### /my-custom-skill (N rules)
**Target:** `skills/my-custom-skill/SKILL.md` (direct edit — custom skill)

1. **Add pattern**
   - **Source:** codebase convention
   - **Why:** Missing guard in Step 2
   - **Rule:** "..."

After presenting the full report, use AskUserQuestion to collect decisions:

For improvements — ask:

  • Yes, apply all improvements
  • Let me pick
  • No, just save report (no changes applied)

Based on choice:

  • "Yes, apply all improvements" → proceed to 7.2 with all improvements
  • "Let me pick" → present improvements in batches of up to 4 per AskUserQuestion call (same approach as Step 4 stale rules). For each improvement, options: Apply / Skip. Continue until all improvements are resolved. Then proceed to 7.2 with only approved improvements.
  • "No, just save report" → no changes applied, STOP

Do NOT apply any changes until the user answers.

7.2: Apply approved improvements

For each approved improvement, determine the target:

If the skill is a built-in aif-* skill (its SKILL.md is inside the package skills/ directory):

  1. Create directory if needed: mkdir -p .ai-factory/skill-context/<skill-name>
  2. If .ai-factory/skill-context/<skill-name>/SKILL.md doesn't exist — create it with the header template
  3. If it exists — read it first, then for each improvement decide:
    • Update existing rule — when a rule on the same topic already exists (e.g., a null-check rule exists from 3 patches, and 5 new null-check patches arrived → strengthen the existing rule, update its Source list, adjust severity/wording based on new evidence)
    • Add new rule — when no existing rule covers this topic
    • Merge rules — when multiple narrow rules can be combined into one broader rule (e.g., three separate "check field X" rules → one "always null-check optional DB relations" rule)
  4. Update the > Last updated: and > Based on: lines in the header
  5. NEVER edit any files inside the skill's skills/aif-*/ directory — all files there are owned by ai-factory and WILL be overwritten on update. All improvements go to skill-context only.
  6. After applying all changes (including stale rule removals), if a skill-context file has no rules left (only the header remains), delete the file and its directory: rm .ai-factory/skill-context/<skill-name>/SKILL.md rmdir .ai-factory/skill-context/<skill-name> (only if empty)
  7. Update the > Based on: count and > Last updated: in skill-context files that were only affected by stale rule removals (Step 4) but did NOT receive new improvements (those were already updated in item 4).

If the skill is a custom/project skill (not aif-*):

  1. Edit the skill's SKILL.md directly (existing behavior, unchanged)

Context file template:

IMPORTANT: All skill-context files MUST be written in English, regardless of the user's language or the language used in patches/RULES.md. Skill-context rules are consumed by AI agents — English ensures consistent interpretation across all skills and sessions.

# Project Rules for /<skill-name>

> Auto-generated by `/aif-evolve`. Do not edit manually.
> Last updated: YYYY-MM-DD HH:mm
> Based on: N analyzed patches

## Rules

### [Rule Name]
**Source**: [patch filenames or "codebase convention"]
**Rule**: [Specific, actionable instruction in English]

7.3: Save evolution log

Create <resolved evolutions dir>/YYYY-MM-DD-HH.mm.md:

bash
mkdir -p <resolved evolutions dir>

After saving the evolution log, update cursor state:

Definitions:

  • "New patches processed" = patches with filename > last_processed_patch.
    • If no cursor exists (first run): "New patches" is the full patch list.
    • Overlap patches do NOT count as "New patches".
  • "Improvements applied" = at least one approved improvement was written to disk (skill-context updated and/or custom skill SKILL.md edited).

Cursor update rules:

  1. If no new patches were processed, keep cursor unchanged.
  2. If new patches were processed:
    • If improvements were applied: advance the cursor to the newest "New patch" filename.
    • If no improvements were applied (e.g., user chose "No, just save report" or skipped all):
      • Do NOT advance cursor by default.
      • Ask the user whether to advance cursor anyway.
        • Recommended: keep cursor unchanged to allow reruns (LLMs may miss prevention points).
        • If the user explicitly chooses to advance anyway, write the cursor as usual.
  3. If execution fails before changes are finalized, do not advance cursor.
markdown
# Evolution: YYYY-MM-DD HH:mm

## Intelligence Summary
- Patches analyzed: X
- Recurring patterns: [list]
- Tech stack: [from DESCRIPTION.md]

## Improvements Applied

### [skill-name] → skill-context
- [change description] ← driven by patches: [patch filenames]
  **File:** `.ai-factory/skill-context/[skill-name]/SKILL.md`

### [skill-name] → SKILL.md (custom skill)
- [change description] ← driven by: [tech stack / convention]
  **File:** `skills/[skill-name]/SKILL.md`

## Patterns Identified
- [pattern]: [frequency] occurrences
- [pattern]: [frequency] occurrences
Step 8: Suggest Next Actions
## Evolution Complete

Skills improved: X
Improvements applied: Y

### Recommendations

1. **Run `/aif-review`** on recent code to verify improvements
2. **Next evolution** — run `/aif-evolve` again after 5-10 more fixes
3. **Consider new skill** — if pattern X keeps recurring, create a dedicated skill:
   `/aif-skill-generator <skill-name>`
Context Cleanup

Artifact Ownership

  • Primary ownership: .ai-factory/skill-context/*, <resolved evolutions dir>/*.md, and <resolved evolutions dir>/patch-cursor.json.
  • Config use is partial here: config.yaml resolves description, rules, patches, and evolution-log paths, but skill-context remains a fixed AI Factory internal path.
  • Read-only context: roadmap, rules, research, and plan artifacts unless the user explicitly requests otherwise.

After completing evolution, suggest /clear or /compact — context is heavy after patch analysis and skill processing.

Rules

  1. Traceable — every improvement must link to a patch, convention, or tech fact
  2. Minimal — add rules to skill-context, don't rewrite base skills
  3. Reversible — user approves before changes are applied
  4. Cumulative — each evolution builds on previous ones
  5. No hallucination — only suggest improvements backed by evidence
  6. Preserve structure — don't change base skill workflow, only enrich via skill-context
  7. Skill-context only — all improvements for built-in aif-* skills go to .ai-factory/skill-context/, never to skills/aif-*/. NEVER edit any files inside skills/aif-*/ — they are overwritten on update. No exceptions.
  8. English only — all skill-context files must be written in English, regardless of user's language
  9. No generic advice — "write clean code" is not an improvement; only project-specific enhancements
  10. No new skills — suggest /aif-skill-generator instead
  11. No losing coverage — do not remove rules unless they are stale (Steps 3-4). Merges in Step 7 (combining narrow rules into a broader one) are allowed as long as all prevention points are preserved in the merged rule.
  12. Installed only — do not evolve skills not installed in the project
  13. Ownership boundary — this command owns <resolved evolutions dir>/*.md, <resolved evolutions dir>/patch-cursor.json, and .ai-factory/skill-context/*; treat roadmap/rules/research/plan artifacts as read-only context unless explicitly asked

Example

/aif-evolve fix

→ Found 6/10 patches tagged #null-check
→ Improvement for /aif-fix (2 rules):
  Target: .ai-factory/skill-context/aif-fix/SKILL.md
  1. "PRIORITY CHECK: Look for optional/nullable fields accessed
      without null guards. This is the #1 source of bugs in this project."
  2. "When fixing nullable relation errors, check ALL usages of that
      relation in the same file — same bug often repeats nearby."

© unxed, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/aif-evolve of unxed/f4.

Open the folder on GitHubat commit e4d719a

Compare with similar skills

Aif Evolve next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Aif Evolve compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Aif Evolve this skillunxed/f4241—~7.2kAutomated safety check: PassBSD-3-Clause
A-Evolve Agent Improvementaiming-lab/AutoResearchClaw15k—~1.8kAutomated safety check: PassMIT
Factory MCPwarpdotdev/warp65k1 repos~237Automated safety check: PassAGPL-3.0
Warp Factory Fileswarpdotdev/warp65k1 repos~2.5kAutomated safety check: PassAGPL-3.0
Factorial AutomationComposioHQ/awesome-claude-skills77k3 repos~738Automated safety check: PassNone
Harness Evolveruvnet/ruflo74k—~1.6kAutomated safety check: NotesMIT

Similar skills

  • A-Evolve Agent Improvement

    aiming-lab/AutoResearchClaw

    Diagnoses where an agent failed across runs and turns the findings into new skills, system prompt patches and knowledge entries, using the A-Evolve loop.

    15k GitHub stars~1.8k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Factory MCP

    warpdotdev/warp

    Use the Warp Factory MCP to hand work to a software factory and collaborate with it — bundle local work and send it to the cloud, find factory tasks from a Slack thread / Linear ticket /…

    65k GitHub starsUsed in 1 repo~237 tokens
    Agent WorkflowsAuto-check passed
  • Warp Factory Files

    warpdotdev/warp

    Authors and edits file-based Warp software factory definitions rooted at factory.yaml, covering agents, automations, scorers and webhooks, and validates them before a pull request.

    65k GitHub starsUsed in 1 repo~2.5k tokens
    DevelopmentAuto-check passed
  • Factorial Automation

    ComposioHQ/awesome-claude-skills

    Automate Factorial tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~738 tokens
    Productivity & AutomationAuto-check passed
  • Harness Evolve

    ruvnet/ruflo

    Run @metaharness/darwin evolve <repo to mutate a harness's seven policy surfaces (planner/contextBuilder/reviewer/retryPolicy/toolPolicy/memoryPolicy/scorePolicy), sandbox-score each variant, and…

    74k GitHub stars~1.6k tokensUpdated yesterday
    DevelopmentAuto-check: notes
  • A-Evolve Agent Evolution

    Orchestra-Research/AI-Research-SKILLs

    Guidance for using A-Evolve to improve an AI agent automatically, evolving its prompts, skills and memory against a benchmark through solve, observe and evolve cycles.

    13k GitHub starsUsed in 1 repo~3.6k tokens
    AI & LLM EngineeringAuto-check passed

More from unxed/f4

All 36 skills in this repo
  • Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt.

    241 GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check passed
  • Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt.

    241 GitHub starsUsed in 3 repos~2.5k tokens
    Auto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    241 GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed
  • Security audit checklist based on OWASP Top 10 and best practices.

    241 GitHub stars~5.4k tokensUpdated yesterday
    Auto-check: notes
  • Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters, functional options, acronyms, test functions, and…

    241 GitHub starsUsed in 2 repos~3.1k tokens
    Auto-check passed
  • Golang concurrency design — goroutine lifecycle and leak prevention, channels and select, channel ownership and direction, sync.Mutex/RWMutex/sync.Map/sync.Once/atomics, errgroup, singleflight…

    241 GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed

Questions about Aif Evolve

What does Aif Evolve do?

Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns. Aif Evolve is an agent skill from unxed/f4. Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns.

When should I use Aif Evolve?

Aif Evolve fits situations like: you want to make AI smarter for your project.

How do I install Aif Evolve in Claude Code?

Run `npx skills add unxed/f4 --skill aif-evolve -a claude-code`. Or copy the skill folder (.agents/skills/aif-evolve in unxed/f4) into .claude/skills/aif-evolve in your project. Claude Code loads it when a task matches its description.

How do I install Aif Evolve in Codex?

Run `npx skills add unxed/f4 --skill aif-evolve -a codex`. Or copy the skill folder (.agents/skills/aif-evolve in unxed/f4) into .agents/skills/aif-evolve in your project. Codex loads it when a task matches its description.

Can I use Aif Evolve in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add unxed/f4 --skill aif-evolve -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/aif-evolve, .gemini/skills/aif-evolve, .github/skills/aif-evolve and .opencode/skills/aif-evolve in your project.

What does Aif Evolve need to run?

SKILL.md names no scripts, command-line tools or credentials: Aif Evolve is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep, Bash(git *), AskUserQuestion, Questions.

Does Aif Evolve access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Aif Evolve safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Aif Evolve use?

Aif Evolve is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Aif Evolve use?

About 7.2k tokens (SKILL.md is roughly 29k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Aif Evolve?

Skills that share tags, products or a category with Aif Evolve: A-Evolve Agent Improvement (aiming-lab/AutoResearchClaw, 15k stars), Factory MCP (warpdotdev/warp, 65k stars), Warp Factory Files (warpdotdev/warp, 65k stars) and Factorial Automation (ComposioHQ/awesome-claude-skills, 77k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Aif Evolve?

unxed (a GitHub user) maintains it in unxed/f4, which has 241 GitHub stars. The repository holds 36 skills in this directory. The repository was last updated on October 8, 2026.

Source: unxed/f4 on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.