agentleFS
reaatechreaatech/mcp-changelog/skills/performance-optimization/SKILL.md

performance-optimization

Skill0 starsChanged 3 months agoMITView on GitHub

The performance-optimization skill provides strategies for ensuring mcp-changelog meets its performance targets: <2 seconds for full pipeline on typical schemas, efficient git operations, and minimal memory footprint.

156 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-engineering, using-agent-skills and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • steven123397Skill

    accessibility-engineering

    Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.

    Also in 4 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 40 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 20 projects that use this

  • LLl0k0laDSkill

    idea-refine

    Refine ideas through structured divergent and convergent thinking. Use "idea-refine" or "ideate" to trigger.

    Also in 45 projects that use this

  • jaydubya818Skill

    deprecation-and-migration

    Retire APIs or migrate consumers and persistent data across releases.

    Also in 46 projects that use this

  • jaydubya818Skill

    observability-and-instrumentation

    Add or review logs, metrics, traces, and actionable alerts.

    Also in 36 projects that use this

  • +5 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 138 edited versions we read keep these.

  • 1

    Distinctive

    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:

    Use streaming for large file extraction

    line 12

“Common” is measured: kept by at least 6 in 10 of the 138 edited versions of this file we could read. “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

Performance Optimization Skill

Purpose

The performance-optimization skill provides strategies for ensuring mcp-changelog meets its performance targets: <2 seconds for full pipeline on typical schemas, efficient git operations, and minimal memory footprint.

Capabilities

1. Git Operation Optimization

  • Batch git operations to minimize process spawns
  • Cache git results within a single run
  • Use streaming for large file extraction
  • Parallelize independent git operations

2. Schema Processing Optimization

  • Lazy parsing of schema files
  • Incremental diffing for large schemas
  • Memory-efficient JSON parsing
  • Early termination for break-on-breaking mode

3. Output Generation Optimization

  • Template caching for changelog generation
  • Parallel format export
  • Streaming file writes
  • Compression for large outputs

Usage Examples

Git Operation Batching

// Good: Batch git operations
import { execa } from 'execa';

async function readFilesAtRef(ref: string, paths: string[]): Promise<Map<string, string>> {
  // Use git cat-file --batch for multiple files
  const batchInput = paths.map(p => `${ref}:${p}`).join('\n');
  const { stdout } = await execa('git', ['cat-file', '--batch'], { input: batchInput });
  // Parse batch output...
}

// Bad: One git process per file
for (const path of paths) {
  const content = await execa('git', ['show', `${ref}:${path}`]); // Slow!
}

Caching Strategy

class CachedGitResolver {
  private cache = new Map<string, GitRef>();

  async resolveRef(ref: string): Promise<GitRef> {
    const cached = this.cache.get(ref);
    if (cached) return cached;

    const resolved = await this.git.revParse(ref);
    const result = { type: this.classifyRef(ref), name: ref, sha: resolved };
    this.cache.set(ref, result);
    return result;
  }

  clearCache() {
    this.cache.clear();
  }
}

// Usage: Single instance per run
const resolver = new CachedGitResolver({ repoPath });
const [ref1, ref2, ref3] = await Promise.all([
  resolver.resolveRef('v1.0.0'),
  resolver.resolveRef('v1.1.0'),
  resolver.resolveRef('v2.0.0')
]);

Parallel Schema Processing

// Good: Parallel independent operations
const [oldSchemas, newSchemas] = await Promise.all([
  discoverSchemas(oldRef),
  discoverSchemas(newRef)
]);

const changes = await Promise.all(
  Object.entries(toolPairs).map(([toolName, { oldTool, newTool }]) =>
    compareTools(toolName, oldTool, newTool)
  )
);

// Bad: Sequential operations
const oldSchemas = await discoverSchemas(oldRef);
const newSchemas = await discoverSchemas(newRef);
const changes = [];
for (const [toolName, { oldTool, newTool }] of toolPairs) {
  changes.push(await compareTools(toolName, oldTool, newTool));
}

Streaming JSON Output

import { createWriteStream } from 'fs';
import { pipeline } from 'stream/promises';

async function writeJsonDiff(diff: JsonDiffResult, outputPath: string) {
  const writeStream = createWriteStream(outputPath);
  const jsonStream = JSON.stringify(diff, null, 2);
  writeStream.write(jsonStream);
  writeStream.end();
  await finished(writeStream);
}

// For very large diffs, use streaming JSON serializer
import { stringify } from 'stream-json/stringify';
import { chain } from 'stream-chain';

async function streamJsonDiff(diff: JsonDiffResult, outputPath: string) {
  await pipeline(
    read(diff),
    chain(),
    stringify(),
    createWriteStream(outputPath)
  );
}

Configuration Options

interface PerformanceConfig {
  // Git operation timeout in milliseconds
  gitTimeout: number;

  // Maximum concurrent git operations
  maxConcurrentGitOps: number;

  // Whether to cache git operations
  cacheGitOps: boolean;

  // Maximum schema file size to parse (bytes)
  maxSchemaSize: number;

  // Whether to use streaming for large outputs
  streamLargeOutputs: boolean;

  // Size threshold for streaming (bytes)
  streamThreshold: number;
}

const config: PerformanceConfig = {
  gitTimeout: 30000,
  maxConcurrentGitOps: 4,
  cacheGitOps: true,
  maxSchemaSize: 10 * 1024 * 1024, // 10MB
  streamLargeOutputs: true,
  streamThreshold: 1024 * 1024 // 1MB
};

Performance Targets

OperationTargetAcceptable
Git ref resolution<10ms<50ms
Schema file discovery<50ms<200ms
Schema parsing (typical)<20ms<100ms
Change detection (typical)<50ms<200ms
Changelog generation<30ms<100ms
Full pipeline<2s<5s
Memory usage<50MB<100MB

Best Practices

1. Minimize Git Process Spawns

// Good: Single git command for multiple operations
const { stdout } = await execa('git', ['ls-tree', '-r', ref]);
const files = stdout.split('\n').map(line => line.split('\t')[1]);

// Bad: One git command per file
for (const pattern of patterns) {
  const { stdout } = await execa('git', ['ls-files', pattern]);
}

2. Use Appropriate Data Structures

// Good: Set for O(1) lookups
const oldToolNames = new Set(oldSchema.tools.map(t => t.name));
const removedTools = newSchema.tools.filter(t => !oldToolNames.has(t.name));

// Bad: Array includes is O(n)
const removedTools = newSchema.tools.filter(t =>
  !oldSchema.tools.some(ot => ot.name === t.name)
);

3. Early Termination

// Good: Stop on first breaking change when only checking
function hasBreakingChanges(changes: SchemaChange[]): boolean {
  return changes.some(c => c.type === 'breaking');
}

// Bad: Process all changes when one is enough
function hasBreakingChanges(changes: SchemaChange[]): boolean {
  const breaking = changes.filter(c => c.type === 'breaking');
  return breaking.length > 0;
}

Monitoring and Profiling

import { performance } from 'perf_hooks';

class PerformanceMonitor {
  private timings = new Map<string, number>();

  start(operation: string) {
    this.timings.set(operation, performance.now());
  }

  end(operation: string): number {
    const start = this.timings.get(operation);
    if (start === undefined) throw new Error(`No start time for ${operation}`);
    const duration = performance.now() - start;
    this.timings.delete(operation);
    return duration;
  }

  log(operation: string, duration: number) {
    if (duration > 100) {
      console.warn(`[PERF] ${operation} took ${duration.toFixed(2)}ms`);
    }
  }
}

// Usage
const monitor = new PerformanceMonitor();
monitor.start('git-resolve');
const ref = await resolver.resolveRef('v1.0.0');
const duration = monitor.end('git-resolve');
monitor.log('git-resolve', duration);

Resources

  • ARCHITECTURE.md - System architecture
  • Performance section - Architecture performance spec

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.