agentleFS
reaatechreaatech/mcp-changelog/skills/config-loader/SKILL.md

config-loader

Skill0 starsChanged 3 months agoMITView on GitHub

The config-loader skill provides capabilities for loading, merging, and validating mcp-changelog configuration. Configuration flows from defaults → config file → CLI options → environment variables, with later sources overriding earlier ones. TypeScript (mcp-changelog.config.ts): JSON (mcp-changelog.config.json):

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default configuration as base layer

    line 15

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Config Loader Skill

Purpose

The config-loader skill provides capabilities for loading, merging, and validating mcp-changelog configuration. Configuration flows from defaults → config file → CLI options → environment variables, with later sources overriding earlier ones.

Capabilities

1. Configuration Discovery

  • Auto-discover mcp-changelog.config.ts, .js, .json, or mcp-changelog key in package.json
  • Support explicit --config <path> override
  • Load from current working directory or git repository root

2. Configuration Merging

  • Default configuration as base layer
  • Config file overrides defaults
  • CLI flags override config file
  • Environment variables override CLI flags

3. Runtime Validation

  • Validate configuration with Zod schemas
  • Provide helpful error messages for invalid config
  • Support partial configuration (unspecified keys use defaults)

Configuration Schema

import { z } from 'zod';

const configSchema = z.object({
  schema: z.object({
    paths: z.array(z.string()).optional(),
    exclude: z.array(z.string()).optional(),
  }).optional(),
  output: z.object({
    dir: z.string().optional(),
    formats: z.array(z.enum(['markdown', 'json'])).optional(),
    changelogFile: z.string().optional(),
    migrationFile: z.string().optional(),
    diffFile: z.string().optional(),
  }).optional(),
  changelog: z.object({
    template: z.string().optional(),
    includeMigrationLinks: z.boolean().optional(),
    emojiStyle: z.enum(['github', 'none']).optional(),
  }).optional(),
  migration: z.object({
    includeCodeExamples: z.boolean().optional(),
    languages: z.array(z.string()).optional(),
  }).optional(),
  git: z.object({
    tagPattern: z.string().optional(),
  }).optional(),
  ci: z.object({
    commentOnPR: z.boolean().optional(),
    failOnBreaking: z.boolean().optional(),
  }).optional(),
});

export type Config = z.infer<typeof configSchema>;

Usage Examples

Loading Configuration

import { loadConfig } from '@reaatech/mcp-changelog/config';

// Auto-discover config file
const config = await loadConfig();

// Explicit path
const config = await loadConfig('./mcp-changelog.config.ts');

// With CLI overrides
const config = await loadConfig(options.config, {
  output: { dir: options.outputDir },
  schema: { paths: options.schemaPath ? [options.schemaPath] : undefined },
});

Default Configuration

const defaultConfig: Config = {
  schema: {
    paths: undefined, // Auto-detect
    exclude: ['node_modules/**', 'dist/**', '.git/**'],
  },
  output: {
    dir: './',
    formats: ['markdown', 'json'],
    changelogFile: 'CHANGELOG.md',
    migrationFile: 'MIGRATION.md',
    diffFile: 'diff.json',
  },
  changelog: {
    template: 'default',
    includeMigrationLinks: true,
    emojiStyle: 'github',
  },
  migration: {
    includeCodeExamples: true,
    languages: ['json'],
  },
  git: {
    tagPattern: '^v\\d+\\.\\d+\\.\\d+$',
  },
  ci: {
    commentOnPR: true,
    failOnBreaking: false,
  },
};

Configuration File Examples

TypeScript (mcp-changelog.config.ts):

import { defineConfig } from '@reaatech/mcp-changelog/config';

export default defineConfig({
  schema: {
    paths: ['packages/*/schema.json'],
    exclude: ['**/node_modules/**'],
  },
  output: {
    dir: './docs/changelog',
    formats: ['markdown', 'json'],
  },
  changelog: {
    template: 'default',
    emojiStyle: 'github',
  },
});

JSON (mcp-changelog.config.json):

{
  "schema": {
    "paths": ["schema.json"]
  },
  "output": {
    "dir": "./changelog",
    "formats": ["markdown"]
  }
}

Best Practices

1. Always Merge with Defaults

// Good: Defaults + overrides
const config = mergeConfig(defaultConfig, fileConfig, cliOverrides);

// Bad: Only CLI options
const config = cliOptions; // Missing defaults for unset keys

2. Validate Early

// Good: Validate at load time
const config = validateConfig(rawConfig);
if (!config.ok) {
  console.error(`Invalid config: ${config.error.message}`);
  process.exit(1);
}

// Bad: Validate at use time
generateChangelog(rawConfig); // May fail mid-run with cryptic error

3. Support Partial Configs

// Good: Only specify what you need
export default {
  output: { dir: './docs' }
};
// Everything else uses defaults

// Bad: Require full config
export default {
  // User must specify every key
};

Error Handling

class ConfigNotFoundError extends Error {
  constructor(searchPaths: string[]) {
    super(`Config file not found. Searched: ${searchPaths.join(', ')}`);
    this.name = 'ConfigNotFoundError';
  }
}

class ConfigValidationError extends Error {
  constructor(errors: z.ZodError) {
    super(`Config validation failed: ${errors.message}`);
    this.name = 'ConfigValidationError';
  }
}

Testing Strategies

describe('loadConfig', () => {
  it('should load TypeScript config file', async () => {
    const config = await loadConfig('./fixtures/mcp-changelog.config.ts');
    expect(config.output.dir).toBe('./changelog');
  });

  it('should merge CLI overrides', async () => {
    const config = await loadConfig(undefined, {
      output: { dir: '/tmp/output' }
    });
    expect(config.output.dir).toBe('/tmp/output');
    expect(config.output.formats).toEqual(['markdown', 'json']); // Default preserved
  });

  it('should throw for invalid config', async () => {
    await expect(loadConfig('./fixtures/invalid.config.ts'))
      .rejects.toThrow(ConfigValidationError);
  });

  it('should use defaults when no config file exists', async () => {
    const config = await loadConfig();
    expect(config.output.formats).toEqual(['markdown', 'json']);
  });
});

Resources

  • ARCHITECTURE.md - System architecture
  • CLI Development skill - CLI configuration integration
  • GitHub Action skill - Action input handling

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.