Skip to content
cccskills
FreePublished on GitHub

automation-ci-helper

Instructions for managing CI pipelines, GitHub Actions workflows, Airflow DAGs, and automation scripts in the insurance analytics project.

The English summary is being prepared. Showing the original description.

Run score Not tested

See how to install

Files included (1)

  • SKILL.md9.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Automation & CI Helper Skill

This skill covers all automation in the insurance analytics project: GitHub Actions CI workflows, the Apache Airflow data pipeline, the Makefile task runner, pre-commit hooks, and quality-gate tooling.

Automation components at a glance

ComponentLocationPurpose
GitHub Actions – CI.github/workflows/ci-postgres.ymlLint → test → SonarCloud on every push/PR
GitHub Actions – Release.github/workflows/release.ymlManual workflow dispatch: bumps patch version tag and creates a GitHub Release (no build artifact is uploaded)
GitHub Actions – Scheduled.github/workflows/scheduled-pipeline.ymlRuns the pipeline on a schedule (now delegates to a reusable workflow)
GitHub Actions – Reusable pipeline.github/workflows/run-pipeline.ymlReusable workflow that owns Postgres service and runs ingest/ETL/upload
Composite actions.github/actions/setup-python-env, .github/actions/run-etlShared actions for Python setup and running ETL steps
Airflow DAGairflow/dags/insurance_pipeline_dag.pyOrchestrates the ETL end-to-end
MakefileMakefileDeveloper task runner (local shortcuts)
Pre-commit hooks.pre-commit-config.yamlAuto-formats and lints on every git commit

GitHub Actions: CI workflow (ci-postgres.yml)

The CI workflow has three sequential jobs:

lint  →  etl  →  sonarcloud

Job 1 – lint (static analysis)

Runs on every push to main/master that touches src/**, tests/**, src/sql/**, requirements.txt, pyproject.toml, sonar-project.properties, or .github/workflows/ci-postgres.yml. Pull requests to those branches trigger lint only when src/**, tests/**, requirements.txt, or pyproject.toml are changed (src/sql/** and other config files do not trigger CI on PRs).

Steps:

  1. ruff format --check – formatting check
  2. ruff check + pylint – linting (ruff is non-blocking on auto-fixable issues; pylint is non-blocking)
  3. mypy src – static type checking
  4. bandit -r src – security scan
  5. radon cc + radon mi – cyclomatic complexity and maintainability index

Job 2 – etl (ETL smoke test with PostgreSQL)

The project now centralises the integration pipeline in a reusable workflow: .github/workflows/run-pipeline.yml.

Key points:

  • The reusable workflow owns the Postgres 15 service and offers two modes via inputs:
    • seed-db: true — initialise and seed the DB with stable fixtures (used by CI tests)
    • seed-db: false — run a live Kaggle ingest via src.load (used by the scheduled run)
  • Schema application is no longer performed with runner psql -f ... in multiple places; the loader/seed script executes the canonical DDL (src/sql/ddl_create_tables.sql) via the same Python helper (_apply_ddl()), so CI and scheduled runs share the exact schema logic.
  • The test flow (CI) typically calls the reusable workflow with seed-db: true, runs the ETL steps, and then a dedicated coverage job collects and uploads coverage artifacts.

Key environment variable set by the workflow:

DATABASE_URL: postgresql+psycopg2://postgres:postgres@localhost:5432/insurdb

Job 3 – sonarcloud

Downloads the test artifacts (coverage + JUnit XML) and runs SonarCloud analysis. The Sonar job now depends on the CI coverage job (which produces build/reports/coverage.xml and build/reports/junit-report.xml).

Secrets used:

  • SONAR_TOKEN – SonarCloud authentication
  • CODECOV_TOKEN – Codecov upload (used by the CI coverage job)

Triggering CI manually

Push any change to a file under src/, tests/, src/sql/, requirements.txt, pyproject.toml, sonar-project.properties, or .github/workflows/ci-postgres.yml on a branch targeting main/master. A pull request against those branches also triggers CI when src/**, tests/**, requirements.txt, or pyproject.toml are modified.

Note: because the ETL and service logic are now in a reusable workflow, changes to the pipeline are tested more consistently across CI and scheduled runs.

Makefile: local task runner

Run make help to see all targets. Most-used ones:

make install        # pip install all dependencies
make test           # pytest with coverage
make lint           # flake8 + ruff + pylint
make format         # black + isort + ruff format + docformatter
make check-types    # mypy --strict
make quality        # bandit + radon + xenon + cohesion + vulture
make check          # lint + check-types + test + quality (full gate)

make db-init        # apply src/sql/ddl_create_tables.sql
make db-reset       # DROP SCHEMA + re-apply DDL
make kaggle-load    # download Kaggle dataset and load into PostgreSQL
make setup          # install + db-init + kaggle-load (full first-time setup)

make airflow-up     # start Airflow via Docker Compose (port 8080)
make airflow-down   # stop Airflow
make airflow-logs   # tail scheduler logs

Airflow DAG

The DAG is defined in airflow/dags/insurance_pipeline_dag.py and orchestrates:

kaggle_ingest  →  [run_transform_kpis, run_ml_model]  →  generate_excel_report
TaskModule invokedNotes
kaggle_ingestsrc.load --kaggle-configDownloads dataset from Kaggle and loads into DB; requires KAGGLE_USERNAME + KAGGLE_KEY env vars
run_transform_kpissrc.transformRuns in parallel with run_ml_model
run_ml_modelsrc.modelRuns in parallel with run_transform_kpis
generate_excel_reportsrc.reportRuns after both transform and model complete

The schedule defaults to daily at 06:00 UTC and can be overridden via the AIRFLOW_PIPELINE_SCHEDULE environment variable. The project directory is set via AIRFLOW_PROJECT_DIR.

Starting Airflow locally

make airflow-up
# Airflow UI → http://localhost:8080   login: admin / admin
make airflow-down   # stop when done

Airflow runs via Docker Compose (airflow/docker-compose-airflow.yml) on a dedicated insurance-network Docker network.

Pre-commit hooks (.pre-commit-config.yaml)

Pre-commit runs automatically on git commit. To run it manually against all files:

make pre-commit
# or directly:
pre-commit run --all-files

This project uses Ruff as the unified linter and formatter in pre-commit, replacing the former black, isort, and flake8 hooks. Typical hooks: ruff (lint + fix), ruff-format, trailing-whitespace / end-of-file fixers.

First-time setup:

pip install pre-commit
pre-commit install   # installs the git hook

Quality gate script (scripts/check_quality.sh)

A shell script that aggregates multiple quality checks in one pass:

make quality-check
# or directly:
./scripts/check_quality.sh

Run this locally before opening a pull request to catch issues that CI will also catch.

Adding a new CI step

Prefer adding new behaviour as a composite action or to the reusable workflow so it can be exercised by both CI and scheduled runs. General steps:

  1. If the change affects runtime/test behaviour (DB, ETL), update ./.github/workflows/run-pipeline.yml or add a new composite action under ./.github/actions/ so callers can reuse it.
  2. Otherwise add a step in ci-postgres.yml (lint/coverage) or in run-pipeline.yml for runtime steps.
  3. Add required Python tooling to requirements.txt and/or pyproject.toml.
  4. Test locally (run make test) and push to a feature branch to validate the workflow in Actions.

Common CI failures and fixes

FailureLikely causeFix
ruff format --check failsCode not formattedRun make format locally, then commit
mypy errorsMissing type annotations or wrong typesAdd/fix type hints in src/
bandit security warningUse of a flagged function (e.g. subprocess, pickle)Refactor or add # nosec with justification
Postgres connection refusedService container not readyThe reusable workflow uses health-checks on the Postgres service; if you see failures, confirm the run-pipeline.yml service definition and health options.
pytest collection errorImport error in src/Run pytest -q locally with the same DATABASE_URL to reproduce
SonarCloud gate failsCoverage below threshold or new bugs foundFix the issues reported in the SonarCloud PR comment

Secrets required in GitHub repository settings

Secret nameUsed by
SONAR_TOKENSonarCloud scan (job 3)
CODECOV_TOKENCodecov coverage upload (job 2)
KAGGLE_USERNAMEScheduled pipeline — Kaggle dataset ingest
KAGGLE_KEYScheduled pipeline — Kaggle dataset ingest

Additional notes:

  • The canonical DDL lives in src/sql/ddl_create_tables.sql (loaded via importlib.resources in src.load). The Python helpers _apply_ddl() and _table_columns() (in src.load) are the preferred way to apply and reflect the schema programmatically; the seed script .github/scripts/seed_test_db.py reuses them.
  • Test and coverage artifacts are written to build/reports/ by default (junit-report.xml, coverage.xml, htmlcov/). Update pyproject.toml / Makefile if you need a different location.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

Drafts U.S. commercial real estate access and indemnity (right-of-entry) agreements for pre-closing due diligence. Covers license grants, non-invasive vs invasive testing gates, insurance/endorsement requirements, indemnity with discovery carve-outs, restoration and lien remedies, confidentiality, and anti-indemnity guardrails. Trigger: access agreement, right of entry, due diligence access, Phase I/II, invasive testing, pre-PSA site inspection.

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

当用户需要对意外险投保问卷进行专业、结构化的核保审查,提取职业类别、工作环境、作业内容、危险活动参与情况、交通出行习惯、特殊工作暴露及其他可能影响意外险承保判断的高风险信息,并生成适合意外险核保、补问流转和风险分层处理的结构化分析结果时使用本 skill。

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

Inspect, schema, and fill true AcroForm PDFs using sciClaw's pdf_form_inspect, pdf_form_schema, and pdf_form_fill tools. Use when: (1) checking whether a PDF is a real fillable AcroForm, (2) listing form field names, types, and choices, (3) filling a supported form from structured values, (4) preparing reviewable insurance, legal, administrative, or clinical form drafts, (5) reporting skipped fields or unused input keys after a fill. Do not use for scanned PDFs, OCR tasks, or XFA-only forms.

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

Guide actuarial analysis for insurance pricing. TRIGGERS - Use when user needs help with actuarial-analysis related tasks.

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

Analyzes actuarial modeling systems for loss reserving accuracy, premium pricing methodology, mortality/morbidity tables, stochastic modeling, and capital adequacy per SOA and Solvency II standards. USE THIS SKILL WHEN: - You need to review or audit actuarial models (reserving, pricing, capital) - Someone asks about loss triangle analysis or reserve adequacy - You are evaluating IBNR calculations, chain ladder methods, or Bornhuetter-Ferguson - A project involves insurance pricing, GLM rating models, or ratemaking - You need to assess Solvency II SCR calculations or RBC compliance - Someone mentions actuarial opinions, ASOP compliance, or SOA standards - You are reviewing stochastic models, ESG configurations, or DFA frameworks - A codebase uses actuarial libraries (chainladder, lifetables, ChainLadder R package) TRIGGER PHRASES: "actuarial", "loss reserving", "IBNR", "chain ladder", "premium pricing", "mortality table", "Solvency II", "capital adequacy", "ratemaking", "GLM pricing", "risk-based capital", "reserve analysis", "actuarial opinion"

The English summary is being prepared. Showing the original description.

FDU-INS/Insurance-Skills80Updated Jul 12, 2026

See all skills by FDU-INS

Report a problem with this skill