Skip to content

Self-improving AI agent system for GitHub PR automation

Notifications You must be signed in to change notification settings

fetch-rewards/skill-ception

Repository files navigation

Skill-ception: Self-Improving AI Agent System

Skill-ception is an iterative AI agent system that monitors GitHub PRs, fixes issues using Claude Code, and maintains a self-improving skill repository. When fixing issues, it searches for appropriate skills, uses existing ones when available, creates new ones when needed, and updates skills that previously failed.

Features

  • Automated PR Fixing: Uses Claude Code with matched skills to fix issues
  • Multi-Repository Skill Search: Searches skills across multiple configured repositories
  • Semantic Skill Matching: Uses LLM-based matching to find most relevant skills
  • Automatic Skill Creation: Creates new skills from successful novel solutions
  • Skill Improvement: Updates skills that previously failed
  • Skill Testing: Automatically tests new/updated skills before merging
  • PR History Tracking: Tracks which skills were used and their success rates

Architecture

GitHub PR Event
    ↓
GitHub Actions Workflow (claude-code-action@v1)
    ↓
Skill-ception Orchestrator
    ├─→ Load PR Context & History
    ├─→ Skill Manager (Search & Match)
    └─→ Load Matched Skills
    ↓
Claude Code Execution
    ↓
Skill Evaluator
    ├─→ Success Evaluation
    └─→ Decision: Create/Update/Nothing
    ↓
Skill Repository Manager
    ├─→ Create New Skill (if needed)
    ├─→ Update Existing Skill (if failed before)
    └─→ Submit PR to skill repo
    ↓
Skill Tester (auto-triggered)
    ├─→ Generate Test Scenarios
    ├─→ Run Tests
    └─→ Report Results

Setup

Prerequisites

  • Python 3.11+
  • uv (Python package manager)
  • GitHub repository with Actions enabled
  • AWS Bedrock access (for Claude Code via OIDC)
  • Anthropic API key (for skill matching and generation)

Installation

# Clone the repository
git clone https://github.com/fetch-rewards/skill-ception.git
cd skill-ception

# Install dependencies
uv sync

Configuration

  1. Configure skill repositories in .skill-ception/config.yml:
skill_repos:
  - url: https://github.com/fetch-rewards/labs-skills
    branch: main
    enabled: true
    priority: 1
  1. Set up GitHub secrets:

    • ANTHROPIC_API_KEY: Your Anthropic API key
    • GITHUB_TOKEN: Automatically provided by GitHub Actions
  2. Configure AWS OIDC for Bedrock access:

    • Set OIDC_IAM_ROLE repository variable
  3. Enable workflows in your repository settings

Usage

Automated PR Fixing

  1. Create a PR with code that needs fixing
  2. Add the ai-fix label, OR
  3. Comment @claude on the PR

Skill-ception will:

  • Search for relevant skills
  • Generate a system prompt with matched skills
  • Run Claude Code to fix the issue
  • Evaluate results and create/update skills if needed

Manual Testing

# Test skill matching
python -m skill-ception.skill_manager --match "Add JWT validation to API"

# Test orchestrator (dry run)
python -m skill-ception.orchestrator --pr 123 --dry-run

# Test skill creation
python -m skill-ception.skill_creator --task "Add JWT validation" --solution "Used PyJWT library"

# Test skill testing
python -m skill-ception.skill_tester --test-skill "07-security/jwt-validation"

Components

Orchestrator

File: skill-ception/orchestrator.py

Main coordination logic:

  • Loads PR context and history
  • Coordinates skill search and matching
  • Generates system prompt for Claude Code
  • Handles post-execution evaluation

Skill Manager

File: skill-ception/skill_manager.py

Manages skill repositories:

  • Clones/updates skill repos
  • Searches all skills
  • Performs keyword filtering
  • Semantic matching with LLM

Evaluator

File: skill-ception/evaluator.py

Evaluates execution results:

  • Determines success/failure
  • Extracts used skills
  • Decides if skill creation/update needed
  • Calculates solution complexity

Skill Creator

File: skill-ception/skill_creator.py

Creates new skills:

  • Generates skill name (gerund form)
  • Determines category
  • Creates SKILL.md content
  • Submits PR to skill repo
  • Triggers skill testing

Skill Updater

File: skill-ception/skill_updater.py

Updates existing skills:

  • Analyzes failures
  • Generates improvements
  • Updates skill content
  • Submits update PR

Skill Tester

File: skill-ception/skill_tester.py

Tests skills automatically:

  • Generates test scenarios
  • Creates test environments
  • Runs Claude Code with skill
  • Verifies outcomes
  • Reports results

History Tracker

File: skill-ception/history_tracker.py

Tracks PR attempts:

  • Records skill usage
  • Tracks success/failure
  • Stores metadata
  • Enforces attempt limits

Configuration Options

See .skill-ception/config.yml for all options:

  • Skill repositories: Configure multiple repos to search
  • Skill creation: Auto-create, complexity threshold, approval required
  • Skill updates: Auto-update, approval required, max updates per PR
  • Skill testing: Enable/disable, test strategy, auto-iteration
  • Safety limits: Max attempts per PR, max skills created

Skill Format

Skills follow the One-Agent Skill Standard (OASS):

---
name: skill-name-in-gerund-form
description: Use when [specific scenario]
category: 07-security
tags: [jwt, authentication, security]
---

## Quick Start

[Practical example of using this skill]

## Key Points

- Point 1
- Point 2
- Point 3

## Common Mistakes

- Mistake 1
- Mistake 2

## More Detail

[Additional context and guidance]

Workflows

Main Workflow

File: .github/workflows/skill-ception.yml

Triggers:

  • PR opened/updated with ai-fix label
  • Comment with @claude mention

Steps:

  1. Load PR context
  2. Generate system prompt with skills
  3. Run Claude Code
  4. Evaluate results
  5. Create/update skills if needed

Skill Testing Workflow

File: .github/workflows/skill-test.yml

Triggers:

  • Repository dispatch from skill creation
  • Manual workflow dispatch

Steps:

  1. Load skill content
  2. Generate test scenarios
  3. Create test environments
  4. Run tests
  5. Comment results on skill PR

Development

Running Tests

# Run unit tests
uv run pytest tests/

# Run with coverage
uv run pytest --cov=skill-ception tests/

Linting

# Run ruff
uv run ruff check skill-ception/

# Auto-fix issues
uv run ruff check --fix skill-ception/

Type Checking

uv run mypy skill-ception/

Safety Features

  • Attempt limits: Max 3 attempts per PR to prevent infinite loops
  • Skill creation throttle: Max 1 new skill per PR
  • Human review: All skill changes go through PR review
  • Test before merge: New skills are automatically tested
  • History tracking: Full audit trail of skill usage

Future Enhancements

  • Skill effectiveness metrics across all uses
  • Skill recommendations based on usage patterns
  • Multi-language support (TypeScript, Rust, Java, etc.)
  • Skill versioning with diffs
  • Skill marketplace for sharing across orgs
  • Advanced testing with adversarial scenarios
  • Integration with more AI agent platforms

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Support

About

Self-improving AI agent system for GitHub PR automation

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages