| name | self-fix-loop |
| description | Self-learning fix loop - commit, push, monitor CI, auto-fix failures using swarm agents with skills on demand, loop until all checks pass. |
| version | 1.0 |
| template_version | 0.2 |
Self-Fix Loop Skill
Automated self-learning cycle: commit → push → monitor → analyze failures → fix → retry until all GitHub Actions pass.
Overview
Continuous improvement loop that:
- Commits all changes atomically
- Pushes to feature branch
- Creates/updates PR
- Monitors GitHub Actions
- On failure: uses swarm agents + skills to diagnose and fix
- Repeats until ALL checks pass
Usage
./scripts/self-fix-loop.sh
./scripts/self-fix-loop.sh --max-retries 5 --auto-research --fix-issues
./scripts/self-fix-loop.sh --dry-run
Arguments
| Argument | Description | Default |
|---|
--max-retries N | Maximum fix iterations | 5 |
--auto-research | Use web research on failures | true |
--fix-issues | Attempt automatic fixes | true |
--strict-validation | ALL checks must pass | true |
--timeout SECONDS | Per-iteration timeout | 1800 |
--poll-interval SECONDS | CI check polling | 30 |
--dry-run | Simulate without pushing | false |
--base-branch BRANCH | Target branch | main |
Loop Phases
[Start]
↓
Phase 1: COMMIT & PUSH
- Stage all changes
- Run quality gate
- Atomic commit
- Push to feature branch
↓
Phase 2: CREATE/UPDATE PR
- Create new PR or update existing
↓
Phase 3: MONITOR CI
- Poll GitHub Actions
- Wait for all checks complete
↓
Phase 4: ANALYZE FAILURES
- Identify failed checks
- Extract error messages
- Categorize failure type
↓
Phase 5: FIX (if failures)
- Launch swarm agents
- Use relevant skills on demand
- Apply fixes
- Commit fix
↓
Phase 6: RETRY LOOP
- If retries remaining → Phase 1
- If max retries → FAIL
- If all pass → SUCCESS
Skills Used On Demand
| Failure Type | Skills Activated |
|---|
| Shell script errors | shell-script-quality |
| YAML syntax | cicd-pipeline |
| Python errors | code-quality |
| TypeScript/JS errors | code-quality |
| Markdown issues | markdownlint |
| Security warnings | security-code-auditor |
| Link/reference errors | validate-links.sh |
| Skill format issues | validate-skill-format.sh |
| Codacy blocked | codacy (triage, suppress false positives, fix real issues) |
| Vercel deployment failure | Run ./scripts/verify-deps.sh, check for breaking API changes in major dep bumps |
| Unknown errors | web-search-researcher + do-web-doc-resolver |
Common Failure Patterns
| CI Check | Root Cause | Fix |
|---|
| Vercel — Type error: Property does not exist | Major dependency bump changed API (e.g. react-resizable-panels v3→v4 renamed exports) | Update imports to match new API, run pnpm run build to verify |
| Vercel — TSconfig deprecated option | TypeScript major bump deprecated baseUrl or other options | Add "ignoreDeprecations": "6.0" to tsconfig.base.json |
| Codacy — Object Injection Sink | ESLint security/detect-object-injection flags OBJ[variable] bracket access | Use switch/case pattern or Object.prototype.hasOwnProperty.call() guard |
| Codacy — static-components | react-hooks/static-components flags component creation during render | Use render function returning JSX instead of assigning component variable |
| Quality Gate — lockfile mismatch | pnpm-lock.yaml out of sync after dep bump | Run pnpm install and commit updated lockfile |
Swarm Agent Coordination
On each failure:
- Analyzer Agent: Diagnoses root cause from CI logs
- Researcher Agent: Web searches for solutions (if enabled)
- Fixer Agent: Applies fixes using relevant skills
- Validator Agent: Runs local quality gate before retry
Configuration
SELF_FIX_LOOP_MAX_RETRIES=5
SELF_FIX_LOOP_TIMEOUT=1800
SELF_FIX_LOOP_POLL_INTERVAL=30
SELF_FIX_LOOP_AUTO_RESEARCH=1
SELF_FIX_LOOP_STRICT_VALIDATION=1
Success Criteria
Loop succeeds when:
- ✓ All changes committed and pushed
- ✓ PR exists
- ✓ ALL GitHub Actions passing
- ✓ Zero warnings in all checks
Error Codes
| Code | Meaning |
|---|
| 0 | Success - all checks passed |
| 1 | Quality gate failed |
| 2 | Git operations failed |
| 3 | Max retries exceeded |
| 4 | Timeout |
| 5 | PR operations failed |
See Also
git-github-workflow/SKILL.md - Full git workflow
atomic-commit/SKILL.md - Atomic commit pattern
web-search-researcher/SKILL.md - Web research skill