Skip to content
Back to skills

Data Driven Layouts

ASecurity

Template-driven layouts require code changes for structural updates:

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 3, 2026
ai-agentsjavascriptjava

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill data-driven-layouts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Driven Layouts?

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

Security grade badge for Data Driven Layouts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/fabioc-aloha-data-driven-layouts/badge)](https://www.skillsdirectory.com/skills/fabioc-aloha-data-driven-layouts)

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: data-driven-layouts
description: "Template-driven layouts require code changes for structural updates:"
lastReviewed: 2026-04-30
---

# Data-Driven Layouts

## The Problem

Template-driven layouts require code changes for structural updates:

```javascript
// Bad: structure embedded in code
function renderDashboard() {
  return `
    <div class="section">
      <h2>Users</h2>
      ${renderUserTable()}
    </div>
    <div class="section">
      <h2>Revenue</h2>
      ${renderRevenueChart()}
    </div>
  `;
}
// Adding a new section = code change
```

## The Solution

Define layout structure as data. Rendering is generic.

```javascript
// layouts/dashboard.json
{
  "sections": [
    { "id": "users", "title": "Users", "component": "userTable" },
    { "id": "revenue", "title": "Revenue", "component": "revenueChart" },
    { "id": "alerts", "title": "Alerts", "component": "alertList" }
  ]
}
```

```javascript
// Generic renderer
const components = {
  userTable: () => renderUserTable(),
  revenueChart: () => renderRevenueChart(),
  alertList: () => renderAlertList()
};

function renderDashboard(layout) {
  return layout.sections.map(section => `
    <div class="section" id="${section.id}">
      <h2>${section.title}</h2>
      ${components[section.component]()}
    </div>
  `).join('');
}

// Usage
const layout = require('./layouts/dashboard.json');
const html = renderDashboard(layout);
```

## Benefits

- Add sections by editing JSON, not code
- Reorder by changing array order
- Non-developers can modify layouts
- Easier to A/B test different layouts

## Schema Example

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "title", "component"],
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "component": { "type": "string" },
          "props": { "type": "object" }
        }
      }
    }
  }
}
```

## Verification

1. Adding a section = only JSON change
2. Unknown component throws clear error
3. Layout validates against schema

## When to Apply

- Dashboards
- Forms
- Navigation menus
- Any UI with variable structure

## Tags

`build` `architecture` `layouts` `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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.