Config content separation
Skill fabioc-aloha/Alex_Skill_Mall/plugins/devops-process/config-content-separation
284 curated plugins for AI assistants across 16 categories: security, Azure, documentation, code quality, cloud infrastructure, and more. Works with GitHub Copilot. Drop into .github/skills/local/ and go.
npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill config-content-separationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Mixing structure and content makes both hard to maintain:
SKILL.md
2.4 KB, 524 tokens by cl100k_base, as published. Nobody here has run it
Config + Content Separation
The Problem
Mixing structure and content makes both hard to maintain:
// Bad: structure and content interleaved
const menu = [
{ label: 'Home', icon: 'house', content: 'Welcome to our site...' },
{ label: 'About', icon: 'info', content: 'We are a company that...' }
];
Content updates require touching code. Structure changes require editing content.
The Solution
JSON defines structure. Separate files hold content.
// config/menu.json
{
"items": [
{ "id": "home", "label": "Home", "icon": "house", "contentFile": "home.md" },
{ "id": "about", "label": "About", "icon": "info", "contentFile": "about.md" }
]
}
<!-- content/home.md -->
# Welcome
Welcome to our site. We're glad you're here.
// Loader resolves file references at runtime
function loadMenu(configPath, contentDir) {
const config = require(configPath);
return config.items.map(item => ({
...item,
content: fs.readFileSync(path.join(contentDir, item.contentFile), 'utf8')
}));
}
Caching Pattern
let cache = null;
let cacheTime = 0;
const CACHE_TTL = 60000; // 1 minute
function getMenu(refresh = false) {
if (!refresh && cache && Date.now() - cacheTime < CACHE_TTL) {
return cache;
}
cache = loadMenu('./config/menu.json', './content');
cacheTime = Date.now();
return cache;
}
// Force refresh on explicit request
app.post('/admin/refresh-content', (req, res) => {
getMenu(true);
res.json({ status: 'refreshed' });
});
Benefits
- Content authors edit markdown, not JSON
- Developers edit structure without touching content
- Version control diffs are meaningful (content vs structure)
- Can hot-reload content without rebuilding
Verification
- Change content file → reflected without code change
- Change structure → content unchanged
- Missing content file → clear error message
When to Apply
- CMS-like systems
- Documentation sites
- Configuration panels
- Any mix of structure + prose
Tags
build architecture content-management configuration