Claude Code Prompt Optimizer banner
johnpsasser johnpsasser

Claude Code Prompt Optimizer

AI community

Description

AI-powered prompt optimization hook for Claude Code. Transforms simple prompts into comprehensive, structured instructions using Claude Opus 4.6's advanced reasoning capabilities.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Claude Code Prompt Optimizer

![Claude Code Prompt Optimizer](./assets/header.png)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node Version](https://img.shields.io/badge/node-%3E%3D18.0.0-green)](https://nodejs.org) [![Anthropic API](https://img.shields.io/badge/Anthropic-Claude%20Opus%204.6-blue)](https://www.anthropic.com)

A Claude Code hook that transforms simple prompts into detailed, structured instructions. Add `` to any prompt and it'll expand your request into something Claude can really sink its teeth into.

What It Does

When you tag a prompt with ``, this hook intercepts it and runs it through Claude's extended thinking mode. The result is a fleshed-out version of your original request with:

  • Specific implementation steps
  • Error handling considerations
  • Testing requirements
  • Edge cases to watch for

Basically, it does the prompt engineering for you.

Requirements

  • Claude Code CLI installed
  • Node.js 18+
  • One of the following:
    • CLAUDE_CODE_OAUTH_TOKEN (Claude Pro/MAX subscribers)
    • ANTHROPIC_API_KEY (API credit users)
    • Stored OAuth from claude login

Quick Install

git clone https://github.com/johnpsasser/claude-code-prompt-optimizer.git
cd claude-code-prompt-optimizer
npm run install-hook

The installer handles dependencies, auth setup, hook configuration, and verification.

Authentication

The Agent SDK checks for credentials in this order:

Priority Method Variable Best For
1 OAuth token CLAUDE_CODE_OAUTH_TOKEN Claude Pro/MAX subscribers
2 API key ANTHROPIC_API_KEY API credit users
3 Stored OAuth (none — uses claude login) Already logged in

If `CLAUDE_CODE_OAUTH_TOKEN` is set, the API key is ignored. If neither env var is set, the Agent SDK falls back to stored OAuth credentials from `claude login`.

Setting Up OAuth To