Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计通过

contextual-pattern-learning情境模式学习

Agent Skill

contextual-pattern-learning 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

210

周安装

9

GitHub Stars

22

下载量

73
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:contextual-pattern-learning(情境模式学习)
来源仓库:https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude
仓库路径:skills/contextual-pattern-learning
安装命令:
npx skills add https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude --skill contextual-pattern-learning
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bejranonda/llm-autonomous-agent-plugin-for-claude --skill contextual-pattern-learning

简介

contextual-pattern-learning 识别跨项目的可迁移模式与架构特征。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中进行代码相似性分析与最佳实践复用。
  • 支持技术栈检测、架构模式分类和团队协作惯例提取等多维度指纹构建。
  • 输出为结构化清单,便于后续自动化检查或知识沉淀集成。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Contextual Pattern Learning Skill

Provides advanced pattern recognition capabilities that understand project context, compute semantic similarities, and identify transferable patterns across different codebases and domains.

Core Capabilities

Project Fingerprinting

Multi-dimensional Project Analysis:

  • Technology Stack Detection: Languages, frameworks, libraries, build tools
  • Architectural Patterns: MVC, microservices, monolith, serverless, etc.
  • Code Structure Analysis: Module organization, dependency patterns, coupling metrics
  • Team Patterns: Coding conventions, commit patterns, testing strategies
  • Domain Classification: Business domain, problem space, user type

Fingerprint Generation:

project_fingerprint = {
    "technology_hash": sha256(sorted(languages + frameworks + libraries)),
    "architecture_hash": sha256(architectural_patterns + structural_metrics),
    "domain_hash": sha256(business_domain + problem_characteristics),
    "team_hash": sha256(coding_conventions + workflow_patterns),
    "composite_hash": combine_all_hashes_with_weights()
}

Context Similarity Analysis

Multi-factor Similarity Calculation:

  1. Technology Similarity (40%): Language/framework overlap
  2. Architectural Similarity (25%): Structure and design patterns
  3. Domain Similarity (20%): Business context and problem type
  4. Scale Similarity (10%): Project size and complexity
  5. Team Similarity (5%): Development practices and conventions

Semantic Context Understanding:

  • Intent Recognition: What the code is trying to accomplish
  • Problem Space Analysis: What category of problem being solved
  • Solution Pattern Matching: How similar problems are typically solved
  • Contextual Constraints: Performance, security, maintainability requirements

Pattern Classification System

Primary Classifications:

  • Implementation Patterns: Feature addition, API development, UI components
  • Refactoring Patterns: Code cleanup, optimization, architectural changes
  • Debugging Patterns: Bug fixing, issue resolution, problem diagnosis
  • Testing Patterns: Test creation, coverage improvement, test maintenance
  • Integration Patterns: Third-party services, databases, external APIs
  • Security Patterns: Authentication, authorization, vulnerability fixes

Secondary Attributes:

  • Complexity Level: Simple, moderate, complex, expert
  • Risk Level: Low, medium, high, critical
  • Time Sensitivity: Quick fix, planned work, research task
  • Collaboration Required: Solo, pair, team, cross-team

Cross-Domain Pattern Transfer

Pattern Transferability Assessment:

def calculate_transferability(pattern, target_context):
    technology_match = calculate_tech_overlap(pattern.tech, target_context.tech)
    domain_similarity = calculate_domain_similarity(pattern.domain, target_context.domain)
    complexity_match = assess_complexity_compatibility(pattern.complexity, target_context.complexity)

    transferability = (
        technology_match * 0.4 +
        domain_similarity * 0.3 +
        complexity_match * 0.2 +
        pattern.success_rate * 0.1
    )

    return transferability

Adaptation Strategies:

  • Direct Transfer: Pattern applies without modification
  • Technology Adaptation: Same logic, different implementation
  • Architectural Adaptation: Same approach, different structure
  • Conceptual Transfer: High-level concept, complete reimplementation

Pattern Matching Algorithm

Context-Aware Similarity

Weighted Similarity Scoring:

def calculate_contextual_similarity(source_pattern, target_context):
    # Technology alignment (40%)
    tech_score = calculate_technology_similarity(
        source_pattern.technologies,
        target_context.technologies
    )

    # Problem type alignment (30%)
    problem_score = calculate_problem_similarity(
        source_pattern.problem_type,
        target_context.problem_type
    )

    # Scale and complexity alignment (20%)
    scale_score = calculate_scale_similarity(
        source_pattern.scale_metrics,
        target_context.scale_metrics
    )

    # Domain relevance (10%)
    domain_score = calculate_domain_relevance(
        source_pattern.domain,
        target_context.domain
    )

    return (
        tech_score * 0.4 +
        problem_score * 0.3 +
        scale_score * 0.2 +
        domain_score * 0.1
    )

Pattern Quality Assessment

Multi-dimensional Quality Metrics:

  1. Outcome Quality: Final result quality score (0-100)
  2. Process Efficiency: Time taken vs. expected time
  3. Error Rate: Number and severity of errors encountered
  4. Reusability: How easily the pattern can be applied elsewhere
  5. Adaptability: How much modification was needed for reuse

Quality Evolution Tracking:

  • Initial Quality: Quality when first captured
  • Evolved Quality: Updated quality after multiple uses
  • Context Quality: Quality in specific contexts
  • Time-based Quality: How quality changes over time

Learning Strategies

Progressive Pattern Refinement

1. Pattern Capture:

def capture_pattern(task_execution):
    pattern = {
        "id": generate_unique_id(),
        "timestamp": current_time(),
        "context": extract_rich_context(task_execution),
        "execution": extract_execution_details(task_execution),
        "outcome": extract_outcome_metrics(task_execution),
        "insights": extract_learning_insights(task_execution),
        "relationships": extract_pattern_relationships(task_execution)
    }

    return refine_pattern_with_learning(pattern)

2. Pattern Validation:

  • Immediate Validation: Check pattern completeness and consistency
  • Cross-validation: Compare with similar existing patterns
  • Predictive Validation: Test pattern predictive power
  • Temporal Validation: Monitor pattern performance over time

3. Pattern Evolution:

def evolve_pattern(pattern_id, new_execution_data):
    existing_pattern = load_pattern(pattern_id)

    # Update success metrics
    update_success_rates(existing_pattern, new_execution_data)

    # Refine context understanding
    refine_context_similarity(existing_pattern, new_execution_data)

    # Update transferability scores
    update_transferability_assessment(existing_pattern, new_execution_data)

    # Generate new insights
    generate_new_insights(existing_pattern, new_execution_data)

    save_evolved_pattern(existing_pattern)

Relationship Mapping

Pattern Relationships:

  • Sequential Patterns: Patterns that often follow each other
  • Alternative Patterns: Different approaches to similar problems
  • Prerequisite Patterns: Patterns that enable other patterns
  • Composite Patterns: Multiple patterns used together
  • Evolutionary Patterns: Patterns that evolve into other patterns

Relationship Discovery:

def discover_pattern_relationships(patterns):
    relationships = {}

    for pattern_a in patterns:
        for pattern_b in patterns:
            if pattern_a.id == pattern_b.id:
                continue

            # Sequential relationship
            if often_sequential(pattern_a, pattern_b):
                relationships[f"{pattern_a.id} -> {pattern_b.id}"] = {
                    "type": "sequential",
                    "confidence": calculate_sequential_confidence(pattern_a, pattern_b)
                }

            # Alternative relationship
            if are_alternatives(pattern_a, pattern_b):
                relationships[f"{pattern_a.id} <> {pattern_b.id}"] = {
                    "type": "alternative",
                    "confidence": calculate_alternative_confidence(pattern_a, pattern_b)
                }

    return relationships

Context Extraction Techniques

Static Analysis Context

Code Structure Analysis:

  • Module Organization: How code is organized into modules/packages
  • Dependency Patterns: How modules depend on each other
  • Interface Design: How components communicate
  • Design Patterns: GoF patterns, architectural patterns used
  • Code Complexity: Cyclomatic complexity, cognitive complexity

Technology Stack Analysis:

def extract_technology_context(project_root):
    technologies = {
        "languages": detect_languages(project_root),
        "frameworks": detect_frameworks(project_root),
        "databases": detect_databases(project_root),
        "build_tools": detect_build_tools(project_root),
        "testing_frameworks": detect_testing_frameworks(project_root),
        "deployment_tools": detect_deployment_tools(project_root)
    }

    return analyze_technology_relationships(technologies)

Dynamic Context Analysis

Runtime Behavior Patterns:

  • Performance Characteristics: Speed, memory usage, scalability
  • Error Patterns: Common errors and their contexts
  • Usage Patterns: How the code is typically used
  • Interaction Patterns: How components interact at runtime

Development Workflow Patterns:

def extract_workflow_context(git_history):
    return {
        "commit_patterns": analyze_commit_patterns(git_history),
        "branching_strategy": detect_branching_strategy(git_history),
        "release_patterns": analyze_release_patterns(git_history),
        "collaboration_patterns": analyze_collaboration(git_history),
        "code_review_patterns": analyze_review_patterns(git_history)
    }

Semantic Context Analysis

Domain Understanding:

  • Business Domain: E-commerce, finance, healthcare, education
  • Problem Category: Data processing, user interface, authentication, reporting
  • User Type: End-user, admin, developer, system
  • Performance Requirements: Real-time, batch, high-throughput, low-latency

Intent Recognition:

def extract_intent_context(task_description, code_changes):
    intent_indicators = {
        "security": detect_security_intent(task_description, code_changes),
        "performance": detect_performance_intent(task_description, code_changes),
        "usability": detect_usability_intent(task_description, code_changes),
        "maintainability": detect_maintainability_intent(task_description, code_changes),
        "functionality": detect_functionality_intent(task_description, code_changes)
    }

    return rank_intent_by_confidence(intent_indicators)

Adaptation Learning

Success Pattern Recognition

What Makes Patterns Successful:

  1. Context Alignment: How well the pattern fits the context
  2. Execution Quality: How well the pattern was executed
  3. Outcome Quality: The quality of the final result
  4. Efficiency: Time and resource usage
  5. Adaptability: How easily the pattern can be modified

Success Factor Analysis:

def analyze_success_factors(pattern):
    factors = {}

    # Context alignment
    factors["context_alignment"] = calculate_context_fit_score(pattern)

    # Execution quality
    factors["execution_quality"] = analyze_execution_process(pattern)

    # Team skill match
    factors["skill_alignment"] = analyze_team_skill_match(pattern)

    # Tooling support
    factors["tooling_support"] = analyze_tooling_effectiveness(pattern)

    # Environmental factors
    factors["environment_fit"] = analyze_environmental_fit(pattern)

    return rank_factors_by_importance(factors)

Failure Pattern Learning

Common Failure Modes:

  1. Context Mismatch: Pattern applied in wrong context
  2. Skill Gap: Required skills not available
  3. Tooling Issues: Required tools not available or not working
  4. Complexity Underestimation: Pattern more complex than expected
  5. Dependency Issues: Required dependencies not available

Failure Prevention:

def predict_pattern_success(pattern, context):
    risk_factors = []

    # Check context alignment
    if calculate_context_similarity(pattern.context, context) < 0.6:
        risk_factors.append({
            "type": "context_mismatch",
            "severity": "high",
            "mitigation": "consider alternative patterns or adapt context"
        })

    # Check skill requirements
    required_skills = pattern.execution.skills_required
    available_skills = context.team_skills
    missing_skills = set(required_skills) - set(available_skills)
    if missing_skills:
        risk_factors.append({
            "type": "skill_gap",
            "severity": "medium",
            "mitigation": f"acquire skills: {', '.join(missing_skills)}"
        })

    return {
        "success_probability": calculate_success_probability(pattern, context),
        "risk_factors": risk_factors,
        "recommendations": generate_mitigation_recommendations(risk_factors)
    }

Pattern Transfer Strategies

Technology Adaptation

Language-Agnostic Patterns:

  • Algorithmic Patterns: Logic independent of language syntax
  • Architectural Patterns: Structure independent of implementation
  • Process Patterns: Workflow independent of technology
  • Design Patterns: Object-oriented design principles

Technology-Specific Adaptation:

def adapt_pattern_to_technology(pattern, target_technology):
    adaptation_rules = load_adaptation_rules(pattern.source_technology, target_technology)

    adapted_pattern = {
        "original_pattern": pattern,
        "target_technology": target_technology,
        "adaptations": [],
        "confidence": 0.0
    }

    for rule in adaptation_rules:
        if rule.applicable(pattern):
            adaptation = rule.apply(pattern, target_technology)
            adapted_pattern.adaptations.append(adaptation)
            adapted_pattern.confidence += adaptation.confidence_boost

    return validate_adapted_pattern(adapted_pattern)

Scale Adaptation

Complexity Scaling:

  • Pattern Simplification: Reduce complexity for simpler contexts
  • Pattern Enhancement: Add complexity for more demanding contexts
  • Pattern Modularity: Break complex patterns into reusable components
  • Pattern Composition: Combine simple patterns for complex solutions

Scale Factor Analysis:

def adapt_pattern_for_scale(pattern, target_scale):
    current_scale = pattern.scale_context
    scale_factor = calculate_scale_factor(current_scale, target_scale)

    if scale_factor > 2.0:  # Need to scale up
        return enhance_pattern_for_scale(pattern, target_scale)
    elif scale_factor < 0.5:  # Need to scale down
        return simplify_pattern_for_scale(pattern, target_scale)
    else:  # Scale is compatible
        return pattern.with_scale_adjustments(target_scale)

Continuous Improvement

Learning Feedback Loops

1. Immediate Feedback:

  • Pattern quality assessment
  • Success/failure recording
  • Context accuracy validation
  • Prediction accuracy tracking

2. Short-term Learning (Daily/Weekly):

  • Pattern performance trending
  • Context similarity refinement
  • Success factor correlation
  • Failure pattern identification

3. Long-term Learning (Monthly):

  • Cross-domain pattern transfer
  • Technology evolution adaptation
  • Team learning integration
  • Best practice extraction

Meta-Learning

Learning About Learning:

def analyze_learning_effectiveness():
    learning_metrics = {
        "pattern_accuracy": measure_pattern_prediction_accuracy(),
        "context_comprehension": measure_context_understanding_quality(),
        "adaptation_success": measure_pattern_adaptation_success_rate(),
        "knowledge_transfer": measure_cross_project_knowledge_transfer(),
        "prediction_improvement": measure_prediction_accuracy_over_time()
    }

    return generate_learning_insights(learning_metrics)

Adaptive Learning Strategies:

  • Confidence Adjustment: Adjust prediction confidence based on accuracy
  • Context Weighting: Refine context importance weights
  • Pattern Selection: Improve pattern selection algorithms
  • Feedback Integration: Better integrate user feedback

Usage Guidelines

When to Apply This Skill

Trigger Conditions:

  • Starting a new task in an unfamiliar codebase
  • Need to understand project context quickly
  • Looking for similar solutions in other projects
  • Adapting patterns from one technology to another
  • Estimating task complexity based on historical patterns

Optimal Contexts:

  • Multi-language or multi-framework projects
  • Large codebases with established patterns
  • Teams working on multiple similar projects
  • Projects requiring frequent adaptation of solutions
  • Knowledge sharing across teams or organizations

Expected Outcomes

Primary Benefits:

  • Faster Context Understanding: Quickly grasp project structure and conventions
  • Better Pattern Matching: Find more relevant solutions from past experience
  • Improved Adaptation: More successful adaptation of patterns to new contexts
  • Cross-Project Learning: Leverage knowledge from previous projects
  • Predictive Insights: Better predictions of task complexity and success

Quality Metrics:

  • Context Similarity Accuracy: >85% accurate context matching
  • Pattern Transfer Success: >75% successful pattern adaptation
  • Prediction Accuracy: >80% accurate outcome predictions
  • Learning Velocity: Continuous improvement in pattern quality

Integration with Other Skills

Complementary Skills

code-analysis:

  • Provides detailed code structure analysis for context extraction
  • Helps identify design patterns and architectural decisions
  • Contributes to technology stack detection

quality-standards:

  • Provides quality metrics for pattern assessment
  • Helps establish quality thresholds for pattern selection
  • Contributes to best practice identification

pattern-learning (basic):

  • Provides foundation pattern storage and retrieval
  • Enhanced by contextual understanding and similarity analysis
  • Benefits from advanced classification and relationship mapping

Data Flow

# Context extraction
context = code_analysis.extract_structure() + contextual_pattern_learning.extract_semantic_context()

# Pattern matching
matches = contextual_pattern_learning.find_similar_patterns(context, code_analysis.get_quality_metrics())

# Quality assessment
quality_score = quality_standards.assess_pattern_quality(matches)

# Learning integration
contextual_pattern_learning.capture_pattern_with_context(execution_data, context, quality_score)

This skill creates a comprehensive contextual understanding system that dramatically improves pattern matching, adaptation, and learning capabilities by considering the rich context in which patterns are created and applied.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.27%
按下载量换算26

Claude

30.86%
按下载量换算23

Cursor

22.01%
按下载量换算16

Gemini CLI

9.83%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills