Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns
日本語の概要は準備中です。原文の説明を表示しています。
Instructions for managing CI pipelines, GitHub Actions workflows, Airflow DAGs, and automation scripts in the insurance analytics project.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
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.
| Component | Location | Purpose |
|---|---|---|
| GitHub Actions – CI | .github/workflows/ci-postgres.yml | Lint → test → SonarCloud on every push/PR |
| GitHub Actions – Release | .github/workflows/release.yml | Manual workflow dispatch: bumps patch version tag and creates a GitHub Release (no build artifact is uploaded) |
| GitHub Actions – Scheduled | .github/workflows/scheduled-pipeline.yml | Runs the pipeline on a schedule (now delegates to a reusable workflow) |
| GitHub Actions – Reusable pipeline | .github/workflows/run-pipeline.yml | Reusable workflow that owns Postgres service and runs ingest/ETL/upload |
| Composite actions | .github/actions/setup-python-env, .github/actions/run-etl | Shared actions for Python setup and running ETL steps |
| Airflow DAG | airflow/dags/insurance_pipeline_dag.py | Orchestrates the ETL end-to-end |
| Makefile | Makefile | Developer task runner (local shortcuts) |
| Pre-commit hooks | .pre-commit-config.yaml | Auto-formats and lints on every git commit |
ci-postgres.yml)The CI workflow has three sequential jobs:
lint → etl → sonarcloud
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:
ruff format --check – formatting checkruff check + pylint – linting (ruff is non-blocking on auto-fixable issues; pylint is non-blocking)mypy src – static type checkingbandit -r src – security scanradon cc + radon mi – cyclomatic complexity and maintainability indexetl (ETL smoke test with PostgreSQL)The project now centralises the integration pipeline in a reusable workflow: .github/workflows/run-pipeline.yml.
Key points:
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)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.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
sonarcloudDownloads 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 authenticationCODECOV_TOKEN – Codecov upload (used by the CI coverage job)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.
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
The DAG is defined in airflow/dags/insurance_pipeline_dag.py and orchestrates:
kaggle_ingest → [run_transform_kpis, run_ml_model] → generate_excel_report
| Task | Module invoked | Notes |
|---|---|---|
kaggle_ingest | src.load --kaggle-config | Downloads dataset from Kaggle and loads into DB; requires KAGGLE_USERNAME + KAGGLE_KEY env vars |
run_transform_kpis | src.transform | Runs in parallel with run_ml_model |
run_ml_model | src.model | Runs in parallel with run_transform_kpis |
generate_excel_report | src.report | Runs 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.
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-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
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.
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:
./.github/workflows/run-pipeline.yml or add a new composite action under ./.github/actions/ so callers can reuse it.ci-postgres.yml (lint/coverage) or in run-pipeline.yml for runtime steps.requirements.txt and/or pyproject.toml.make test) and push to a feature branch to validate the workflow in Actions.| Failure | Likely cause | Fix |
|---|---|---|
ruff format --check fails | Code not formatted | Run make format locally, then commit |
mypy errors | Missing type annotations or wrong types | Add/fix type hints in src/ |
bandit security warning | Use of a flagged function (e.g. subprocess, pickle) | Refactor or add # nosec with justification |
| Postgres connection refused | Service container not ready | The 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 error | Import error in src/ | Run pytest -q locally with the same DATABASE_URL to reproduce |
| SonarCloud gate fails | Coverage below threshold or new bugs found | Fix the issues reported in the SonarCloud PR comment |
| Secret name | Used by |
|---|---|
SONAR_TOKEN | SonarCloud scan (job 3) |
CODECOV_TOKEN | Codecov coverage upload (job 2) |
KAGGLE_USERNAME | Scheduled pipeline — Kaggle dataset ingest |
KAGGLE_KEY | Scheduled pipeline — Kaggle dataset ingest |
Additional notes:
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.build/reports/ by default (junit-report.xml, coverage.xml, htmlcov/). Update pyproject.toml / Makefile if you need a different location.まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Complete architecture reference for the A3 insurance platform — file locations, data flow, conventions, microservice map, and fullstack patterns
日本語の概要は準備中です。原文の説明を表示しています。
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.
日本語の概要は準備中です。原文の説明を表示しています。
当用户需要对意外险投保问卷进行专业、结构化的核保审查,提取职业类别、工作环境、作业内容、危险活动参与情况、交通出行习惯、特殊工作暴露及其他可能影响意外险承保判断的高风险信息,并生成适合意外险核保、补问流转和风险分层处理的结构化分析结果时使用本 skill。
日本語の概要は準備中です。原文の説明を表示しています。
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.
日本語の概要は準備中です。原文の説明を表示しています。
Guide actuarial analysis for insurance pricing. TRIGGERS - Use when user needs help with actuarial-analysis related tasks.
日本語の概要は準備中です。原文の説明を表示しています。
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"
日本語の概要は準備中です。原文の説明を表示しています。