Add a script to update the prompts

This commit is contained in:
bl-ue 2025-11-19 10:13:55 -07:00
parent c64a9d3fda
commit 41eba70cfa
15 changed files with 498 additions and 49 deletions

View File

@ -37,37 +37,37 @@ Sub-agents and utilities.
### Creation Assistants ### Creation Assistants
- [Agent Prompt: Agent creation architect](./system-prompts/agent-prompt-agent-creation-architect.md) (**1111** tks) - System prompt for creating custom AI agents with detailed specifications. - [Agent Prompt: Agent creation architect](./system-prompts/agent-prompt-agent-creation-architect.md) (**1111** tks) - System prompt for creating custom AI agents with detailed specifications.
- [Agent Prompt: CLAUDE.md creation](./system-prompts/agent-prompt-claudemd-creation.md) (**384** tks) - System prompt for analyzing codebases and creating CLAUDE.md documentation. - [Agent Prompt: CLAUDE.md creation](./system-prompts/agent-prompt-claudemd-creation.md) (**384** tks) - System prompt for analyzing codebases and creating CLAUDE.md documentation files.
- [Agent Prompt: Status line setup](./system-prompts/agent-prompt-status-line-setup.md) (**993** tks) - System prompt for the statusline-setup agent that configures status line. - [Agent Prompt: Status line setup](./system-prompts/agent-prompt-status-line-setup.md) (**993** tks) - System prompt for the statusline-setup agent that configures status line display.
### Slash commands ### Slash commands
- [Agent Prompt: /pr-comments slash command](./system-prompts/agent-prompt-pr-comments-slash-command.md) (**404** tks) - System prompt for fetching and displaying GitHub PR comments. - [Agent Prompt: /pr-comments slash command](./system-prompts/agent-prompt-pr-comments-slash-command.md) (**404** tks) - System prompt for fetching and displaying GitHub PR comments.
- [Agent Prompt: /review-pr slash command](./system-prompts/agent-prompt-review-pr-slash-command.md) (**245** tks) - System prompt for reviewing GitHub pull requests with code analysis. - [Agent Prompt: /review-pr slash command](./system-prompts/agent-prompt-review-pr-slash-command.md) (**245** tks) - System prompt for reviewing GitHub pull requests with code analysis.
- [Agent Prompt: /security-review slash](./system-prompts/agent-prompt-security-review-slash.md) (**2614** tks) - Comprehensive security review prompt for analyzing code changes with focus on. - [Agent Prompt: /security-review slash](./system-prompts/agent-prompt-security-review-slash.md) (**2614** tks) - Comprehensive security review prompt for analyzing code changes with focus on exploitable vulnerabilities.
### Utilities ### Utilities
- [Agent Prompt: Bash command file path extraction](./system-prompts/agent-prompt-bash-command-file-path-extraction.md) (**286** tks) - System prompt for extracting file paths from bash command output. - [Agent Prompt: Bash command file path extraction](./system-prompts/agent-prompt-bash-command-file-path-extraction.md) (**286** tks) - System prompt for extracting file paths from bash command output.
- [Agent Prompt: Bash command prefix detection](./system-prompts/agent-prompt-bash-command-prefix-detection.md) (**835** tks) - System prompt for detecting command prefixes and command injection. - [Agent Prompt: Bash command prefix detection](./system-prompts/agent-prompt-bash-command-prefix-detection.md) (**835** tks) - System prompt for detecting command prefixes and command injection.
- [Agent Prompt: Bash output summarization](./system-prompts/agent-prompt-bash-output-summarization.md) (**605** tks) - System prompt for determining whether bash command output should be summarized. - [Agent Prompt: Bash output summarization](./system-prompts/agent-prompt-bash-output-summarization.md) (**605** tks) - System prompt for determining whether bash command output should be summarized.
- [Agent Prompt: Conversation summarization](./system-prompts/agent-prompt-conversation-summarization.md) (**1121** tks) - System prompt for creating detailed conversation summaries.
- [Agent Prompt: Conversation summarization with additional instructions](./system-prompts/agent-prompt-conversation-summarization-with-additional-instructions.md) (**1133** tks) - Extended summarization prompt with support for custom additional instructions. - [Agent Prompt: Conversation summarization with additional instructions](./system-prompts/agent-prompt-conversation-summarization-with-additional-instructions.md) (**1133** tks) - Extended summarization prompt with support for custom additional instructions.
- [Agent Prompt: Prompt Hook execution](./system-prompts/agent-prompt-prompt-hook-execution.md) (**134** tks) - Prompt given to Claude when acting evaluating whether to pass or fail a prompt. - [Agent Prompt: Conversation summarization](./system-prompts/agent-prompt-conversation-summarization.md) (**1121** tks) - System prompt for creating detailed conversation summaries.
- [Agent Prompt: Prompt Hook execution](./system-prompts/agent-prompt-prompt-hook-execution.md) (**134** tks) - Prompt given to Claude when acting evaluating whether to pass or fail a prompt hook..
- [Agent Prompt: Session notes template](./system-prompts/agent-prompt-session-notes-template.md) (**226** tks) - Template structure for session notes tracking coding work and decisions. - [Agent Prompt: Session notes template](./system-prompts/agent-prompt-session-notes-template.md) (**226** tks) - Template structure for session notes tracking coding work and decisions.
- [Agent Prompt: Session notes update instructions](./system-prompts/agent-prompt-session-notes-update-instructions.md) (**730** tks) - Instructions for updating session notes files during conversations. - [Agent Prompt: Session notes update instructions](./system-prompts/agent-prompt-session-notes-update-instructions.md) (**730** tks) - Instructions for updating session notes files during conversations.
- [Agent Prompt: Session title generation](./system-prompts/agent-prompt-session-title-generation.md) (**159** tks) - System prompt for generating succinct titles for coding sessions. - [Agent Prompt: Session title generation](./system-prompts/agent-prompt-session-title-generation.md) (**159** tks) - System prompt for generating succinct titles for coding sessions.
- [Agent Prompt: Update Magic Docs](./system-prompts/agent-prompt-update-magic-docs.md) (**718** tks) - Prompt for the magic-docs agent. - [Agent Prompt: Update Magic Docs](./system-prompts/agent-prompt-update-magic-docs.md) (**718** tks) - Prompt for the magic-docs agent..
- [Agent Prompt: User sentiment analysis](./system-prompts/agent-prompt-user-sentiment-analysis.md) (**205** tks) - System prompt for analyzing user frustration and PR creation requests. - [Agent Prompt: User sentiment analysis](./system-prompts/agent-prompt-user-sentiment-analysis.md) (**205** tks) - System prompt for analyzing user frustration and PR creation requests.
- [Agent Prompt: WebFetch summarizer](./system-prompts/agent-prompt-webfetch-summarizer.md) (**147** tks) - Prompt for agent that summarizes verbose output from WebFetch for the main. - [Agent Prompt: WebFetch summarizer](./system-prompts/agent-prompt-webfetch-summarizer.md) (**147** tks) - Prompt for agent that summarizes verbose output from WebFetch for the main model.
<!-- <!--
### Data ### Data
Misc large strings. Misc large strings.
- [Data: GitHub Actions workflow for @claude mentions](./system-prompts/data-github-actions-workflow-for-claude-mentions.md) (**531** tks) - GitHub Actions workflow template for triggering Claude Code via @claude. - [Data: GitHub Actions workflow for @claude mentions](./system-prompts/data-github-actions-workflow-for-@claude-mentions.md) (**531** tks) - GitHub Actions workflow template for triggering Claude Code via @claude mentions.
- [Data: GitHub Actions workflow for automated code review (beta)](./system-prompts/data-github-actions-workflow-for-automated-code-review-beta.md) (**573** tks) - GitHub Actions workflow template for automated Claude Code reviews using. - [Data: GitHub Actions workflow for automated code review (beta)](./system-prompts/data-github-actions-workflow-for-automated-code-review-beta.md) (**573** tks) - GitHub Actions workflow template for automated Claude Code reviews using direct_prompt.
- [Data: GitHub App installation PR description](./system-prompts/data-github-app-installation-pr-description.md) (**424** tks) - Template for PR description when installing Claude Code GitHub App integration. - [Data: GitHub App installation PR description](./system-prompts/data-github-app-installation-pr-description.md) (**424** tks) - Template for PR description when installing Claude Code GitHub App integration.
--> -->
@ -75,9 +75,9 @@ Misc large strings.
Parts of the main system prompt. Parts of the main system prompt.
- [**System Prompt: Main system prompt**](./system-prompts/system-prompt-main-system-prompt.md) (**2601** tks) - Core system prompt for Claude Code defining behavior, tone, and tool usage. - [**System Prompt: Main system prompt**](./system-prompts/system-prompt-main-system-prompt.md) (**2601** tks) - Core system prompt for Claude Code defining behavior, tone, and tool usage policies.
- [System Prompt: Learning mode](./system-prompts/system-prompt-learning-mode.md) (**1042** tks) - System Prompt: Main system prompt for learning mode with human collaboration.
- [System Prompt: Learning mode (insights)](./system-prompts/system-prompt-learning-mode-insights.md) (**142** tks) - Instructions for providing educational insights when learning mode is active. - [System Prompt: Learning mode (insights)](./system-prompts/system-prompt-learning-mode-insights.md) (**142** tks) - Instructions for providing educational insights when learning mode is active.
- [System Prompt: Learning mode](./system-prompts/system-prompt-learning-mode.md) (**1042** tks) - System Prompt: Main system prompt for learning mode with human collaboration instructions.
- [System Prompt: MCP CLI](./system-prompts/system-prompt-mcp-cli.md) (**1357** tks) - Instructions for using mcp-cli to interact with Model Context Protocol servers. - [System Prompt: MCP CLI](./system-prompts/system-prompt-mcp-cli.md) (**1357** tks) - Instructions for using mcp-cli to interact with Model Context Protocol servers.
### System Reminders ### System Reminders
@ -87,19 +87,19 @@ Text for large system reminders.
> [!NOTE] > [!NOTE]
> Note that we're planning to add a **system reminder creator/editor** to [tweakcc](https://github.com/Piebald-AI/tweakcc); :+1: [this issue](https://github.com/Piebald-AI/tweakcc/issues/113) if you're interested in that idea. > Note that we're planning to add a **system reminder creator/editor** to [tweakcc](https://github.com/Piebald-AI/tweakcc); :+1: [this issue](https://github.com/Piebald-AI/tweakcc/issues/113) if you're interested in that idea.
- [System Reminder: Plan mode is active](./system-prompts/system-reminder-plan-mode-is-active.md) (**242** tks) - System reminder sent to Claude when the user enters plan mode.
- [System Reminder: Plan mode is active (enhanced)](./system-prompts/system-reminder-plan-mode-is-active-enhanced.md) (**1093** tks) - Enhanced plan mode system reminder. - [System Reminder: Plan mode is active (enhanced)](./system-prompts/system-reminder-plan-mode-is-active-enhanced.md) (**1093** tks) - Enhanced plan mode system reminder.
- [System Reminder: Plan mode is active (for subagents)](./system-prompts/system-reminder-plan-mode-is-active-for-subagents.md) (**310** tks) - Simplified plan mode system reminder for sub agents. - [System Reminder: Plan mode is active (for subagents)](./system-prompts/system-reminder-plan-mode-is-active-for-subagents.md) (**310** tks) - Simplified plan mode system reminder for sub agents.
- [System Reminder: Plan mode is active](./system-prompts/system-reminder-plan-mode-is-active.md) (**242** tks) - System reminder sent to Claude when the user enters plan mode.
### Builtin Tool Descriptions ### Builtin Tool Descriptions
- [Tool Description: Bash](./system-prompts/tool-description-bash.md) (**1074** tks) - Description for the Bash tool, which allows Claude to run shell commands. - [Tool Description: Bash](./system-prompts/tool-description-bash.md) (**1074** tks) - Description for the Bash tool, which allows Claude to run shell commands.
- [Tool Description: Edit](./system-prompts/tool-description-edit.md) (**278** tks) - Tool description for performing exact string replacements in files. - [Tool Description: Edit](./system-prompts/tool-description-edit.md) (**278** tks) - Tool description for performing exact string replacements in files.
- [Tool Description: ExitPlanMode](./system-prompts/tool-description-exitplanmode.md) (**342** tks) - Description for the ExitPlanMode tool, which presents a plan dialog for the. - [Tool Description: ExitPlanMode v2](./system-prompts/tool-description-exitplanmode-v2.md) (**450** tks) - V2 description for the ExitPlanMode tool, which presents a plan dialog for the user to approve.
- [Tool Description: ExitPlanMode v2](./system-prompts/tool-description-exitplanmode-v2.md) (**450** tks) - V2 description for the ExitPlanMode tool, which presents a plan dialog for the. - [Tool Description: ExitPlanMode](./system-prompts/tool-description-exitplanmode.md) (**342** tks) - Description for the ExitPlanMode tool, which presents a plan dialog for the user to approve.
- [Tool Description: Glob](./system-prompts/tool-description-glob.md) (**122** tks) - Tool description for file pattern matching and searching by name. - [Tool Description: Glob](./system-prompts/tool-description-glob.md) (**122** tks) - Tool description for file pattern matching and searching by name.
- [Tool Description: Grep](./system-prompts/tool-description-grep.md) (**300** tks) - Tool description for content search using ripgrep. - [Tool Description: Grep](./system-prompts/tool-description-grep.md) (**300** tks) - Tool description for content search using ripgrep.
- [Tool Description: LSP](./system-prompts/tool-description-lsp.md) (**172** tks) - Description for the LSP tool. - [Tool Description: LSP](./system-prompts/tool-description-lsp.md) (**172** tks) - Description for the LSP tool..
- [Tool Description: NotebookEdit](./system-prompts/tool-description-notebookedit.md) (**121** tks) - Tool description for editing Jupyter notebook cells. - [Tool Description: NotebookEdit](./system-prompts/tool-description-notebookedit.md) (**121** tks) - Tool description for editing Jupyter notebook cells.
- [Tool Description: ReadFile](./system-prompts/tool-description-readfile.md) (**439** tks) - Tool description for reading files. - [Tool Description: ReadFile](./system-prompts/tool-description-readfile.md) (**439** tks) - Tool description for reading files.
- [Tool Description: Skill](./system-prompts/tool-description-skill.md) (**279** tks) - Tool description for executing skills in the main conversation. - [Tool Description: Skill](./system-prompts/tool-description-skill.md) (**279** tks) - Tool description for executing skills in the main conversation.

470
scripts/updatePrompts.js Normal file
View File

@ -0,0 +1,470 @@
#!/usr/bin/env node
import { readFileSync, writeFileSync, readdirSync, unlinkSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const ROOT_DIR = join(__dirname, '..');
const SYSTEM_PROMPTS_DIR = join(ROOT_DIR, 'system-prompts');
const README_PATH = join(ROOT_DIR, 'README.md');
// Get API key from environment
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
if (!ANTHROPIC_API_KEY) {
console.error('Error: ANTHROPIC_API_KEY environment variable is required');
console.error('Set it with: export ANTHROPIC_API_KEY=your-api-key');
process.exit(1);
}
/**
* Count tokens using Anthropic's token counting API
*/
async function countTokens(text) {
const response = await fetch('https://api.anthropic.com/v1/messages/count_tokens', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'anthropic-version': '2023-06-01',
'x-api-key': ANTHROPIC_API_KEY
},
body: JSON.stringify({
model: 'claude-sonnet-4-20250514',
messages: [
{
role: 'user',
content: text
}
]
})
});
if (!response.ok) {
const error = await response.text();
throw new Error(`Token counting API error: ${response.status} ${error}`);
}
const data = await response.json();
return data.input_tokens;
}
/**
* Batch count tokens for multiple prompts with rate limiting
*/
async function countTokensBatch(prompts, batchSize = 5, delayMs = 100) {
const results = new Map();
for (let i = 0; i < prompts.length; i += batchSize) {
const batch = prompts.slice(i, i + batchSize);
const promises = batch.map(async ({ filename, content }) => {
try {
const tokens = await countTokens(content);
return { filename, tokens };
} catch (err) {
console.error(`Error counting tokens for ${filename}: ${err.message}`);
return { filename, tokens: 0 };
}
});
const batchResults = await Promise.all(promises);
batchResults.forEach(({ filename, tokens }) => {
results.set(filename, tokens);
});
// Rate limiting delay between batches
if (i + batchSize < prompts.length) {
await new Promise(resolve => setTimeout(resolve, delayMs));
}
}
return results;
}
/**
* Convert prompt name to filename
* Examples:
* "Agent Prompt: Explore" "agent-prompt-explore.md"
* "System Prompt: Main system prompt" "system-prompt-main-system-prompt.md"
* "Tool Description: Bash" "tool-description-bash.md"
*/
function nameToFilename(name) {
// Determine prefix based on the name prefix
let prefix = '';
let namePart = name;
if (name.startsWith('Agent Prompt: ')) {
prefix = 'agent-prompt-';
namePart = name.substring('Agent Prompt: '.length);
} else if (name.startsWith('System Prompt: ')) {
prefix = 'system-prompt-';
namePart = name.substring('System Prompt: '.length);
} else if (name.startsWith('System Reminder: ')) {
prefix = 'system-reminder-';
namePart = name.substring('System Reminder: '.length);
} else if (name.startsWith('Tool Description: ')) {
prefix = 'tool-description-';
namePart = name.substring('Tool Description: '.length);
} else if (name.startsWith('Data: ')) {
prefix = 'data-';
namePart = name.substring('Data: '.length);
}
// Convert to lowercase and replace special chars
const filename = namePart
.toLowerCase()
.replace(/\./g, '') // Remove dots
.replace(/\s+/g, '-') // Spaces to hyphens
.replace(/[()]/g, '') // Remove parentheses
.replace(/\//g, '-') // Slashes to hyphens
.replace(/-+/g, '-') // Collapse multiple hyphens
.replace(/^-|-$/g, ''); // Trim hyphens from start/end
return prefix + filename + '.md';
}
/**
* Reconstruct the full prompt content from pieces and identifiers
*/
function reconstructPrompt(prompt) {
if (prompt.pieces.length === 0) return '';
if (prompt.pieces.length === 1) return prompt.pieces[0];
let result = '';
let identifierIndex = 0;
for (let i = 0; i < prompt.pieces.length; i++) {
result += prompt.pieces[i];
// Add variable name (pieces already contain ${ and } delimiters)
if (i < prompt.pieces.length - 1 && identifierIndex < prompt.identifiers.length) {
const identifierId = prompt.identifiers[identifierIndex].toString();
const variableName = prompt.identifierMap[identifierId];
if (variableName) {
result += variableName;
}
identifierIndex++;
}
}
return result;
}
/**
* Create markdown file content with HTML comment metadata
*/
function createMarkdownContent(prompt, reconstructedContent) {
const variables = Object.values(prompt.identifierMap || {});
let content = '<!--\n';
content += `name: '${prompt.name}'\n`;
content += `description: ${prompt.description.includes('\n') ? '>\n ' + prompt.description.replace(/\n/g, '\n ') : prompt.description}\n`;
content += `ccVersion: ${prompt.version}\n`;
if (variables.length > 0) {
content += 'variables:\n';
variables.forEach(varName => {
content += ` - ${varName}\n`;
});
}
content += '-->\n';
content += reconstructedContent;
// Ensure file ends with newline
if (!content.endsWith('\n')) {
content += '\n';
}
return content;
}
/**
* Parse existing markdown file to extract metadata
*/
function parseMarkdownFile(filepath) {
try {
const content = readFileSync(filepath, 'utf-8');
const commentMatch = content.match(/<!--\n([\s\S]*?)\n-->/);
if (!commentMatch) return null;
const metadataSection = commentMatch[1];
const nameMatch = metadataSection.match(/name: '(.+)'/);
const descMatch = metadataSection.match(/description: (.+?)(?=\nccVersion:)/s);
return {
name: nameMatch ? nameMatch[1] : null,
description: descMatch ? descMatch[1].replace(/>\n\s+/g, '').trim() : null,
fullContent: content
};
} catch (err) {
return null;
}
}
/**
* Categorize prompts based on their name
*/
function categorizePrompt(name) {
if (name.startsWith('Agent Prompt: ')) {
const namePart = name.substring('Agent Prompt: '.length);
// Sub-categorize agent prompts
if (['Explore', 'Plan mode (enhanced)', 'Task tool'].some(sub => namePart.startsWith(sub))) {
return { category: 'Agent Prompts', subcategory: 'Sub-agents' };
} else if (['Agent creation architect', 'CLAUDE.md creation', 'Status line setup'].some(sub => namePart.includes(sub))) {
return { category: 'Agent Prompts', subcategory: 'Creation Assistants' };
} else if (namePart.includes('slash command') || namePart.startsWith('/')) {
return { category: 'Agent Prompts', subcategory: 'Slash commands' };
} else {
return { category: 'Agent Prompts', subcategory: 'Utilities' };
}
} else if (name.startsWith('System Prompt: ')) {
return { category: 'System Prompt', subcategory: null };
} else if (name.startsWith('System Reminder: ')) {
return { category: 'System Reminders', subcategory: null };
} else if (name.startsWith('Tool Description: ')) {
// Check for "additional notes" subcategory
if (name.includes('(') && name.includes(')')) {
return { category: 'Builtin Tool Descriptions', subcategory: 'Additional notes for some Tool Descriptions' };
}
return { category: 'Builtin Tool Descriptions', subcategory: null };
} else if (name.startsWith('Data: ')) {
return { category: 'Data', subcategory: null };
}
return { category: 'Other', subcategory: null };
}
/**
* Update or create README entry for a prompt
*/
function createReadmeEntry(prompt, filename, tokens, isBold = false) {
const link = isBold ? `[**${prompt.name}**]` : `[${prompt.name}]`;
const path = `./system-prompts/${filename}`;
const tokenCount = `(**${tokens}** tks)`;
const description = prompt.description.replace(/\n\s+/g, ' ').trim();
return `- ${link}(${path}) ${tokenCount} - ${description}.`;
}
/**
* Main update function
*/
async function updateFromJSON(jsonPath) {
console.log(`Reading JSON from: ${jsonPath}`);
const jsonData = JSON.parse(readFileSync(jsonPath, 'utf-8'));
console.log(`Version: ${jsonData.version}`);
console.log(`Prompts count: ${jsonData.prompts.length}`);
// Track all prompts by filename
const promptsByFilename = new Map();
const changedPrompts = new Set();
const newPrompts = new Set();
const promptsToCount = [];
// First pass: Process files and identify what needs token counting
for (const prompt of jsonData.prompts) {
const filename = nameToFilename(prompt.name);
const filepath = join(SYSTEM_PROMPTS_DIR, filename);
const reconstructedContent = reconstructPrompt(prompt);
const newMarkdownContent = createMarkdownContent(prompt, reconstructedContent);
// Check if file exists and compare
const existingFile = parseMarkdownFile(filepath);
if (existingFile) {
// Compare content
if (existingFile.fullContent.trim() !== newMarkdownContent.trim()) {
console.log(`⚠️ Changed: ${filename}`);
unlinkSync(filepath); // Delete old file
writeFileSync(filepath, newMarkdownContent);
changedPrompts.add(filename);
}
} else {
console.log(`✨ New: ${filename}`);
writeFileSync(filepath, newMarkdownContent);
newPrompts.add(filename);
}
// Store for token counting
promptsToCount.push({ filename, content: reconstructedContent, prompt });
}
// Batch count tokens for all prompts
console.log('\n🔢 Counting tokens...');
const tokenCounts = await countTokensBatch(promptsToCount);
// Store prompt info for README updates
for (const { filename, prompt } of promptsToCount) {
const tokens = tokenCounts.get(filename) || 0;
promptsByFilename.set(filename, { prompt, tokens });
}
// Find deleted prompts
const allMdFiles = readdirSync(SYSTEM_PROMPTS_DIR).filter(f => f.endsWith('.md'));
const deletedFiles = allMdFiles.filter(f => !promptsByFilename.has(f));
if (deletedFiles.length > 0) {
console.log('\n🗑 Deleting removed prompts:');
deletedFiles.forEach(f => {
console.log(` - ${f}`);
unlinkSync(join(SYSTEM_PROMPTS_DIR, f));
});
}
// Update README
console.log('\n📝 Updating README.md...');
updateReadme(promptsByFilename, jsonData.version);
console.log('\n✅ Update complete!');
console.log(` New: ${newPrompts.size}`);
console.log(` Changed: ${changedPrompts.size}`);
console.log(` Deleted: ${deletedFiles.length}`);
}
/**
* Update README.md with new prompt information
*/
function updateReadme(promptsByFilename, version) {
let readme = readFileSync(README_PATH, 'utf-8');
const lines = readme.split('\n');
// Update version in header
lines[2] = `This repository contains an up-to-date list of all Claude Code's various system prompts and their associated token counts as of ${version}.`;
// Organize prompts by category
const categories = {
'Agent Prompts': {
'Sub-agents': [],
'Creation Assistants': [],
'Slash commands': [],
'Utilities': []
},
'System Prompt': { 'main': [] },
'System Reminders': { 'main': [] },
'Builtin Tool Descriptions': {
'main': [],
'Additional notes for some Tool Descriptions': []
},
'Data': { 'main': [] }
};
// Categorize all prompts
for (const [filename, { prompt, tokens }] of promptsByFilename) {
const { category, subcategory } = categorizePrompt(prompt.name);
// Special handling for bold main system prompt
const isBold = prompt.name === 'System Prompt: Main system prompt';
const entry = createReadmeEntry(prompt, filename, tokens, isBold);
if (category === 'Agent Prompts') {
categories['Agent Prompts'][subcategory].push(entry);
} else if (category === 'System Prompt') {
categories['System Prompt']['main'].push(entry);
} else if (category === 'System Reminders') {
categories['System Reminders']['main'].push(entry);
} else if (category === 'Builtin Tool Descriptions') {
const subcat = subcategory || 'main';
categories['Builtin Tool Descriptions'][subcat].push(entry);
} else if (category === 'Data') {
categories['Data']['main'].push(entry);
}
}
// Sort entries alphabetically within each category
for (const category of Object.values(categories)) {
for (const subcategory of Object.values(category)) {
if (Array.isArray(subcategory)) {
subcategory.sort();
}
}
}
// Rebuild README sections
const newLines = [];
let i = 0;
// Copy everything up to "### Agent Prompts"
while (i < lines.length && !lines[i].startsWith('### Agent Prompts')) {
newLines.push(lines[i]);
i++;
}
// Agent Prompts section
newLines.push('### Agent Prompts');
newLines.push('');
newLines.push('Sub-agents and utilities.');
newLines.push('');
newLines.push('#### Sub-agents');
newLines.push('');
newLines.push(...categories['Agent Prompts']['Sub-agents']);
newLines.push('');
newLines.push('### Creation Assistants');
newLines.push('');
newLines.push(...categories['Agent Prompts']['Creation Assistants']);
newLines.push('');
newLines.push('### Slash commands');
newLines.push('');
newLines.push(...categories['Agent Prompts']['Slash commands']);
newLines.push('');
newLines.push('### Utilities');
newLines.push('');
newLines.push(...categories['Agent Prompts']['Utilities']);
newLines.push('');
// Data section (commented out if has entries)
if (categories['Data']['main'].length > 0) {
newLines.push('<!--');
newLines.push('### Data');
newLines.push('');
newLines.push('Misc large strings.');
newLines.push('');
newLines.push(...categories['Data']['main']);
newLines.push('-->');
newLines.push('');
}
// System Prompt section
newLines.push('### System Prompt');
newLines.push('');
newLines.push('Parts of the main system prompt.');
newLines.push('');
newLines.push(...categories['System Prompt']['main']);
newLines.push('');
// System Reminders section
newLines.push('### System Reminders');
newLines.push('');
newLines.push('Text for large system reminders.');
newLines.push('');
newLines.push('> [!NOTE]');
newLines.push('> Note that we\'re planning to add a **system reminder creator/editor** to [tweakcc](https://github.com/Piebald-AI/tweakcc); :+1: [this issue](https://github.com/Piebald-AI/tweakcc/issues/113) if you\'re interested in that idea.');
newLines.push('');
newLines.push(...categories['System Reminders']['main']);
newLines.push('');
// Builtin Tool Descriptions section
newLines.push('### Builtin Tool Descriptions');
newLines.push('');
newLines.push(...categories['Builtin Tool Descriptions']['main']);
newLines.push('');
newLines.push('**Additional notes for some Tool Desscriptions**');
newLines.push('');
newLines.push(...categories['Builtin Tool Descriptions']['Additional notes for some Tool Descriptions']);
newLines.push('');
// Write updated README
writeFileSync(README_PATH, newLines.join('\n'));
}
// Main execution
const args = process.argv.slice(2);
if (args.length === 0) {
console.error('Usage: node updatePrompts.js <path-to-prompts.json>');
console.error('Example: node updatePrompts.js /path/to/tweakcc/data/prompts/prompts-2.0.44.json');
process.exit(1);
}
const jsonPath = args[0];
await updateFromJSON(jsonPath);

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Agent Prompt: CLAUDE.md creation' name: 'Agent Prompt: CLAUDE.md creation'
description: >- description: System prompt for analyzing codebases and creating CLAUDE.md documentation files
System prompt for analyzing codebases and creating CLAUDE.md documentation
files
ccVersion: 2.0.14 ccVersion: 2.0.14
--> -->
Please analyze this codebase and create a CLAUDE.md file, which will be given to future instances of Claude Code to operate in this repository. Please analyze this codebase and create a CLAUDE.md file, which will be given to future instances of Claude Code to operate in this repository.

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Agent Prompt: Prompt Hook execution' name: 'Agent Prompt: Prompt Hook execution'
description: >- description: Prompt given to Claude when acting evaluating whether to pass or fail a prompt hook.
Prompt given to Claude when acting evaluating whether to pass or fail a prompt
hook.
ccVersion: 2.0.41 ccVersion: 2.0.41
--> -->
You are evaluating a hook in Claude Code. You are evaluating a hook in Claude Code.

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Agent Prompt: /security-review slash' name: 'Agent Prompt: /security-review slash'
description: >- description: Comprehensive security review prompt for analyzing code changes with focus on exploitable vulnerabilities
Comprehensive security review prompt for analyzing code changes with focus on
exploitable vulnerabilities
ccVersion: 2.0.14 ccVersion: 2.0.14
--> -->
--- ---

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Agent Prompt: Status line setup' name: 'Agent Prompt: Status line setup'
description: >- description: System prompt for the statusline-setup agent that configures status line display
System prompt for the statusline-setup agent that configures status line
display
ccVersion: 2.0.14 ccVersion: 2.0.14
--> -->
You are a status line setup agent for Claude Code. Your job is to create or update the statusLine command in the user's Claude Code settings. You are a status line setup agent for Claude Code. Your job is to create or update the statusLine command in the user's Claude Code settings.

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Agent Prompt: WebFetch summarizer' name: 'Agent Prompt: WebFetch summarizer'
description: >- description: Prompt for agent that summarizes verbose output from WebFetch for the main model
Prompt for agent that summarizes verbose output from WebFetch for the main
model
ccVersion: 2.0.14 ccVersion: 2.0.14
variables: variables:
- WEB_CONTENT - WEB_CONTENT

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Data: GitHub Actions workflow for @claude mentions' name: 'Data: GitHub Actions workflow for @claude mentions'
description: >- description: GitHub Actions workflow template for triggering Claude Code via @claude mentions
GitHub Actions workflow template for triggering Claude Code via @claude
mentions
ccVersion: 2.0.14 ccVersion: 2.0.14
--> -->
name: Claude Code name: Claude Code

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Data: GitHub Actions workflow for automated code review (beta)' name: 'Data: GitHub Actions workflow for automated code review (beta)'
description: >- description: GitHub Actions workflow template for automated Claude Code reviews using direct_prompt
GitHub Actions workflow template for automated Claude Code reviews using
direct_prompt
ccVersion: 2.0.14 ccVersion: 2.0.14
--> -->
name: Claude Code Review name: Claude Code Review

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'System Prompt: Learning mode' name: 'System Prompt: Learning mode'
description: >- description: System Prompt: Main system prompt for learning mode with human collaboration instructions
System Prompt: Main system prompt for learning mode with human collaboration
instructions
ccVersion: 2.0.14 ccVersion: 2.0.14
variables: variables:
- ICONS_OBJECT - ICONS_OBJECT

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'System Prompt: Main system prompt' name: 'System Prompt: Main system prompt'
description: >- description: Core system prompt for Claude Code defining behavior, tone, and tool usage policies
Core system prompt for Claude Code defining behavior, tone, and tool usage
policies
ccVersion: 2.0.43 ccVersion: 2.0.43
variables: variables:
- OUTPUT_STYLE_CONFIG - OUTPUT_STYLE_CONFIG

View File

@ -1,6 +1,6 @@
<!-- <!--
name: 'Tool Description: Bash' name: 'Tool Description: Bash'
description: 'Description for the Bash tool, which allows Claude to run shell commands' description: Description for the Bash tool, which allows Claude to run shell commands
ccVersion: 2.0.25 ccVersion: 2.0.25
variables: variables:
- CUSTOM_TIMEOUT_MS - CUSTOM_TIMEOUT_MS

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Tool Description: ExitPlanMode v2' name: 'Tool Description: ExitPlanMode v2'
description: >- description: V2 description for the ExitPlanMode tool, which presents a plan dialog for the user to approve
V2 description for the ExitPlanMode tool, which presents a plan dialog for the
user to approve
ccVersion: 2.0.43 ccVersion: 2.0.43
variables: variables:
- ASK_USER_QUESTION_TOOL_NAME - ASK_USER_QUESTION_TOOL_NAME

View File

@ -1,8 +1,6 @@
<!-- <!--
name: 'Tool Description: ExitPlanMode' name: 'Tool Description: ExitPlanMode'
description: >- description: Description for the ExitPlanMode tool, which presents a plan dialog for the user to approve
Description for the ExitPlanMode tool, which presents a plan dialog for the
user to approve
ccVersion: 2.0.30 ccVersion: 2.0.30
variables: variables:
- ASK_USER_QUESTION_TOOL - ASK_USER_QUESTION_TOOL

View File

@ -7,6 +7,7 @@ variables:
- AGENT_TYPE_REGISTRY_STRING - AGENT_TYPE_REGISTRY_STRING
- READ_TOOL - READ_TOOL
- GLOB_TOOL - GLOB_TOOL
- TASK_TOOL
- WRITE_TOOL - WRITE_TOOL
--> -->
Launch a new agent to handle complex, multi-step tasks autonomously. Launch a new agent to handle complex, multi-step tasks autonomously.