agentleFS
PederHPPederHP/image-gen-cli/.github/copilot-instructions.md

image-gen-cli

Copilot instructions2 starsChanged 11 months agoMITView on GitHub

Multi-provider image generation CLI using .NET 10 and System.CommandLine. Provider pattern - all providers implement IImageGenerationClient with a single method: Key files: - src/Program.cs - CLI parsing, provider instantiation, validation, output handling - src/IImageGenerationClient.cs - Provider interface - src/GeminiImageClient.cs - Google Gemini API (direct HTTP, no SDK) - src/OpenAIImageClient.cs - OpenAI API (direct HTTP, no SDK) - src/Models/ - Provider-agnostic request/response types Gemini: - Uses generativelanguage.googleapis.com/v1beta API directly - imageSize parameter only works with Pro models; Flash models ignore it…

  • Reads credentials

The file

We split this copilot-instructions.md into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Provider pattern: - all providers implement IImageGenerationClient with a single method:

    line 26
  2. Very specific:

    Create NewProviderImageClient.cs implementing IImageGenerationClient

    line 40
  3. Distinctive:

    Default model switch (~line 99)

    line 43
  4. Distinctive:

    No system prompt, temperature, or resolution support (validated at runtime - causes error)

    line 59
  5. Very specific:

    Use .tmp/ directory for test outputs (gitignored).

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions for image-gen-cli

Multi-provider image generation CLI using .NET 10 and System.CommandLine.

Quick Commands

# Build
dotnet build src/ImageGenCli.csproj

# Run directly (development)
dotnet run --project src/ImageGenCli.csproj -- "prompt"

# Install as global tool
dotnet pack src/ImageGenCli.csproj -c Release -o ./nupkg
dotnet tool install --global --add-source ./nupkg ImageGenCli

# Then use anywhere
image-gen "prompt"
image-gen -p openai "prompt"    # OpenAI provider
image-gen -i image.png "edit"   # With reference image

Architecture

Provider pattern - all providers implement IImageGenerationClient with a single method:

Task<GenerationResult> GenerateImagesAsync(GenerationRequest request, CancellationToken ct)

Key files:

  • src/Program.cs - CLI parsing, provider instantiation, validation, output handling
  • src/IImageGenerationClient.cs - Provider interface
  • src/GeminiImageClient.cs - Google Gemini API (direct HTTP, no SDK)
  • src/OpenAIImageClient.cs - OpenAI API (direct HTTP, no SDK)
  • src/Models/ - Provider-agnostic request/response types

Adding a New Provider

  1. Create NewProviderImageClient.cs implementing IImageGenerationClient
  2. In Program.cs, add to:
    • API key resolution switch (~line 84)
    • Default model switch (~line 99)
    • Provider validation array (~line 106)
    • Provider-specific parameter validation (~line 131)
    • Client instantiation switch (~line 171)

Provider-Specific Notes

Gemini:

  • Uses generativelanguage.googleapis.com/v1beta API directly
  • imageSize parameter only works with Pro models; Flash models ignore it
  • Supports systemInstruction for system prompts
  • Returns both images and optional text in response

OpenAI:

  • /v1/images/generations for text-only prompts
  • /v1/images/edits with multipart form for reference images
  • No system prompt, temperature, or resolution support (validated at runtime - causes error)
  • Maps aspect ratios to fixed pixel dimensions in MapSize() (e.g., 16:9 → 1536x1024)

Conventions

  • No SDK dependencies - both clients use raw HttpClient with direct JSON serialization
  • Models use required and init - immutable request types with required fields
  • Error handling - throw ImageGenerationException for API errors; let HttpRequestException propagate for network issues
  • Provider validation - unsupported parameter combinations cause hard errors (not warnings) for agent-friendliness
  • Output naming - {provider}-{timestamp}.{ext} or {provider}-{timestamp}-{n}.{ext} for multiple

Environment Variables

  • GEMINI_API_KEY - Gemini provider
  • OPENAI_API_KEY - OpenAI provider

Agent Skill

See image-gen/SKILL.md for the Agent Skills definition with complete usage documentation.

Test Outputs

Use .tmp/ directory for test outputs (gitignored).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.