Sunday, 26 April 2026

Using Claude Code to investigate Prod Machines? Use this skill...

 I do NOT recommended you to use Claude Code to execute arbitrary commands on a production application server. But it is a very addictive, time-saving thing to do - particularly to investigate the logs. If you want to ever do it, here is my suggestion for a skill that provides a harness. Please feel free to comment on your suggested improvements.

---
name: prod-vm
description: Rules and protocol for Claude Code when connecting to and operating on production VMs.
---

When the user asks Claude Code to connect to a production VM and perform actions, the following rules apply.

## Connection

Connections are typically made using `plink` with named saved sessions (e.g., `plink "ERP Kerberos Server" <command>`).

## Command Authorization

- **Diagnostic / read-only commands** (viewing logs, checking processes, disk usage, service status, etc.) are permitted without explicit authorization. `sudo` with a read-only payload is also permitted.
- **Any command that alters machine configuration or files** requires explicit user authorization before execution. Authorization may be granted for a single command, a batch of commands, or a class of commands (e.g., "you may restart services if needed").
- **Every command must be printed before execution**, along with the reason it is being run.

## Logging

Maintain a session log at `~/.claude/logs/prod-vm/<machine-name>.cc.log` on the dev machine (never on the prod VM). Log each command executed, the reason it was run, and a summary of its output.

## Data / File Downloads

Any files or data downloaded from the session must be listed at the end of the session for proper handling and securing.

## Sub-commands

If the user specifies `clean-logs`, delete all log files under `~/.claude/logs/prod-vm/`.

If the user specifies `help`, display the available sub-commands and a summary of the rules above.

Thursday, 29 January 2026

Frappe Insights app - Installation Issues

 

Issue 1: mysqlclient Compilation Error During bench get-app

Insights depends on ibis-framework[mysql], which requires the mysqlclient Python package—a C extension that needs MariaDB development headers.

The Error

During the Docker build:

text
Trying pkg-config --exists libmariadb
Command 'pkg-config --exists libmariadb' returned non-zero exit status 127.
/bin/sh: 1: pkg-config: not found
Exception: Can not find valid pkg-config name.
Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually

This happened because the base frappe/erpnext image lacks pkg-config and MariaDB dev packages.

The Fix

I updated my Containerfile to install the necessities as root:

text
USER root
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    libmariadb-dev \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

USER frappe

# Set env vars to skip pkg-config
ENV MYSQLCLIENT_CFLAGS="-I/usr/include/mariadb"
ENV MYSQLCLIENT_LDFLAGS="-L/usr/lib -lmariadb"

This forces mysqlclient to build from source using explicit paths, keeping the image lean (no pkg-config needed). Rebuild the image, and the bench get-app step succeeds.

Issue 2: NumPy Baseline Optimization Error During bench install-app

After getting the app, running bench --site site.name install-app insights failed with:

RuntimeError: NumPy was built with baseline optimizations: (X86_V2) but your machine doesn't support: (X86_V2).

NumPy 2.0+ (here v2.4.1) requires x86-64-v2 features (SSE4.2, SSSE3, POPCNT), but my VM didn't expose them.

The Cause

Proxmox VM default CPU type (kvm64 or similar) emulates a minimal CPU without passing through host features. My Xeon Silver 4510 supports these, but the guest OS didn't see them (grep sse4_2 /proc/cpuinfo returned nothing).

The Fix

In Proxmox UI:

  • Shut down VM.
  • Hardware > Processor > Edit > Type: Set to host. 
  • Or, change the machine type to q35 (which I did not try)

This passes through the real CPU capabilities. No more NumPy error!

Monday, 19 January 2026

Troubleshooting Claude Code - PyCharm Integration

 If you’re a Python developer using PyCharm and excited about Anthropic’s Claude Code (the powerful AI coding assistant that lives in your terminal and integrates with IDEs), you might run into the same frustrating issue I did recently.

I have a Claude Pro subscription, and I was eager to get the full IDE integration working in PyCharm 2025.3.1. Here’s what happened and how I finally fixed it.

My Setup

•  PyCharm version: 2025.3.1.1 (Build #PY-253.29346.308)

•  Claude Code CLI: v2.1.5 (updated to latest)

•  Claude Code PyCharm Plugin: 0.1.14-Beta (installed from JetBrains Marketplace)

•  OS: Windows 11 Pro

The Claude CLI worked perfectly when I typed claude in my regular terminal — it launched, chatted with my codebase, everything fine.

But inside PyCharm:

•  Clicking the Claude icon launched the tool.

•  Running /ide showed “No IDE detected”.

•  Diff viewing, selection context sharing, file references, and other integrations refused to work.

•  PyCharm popped up a notification: “Cannot Launch Claude Code. Please ensure Claude Code is installed and the ‘claude’ command is in your system path.”

I knew the claude command was in my PATH — it worked everywhere else!

What I Tried First (The Usual Suspects)

I followed Anthropic support’s excellent suggestions:

1.  Ran claude update and restarted terminals/IDEs.

2.  Checked PyCharm’s Python Console PATH in Settings → Build, Execution, Deployment → Console → Python Console — it included the Claude bin directory.

3.  Ran /doctor in Claude Code — installation looked healthy.

4.  Updated both PyCharm and the plugin to the absolute latest versions.

Nothing helped. The integration still failed.

I was about to file a detailed bug report using /bug in Claude Code when I decided to try one more thing…

The Unexpected Fix: Firewall Interference

Out of curiosity, I temporarily disabled my firewall completely and relaunched everything in PyCharm.

It worked instantly!

/ide detected PyCharm, diffs opened in the IDE viewer, context from selections flowed seamlessly, and the notification disappeared.

Turns out, the Claude Code plugin and CLI communicate over a local socket/port (likely localhost TCP connection) to enable those fancy IDE features. My firewall was blocking this internal loopback traffic between the plugin and the running Claude process.

Permanent Solution

Instead of leaving the firewall off (not recommended!), I added a targeted exception:

1.  Opened Windows Defender Firewall.

2.  Created a new inbound and outbound rule.

3.  Allowed the claude executable.

•  Program path: Full path to the claude binary.

•  Action: Allow the connection.

•  Profile: All (Domain/Private/Public) or just Private if you’re careful.

4.  Restarted PyCharm and Claude Code.

Boom — full integration unlocked!

Quick Tips for Others Facing This

•  If /ide says no IDE detected → Check firewall first, especially on Windows or strict corporate setups.

•  PATH issues are common, but in my case it was not.

•  The plugin is still in beta, so small quirks happen.

  Always run claude from your project root in the IDE terminal for best context.

•  If you’re on WSL2 + Windows, also check WSL networking/firewall rules — similar localhost blocking can occur.