Extract Formulas

by foolishimp

skill

Extract mathematical formulas (F-*) from requirements - calculations, algorithms, conversions. Enables autogeneration of calculation functions with tests. Use when requirements involve math, dates, percentages, or algorithms.

Skill Details

Repository Files

1 file in this skill directory


name: extract-formulas description: Extract mathematical formulas (F-*) from requirements - calculations, algorithms, conversions. Enables autogeneration of calculation functions with tests. Use when requirements involve math, dates, percentages, or algorithms. allowed-tools: [Read, Write, Edit]

extract-formulas

Skill Type: Actuator (Requirements Disambiguation) Purpose: Extract F-* formulas from REQ-* requirements Prerequisites: REQ-* requirement exists


Agent Instructions

You are extracting formulas (F-*) from requirements.

Formulas are:

  • Mathematical calculations (fee = amount * rate)
  • Date/time calculations (expiry = issue_time + duration)
  • Conversions (celsius = (fahrenheit - 32) * 5/9)
  • Algorithms (hash, scoring, ranking)

Goal: Identify formulas precise enough for code autogeneration.


F-* Categories

1. Arithmetic Formulas

F-001: Stripe processing fee
  - Formula: fee = (amount * 0.029) + 0.30
  - Inputs: amount (float)
  - Output: fee (float, rounded to 2 decimals)
  - Autogenerate: calculate_stripe_fee(amount) -> float

2. Date/Time Calculations

F-010: Token expiry time
  - Formula: expiry = issue_time + (60 * 60) seconds
  - Inputs: issue_time (datetime)
  - Output: expiry (datetime)
  - Autogenerate: calculate_token_expiry(issue_time) -> datetime

3. Percentage/Ratio Calculations

F-020: Discount amount
  - Formula: discount = original_price * discount_percentage
  - Inputs: original_price (float), discount_percentage (float 0.0-1.0)
  - Output: discount (float, rounded to 2 decimals)
  - Autogenerate: calculate_discount(price, percentage) -> float

4. Hash/Checksum Algorithms

F-030: Idempotency key
  - Formula: key = SHA256(merchant_id + timestamp + amount)
  - Inputs: merchant_id (str), timestamp (int), amount (float)
  - Output: key (hex string, 64 chars)
  - Autogenerate: generate_idempotency_key(...) -> str

Extraction Process

Identify formulas by looking for:

  • Calculations: "calculate", "compute", "determine"
  • Operators: +, -, *, /, %, ^
  • Functions: SHA256, round, abs, max, min
  • Time: "expires after", "duration", "timeout"
  • Money: "fee", "tax", "discount", "total"

Output Format

[EXTRACT FORMULAS - <REQ-ID>]

Requirement: Payment processing

Formulas Extracted (3):
  āœ“ F-001: Stripe processing fee calculation
  āœ“ F-002: Idempotency key generation
  āœ“ F-003: Transaction timeout calculation

Updated: docs/requirements/payments.md
  Added: Formulas section with 3 F-*

āœ… Formula Extraction Complete!

"Excellence or nothing" šŸ”„

Related Skills

Attack Tree Construction

Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.

skill

Grafana Dashboards

Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.

skill

Matplotlib

Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.

skill

Scientific Visualization

Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.

skill

Seaborn

Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.

skill

Shap

Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Query Writing

For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Scientific Visualization

Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.

skill

Skill Information

Category:Skill
Allowed Tools:[Read, Write, Edit]
Last Updated:12/2/2025