# How to Use GPT-Image2 from GitHub Packages: Installation and Setup Guide

> Learn how to use GPT-Image2 from GitHub Packages. Follow our guide for installation, setup, and seamless integration with AI agents. Get started today!

- Repository: [苍何/awesome-gpt-image-2](https://github.com/freestylefly/awesome-gpt-image-2)
- Tags: getting-started
- Published: 2026-09-01

---

**You can use GPT-Image2 from GitHub Packages by authenticating to the GitHub npm registry with a personal access token, installing the `@freestylefly/gpt-image-2-style-library` package, and invoking the skill through the CLI wrapper or compatible AI agents like Claude Code and Codex.**

The `freestylefly/awesome-gpt-image-2` repository distributes its style library as an npm package hosted on GitHub Packages, enabling seamless integration with agent frameworks and CLI workflows. By installing the package from the GitHub Packages registry, you gain access to curated templates, style tags, and example cases for generating production-ready GPT-Image2 prompts without cloning the entire repository.

## Prerequisites and GitHub Packages Authentication

Before installing the package, you must authenticate with the GitHub Packages registry, which requires a **personal access token** with `read:packages` scope. This authentication binds your npm client to the `@freestylefly` scope and grants access to private packages hosted at `npm.pkg.github.com`.

Run the following command to authenticate:

```bash
npm login --scope=@freestylefly --registry=https://npm.pkg.github.com

```

When prompted, enter:
- **Username**: Your GitHub username
- **Password**: Your personal access token (with `read:packages` scope)
- **Email**: Optional

## Installing the GPT-Image2 Style Library

Once authenticated, install the package globally using npm with the explicit registry flag to ensure npm pulls from GitHub Packages rather than the public npm registry.

```bash
npm install -g @freestylefly/gpt-image-2-style-library --registry=https://npm.pkg.github.com

```

The package definition resides in [`agents/skills/gpt-image-2-style-library/package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/package.json), which declares the package name, version, and publish settings targeting the GitHub Packages registry under the `@freestylefly` scope.

## Package Structure and Key Files

Understanding the internal structure of the installed package helps you leverage its full capabilities for prompt generation.

### package.json Configuration

The file [`agents/skills/gpt-image-2-style-library/package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/package.json) defines the npm package metadata, including the binary entry point for the CLI wrapper (`gpt-image-2-style-library`) and the repository links required by the GitHub Packages registry.

### SKILL.md Interface

The agent-skill definition lives in [`agents/skills/gpt-image-2-style-library/SKILL.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/SKILL.md). This markdown file describes the skill interface, workflow parameters, and output defaults used by Claude Code, Codex, Cursor, and other local agents that support the **skills** framework. It specifies how the agent should interpret style tags and template structures when generating GPT-Image2 prompts.

### style-library.json Data

The core data driving all prompt generation is stored in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json). This generated JSON file contains the curated collection of categories, templates, style tags, and example case references compiled from the repository's case collection. When you invoke the CLI or skill, the tool queries this JSON structure to assemble contextually appropriate prompts.

## Using the Skill with AI Agents

After installation, you can load the skill into compatible AI agents. For Claude Code, use the following plugin commands:

```text
/plugin marketplace add freestylefly/awesome-gpt-image-2
/plugin install gpt-image-2-style-library@awesome-gpt-image-2

```

For local agent folders (Codex, Cursor, or custom implementations), run the install command:

```bash
gpt-image-2-style-library install all

```

This command copies the skill definition and metadata into the agent's skills directory, making the GPT-Image2 templates available within the agent's context window.

## Generating Prompts via CLI

The package ships with a CLI wrapper (`gpt-image-2-style-library`) that provides direct access to the style library without requiring an agent interface. To generate a production-ready prompt, use the `prompt` subcommand followed by your subject description:

```bash
gpt-image-2-style-library prompt "Create an infographic about AI-driven analytics"

```

The CLI queries [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json) and returns a structured output containing composition guidelines, visual style parameters, aspect ratios, and template references:

```text
Subject: AI-driven analytics infographic
Composition: Clean grid layout with hierarchical data flow arrows
Visual style: Flat-vector illustration, teal-blue palette, subtle gradients
Text: Bold heading, concise data labels, legend
Aspect ratio: 16:9
Constraints: No photorealism, avoid clutter, no background textures
Template: tpl-infographic
Example case IDs: 33, 102

```

## Summary

- **Authenticate first**: You must run `npm login` with a `read:packages` token against the GitHub Packages registry (`npm.pkg.github.com`) before installation.
- **Install globally**: Use `npm install -g @freestylefly/gpt-image-2-style-library` with the `--registry` flag to pull from GitHub Packages.
- **Deploy to agents**: Use `gpt-image-2-style-library install all` to populate local agent skill folders for Claude Code, Codex, or Cursor.
- **Generate via CLI**: Invoke `gpt-image-2-style-library prompt` to create structured GPT-Image2 prompts based on the curated data in [`style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/style-library.json).

## Frequently Asked Questions

### What authentication is required to install packages from GitHub Packages?

You need a GitHub personal access token with the `read:packages` scope. When running `npm login --scope=@freestylefly --registry=https://npm.pkg.github.com`, provide this token as the password. Without this authentication, npm cannot access the private scoped packages hosted on the GitHub Packages registry.

### How do I install the GPT-Image2 skill for a specific AI agent?

After installing the npm package globally, run `gpt-image-2-style-library install all` to deploy the skill files to all detected agent directories. For Claude Code specifically, use the `/plugin install` commands to load the skill from the marketplace, which references the [`SKILL.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/SKILL.md) metadata in `agents/skills/gpt-image-2-style-library/` to configure the interface.

### What is the difference between using the CLI wrapper and the agent skill?

The CLI wrapper (`gpt-image-2-style-library prompt`) provides immediate, terminal-based access to the style library defined in [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), returning formatted prompt text directly to stdout. The agent skill, defined in [`SKILL.md`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/SKILL.md), integrates deeply into the agent's reasoning loop, allowing the AI to iteratively refine prompts using the style tags and templates during extended conversations.

### Where does the package store the curated style data?

The package contains [`data/style-library.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/data/style-library.json), which serves as the single source of truth for all style definitions, templates, and example references. This file is generated from the repository's case collection and is bundled into the npm package during the publishing workflow defined in [`agents/skills/gpt-image-2-style-library/package.json`](https://github.com/freestylefly/awesome-gpt-image-2/blob/main/agents/skills/gpt-image-2-style-library/package.json).