用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/fabioc-aloha/Alex_Plug_In --skill vscode-configuration-validation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Create and maintain ASCII visual dashboards for project tracking with parallel lane progress bars
Store and manage voice samples for TTS cloning — portable, version-controlled audio references
Clear documentation through visual excellence
正在显示 SKILL.md
基于 SOC 职业分类
| name | vscode-configuration-validation |
| description | Validate VS Code extension manifest against runtime code usage |
| tier | standard |
Domain: VS Code extension development, configuration management, quality assurance
Complexity: Intermediate
Prerequisites: Understanding of VS Code extension manifest (package.json), TypeScript
VS Code extensions fail at runtime when:
package.jsonThese misconfigurations don't cause compile-time errors and only surface when users interact with specific features.
Systematic validation of VS Code extension manifest against runtime code usage.
Check: All workspace.getConfiguration().update() calls reference registered properties.
// ❌ WRONG - config key not registered
await vscode.workspace.getConfiguration('alex.skillRecommendations')
.update('code-review.accepted', count + 1, ConfigurationTarget.Global);
// ✅ RIGHT - key registered in package.json or wrapped in try-catch
try {
await vscode.workspace.getConfiguration('alex.skillRecommendations')
.update('code-review.accepted', count + 1, ConfigurationTarget.Global);
} catch (error) {
console.log(`Skip tracking: ${error}`);
}
Audit Pattern:
# Find all config.update() calls
grep -r "getConfiguration.*\.update\(" src/
# Cross-reference with package.json properties section
# Each update() key must exist in "configuration.properties"
Check: All commands.registerCommand() calls match declared commands in manifest.
// Code registration
vscode.commands.registerCommand('alex.validateHeir', async () => {...});
// Must have package.json declaration
{
"contributes": {
"commands": [{
"command": "alex.validateHeir",
"title": "Validate as Heir Project"
}]
}
}
Audit Pattern:
# Find all command registrations
grep -r "registerCommand\(['\"]alex\." src/
# Extract command names and verify each exists in package.json
Check: All getConfiguration().get() calls match registered properties.
// This config read should have a registered property
const enabled = vscode.workspace.getConfiguration('alex.voice').get('enabled', false);
// Check package.json has "alex.voice.enabled"
Warning Pattern: Configuration reads with no defaults are risky:
// ⚠️ No fallback - will be undefined if not registered
const value = config.get('someKey');
// ✅ Better - always provide default
const value = config.get('someKey', defaultValue);
For Dynamic Configuration Keys (skill recommendations, user preferences):
Option A: Register schema with dynamic pattern (complex) Option B: Graceful try-catch (simple, recommended)
// Pattern: Non-critical dynamic config
async function trackUserPreference(key: string, value: any) {
try {
await vscode.workspace.getConfiguration('alex.dynamic')
.update(key, value, ConfigurationTarget.Global);
} catch (error) {
// Log but don't fail - tracking is optional
console.log(`[Alex] Skipping preference tracking: ${error}`);
}
}
For Critical Configuration:
// Pattern: Essential config must be registered
await vscode.workspace.getConfiguration('alex.globalKnowledge')
.update('remoteRepo', repo, ConfigurationTarget.Global);
// No try-catch - failure should bubble up
getConfiguration().update() callspackage.json properties OR has try-catchregisterCommand() callscontributes.commandsPseudocode: validate-manifest
1. Search src/**/*.ts for getConfiguration('section').update('key') calls
2. Load contributes.configuration.properties from package.json
3. For each config update found in source code:
If the full key (section.key) is NOT in package.json properties:
Flag as unregistered config write (potential runtime error)
4. Report all mismatches
$issues += "⚠️ $fullKey - not registered (verify try-catch exists)"
} }
if ($issues.Count -gt 0) { Write-Host "Configuration validation issues:" -ForegroundColor Yellow $issues | ForEach-Object { Write-Host $_ } exit 1 }
## Common Pitfalls
1. **Dynamic Configuration Keys**: User preferences, tracking counters
- **Solution**: Either register dynamic schema or use try-catch pattern
2. **Namespaced Configuration**: `alex.skill.subkey.value`
- **Solution**: Register full dotted path: `"alex.skill.subkey.value": {...}`
3. **Multi-Target Updates**: Workspace vs Global vs WorkspaceFolder
- **Solution**: Test configuration across all scopes
4. **Configuration Migration**: Deprecated settings
- **Solution**: Use `deprecationMessage` in property definition
## Real-World Example: Skill Recommendations
**Problem**: Tracking skill usage without bloating package.json with hundreds of dynamic keys.
**Solution**: Graceful degradation pattern
```typescript
async function trackRecommendation(skillId: string, accepted: boolean) {
try {
const context = 'alex.skillRecommendations';
const key = `${skillId}.${accepted ? 'accepted' : 'dismissed'}`;
const current = vscode.workspace.getConfiguration(context).get<number>(key, 0);
await vscode.workspace.getConfiguration(context).update(
key,
current + 1,
vscode.ConfigurationTarget.Global
);
} catch (error) {
// Feature degrades gracefully - recommendations still work
console.log(`[Alex] Skipping recommendation tracking: ${error}`);
}
}
Why This Works:
### Configuration Validation
Before each release:
1. Run `scripts/validate-manifest.ps1`
2. Review any warnings for try-catch coverage
3. Test configuration updates in clean VS Code instance
4. Verify error messages are user-friendly
Sources of Truth:
alex.skillRecommendations.* keys not in package.jsonsrc/chat/skillRecommendations.ts