PixelPilot uiux-component-docs.instructions.md

A documentation generator for frontend components written in React or Vue. It creates pages describing component properties, examples, and design-token usage from the source code.

In plain words
What is it for?
It is for generating React documentation with react-docgen, Vue documentation with vuese, or component sites with VitePress.
Why use it?
It removes the need to write and update basic component documentation by hand whenever the source changes.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dev-lou/pixelpilot/uiux-component-docs
Clone the repo
git clone --depth 1 https://github.com/dev-lou/PixelPilot

Made for: GitHub Copilot.

Per session 2,951 This file is loaded in full into every session.
When invoked 2,951 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02951 $0.02951
Opus 5 $0.01476 $0.01476
Sonnet 5 $0.00590 $0.00590
Haiku 4.5 $0.00295 $0.00295

Measured yesterday against content hash 3b69834f1433, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

PixelPilot uiux-component-docs.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

vscode/.github/instructions/uiux-component-docs.instructions.md · 482 lines

How it starts

The opening of the file, as written. The whole thing — 482 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Component Documentation Skill

Generate documentation for components automatically from source code.


CORE PRINCIPLE

Rule: Every component should have documentation generated from its source code. Documentation must include props, examples, and design token usage.


REACT (REACT-DOCGEN + MARKDOWN)

Setup

npm install -D react-docgen-typescript typescript

Script

// scripts/generate-docs.ts
import * as fs from 'fs';
import * as path from 'path';
import { parse } from 'react-docgen-typescript';

const COMPONENTS_DIR = './src/components';
const DOCS_DIR = './docs/components';

// Ensure docs directory exists
if (!fs.existsSync(DOCS_DIR)) {
  fs.mkdirSync(DOCS_DIR, { recursive: true });
}

// Parser options
const options = {
  savePropValueAsString: true,
  shouldExtractLiteralValuesFromEnum: true,
  shouldRemoveUndefinedFromOptional: true,
  propFilter: (prop: any) => {
    // Filter out HTML attributes
    if (prop.declarations?.length > 0) {
      return prop.declarations.some(
        (d: any) => !d.fileName.includes('node_modules')
      );
    }
    return true;
  },
};

// Find all component files
function findComponents(dir: string): string[] {
  const files: string[] = [];
  
  fs.readdirSync(dir).forEach(file => {
    const fullPath = path.join(dir, file);
    const stat = fs.statSync(fullPath);
    
    if (stat.isDirectory()) {
      files.push(...findComponents(fullPath));
    } else if (file.match(/\.(tsx|ts)$/) && !file.includes('.test.') && !file.includes('.stories.')) {
      files.push(fullPath);
    }
  });
  
  return files;
}

// Generate markdown for a component
function generateMarkdown(component: any): string {
  let md = `# ${component.displayName}\n\n`;
  
  if (component.description) {
    md += `${component.description}\n\n`;
  }
  
  // Props table
  const props = Object.entries(component.props || {});
  if (props.length > 0) {
    md += `## Props\n\n`;
    md += `| Prop | Type | Default | Required | Description |\n`;
    md += `|------|------|---------|----------|-------------|\n`;
    
    props.forEach(([name, prop]: [string, any]) => {
      const type = prop.type?.name || 'unknown';
      const defaultValue = prop.defaultValue?.value || '-';
      const required = prop.required ? '✅' : '❌';
      const description = prop.description || '-';
      
      md += `| \`${name}\` | \`${type}\` | \`${defaultValue}\` | ${required} | ${description} |\n`;
    });
    
    md += '\n';
  }
  
  // Design tokens section
  md += `## Design Tokens Used\n\n`;
  md += `> This component uses the following design tokens:\n\n`;
  md += `\`\`\`css\n`;
  md += `/* Spacing */\n`;
  md += `var(--space-2), var(--space-4)\n\n`;
  md += `/* Colors */\n`;
  md += `var(--accent), var(--text), var(--border)\n\n`;
  md += `/* Radius */\n`;
  md += `var(--radius-md)\n`;
  md += `\`\`\`\n\n`;
  
  // Usage example
  md += `## Usage\n\n`;
  md += `\`\`\`tsx\n`;
  md += `import { ${component.displayName} } from '@/components/${component.displayName}';\n\n`;
  md += `function Example() {\n`;
  md += `  return (\n`;
  md += `    <${component.displayName}\n`;
  
  // Add example props
  props.slice(0, 3).forEach(([name, prop]: [string, any]) => {
    if (prop.required) {
      const exampleValue = getExampleValue(prop.type?.name);
      md += `      ${name}={${exampleValue}}\n`;
    }
  });
  
  md += `    />\n`;
  md += `  );\n`;
  md += `}\n`;
  md += `\`\`\`\n\n`;
  
  return md;
}

function getExampleValue(type: string): string {
  switch (type) {
    case 'string': return '"example"';
    case 'number': return '42';
    case 'boolean': return 'true';
    case 'function':
    case '() => void': return '() => {}';
    default: return '...';
  }
}

// Main execution
const componentFiles = findComponents(COMPONENTS_DIR);

componentFiles.forEach(file => {
  try {
    const components = parse(file, options);
    
    components.forEach(component => {
      if (component.displayName) {
        const markdown = generateMarkdown(component);
        const outputPath = path.join(DOCS_DIR, `${component.displayName}.md`);
        
        fs.writeFileSync(outputPath, markdown);
        console.log(`✅ Generated: ${outputPath}`);
      }
    });
  } catch (error) {
    console.warn(`⚠️ Skipped: ${file}`);
  }
});

// Generate index
const indexContent = `# Component Documentation\n\n` +
  fs.readdirSync(DOCS_DIR)
    .filter(f => f.endsWith('.md') && f !== 'index.md')
    .map(f => `- [${f.replace('.md', '')}](./${f})`)
    .join('\n');

fs.writeFileSync(path.join(DOCS_DIR, 'index.md'), indexContent);
console.log('\n✅ Generated index.md');

Read the full file on GitHub · 482 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 482 lines · 2,951 tokens per session scan A 3b69834f1433

Subscribe to this mod's changes

PixelPilot uiux-component-docs.instructions.md is an instructions file published in the GitHub repository dev-lou/PixelPilot (2 stars, last pushed 4mo ago), licensed MIT. It adds 2,951 tokens to every session, about $0.0148 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.