|
| 1 | +# Migration Guide: Custom Instructions to Agent Skills |
| 2 | + |
| 3 | +This document explains the migration from custom instructions to Agent Skills and the rationale behind each decision. |
| 4 | + |
| 5 | +## Why Migrate? |
| 6 | + |
| 7 | +Agent Skills offer several advantages over static custom instructions: |
| 8 | + |
| 9 | +| Feature | Custom Instructions | Agent Skills | |
| 10 | +|---------|---------------------|--------------| |
| 11 | +| Loading | Always loaded (high token usage) | Loaded dynamically when needed | |
| 12 | +| Discovery | Manual file references | Rich metadata for automatic discovery | |
| 13 | +| Organization | Single file only | Main file + scripts + references | |
| 14 | +| Execution | Instructions only | Can include executable scripts | |
| 15 | +| Versioning | File-level only | Metadata versioning support | |
| 16 | + |
| 17 | +## Migration Decision Matrix |
| 18 | + |
| 19 | +### ✅ Migrated to Agent Skills |
| 20 | + |
| 21 | +**Criteria**: Language/framework-specific, task-specific workflows, executable patterns |
| 22 | + |
| 23 | +| Instruction File | Migrated To | Reason | |
| 24 | +|-----------------|-------------|---------| |
| 25 | +| javascript-typescript.instructions.md | javascript-typescript-standards | Language-specific style guide | |
| 26 | +| vue.instructions.md | vue-development | Framework-specific patterns | |
| 27 | +| nuxt.instructions.md | nuxt-development | Framework-specific workflows | |
| 28 | +| css.instructions.md | css-standards | Language-specific guidelines | |
| 29 | +| tailwind.instructions.md | tailwind-css | Framework-specific configuration | |
| 30 | +| html.instructions.md | html-standards | Language-specific markup patterns | |
| 31 | +| csharp.instructions.md | csharp-standards | Language-specific conventions | |
| 32 | +| dotnet.instructions.md | dotnet-development | Framework-specific architecture | |
| 33 | +| markdown.instructions.md | markdown-standards | Format-specific workflows | |
| 34 | +| testing.instructions.md | testing-tdd | Specific task workflow (TDD) | |
| 35 | +| commit.instructions.md | commit-conventions | Specific task workflow (commits) | |
| 36 | + |
| 37 | +### 🔄 Remain as Custom Instructions |
| 38 | + |
| 39 | +**Criteria**: Universal principles, always-applicable security/accessibility, cross-cutting concerns |
| 40 | + |
| 41 | +| Instruction File | Reason to Keep | |
| 42 | +|-----------------|----------------| |
| 43 | +| best-practices.instructions.md | Universal architecture patterns (SOLID, DRY, KISS) apply to ALL code | |
| 44 | +| security.instructions.md | Security must ALWAYS be considered (OWASP Top 10) | |
| 45 | +| accessibility.instructions.md | Accessibility principles apply universally to all UI work | |
| 46 | +| ui-guidelines.instructions.md | General design principles that transcend specific frameworks | |
| 47 | +| config.instructions.md | Project-wide configuration standards | |
| 48 | +| project-file-structure.instructions.md | Repository-wide structural conventions | |
| 49 | + |
| 50 | +## Migration Benefits by Skill |
| 51 | + |
| 52 | +### JavaScript/TypeScript Standards |
| 53 | +**Before**: 42 lines always loaded |
| 54 | +**After**: ~100 tokens for metadata, full skill loaded only when working with JS/TS files |
| 55 | +**Benefit**: 80% reduction in constant context usage |
| 56 | + |
| 57 | +### Vue Development |
| 58 | +**Before**: 67 lines always loaded |
| 59 | +**After**: Loaded only when working with .vue files |
| 60 | +**Benefit**: Zero overhead when working on backend or documentation |
| 61 | + |
| 62 | +### Testing TDD |
| 63 | +**Before**: 30 lines always loaded |
| 64 | +**After**: Loaded only when writing/running tests |
| 65 | +**Benefit**: Can include test runner scripts in `scripts/` directory |
| 66 | + |
| 67 | +### Commit Conventions |
| 68 | +**Before**: 65 lines always loaded |
| 69 | +**After**: Loaded when making commits, includes validation script |
| 70 | +**Benefit**: Executable `validate-commit.sh` script available |
| 71 | + |
| 72 | +## Skill Enhancements |
| 73 | + |
| 74 | +Each migrated skill includes enhancements beyond the original instructions: |
| 75 | + |
| 76 | +### 1. Rich Metadata |
| 77 | +```yaml |
| 78 | +metadata: |
| 79 | + author: devbyray |
| 80 | + version: "1.0" |
| 81 | + framework: "vue3" |
| 82 | + depends-on: "vue-development" |
| 83 | +``` |
| 84 | +
|
| 85 | +### 2. Better Discovery |
| 86 | +```yaml |
| 87 | +description: Coding standards for Vue.js 3 development with Composition API. |
| 88 | + Use when working with .vue files, Vue components, composables, |
| 89 | + or when the user asks about Vue.js patterns... |
| 90 | +``` |
| 91 | +
|
| 92 | +### 3. Executable Scripts |
| 93 | +``` |
| 94 | +commit-conventions/ |
| 95 | +├── SKILL.md |
| 96 | +└── scripts/ |
| 97 | + └── validate-commit.sh # Git hook for validation |
| 98 | +``` |
| 99 | + |
| 100 | +### 4. Expanded Examples |
| 101 | +Each skill includes more comprehensive examples and common patterns. |
| 102 | + |
| 103 | +### 5. When to Apply Section |
| 104 | +Clear guidance on when the skill should be activated. |
| 105 | + |
| 106 | +## Token Usage Analysis |
| 107 | + |
| 108 | +### Before Migration (All Custom Instructions) |
| 109 | + |
| 110 | +``` |
| 111 | +Total always-loaded instructions: ~800 lines |
| 112 | +Approximate tokens: ~16,000 tokens |
| 113 | +``` |
| 114 | + |
| 115 | +### After Migration (Skills + Remaining Instructions) |
| 116 | + |
| 117 | +``` |
| 118 | +Always loaded (Custom Instructions): ~200 lines (~4,000 tokens) |
| 119 | +Skills metadata (all 11 skills): ~100 tokens each = ~1,100 tokens |
| 120 | +Total baseline: ~5,100 tokens |
| 121 | +
|
| 122 | +Active skill when working: +2,000-5,000 tokens (only when relevant) |
| 123 | +``` |
| 124 | + |
| 125 | +**Net Savings**: ~70% reduction in baseline context usage, with skills loaded only when needed. |
| 126 | + |
| 127 | +## Implementation Notes |
| 128 | + |
| 129 | +### Skill Format Compliance |
| 130 | + |
| 131 | +All migrated skills follow the [Agent Skills specification](https://agentskills.io/specification): |
| 132 | + |
| 133 | +- ✅ Valid YAML frontmatter with `name` and `description` |
| 134 | +- ✅ Skill name matches directory name |
| 135 | +- ✅ Description includes keywords and use cases |
| 136 | +- ✅ Main file kept under 500 lines |
| 137 | +- ✅ Optional scripts and references in subdirectories |
| 138 | + |
| 139 | +### Naming Conventions |
| 140 | + |
| 141 | +Skill names follow the spec requirements: |
| 142 | +- Lowercase only |
| 143 | +- Hyphens for separation (no underscores) |
| 144 | +- No leading/trailing hyphens |
| 145 | +- No consecutive hyphens |
| 146 | +- 1-64 characters |
| 147 | + |
| 148 | +### Dependencies |
| 149 | + |
| 150 | +Some skills depend on others: |
| 151 | +- `nuxt-development` depends on `vue-development` |
| 152 | +- `dotnet-development` depends on `csharp-standards` |
| 153 | + |
| 154 | +This is documented in the `metadata.depends-on` field. |
| 155 | + |
| 156 | +## Future Enhancements |
| 157 | + |
| 158 | +### Potential Additions |
| 159 | + |
| 160 | +1. **Scripts Directory** |
| 161 | + - Linting scripts for each language |
| 162 | + - Test runners |
| 163 | + - Code formatters |
| 164 | + - Validation utilities |
| 165 | + |
| 166 | +2. **References Directory** |
| 167 | + - Detailed API references |
| 168 | + - Framework-specific deep dives |
| 169 | + - Common patterns library |
| 170 | + - Troubleshooting guides |
| 171 | + |
| 172 | +3. **Additional Skills** |
| 173 | + - `react-development` |
| 174 | + - `angular-development` |
| 175 | + - `python-standards` |
| 176 | + - `docker-workflows` |
| 177 | + - `ci-cd-patterns` |
| 178 | + |
| 179 | +## Validation |
| 180 | + |
| 181 | +To ensure skills are valid: |
| 182 | + |
| 183 | +```bash |
| 184 | +# Validate all skills |
| 185 | +for skill in .github/skills/*/; do |
| 186 | + skills-ref validate "$skill" |
| 187 | +done |
| 188 | +``` |
| 189 | + |
| 190 | +## Rollback Plan |
| 191 | + |
| 192 | +If issues arise, revert by: |
| 193 | + |
| 194 | +1. Re-activating original `.instructions.md` files |
| 195 | +2. Removing `@import` or skill activation |
| 196 | +3. Keeping skills directory for future use |
| 197 | + |
| 198 | +## Conclusion |
| 199 | + |
| 200 | +The migration to Agent Skills provides: |
| 201 | +- ✅ Significant reduction in baseline token usage |
| 202 | +- ✅ Better organization and discoverability |
| 203 | +- ✅ Ability to include executable scripts |
| 204 | +- ✅ Progressive disclosure for complex documentation |
| 205 | +- ✅ Independent versioning per skill |
| 206 | +- ✅ Standards-compliant format |
| 207 | + |
| 208 | +Universal principles (security, accessibility, SOLID) remain as custom instructions to ensure they're always considered. |
0 commit comments