agentsclimarketplace

Defaults plus overrides

Skill fabioc-aloha/Alex_Skill_Mall/plugins/architecture-patterns/defaults-plus-overrides

Provide sensible defaults with user-overridable configuration — reduce boilerplate without limiting flexibilityFrom its SKILL.md

Install
npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill defaults-plus-overrides

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 4 stars4 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.

SKILL.md

5.3 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Defaults Plus Overrides

Category: Architecture Time Saved: 2+ hours avoiding configuration complexity Battle-tested: Yes — user preference systems, role-based config


The Problem

You're building a system with configurable behavior — user preferences, role-based permissions, or tenant-specific settings. You need sensible defaults but also flexibility. You end up with either rigid presets OR overwhelming configuration options.

Why It's Hard

  • Too rigid: Users can't customize what they need
  • Too flexible: Users must configure everything
  • Presets only: Edge cases require workarounds
  • Full config: Decision fatigue, misconfiguration risk

The Rule

Provide role/archetype defaults, allow partial overrides, clamp to safe bounds.

The Pattern

Archetype Default + User Overrides + Bounds Clamping = Final Config

Step 1: Define Archetypes

const ARCHETYPES = {
  developer: {
    verbosity: 'detailed',
    theme: 'dark',
    shortcuts: true,
    maxTokens: 4000,
    autoSave: true,
  },
  executive: {
    verbosity: 'concise',
    theme: 'light',
    shortcuts: false,
    maxTokens: 1000,
    autoSave: false,
  },
  researcher: {
    verbosity: 'detailed',
    theme: 'auto',
    shortcuts: true,
    maxTokens: 8000,
    autoSave: true,
  },
};

Step 2: Define Bounds

const BOUNDS = {
  maxTokens: { min: 100, max: 16000 },
  verbosity: ['concise', 'normal', 'detailed'],
  theme: ['light', 'dark', 'auto'],
};

Step 3: Merge with Clamping

function resolveConfig(archetype, overrides = {}) {
  // Start with archetype defaults
  const base = { ...ARCHETYPES[archetype] };
  
  // Apply user overrides
  const merged = { ...base, ...overrides };
  
  // Clamp to bounds
  return clampConfig(merged, BOUNDS);
}

function clampConfig(config, bounds) {
  const result = { ...config };
  
  for (const [key, constraint] of Object.entries(bounds)) {
    if (constraint.min !== undefined) {
      // Numeric bound
      result[key] = Math.max(constraint.min, Math.min(constraint.max, result[key]));
    } else if (Array.isArray(constraint)) {
      // Enum bound
      if (!constraint.includes(result[key])) {
        result[key] = constraint[0]; // Default to first option
      }
    }
  }
  
  return result;
}

Step 4: Usage

// User selects archetype, optionally overrides specific values
const userConfig = resolveConfig('developer', {
  theme: 'light',        // Override: prefer light theme
  maxTokens: 50000,      // Will be clamped to 16000
});

// Result:
// {
//   verbosity: 'detailed',  // From archetype
//   theme: 'light',         // User override
//   shortcuts: true,        // From archetype
//   maxTokens: 16000,       // Clamped from 50000
//   autoSave: true,         // From archetype
// }

JSON Schema Example

{
  "type": "object",
  "properties": {
    "archetype": {
      "type": "string",
      "enum": ["developer", "executive", "researcher"],
      "default": "developer"
    },
    "overrides": {
      "type": "object",
      "properties": {
        "verbosity": {
          "type": "string",
          "enum": ["concise", "normal", "detailed"]
        },
        "maxTokens": {
          "type": "integer",
          "minimum": 100,
          "maximum": 16000
        }
      }
    }
  }
}

UI Pattern

┌─────────────────────────────────────┐
│ Profile: [Developer ▾]             │
├─────────────────────────────────────┤
│ ☑ Use defaults                      │
│                                     │
│ Customize:                          │
│   Theme: [Light ▾]                  │
│   Max Tokens: [====|====] 4000      │
│   ☐ Auto-save                       │
│                                     │
│ [Reset to defaults]                 │
└─────────────────────────────────────┘

When to Use

ScenarioDefaults-Plus-Overrides?
User preferences✅ Yes
Role-based permissions✅ Yes
Tenant configuration✅ Yes
Feature flags⚠️ Maybe (often boolean)
Security settings❌ No (strict policy)

Anti-Patterns

Anti-PatternProblem
No defaultsUsers must configure everything
No overridesPower users can't customize
No boundsInvalid configurations possible
Archetype-onlyCan't handle edge cases
Everything configurableDecision paralysis

Verification Checklist

  • Archetypes cover 80% of users out of the box
  • Overrides are partial (don't require full config)
  • Bounds prevent invalid/dangerous values
  • Reset-to-defaults option exists
  • Configuration is validated at load time

Related Skills

  • universal-audit-pattern — Validating configuration

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.