Files
pbakaus_impeccable/scripts/lib/transformers/gemini.js
T
Paul BakausandClaude Opus 4.5 0b9c1846a6 Add teach-impeccable and review commands, dynamic placeholders
New commands:
- /teach-impeccable: One-time setup that gathers UX-focused design
  context (explores codebase first, then asks targeted questions)
- /review: UX design review evaluating hierarchy, clarity, emotional
  resonance (complements technical /audit)

Build system improvements:
- Dynamic {{model}}, {{ask_instruction}}, {{config_file}} placeholders
  per provider (Claude/Gemini/GPT/the model)
- context: fork support for Claude Code sub-agents (audit, extract)
- Skill reference auto-added to design commands

Skill refinements:
- Merged Design Thinking and Context Awareness sections
- Removed redundant patterns and technical questions
- More direct feedback guidance (radical candor)

Website updates:
- 17 commands (was 16)
- Review demo showing UX issues (HIERARCHY, NO PRIMARY, DEAD END)
- teach-impeccable in System group of periodic table

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 16:56:08 -08:00

95 lines
3.5 KiB
JavaScript

import path from 'path';
import { cleanDir, ensureDir, writeFile, replacePlaceholders } from '../utils.js';
/**
* Gemini Transformer (Full Featured - TOML + Modular Skills)
*
* Commands: Converts to TOML format with {{args}} placeholders
* Skills: Creates modular files imported via @./GEMINI.{name}.md syntax
* Reference files are inlined into the main skill file for Gemini
*/
export function transformGemini(commands, skills, distDir, patterns = null) {
const geminiDir = path.join(distDir, 'gemini');
const commandsDir = path.join(geminiDir, '.gemini/commands');
cleanDir(geminiDir);
ensureDir(commandsDir);
// Commands: Transform to TOML
for (const command of commands) {
// First replace our placeholders, then replace remaining {{arg}} with {{args}}
let prompt = replacePlaceholders(command.body, 'gemini');
prompt = prompt.replace(/\{\{[^}]+\}\}/g, '{{args}}');
const toml = [
`description = "${command.description.replace(/"/g, '\\"')}"`,
`prompt = """`,
prompt,
`"""`
].join('\n');
const outputPath = path.join(commandsDir, `${command.name}.toml`);
writeFile(outputPath, toml);
}
// Skills: Create modular files (with references inlined)
let refCount = 0;
for (const skill of skills) {
let content = skill.body;
// Merge patterns body into frontend-design skill (before Domain Reference Files section)
if (skill.name === 'frontend-design' && patterns && patterns.body) {
const insertPoint = content.indexOf('---\n\n## Domain Reference Files');
if (insertPoint > -1) {
content = content.slice(0, insertPoint) + '\n\n' + patterns.body + '\n\n' + content.slice(insertPoint);
} else {
content += '\n\n' + patterns.body;
}
}
// Inline reference files if they exist
if (skill.references && skill.references.length > 0) {
const refSections = skill.references.map(ref => {
refCount++;
const refContent = replacePlaceholders(ref.content, 'gemini');
return `\n\n---\n\n## Reference: ${ref.name}\n\n${refContent}`;
});
content += refSections.join('');
}
// Replace all placeholders
content = replacePlaceholders(content, 'gemini');
const outputPath = path.join(geminiDir, `GEMINI.${skill.name}.md`);
writeFile(outputPath, content);
}
// Create main GEMINI.md that imports skill files
const geminiMd = [
'# Gemini Context',
'',
'This repository contains specialized skills for different tasks. When you detect a user request in a particular domain, the corresponding skill file will be automatically loaded to provide detailed guidance.',
'',
'## Available Skills',
'',
'Each skill provides deep expertise in its domain. The skills below are automatically imported and will guide your responses:',
'',
...skills.map(skill =>
`### ${skill.name}\n\n**When to use**: ${skill.description}\n\n@./GEMINI.${skill.name}.md\n`
),
'',
'## How Skills Work',
'',
'1. Skills are automatically loaded via the import statements above',
'2. When a user request matches a skill domain, apply that skill\'s guidance',
'3. Multiple skills can be combined when the task requires expertise from different domains',
'4. Follow the detailed instructions provided in each imported skill file'
].join('\n');
writeFile(path.join(geminiDir, 'GEMINI.md'), geminiMd);
const refInfo = refCount > 0 ? ` (${refCount} refs inlined)` : '';
console.log(`✓ Gemini: ${commands.length} commands (TOML), ${skills.length} skills (modular)${refInfo}`);
}