Claude Skills Guide

Claude Code for Hopsworks Feature Store Workflow

Feature stores have become the backbone of production machine learning systems, enabling teams to serve consistent features for both training and inference. Hopsworks, a popular open-source feature store, provides a powerful platform for managing features at scale. When combined with Claude Code’s AI-assisted development capabilities, you can dramatically accelerate your feature engineering workflows, reduce errors, and maintain better documentation.

This guide walks you through integrating Claude Code with Hopsworks Feature Store, from initial setup to production-ready feature pipelines.

Understanding the Hopsworks Feature Store Architecture

Before diving into the workflow, it’s essential to understand what Hopsworks offers. The platform provides three core components: the Feature Store (for storing and managing features), Feature Groups (grouped features with common metadata), and Feature Views (a defined set of features for training or serving).

Hopsworks supports both online and offline feature stores. The offline store serves training data from a data lake, while the online store provides low-latency feature serving for inference. This separation is crucial for production ML systems, and Claude Code can help you manage both effectively.

Setting Up Your Development Environment

Start by ensuring your environment has the required dependencies. You’ll need the hopsworks Python library and appropriate credentials:

pip install hopsworks

Next, authenticate with your Hopsworks instance:

import hopsworks

project = hopsworks.login(
    host="my-instance.hopsworks.ai",
    project="my_ml_project",
    api_key_value="your-api-key"
)

Claude Code can help you set up this configuration and manage API keys securely using environment variables or secrets management tools.

Creating Feature Groups with Claude Code Assistance

Feature groups are the building blocks of your feature store. They contain related features that are computed together and share the same schema. Here’s a practical workflow for creating feature groups with AI assistance:

Step 1: Define Your Feature Schema

Before writing code, document your features clearly. For example, if you’re building a fraud detection system, you might need features like:

Step 2: Generate Feature Group Code

Use Claude Code to generate the feature group creation code:

from hsfs.feature import Feature
from hsfs.feature_group import FeatureGroup

# Define features for fraud detection
features = [
    Feature(name="transaction_id", type="string", description="Unique transaction identifier"),
    Feature(name="transaction_amount", type="double", description="Transaction value in USD"),
    Feature(name="user_transaction_count", type="int", description="Transactions in last hour"),
    Feature(name="merchant_risk_score", type="float", description="Merchant risk assessment 0-1"),
    Feature(name="account_age_days", type="int", description="Account age in days"),
    Feature(name="timestamp", type="timestamp", description="Transaction timestamp")
]

# Create feature group
fg = feature_store.create_feature_group(
    name="fraud_detection_features",
    version=1,
    description="Features for fraud detection model",
    primary_key=["transaction_id"],
    event_time="timestamp",
    online_enabled=True,
    features=features
)

fg.save()

Claude Code can help you customize this template for your specific use case, add validation rules, and handle complex data types.

Step 3: Backfill Historical Data

For new feature groups, you’ll often need to backfill historical data. Claude Code can generate the necessary transformation code:

# Generate training data from offline feature store
fg = feature_store.get_feature_group("fraud_detection_features", version=1)

# Create training dataset
query = fg.select_all()
training_data = query.read()

# Save to training dataset
feature_store.create_training_dataset(
    name="fraud_training_ds",
    version=1,
    description="Training data for fraud detection",
    data=training_data,
    label=["is_fraudulent"]
).save()

Building Feature Pipelines

Feature pipelines transform raw data into store-ready features. These typically run on schedules to keep features updated. Claude Code can help you build robust pipelines using Apache Spark or Python.

Using the Spark Integration

For large-scale feature computation, use the Spark integration:

from hsfs.engine_spark import SparkEngine

# Read from source
df = spark.read.format("jdbc").option("url", jdbc_url).load()

# Transform to features
feature_df = df.withColumn("transaction_amount", col("amount").cast("double")) \
    .withColumn("user_transaction_count", count("user_id").over(windowSpec)) \
    .withColumn("merchant_risk_score", col("merchant_score") / 100.0)

# Insert into feature group
fg.insert(feature_df)

Claude Code skills like the spark skill can help you optimize these pipelines, handle schema evolution, and manage backfills.

Creating Feature Views for Training and Serving

Feature Views define the contract between your feature store and models. They ensure consistent feature sets across training and inference.

# Create feature view
fv = feature_store.create_feature_view(
    name="fraud_detection_fv",
    version=1,
    description="Feature view for fraud detection",
    query=query,
    labels=["is_fraudulent"]
)

# Get training data
train_df = fv.train.get_batch(2024, 2025)

# Get serving vector for inference
serving_vector = fv.serving.get_inference_data(
    transaction_id="tx_12345"
)

Best Practices for Claude Code + Hopsworks Workflows

To maximize the benefits of this integration, follow these actionable best practices:

1. Version Everything

Always version your feature groups and feature views. This enables reproducibility and easy rollbacks:

# Always specify versions explicitly
fg = feature_store.get_feature_group("fraud_detection_features", version=2)
fv = feature_store.get_feature_view("fraud_detection_fv", version=1)

2. Document Features Extensively

Use feature descriptions and metadata. Claude Code can help generate documentation from your code:

Feature(
    name="user_transaction_count",
    type="int",
    description="Rolling count of transactions per user in a 1-hour window. "
                "Computed using Spark streaming with watermark of 2 hours."
)

3. Validate Feature Quality

Implement data quality checks before inserting features:

from great_expectations.core import ExpectationSuite

# Define expectations
suite = ExpectationSuite("feature_quality")
suite.add_expectation(
    ExpectationConfiguration(
        expectation_type="expect_column_values_to_be_between",
        kwargs={"column": "transaction_amount", "min_value": 0, "max_value": 100000}
    )
)

# Validate before insert
validated_df = validate_df_with_suite(feature_df, suite)
fg.insert(validated_df)

4. Use Environment-Specific Configurations

Manage different feature stores for development, staging, and production:

import os

env = os.getenv("ENV", "dev")
config = {
    "dev": {"host": "dev.hopsworks.ai", "project": "ml_dev"},
    "prod": {"host": "prod.hopsworks.ai", "project": "ml_prod"}
}[env]

project = hopsworks.login(**config)

Monitoring and Maintenance

Once your features are in production, continuous monitoring is essential. Track feature statistics, monitor for data drift, and set up alerts for anomalies. Hopsworks provides built-in statistics computation that Claude Code can help you configure and interpret.

Regularly review your feature store’s health:

# Get feature group statistics
fg = feature_store.get_feature_group("fraud_detection_features", version=1)
stats = fg.compute_statistics()

# Check for data quality issues
if stats.num_nulls > threshold:
    alert_team("Feature quality degradation detected")

Conclusion

Integrating Claude Code with Hopsworks Feature Store creates a powerful workflow for managing ML features. By using AI assistance for code generation, documentation, and validation, you can move faster while maintaining high quality standards. Start with feature group creation, build robust pipelines, and establish monitoring practices to keep your feature store healthy in production.

The combination of Claude Code’s development assistance and Hopsworks’ enterprise-grade feature management gives you the best of both worlds: rapid iteration and production-grade reliability.

Built by theluckystrike — More at zovo.one