Skip to content
Back to skills

Config Content Separation

ASecurity

Mixing structure and content makes both hard to maintain:

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsjavascriptjavadocumentation

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill config-content-separation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Config Content Separation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Config Content Separation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabioc-aloha-config-content-separation/badge)](https://www.skillsdirectory.com/skills/fabioc-aloha-config-content-separation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: config-content-separation
description: "Mixing structure and content makes both hard to maintain:"
lastReviewed: 2026-04-30
---

# Config + Content Separation

## The Problem

Mixing structure and content makes both hard to maintain:

```javascript
// 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.

```json
// config/menu.json
{
  "items": [
    { "id": "home", "label": "Home", "icon": "house", "contentFile": "home.md" },
    { "id": "about", "label": "About", "icon": "info", "contentFile": "about.md" }
  ]
}
```

```markdown
<!-- content/home.md -->
# Welcome

Welcome to our site. We're glad you're here.
```

```javascript
// 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

```javascript
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

1. Change content file → reflected without code change
2. Change structure → content unchanged
3. 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`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…