Skip to content

Claude Code

Claude Code is an agentic coding assistant from Anthropic — a CLI and IDE extension that reads your codebase, writes code, runs tests, and iterates autonomously. It's particularly useful for developing research software on or for the PAIS platform.

What Claude Code is good at for research

  • Writing Python scripts that call the PAIS API
  • Designing and iterating on LangChain or LlamaIndex pipelines
  • Debugging Kubeflow Pipeline definitions
  • Writing and running data processing code in a Jupyter notebook context
  • Reading deployed cluster state and drafting configuration changes

Installation

Claude Code is available as a CLI and in VS Code / JetBrains:

npm install -g @anthropic-ai/claude-code

Or use the claude.ai/code web interface.

See the Claude Code documentation for full installation instructions.

Using Claude Code to build PAIS-backed software

Claude Code uses Anthropic's API for the assistant — not the PAIS API. But it can write code that calls the PAIS API and run that code directly.

Example session: building a paper summarisation pipeline

Start Claude Code in your project directory:

cd ~/research/lit-review
claude

Then ask it to build the pipeline:

> I have a folder of PDFs in ./papers/. Build a Python script that:
  1. Reads each PDF
  2. Calls the PAIS API (base URL in $PAIS_API_BASE, key in $PAIS_API_KEY)
     to summarise the abstract
  3. Outputs a markdown file with structured summaries
  Use the openai Python package and read credentials from environment variables.

Claude Code will: 1. Read the directory structure 2. Write summarise_papers.py 3. Install any missing dependencies 4. Run the script against a test PDF 5. Fix any errors it encounters

Example session: debugging a Kubeflow pipeline

> The Kubeflow pipeline in pipeline.py fails with "MLMD connection refused".
  Read the CLAUDE.md in this repo to understand the known Kubeflow/Istio quirks,
  then help me diagnose whether this is the ml-pipeline-mysql DestinationRule issue.

Claude Code can read your CLAUDE.md, look at the pipeline YAML, and reason about the known platform constraints.

Using PAIS as the backend for Claude Code

Experimental / future capability

Claude Code currently uses Anthropic's API. Running Claude Code against a self-hosted PAIS model (Llama 3.1) is not natively supported but can be approximated with OpenAI-compatible proxy tools. Contact the PAIS team if this is a hard requirement.

Configuring Claude Code for PAIS projects

Create a CLAUDE.md in your project root to give Claude Code context:

# Project Context

This project uses the PAIS inference API at $PAIS_API_BASE (OpenAI-compatible).
API key is in $PAIS_API_KEY.

## Models available
- `llama-3-1-8b` — chat completions
- `qwen3-vl-embedding-8b` — embeddings

## Key patterns
- All OpenAI SDK calls use `base_url=os.environ["PAIS_API_BASE"]`
- Never hardcode API keys
- Use `python-dotenv` to load `.env` in local development
- Batch embedding requests in groups of 32

## Data location
- Research papers: ./papers/  (PDFs)
- Vector index: ./chroma_db/  (Chroma persistent store)
- Results: ./output/  (markdown summaries)

With this file, Claude Code understands the project conventions and won't need them repeated each session.

Typical workflows

Iterative pipeline development

claude
> Create an embedding pipeline for the PDFs in ./papers/ using LlamaIndex and PAIS
# Claude writes the code and runs it
> The chunking seems too coarse  retest with chunk_size=500 and show me the difference
# Claude edits, reruns, compares
> Save the best config and add a --chunk-size CLI argument

Debugging and testing

> Run the test suite and fix any failures
> Profile ./embed.py  it's slow on large corpora, suggest optimisations
> Add error handling for rate limit (429) responses from the PAIS API

Documentation generation

> Generate a README for this project explaining what it does, how to set it up,
  and how to run the pipeline. Include the PAIS_API_BASE and PAIS_API_KEY env vars.

Best practices

  • Keep CLAUDE.md updated as the project evolves — it's the primary way Claude Code learns your conventions
  • Use /compact when sessions get long to compress history and stay focused
  • Review all code before running it against production data or cluster resources
  • Claude Code runs commands in your shell — make sure environment variables are set before starting the session

See also