Skip to main content

CLI utility for analyzing CLAUDE.md files and generating structured prompts for Claude Code

Project description

Guru

CLI utility for analyzing CLAUDE.md files and generating structured prompts for Claude Code.

Guru reads your project's CLAUDE.md file and uses it to generate context-aware prompts that include role detection, relevant context filtering, tech stack, coding conventions, and project constraints.

Installation

# From PyPI (when published)
pip install talk-as-guru

# From source
git clone https://github.com/grigory-zhovtun/talk-as-guru.git
cd talk-as-guru
pip install -e .

Quick Start

  1. Create a CLAUDE.md file in your project root:
# Tech Stack
- Python 3.11
- FastAPI
- PostgreSQL

# Conventions
- Use type hints everywhere
- Follow PEP 8 style guide
- Write docstrings for public functions

# Rules
- Never commit secrets
- Always write tests for new features
  1. Run Guru:
guru "create a REST API endpoint for user authentication"
  1. Result — a structured prompt in ./prompts/prompt_01.md:
# Роль
Senior Backend разработчик (FastAPI, Python, PostgreSQL)

# Задача
create a REST API endpoint for user authentication

# Техническое окружение
- Python 3.11
- FastAPI
- PostgreSQL

# Релевантный контекст
[Only relevant sections from CLAUDE.md]

# Конвенции
- Use type hints everywhere
- Follow PEP 8 style guide

# Ограничения и правила
- Never commit secrets
- Always write tests for new features

Two Modes

Standard Mode (default)

Generates a prompt locally using a template with:

  • Automatic role detection — determines the role from query keywords and tech stack (e.g. "Senior Frontend разработчик (Next.js, React, TypeScript)")
  • Relevant context filtering — includes only project-specific sections from CLAUDE.md, sorted by relevance to the query
  • Structured output — role, task, tech environment, context, conventions, constraints
guru "add a notification bell to the header"

Smart Mode (--smart)

Uses Claude Code CLI to analyze the query and generate an enriched prompt with:

  • AI-powered role selection — specific specialization for the task
  • Task decomposition — 3-7 concrete subtasks with details
  • Intelligent context filtering — only the most relevant parts of CLAUDE.md
  • Technical constraints — derived from project architecture
guru --smart "add a notification bell to the header"

Requires Claude Code CLI installed (claude command in PATH).

Usage

Interactive REPL Mode

Start the interactive shell:

guru

Single Query Mode

Process a query without entering the REPL:

guru "create a function for email validation"

Command Line Options

guru --help                    Show help
guru --version                 Show version
guru --smart / -s              Enrich prompt via Claude Code AI
guru -c /path/to/CLAUDE.md     Use specific CLAUDE.md file
guru -p ./my-prompts           Save prompts to custom directory
guru -t custom                 Use a custom template
guru --profile my-project      Load a saved profile

REPL Commands

Command Description
/reload Re-read CLAUDE.md from disk
/history Show recent query history
/template [name] Switch template (no arg = list available)
/profile [name] Load profile (no arg = list available)
/run Send last prompt to Claude Code CLI
/smart [query] Enrich prompt via Claude Code AI
/help Show help
/exit Exit Guru

Generated Prompts

Prompts are saved to ./prompts/ with auto-incrementing filenames:

prompts/
├── prompt_01.md
├── prompt_02.md
└── prompt_03.md

Each prompt includes:

  • Automatically detected role
  • Your query/task
  • Tech stack from CLAUDE.md
  • Relevant project context (filtered, not full dump)
  • Project conventions
  • Constraints and rules

Templates

Guru uses Jinja2 templates for prompt generation.

Available Template Variables

Variable Description
user_query The user's query/task
role Auto-detected role
tech_stack Tech stack section
relevant_context Filtered relevant sections
conventions Conventions section
constraints Constraints/rules section
context Full file content (legacy)

Custom Templates

Create custom templates in ~/.guru/templates/:

mkdir -p ~/.guru/templates

Example template (~/.guru/templates/detailed.md.j2):

# Role
{{ role }}

# Task Description
{{ user_query }}

## Technical Context
### Tech Stack
{{ tech_stack }}

### Relevant Context
{{ relevant_context }}

### Coding Standards
{{ conventions }}

### Important Rules
{{ constraints }}

Use it with:

guru -t detailed
# or in REPL
guru> /template detailed

Profiles

Save project configurations as profiles in ~/.guru/profiles/:

# ~/.guru/profiles/my-project.yaml
name: my-project
claude_md_path: ./docs/CLAUDE.md
template: detailed
prompts_dir: ./generated-prompts

Load with:

guru --profile my-project
# or in REPL
guru> /profile my-project

Claude Code Integration

/run — Execute prompt

Send the last generated prompt to Claude Code CLI:

guru> create a user model
Saved: ./prompts/prompt_01.md

guru> /run
Sending to Claude Code...
[Claude's response appears here]

/smart — AI-enriched prompts

Re-generate the last query with AI analysis:

guru> add notifications to the header
Saved: ./prompts/prompt_01.md

guru> /smart
Smart mode: enriching prompt via Claude Code...
Saved (smart): ./prompts/prompt_02.md

Or provide a new query directly:

guru> /smart add API endpoint for notifications

Requirements:

CLAUDE.md Format

Guru recognizes sections based on keywords in headings:

Section Keywords
Tech Stack tech, stack, technology, tools, dependencies
Conventions convention, style, formatting, patterns, practices
Constraints constraint, rule, restriction, important, warning

All other sections are treated as project context and included based on relevance to the query.

Supported heading formats:

# Heading
## Heading
**Heading**

Role Detection

Guru automatically detects the appropriate role based on query keywords and tech stack:

Keywords Role
react, next.js, frontend, css, ui, компонент Senior Frontend разработчик
python, fastapi, backend, api, endpoint Senior Backend разработчик
sql, postgres, database, модел Senior Database разработчик
docker, kubernetes, deploy, devops Senior DevOps инженер
test, pytest, jest, e2e Senior QA инженер
security, auth, jwt, oauth Senior Security инженер
go, golang, goroutine Senior Go разработчик

The role is enhanced with specific technologies from the project's tech stack (e.g. "Senior Frontend разработчик (Next.js, React, TypeScript)").

Examples

Basic Workflow

# Navigate to your project
cd my-project

# Generate a prompt
guru "implement user authentication with JWT"
# Saved: ./prompts/prompt_01.md

# Generate an AI-enriched prompt
guru --smart "add rate limiting to the API"
# Saved (smart): ./prompts/prompt_02.md

REPL Workflow

guru

guru> implement user authentication with JWT
Saved: ./prompts/prompt_01.md

guru> /smart
Smart mode: enriching prompt via Claude Code...
Saved (smart): ./prompts/prompt_02.md

guru> /run
Sending to Claude Code...

guru> /history
guru> /exit

Configuration Directory

Guru stores configuration in ~/.guru/:

~/.guru/
├── templates/      # Custom Jinja2 templates
│   └── custom.md.j2
└── profiles/       # Project profiles
    └── my-project.yaml

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/

# Lint
ruff src/

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

talk_as_guru-0.2.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

talk_as_guru-0.2.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file talk_as_guru-0.2.0.tar.gz.

File metadata

  • Download URL: talk_as_guru-0.2.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for talk_as_guru-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c7a1621d7b1bdaf7982a6935dcc2bc2319ddc52e97aafba6dcd271908e9b6f7e
MD5 3350e33efa865afbed17c96a8c6583f3
BLAKE2b-256 316773b1ea998d635fe5d87f590375a4ec766ca4d5eea172f7df6dec7e3605c5

See more details on using hashes here.

File details

Details for the file talk_as_guru-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: talk_as_guru-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for talk_as_guru-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96bded5138c5da264ed19c01e282766972a0f43cb15a14c216a4375bcf05d8b7
MD5 e48687c5008a6492f3d828e0283492dc
BLAKE2b-256 e65f00c629363d036a1b05319a0afad49e107dfb34f788d3b1caf830704ecad7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page