Skip to content

usefulmove/coder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coder

A minimal CLI coding assistant powered by Claude and Context7. Ask for a code example in any language and get a concise, working snippet with a short explanation — without leaving the terminal.

Installation

Install the CLI directly from GitHub with pipx:

pipx install git+https://github.com/usefulmove/coder.git

This installs the coder entrypoint in an isolated environment and makes it available on your PATH.

For local development, clone the repository and install it in editable mode:

git clone https://github.com/usefulmove/coder.git
cd coder

uv venv
source .venv/bin/activate
uv pip install -e .

# Or with pip
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Setup

Set your Anthropic API key:

export ANTHROPIC_API_KEY=sk-ant-...

Optionally, set a Context7 API key for higher rate limits:

export CONTEXT7_API_KEY=ctx7sk-...

Get your API keys:

Usage

# Get a code example
coder "modern C++ fold_left"

# Rust iterators
coder "Rust iterators filter map collect"

# Python async
coder "Python asyncio gather example"

# React hooks
coder "React useEffect cleanup"

Pass the query as an argument, or omit it to be prompted interactively:

coder
# code description (and language): Python dataclass frozen

Output

coder returns:

  1. A minimal, working code snippet
  2. A short description explaining how the code works

No preamble. No filler. Just code.

How It Works

Your query
    │
    ▼
Claude Haiku 4.5 + Context7 MCP
    │
    ├── Tries Context7 docs first (accurate, up-to-date)
    │
    ├── Falls back to web search if needed
    │
    ▼
Concise code example
  1. You describe a concept in any programming language
  2. Claude uses the Context7 MCP server to find accurate documentation
  3. If Context7 doesn't have it, Claude searches the web
  4. Claude synthesizes a minimal, working example for an experienced engineer
  5. Output is rendered as markdown with syntax highlighting via rich

Examples

Query:

coder "Python dataclass frozen"

Output:

from dataclasses import dataclass

@dataclass(frozen=True)
class Point:
    x: int
    y: int

p = Point(1, 2)
# p.x = 3  # Raises FrozenInstanceError

A frozen dataclass is immutable after creation.


Query:

coder "Rust Result map_err"

Output:

fn parse_number(s: &str) -> Result<i32, String> {
    s.parse::<i32>()
        .map_err(|e| format!("Parse error: {}", e))
}

map_err transforms the error type while preserving the success value.

Development

# Lint and format
uv run ruff check .
uv run ruff format .

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

Requirements

  • Python 3.13+
  • ANTHROPIC_API_KEY environment variable
  • uv (recommended) or pip

Architecture

  • Claude Haiku 4.5: Fast inference for quick responses
  • Context7 MCP: Accurate, up-to-date documentation
  • Web Search: Fallback for libraries not in Context7
  • Rich: Markdown rendering with syntax highlighting

See docs/core/ARCHITECTURE.md for details.

About

code reference CLI agent

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages