agentleFS
vfarcicvfarcic/dot-ai/.claude/skills/dot-ai-generate-cicd/SKILL.md

dot-ai-generate-cicd

Skill336 starsChanged 10 months agoMITView on GitHub

Generate intelligent CI/CD workflows through interactive conversation by analyzing repository structure and user preferences

  • Reads credentials

The file

Show its rules and text

We split this skill into the rules it gives an agent

29 rules. About 0 are common, 28 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈28

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Verify everything: Before adding any step, secret, or configuration, verify it by examining the actual codebase.

    line 23
  2. Distinctive:

    Use conditional to skip steps when secrets unavailable:

    line 69
  3. Distinctive:

    When the generated workflow requires secrets, document them clearly:

    line 79
  4. Distinctive:

    Ask the user which CI/CD platform they use.

    line 150
  5. Distinctive:

    If automation exists for a task → use it in the generated workflow

    line 184
  6. Distinctive:

    Only generate raw commands if no existing automation found

    line 185
  7. Distinctive:

    When multiple automation options exist → ask the user

    line 186
  8. Distinctive:

    Check for existing CI configuration.

    line 192
  9. Distinctive:

    Check for Dockerfile and container configuration

    line 198
  10. Distinctive:

    Search for registry references in existing CI, automation, or docs

    line 199
  11. Very specific:

    If no Dockerfile but project could benefit from containerization, suggest using /generate-dockerfile prompt

    line 200
  12. Distinctive:

    Check for patterns in existing CI triggers

    line 204
  13. Distinctive:

    Look at git tags for versioning patterns

    line 205
  14. Distinctive:

    Check documentation for workflow hints

    line 206
  15. Distinctive:

    Search code for required environment variables

    line 211
  16. Distinctive:

    If not, may need to create them (same repo or separate cluster-config repo)

    line 233
  17. Distinctive:

    If unclear, ask user during Step 2.

    line 236
  18. Distinctive:

    Check for existing tool/environment managers (DevBox, mise, asdf, etc.).

    line 240
  19. Distinctive:

    Release Validation: Should release workflow re-run checks that already passed in PR?

    line 274
  20. Distinctive:

    Ask clarifying questions as needed:

    line 279
  21. Distinctive:

    If branching strategy unclear: "Do you use feature branches with pull requests, or push directly to main?"

    line 280
  22. Distinctive:

    If multiple automation options exist: "I found multiple ways to run tests.

    line 281
  23. Distinctive:

    If GitOps detected but repo location unclear: "Where are your GitOps manifests stored - same repository or separate?"

    line 282
  24. Distinctive:

    Before presenting to user:

    line 290
  25. Distinctive:

    Syntax validation: Ensure valid YAML and GitHub Actions syntax

    line 292
  26. Distinctive:

    Reference check: Verify referenced automation exists

    line 293
  27. Distinctive:

    Permission check: Ensure permissions block is minimal

    line 295
  28. Distinctive:

    Deployment check: Verify deployment steps match selected mechanism

    line 296
  29. Distinctive:

    After user approves, commit the workflows following the project's established process.

    line 309

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill 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
SKILL.md

Generate CI/CD Workflows

Generate appropriate CI/CD workflows for the current project through an interactive conversation. This prompt analyzes your entire repository, presents findings, asks about workflow preferences, and generates workflows based on your confirmed choices.

Instructions

You are helping a developer set up CI/CD workflows for their project. Unlike template-based generators, you will:

  1. Analyze the entire repository - source code, automation, configs, docs, existing CI
  2. Present findings and workflow options to the user for decision-making
  3. Generate workflows based on confirmed user choices

This interactive model is essential because CI/CD workflows involve policy decisions (PR vs direct push, release triggers, deployment strategy) that cannot be deduced from code alone—they reflect team preferences and organizational policies.

Key Rules

Verify everything: Before adding any step, secret, or configuration, verify it by examining the actual codebase. Never assume. Ask when uncertain.

Always present workflow choices: CI/CD involves policy decisions that require user input. Even if you detect tests and a Dockerfile, you cannot know whether tests should run on PR or main, what triggers releases, which registry to use, or how to deploy. These are workflow choices that require user input.


Best Practices

Apply these practices when generating workflows.

Use Project Automation, Not Inline Commands

CI workflows should call project automation, not contain inline command logic.

# ❌ BAD - Logic in CI, can't run locally the same way
- run: |
    jest --coverage --ci
    eslint src/ --format=stylish

# ✅ GOOD - CI calls project automation
- run: npm test
- run: npm run lint

Why: Local/CI parity, CI platform portability, easier debugging, single source of truth.

When project automation doesn't exist, ask the user:

I didn't find automation for [operation]. Would you like me to:
1. Add it to the project (recommended for local/CI parity)
2. Use inline command in workflow

Actions for Infrastructure, Project Commands for Logic

CategoryExamplesApproach
CI Infrastructurecheckout, setup runtime, cache, registry login✅ Use actions
Project Logicbuild, test, lint, docker build, deploy✅ Use project automation

Secret Handling

Secrets are only accessible from the org/owner that has them configured. Fork PRs cannot access base repo secrets.

Use conditional to skip steps when secrets unavailable:

- name: Run integration tests
  if: secrets.API_KEY != ''
  run: npm run test:integration
  env:
    API_KEY: ${{ secrets.API_KEY }}

When the generated workflow requires secrets, document them clearly:

## Required Secrets

| Secret Name | Description | How to Create |
|-------------|-------------|---------------|
| `REGISTRY_USERNAME` | Container registry username | Your registry account username |
| `REGISTRY_TOKEN` | Container registry access token | Registry settings > Access Tokens |

**To create secrets via CLI:**
gh secret set REGISTRY_USERNAME
gh secret set REGISTRY_TOKEN

Show the gh secret set commands as guidance, but do NOT execute them.

Security

PracticeDescription
Minimal permissionsUse permissions: block, grant only what's needed
OIDC over long-lived tokensFor cloud providers, prefer OIDC federation
Pin action versionsUse SHA or version tags, never @latest
Disable credential persistenceUse persist-credentials: false on actions/checkout
Prevent script injectionNever interpolate untrusted inputs (branch names, PR titles) directly into run: commands
Avoid pull_request_targetThis trigger has access to secrets but can checkout fork code - dangerous combination
Environment protectionUse GitHub environments with required reviewers for production deployments

Testing

PracticeDescription
Fail fastRun quick checks (lint) before slow ones (tests)
Test before buildDon't waste time building if tests fail
Parallel jobsRun independent checks concurrently
Test matrixConsider multiple versions/platforms if relevant

Caching

Implement appropriate caching based on detected package manager and lock files.


Process

IMPORTANT: Execute this process SEQUENTIALLY. Each step may change the direction of the conversation. Do NOT batch all questions upfront - ask questions one phase at a time and wait for user responses before proceeding.

The workflow follows three phases:

┌─────────────────────────────────────────────────────────────────┐
│ PHASE 1: ANALYZE                                                │
│ Discover what CAN be built/tested/deployed                      │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ PHASE 2: PRESENT & ASK                                          │
│ Show findings + present workflow choices for user decision      │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ PHASE 3: GENERATE                                               │
│ Create workflows based on confirmed user choices                │
└─────────────────────────────────────────────────────────────────┘

Step 0: Determine CI Platform (BLOCKING GATE)

CRITICAL: This is a blocking gate. Ask about CI platform FIRST and ALONE. Do NOT ask any other questions or perform any analysis until the user confirms they want GitHub Actions.

Ask the user which CI/CD platform they use. Present ONLY these options:

  1. GitHub Actions
  2. Other

If GitHub Actions → Proceed to Step 1 (analysis)

If Other → STOP. Ask which platform they use, then respond:

[Platform] is not yet supported. Would you like me to open a feature
request issue at https://github.com/dot-ai-app/dot-ai/issues so we
can prioritize adding it?

1. Yes, open a feature request
2. No, I'll use a different approach

Then handle the user's response (create issue or end conversation). Do NOT proceed to repository analysis for unsupported platforms.

Step 1: Comprehensive Repository Analysis

Analyze everything. The entire repository is context.

1.1 Language and Framework Detection

  • Identify primary language(s) from source files and dependency manifests
  • Detect frameworks from dependencies
  • Note version requirements

1.2 Discover and Understand Existing Automation

Find what automation exists and read scripts to understand how they work - what arguments they accept, what they handle internally, how they should be called. Don't just note that a script exists; understand it.

  • If automation exists for a task → use it in the generated workflow
  • Only generate raw commands if no existing automation found
  • When multiple automation options exist → ask the user

Why this matters: Existing automation often handles setup, fixtures, environment variables, and cleanup that raw commands would miss. The maintainers chose their build system for a reason.

1.3 Existing CI Analysis

Check for existing CI configuration. If found:

  • Analyze what's already configured and why
  • During Step 2, ask user whether to update existing workflows or create new ones

1.4 Container and Registry Detection

  • Check for Dockerfile and container configuration
  • Search for registry references in existing CI, automation, or docs
  • If no Dockerfile but project could benefit from containerization, suggest using /generate-dockerfile prompt

1.5 Branching and Release Strategy

  • Check for patterns in existing CI triggers
  • Look at git tags for versioning patterns
  • Check documentation for workflow hints

1.6 Environment and Secrets

  • Find environment variable documentation or examples
  • Search code for required environment variables
  • Identify what secrets the workflow will need

1.7 App Definition Detection

Identify how the application is packaged for deployment:

  • Helm charts
  • Kustomize configurations
  • Plain Kubernetes manifests
  • Container-only (no K8s deployment)

1.8 Deployment Mechanism Detection

Identify how the application is deployed:

  • GitOps (ArgoCD, Flux)
  • Direct deployment (Helm, kubectl)
  • Manual deployment
  • External system

For GitOps:

  • CI must NOT deploy directly - it updates manifests, GitOps controller syncs
  • Determine if GitOps resources (ArgoCD Application, Flux Kustomization) exist
  • If not, may need to create them (same repo or separate cluster-config repo)
  • Determine where manifests live for image tag updates

If unclear, ask user during Step 2.

1.9 Tool Manager Detection

Check for existing tool/environment managers (DevBox, mise, asdf, etc.). If found, use them automatically. If none, will ask user during interactive Q&A.

Step 2: Present Findings for Confirmation

Before generating workflows, present analysis summary. Include only what's relevant to this project - the example below is illustrative, not a template to fill out:

## Analysis Summary

I analyzed your repository and found:

**Language/Framework**: Node.js 20 with Express
**Build Command**: `npm run build` (from package.json)
**Test Command**: `npm test` (from package.json)
**Existing CI**: GitHub Actions workflow found (ci.yml)

**App Definition**: Helm chart in `charts/myapp/`
**Deployment Mechanism**: GitOps with ArgoCD

Is this correct? Would you like to change anything?

User can:

  • Confirm findings → proceed to workflow choices
  • Correct mistakes
  • Clarify ambiguities

Step 3: Present Workflow Choices

Present choices relevant to this project based on analysis. These are policy decisions that require user input. Only ask about what's applicable - for example, don't ask about container registry if there's no Dockerfile, or deployment strategy if it's a library.

Common choices include:

  • PR Workflow: What should run on pull requests?
  • Release Trigger: What triggers a release build?
  • Release Validation: Should release workflow re-run checks that already passed in PR? (Re-run all = safest/slowest, Skip validation = fastest, Security scans only = compromise)
  • Container Registry: Where to push images? (if containerized)
  • Environment Setup: Native GitHub Actions or DevBox?
  • Deployment Strategy: GitOps, direct, or manual? (if deployed)

Ask clarifying questions as needed:

  • If branching strategy unclear: "Do you use feature branches with pull requests, or push directly to main?"
  • If multiple automation options exist: "I found multiple ways to run tests. Which is the primary test command?"
  • If GitOps detected but repo location unclear: "Where are your GitOps manifests stored - same repository or separate?"

Step 4: Generate Workflow(s)

Generate appropriate workflow(s) based on analysis and confirmed user choices.

Step 5: Validate Generated Workflow

Before presenting to user:

  1. Syntax validation: Ensure valid YAML and GitHub Actions syntax
  2. Reference check: Verify referenced automation exists
  3. Secret documentation: List required secrets clearly
  4. Permission check: Ensure permissions block is minimal
  5. Deployment check: Verify deployment steps match selected mechanism

Step 6: Present to User

Provide:

  1. Generated workflow file(s) with explanatory comments
  2. Summary of what was detected and decisions made
  3. Required secrets to configure (with setup guidance)
  4. Required permissions and settings - Based on what the workflow does, identify what permissions or repository settings are needed and provide instructions to configure them. Don't wait for the workflow to fail - tell users upfront what to configure.

Step 7: Validate

After user approves, commit the workflows following the project's established process. Trigger the workflows, monitor runs, and iterate on any failures until they pass.

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.