# CI/CD Pipeline Generation from Codebase Analysis: A Complete Guide to Claude Skills

> Generate CI CD pipelines automatically from codebase analysis. Claude Skills detects your stack and creates production-ready GitHub Actions or GitLab CI workflows with zero-dependency Python scripts.

- Repository: [Alireza Rezvani/claude-skills](https://github.com/alirezarezvani/claude-skills)
- Tags: how-to-guide
- Published: 2026-03-09

---

**The CI/CD Pipeline Builder skill in alirezarezvani/claude-skills automatically detects your repository's technology stack and generates production-ready GitHub Actions or GitLab CI workflows using zero-dependency Python scripts.**

This guide explains how to leverage automated **CI/CD pipeline generation from codebase analysis** to eliminate manual YAML configuration. The skill resides in the `engineering/ci-cd-pipeline-builder` directory of the Claude Skills repository and provides a portable, CLI-first solution for transforming repository signals into continuous integration definitions.

## How the CI/CD Pipeline Builder Works

The system operates through two core Python modules that form a detection-to-generation pipeline. Both scripts use only Python standard libraries, ensuring compatibility across any environment without package installation overhead.

### Stack Detection with [`stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/stack_detector.py)

The **[`stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/stack_detector.py)** module located at [`engineering/ci-cd-pipeline-builder/scripts/stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/scripts/stack_detector.py) performs recursive repository analysis to identify technology signals. It scans for manifest files including [`package.json`](https://github.com/alirezarezvani/claude-skills/blob/main/package.json), [`pyproject.toml`](https://github.com/alirezarezvani/claude-skills/blob/main/pyproject.toml), `go.mod`, lock files, and `Dockerfile` instances to construct a **`StackReport`** dataclass.

This report encapsulates detected programming languages, package managers, appropriate CI targets, and common development commands such as lint, test, and build operations. The detector outputs either human-readable text or structured JSON via the `--format json` flag, enabling programmatic consumption by downstream tools.

### Pipeline Generation with [`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py)

The **[`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py)** script at [`engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py) consumes `StackReport` data to emit platform-specific YAML configurations. It intelligently selects correct node installers—distinguishing between `npm ci`, `pnpm install`, and `yarn install`—and injects language-specific steps for Node.js, Python, and Go environments.

The generator supports both GitHub Actions and GitLab CI platforms, creating appropriately named jobs such as `node-ci`, `python-ci`, and `go-ci` for GitHub, or `node_lint`, `node_test`, and `node_build` for GitLab configurations. Upon completion, it outputs the YAML to a specified file path and prints a concise **`PipelineSummary`** to stdout or stderr based on the selected format mode.

### Data Flow Architecture

The detection and generation process follows a strict four-stage pipeline:

1. **Detection** – [`stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/stack_detector.py) walks the target directory, sets boolean signal flags, and aggregates language-specific commands.
2. **Payload** – The resulting `StackReport` serializes to JSON or streams directly to the generator.
3. **Generation** – [`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py) reads the payload (or auto-detects via internal logic) and builds YAML strings with platform-specific job definitions.
4. **Output** – The final workflow writes to [`.github/workflows/ci.yml`](https://github.com/alirezarezvani/claude-skills/blob/main/.github/workflows/ci.yml) or any custom path supplied via `--output`, accompanied by a generation summary.

Reference templates stored in [`references/github-actions-templates.md`](https://github.com/alirezarezvani/claude-skills/blob/main/references/github-actions-templates.md) and [`references/gitlab-ci-templates.md`](https://github.com/alirezarezvani/claude-skills/blob/main/references/gitlab-ci-templates.md) provide the foundational snippets used during generation, while [`engineering/ci-cd-pipeline-builder/SKILL.md`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/SKILL.md) exposes the capability to Claude Code agents through standardized metadata definitions.

## Using the CI/CD Pipeline Builder

The following workflows demonstrate practical implementations of **CI/CD pipeline generation from codebase analysis** for different scenarios and platforms.

### Detecting Your Technology Stack

Generate a comprehensive stack report to understand what the detector identifies in your repository:

```bash
python3 engineering/ci-cd-pipeline-builder/scripts/stack_detector.py \
  --repo . \
  --format json > stack.json

```

This command analyzes the current directory, identifies all technology markers, and writes a structured `StackReport` JSON payload to [`stack.json`](https://github.com/alirezarezvani/claude-skills/blob/main/stack.json) for inspection or manual editing before pipeline generation.

### Generating GitHub Actions Workflows

Transform an existing stack report into a GitHub Actions workflow file:

```bash
python3 engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py \
  --input stack.json \
  --platform github \
  --output .github/workflows/ci.yml \
  --format text

```

This creates [`.github/workflows/ci.yml`](https://github.com/alirezarezvani/claude-skills/blob/main/.github/workflows/ci.yml) containing jobs for each detected language and prints a "Pipeline generated" summary to confirm successful creation.

### One-Shot Generation for GitLab CI

Execute complete **CI/CD pipeline generation from codebase analysis** without intermediate files by allowing the generator to handle detection internally:

```bash
python3 engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py \
  --repo . \
  --platform gitlab \
  --output .gitlab-ci.yml

```

When no JSON input is supplied via `--input`, the script falls back to its own lightweight detection logic and immediately writes a GitLab CI configuration file.

### Integration with Claude Code

Install and invoke the skill directly within Claude Code environments using the standardized skill interface:

```plaintext
/plugin install ci-cd-pipeline-builder@claude-code-skills
/skill ci-cd-pipeline-builder generate --repo /path/to/project --platform github

```

The [`SKILL.md`](https://github.com/alirezarezvani/claude-skills/blob/main/SKILL.md) metadata file exposes a `generate` command that orchestrates both detection and generation scripts behind a unified interface, making the tool discoverable through the Claude Code marketplace.

## Key Files and Implementation Details

Understanding the repository structure ensures effective customization and troubleshooting:

- **[`engineering/ci-cd-pipeline-builder/scripts/stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/scripts/stack_detector.py)** – Implements repository walking and signal detection logic, producing the `StackReport` dataclass.
- **[`engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/scripts/pipeline_generator.py)** – Contains YAML templating engines for both GitHub Actions and GitLab CI platforms.
- **[`engineering/ci-cd-pipeline-builder/README.md`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/README.md)** – Provides installation instructions for Claude Code, Codex, and OpenClaw integrations.
- **[`engineering/ci-cd-pipeline-builder/SKILL.md`](https://github.com/alirezarezvani/claude-skills/blob/main/engineering/ci-cd-pipeline-builder/SKILL.md)** – Defines input/output schemas and command mappings for Claude agent consumption.
- **`engineering/ci-cd-pipeline-builder/references/`** – Houses template markdown files for GitHub Actions and GitLab CI syntax reference.

The implementation maintains a **zero-dependency** architecture using only Python standard libraries, ensuring the tool functions in minimal container environments or fresh virtual machines without pip installation requirements.

## Summary

- **Automated Detection**: The [`stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/stack_detector.py) script identifies languages, package managers, and build tools by scanning for manifest files like [`package.json`](https://github.com/alirezarezvani/claude-skills/blob/main/package.json) and `go.mod`.
- **Multi-Platform Support**: [`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py) creates valid YAML for both GitHub Actions and GitLab CI, selecting appropriate installers and job structures automatically.
- **Flexible Workflows**: Support for JSON intermediates or one-shot generation accommodates both manual review requirements and fully automated pipelines.
- **Zero Dependencies**: Both scripts rely exclusively on Python standard libraries, ensuring portability across any CI environment or local development machine.
- **Claude Integration**: The [`SKILL.md`](https://github.com/alirezarezvani/claude-skills/blob/main/SKILL.md) wrapper enables seamless usage through Claude Code's plugin ecosystem with standardized command interfaces.

## Frequently Asked Questions

### How does the stack detector determine which package manager to use for Node.js projects?

The detector analyzes lock file presence to select the appropriate installer command. When it identifies [`package-lock.json`](https://github.com/alirezarezvani/claude-skills/blob/main/package-lock.json), it recommends `npm ci`; for [`pnpm-lock.yaml`](https://github.com/alirezarezvani/claude-skills/blob/main/pnpm-lock.yaml), it selects `pnpm install --frozen-lockfile`; and for `yarn.lock`, it chooses `yarn install --frozen-lockfile`. This logic ensures reproducible builds by respecting the specific package manager used in the original project.

### Can I customize the generated pipeline templates?

Yes, while the generator uses reference templates stored in [`references/github-actions-templates.md`](https://github.com/alirezarezvani/claude-skills/blob/main/references/github-actions-templates.md) and [`references/gitlab-ci-templates.md`](https://github.com/alirezarezvani/claude-skills/blob/main/references/gitlab-ci-templates.md), you can modify the Python source in [`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py) to adjust job sequences, add custom steps, or change base images. The modular design separates template strings from detection logic for straightforward customization.

### Does this tool support monorepo structures with multiple languages?

The `StackReport` dataclass aggregates all detected signals within a repository scan, enabling generation of multi-job workflows that handle different languages simultaneously. For example, a repository containing both [`package.json`](https://github.com/alirezarezvani/claude-skills/blob/main/package.json) and [`pyproject.toml`](https://github.com/alirezarezvani/claude-skills/blob/main/pyproject.toml) will generate distinct jobs for Node.js and Python testing within the same CI file.

### Is internet connectivity required during pipeline generation?

No, both [`stack_detector.py`](https://github.com/alirezarezvani/claude-skills/blob/main/stack_detector.py) and [`pipeline_generator.py`](https://github.com/alirezarezvani/claude-skills/blob/main/pipeline_generator.py) operate entirely offline using local file system analysis and embedded template strings. The zero-dependency, standard-library-only architecture ensures functionality in air-gapped environments or secure build pipelines without external package downloads.