Loading...
Loading...
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.
npx skill4agent add lee-to/ai-factory ai-factory.evolvepatches (past mistakes) + project context + codebase patterns
↓
analyze recurring problems, tech-specific pitfalls, project conventions
↓
enhance skills with project-specific rules, guards, and patterns.ai-factory/DESCRIPTION.mdGlob: .ai-factory/patches/*.md.eslintrcphpstan.neonruff.toml$ARGUMENTS$ARGUMENTSGlob: {{skills_dir}}/*/SKILL.md{{skills_dir}}/Glob: skills/*/SKILL.md/ai-factory.fix/ai-factory.implement/ai-factory.task/ai-factory.review## Improvement: [skill-name]
### What
[Specific change to make]
### Why
[Which patches/patterns drove this change]
### Where
[Exact section in SKILL.md to modify]
### Change
[The actual text to add/modify]## Skill Evolution Report
Based on:
- X patches analyzed
- Y recurring patterns found
- Z tech-stack specific insights
### Proposed Improvements
#### /ai-factory.fix
1. **Add null-check guard** — 5 patches involved null references
→ Add to Step 2: "Check for optional/nullable fields before accessing nested properties"
2. **Add async/await pattern** — 3 patches involved unhandled promises
→ Add to Important Rules: "Always use try/catch with async/await"
#### /ai-factory.implement
1. **Add Prisma-specific warning** — 2 patches from incorrect Prisma queries
→ Add to Logging: "Log all Prisma queries in DEBUG mode"
#### /ai-factory.review
1. **Add checklist item** — optional chaining not checked
→ Add to Correctness: "Optional chaining for nullable relations"
Apply these improvements?
- [ ] Yes, apply all
- [ ] Let me pick which ones
- [ ] No, just save the reportEdit.ai-factory/evolutions/YYYY-MM-DD-HH.mm.mdmkdir -p .ai-factory/evolutions# Evolution: YYYY-MM-DD HH:mm
## Intelligence Summary
- Patches analyzed: X
- Recurring patterns: [list]
- Tech stack: [from DESCRIPTION.md]
## Improvements Applied
### [skill-name]
- [change description] ← driven by patches: [patch filenames]
### [skill-name]
- [change description] ← driven by: [tech stack / convention]
## Patterns Identified
- [pattern]: [frequency] occurrences
- [pattern]: [frequency] occurrences## Evolution Complete
Skills improved: X
Improvements applied: Y
### Recommendations
1. **Run `/ai-factory.review`** on recent code to verify improvements
2. **Next evolution** — run `/ai-factory.evolve` again after 5-10 more fixes
3. **Consider new skill** — if pattern X keeps recurring, create a dedicated skill:
`/ai-factory.skill-generator <skill-name>`AskUserQuestion: Free up context before continuing?
Options:
1. /clear — Full reset (recommended)
2. /compact — Compress history
3. Continue as is| Skill | Learns From | Example Enhancement |
|---|---|---|
| Patches → common errors | "Check for X before accessing Y" |
| Patches → prevention rules | "When creating models, always validate Z" |
| Patches → logging gaps | "Add validation task for nullable fields" |
| Patches → missed issues | "Check: are all optional relations null-safe?" |
| Codebase → conventions | "Use project's commit prefix format" |
| Codebase → patterns | "Default branch prefix based on project convention" |
/ai-factory.evolve fix
→ Found 6/10 patches tagged #null-check
→ Improvement: Add to /ai-factory.fix Step 2:
"PRIORITY CHECK: Look for optional/nullable fields accessed
without null guards. This is the #1 source of bugs in this project."
→ Improvement: Add to /ai-factory.review checklist:
"- [ ] All nullable DB fields have null checks in UI/API layer"/ai-factory.evolve all
→ Stack: Laravel + Eloquent (from DESCRIPTION.md)
→ Found 3 patches tagged #n-plus-one #database
→ Improvement: Add to /ai-factory.implement logging:
"Enable query logging: DB::enableQueryLog() in DEBUG mode"
→ Improvement: Add to /ai-factory.review checklist:
"- [ ] Eager loading used for related models (no N+1)"
→ Improvement: Add to /ai-factory.task descriptions:
"Include 'use ->with() for relations' in DB-related tasks"/ai-factory.evolve
→ No patches found (first run)
→ Analyzing project context only...
→ Stack: Next.js 14 + Prisma + TypeScript
→ Improvement: Add to /ai-factory.implement:
"Use server actions for mutations, API routes for external APIs"
→ Improvement: Add to /ai-factory.fix:
"For Prisma errors, check schema.prisma for field types first"
→ Improvement: Add to /ai-factory.review:
"- [ ] Server components don't use client-only hooks"/ai-factory.skill-generator