$npx -y skills add github/awesome-copilot --skill generate-custom-instructions-from-codebaseMigration and code evolution instructions generator for GitHub Copilot. Analyzes differences between two project versions (branches, commits, or releases) to create precise instructions allowing Copilot to maintain consistency during technology migrations, major refactoring, or f
| 1 | # Migration and Code Evolution Instructions Generator |
| 2 | |
| 3 | ## Configuration Variables |
| 4 | |
| 5 | ``` |
| 6 | ${MIGRATION_TYPE="Framework Version|Architecture Refactoring|Technology Migration|Dependencies Update|Pattern Changes"} |
| 7 | <!-- Type of migration or evolution --> |
| 8 | |
| 9 | ${SOURCE_REFERENCE="branch|commit|tag"} |
| 10 | <!-- Source reference point (before state) --> |
| 11 | |
| 12 | ${TARGET_REFERENCE="branch|commit|tag"} |
| 13 | <!-- Target reference point (after state) --> |
| 14 | |
| 15 | ${ANALYSIS_SCOPE="Entire project|Specific folder|Modified files only"} |
| 16 | <!-- Scope of analysis --> |
| 17 | |
| 18 | ${CHANGE_FOCUS="Breaking Changes|New Conventions|Obsolete Patterns|API Changes|Configuration"} |
| 19 | <!-- Main aspect of changes --> |
| 20 | |
| 21 | ${AUTOMATION_LEVEL="Conservative|Balanced|Aggressive"} |
| 22 | <!-- Level of automation for Copilot suggestions --> |
| 23 | |
| 24 | ${GENERATE_EXAMPLES="true|false"} |
| 25 | <!-- Include transformation examples --> |
| 26 | |
| 27 | ${VALIDATION_REQUIRED="true|false"} |
| 28 | <!-- Require validation before application --> |
| 29 | ``` |
| 30 | |
| 31 | ## Generated Prompt |
| 32 | |
| 33 | ``` |
| 34 | "Analyze code evolution between two project states to generate precise migration instructions for GitHub Copilot. These instructions will guide Copilot to automatically apply the same transformation patterns during future modifications. Follow this methodology: |
| 35 | |
| 36 | ### Phase 1: Comparative State Analysis |
| 37 | |
| 38 | #### Structural Changes Detection |
| 39 | - Compare folder structure between ${SOURCE_REFERENCE} and ${TARGET_REFERENCE} |
| 40 | - Identify moved, renamed, or deleted files |
| 41 | - Analyze changes in configuration files |
| 42 | - Document new dependencies and removed ones |
| 43 | |
| 44 | #### Code Transformation Analysis |
| 45 | ${MIGRATION_TYPE == "Framework Version" ? |
| 46 | "- Identify API changes between framework versions |
| 47 | - Analyze new features being used |
| 48 | - Document obsolete methods/properties |
| 49 | - Note syntax or convention changes" : ""} |
| 50 | |
| 51 | ${MIGRATION_TYPE == "Architecture Refactoring" ? |
| 52 | "- Analyze architectural pattern changes |
| 53 | - Identify new abstractions introduced |
| 54 | - Document responsibility reorganization |
| 55 | - Note changes in data flows" : ""} |
| 56 | |
| 57 | ${MIGRATION_TYPE == "Technology Migration" ? |
| 58 | "- Analyze replacement of one technology with another |
| 59 | - Identify functional equivalences |
| 60 | - Document API and syntax changes |
| 61 | - Note new dependencies and configurations" : ""} |
| 62 | |
| 63 | #### Transformation Pattern Extraction |
| 64 | - Identify repetitive transformations applied |
| 65 | - Analyze conversion rules from old to new format |
| 66 | - Document exceptions and special cases |
| 67 | - Create before/after correspondence matrix |
| 68 | |
| 69 | ### Phase 2: Migration Instructions Generation |
| 70 | |
| 71 | Create a `.github/copilot-migration-instructions.md` file with this structure: |
| 72 | |
| 73 | \`\`\`markdown |
| 74 | # GitHub Copilot Migration Instructions |
| 75 | |
| 76 | ## Migration Context |
| 77 | - **Type**: ${MIGRATION_TYPE} |
| 78 | - **From**: ${SOURCE_REFERENCE} |
| 79 | - **To**: ${TARGET_REFERENCE} |
| 80 | - **Date**: [GENERATION_DATE] |
| 81 | - **Scope**: ${ANALYSIS_SCOPE} |
| 82 | |
| 83 | ## Automatic Transformation Rules |
| 84 | |
| 85 | ### 1. Mandatory Transformations |
| 86 | ${AUTOMATION_LEVEL != "Conservative" ? |
| 87 | "[AUTOMATIC_TRANSFORMATION_RULES] |
| 88 | - **Old Pattern**: [OLD_CODE] |
| 89 | - **New Pattern**: [NEW_CODE] |
| 90 | - **Trigger**: When to detect this pattern |
| 91 | - **Action**: Transformation to apply automatically" : ""} |
| 92 | |
| 93 | ### 2. Transformations with Validation |
| 94 | ${VALIDATION_REQUIRED == "true" ? |
| 95 | "[TRANSFORMATIONS_WITH_VALIDATION] |
| 96 | - **Detected Pattern**: [DESCRIPTION] |
| 97 | - **Suggested Transformation**: [NEW_APPROACH] |
| 98 | - **Required Validation**: [VALIDATION_CRITERIA] |
| 99 | - **Alternatives**: [ALTERNATIVE_OPTIONS]" : ""} |
| 100 | |
| 101 | ### 3. API Correspondences |
| 102 | ${CHANGE_FOCUS == "API Changes" || MIGRATION_TYPE == "Framework Version" ? |
| 103 | "[API_CORRESPONDENCE_TABLE] |
| 104 | | Old API | New API | Notes | Example | |
| 105 | | --------- | --------- | --------- | -------------- | |
| 106 | | [OLD_API] | [NEW_API] | [CHANGES] | [CODE_EXAMPLE] | " : ""} | |
| 107 | |
| 108 | ### 4. New Patterns to Adopt |
| 109 | [DETECTED_EMERGING_PATTERNS] |
| 110 | - **Pattern**: [PATTERN_NAME] |
| 111 | - **Usage**: [WHEN_TO_USE] |
| 112 | - **Implementation**: [HOW_TO_IMPLEMENT] |
| 113 | - **Benefits**: [ADVANTAGES] |
| 114 | |
| 115 | ### 5. Obsolete Patterns to Avoid |
| 116 | [DETECTED_OBSOLETE_PATTERNS] |
| 117 | - **Obsolete Pattern**: [OLD_PATTERN] |
| 118 | - **Why Avoid**: [REASONS] |
| 119 | - **Alternative**: [NEW_PATTERN] |
| 120 | - **Migration**: [CONVERSION_STEPS] |
| 121 | |
| 122 | ## File Type Specific Instructions |
| 123 | |
| 124 | ${GENERATE_EXAMPLES == "true" ? |
| 125 | "### Configuration Files |
| 126 | [CONFIG_TRANSFORMATION_EXAMPLES] |
| 127 | |
| 128 | ### Main Source Files |
| 129 | [SOURCE_TRANSFORMATION_EXAMPLES] |
| 130 | |
| 131 | ### Test Files |
| 132 | [TEST_TRANSFORMATION_EXAMPLES]" : ""} |
| 133 | |
| 134 | ## Validation and Security |
| 135 | |
| 136 | ### Automatic Control Points |
| 137 | - Verifications to perform after each transformation |
| 138 | - Tests to run to validate changes |
| 139 | - Performance metrics to monitor |
| 140 | - Compatibility checks to perform |
| 141 | |
| 142 | ### Manual Escalation |
| 143 | Situations |