bdd-mathematical-verification
БесплатноЗапускает вложенные скриптыНе проверенBDD-Driven Mathematical Content Verification Skill Combines Behavior-Driven Development with mathematical formula extraction, verification, and transformation…
от plurigrid★ 73 звезды на GitHubОб этом скилле
BDD Mathematical Verification Skill
Overview
This skill enables Behavior-Driven Development (BDD) workflows for mathematics, combining:
- Gherkin Specifications: Plain-text scenario definitions
- RSpec Implementation: Executable Ruby verification code
- mathpix-gem Integration: Automatic LaTeX extraction from images
- Pattern Matching: Syntax-tree validation for mathematical expressions
- Iterative Discovery: Cucumber features guide formula exploration
Core Components
1. Feature Specifications (Gherkin)
Feature: Mathematical Formula Extraction and Verification
Scenario: Extract LaTeX from mathematical image
Given I have a mathematical image file "quadratic.png"
When I extract LaTeX using Mathpix
Then I should get a LaTeX formula matching the pattern "ax^2 + bx + c"
And the formula should be registered as an artifact
Scenario: Verify quadratic formula in standard form
Given a quadratic formula "x^2 - 5*x + 6"
When I verify it is in standard form
Then the coefficients should be [1, -5, 6]
And it should be factorable as "(x - 2)(x - 3)"
Scenario Outline: Verify binomial expansion
Given a binomial expression "<binomial>"
When I expand it using binomial theorem
Then the result should match "<expanded>"
And all terms should be present with correct signs
Examples:
| binomial | expanded |
| (x + 1)^2 | x^2 + 2*x + 1 |
| (a - b)^3 | a^3 - 3*a^2*b + 3*a*b^2 - b^3 |
| (2*x + 3)^2 | 4*x^2 + 12*x + 9 |
2. RSpec Implementation Blocks
describe "Mathematical Formula Verification" do
describe "Formula Extraction" do
context "with valid mathematical image" do
it "extracts LaTeX representation" do
# Extraction step
end
it "normalizes notation to standard form" do
# Normalization step
end
end
context "with multi-page document" do
it "extracts all formulas in order" do
# Batch processing
end
end
end
describe "Formula Verification" do
context "with polynomial expressions" do
it "matches pattern against syntax tree" do
# Pattern matching verification
end
it "verifies algebraic equivalence" do
# Equivalence checking
end
end
context "with nested/complex expressions" do
it "validates form requirement" do
# Form verification (expanded/factored/etc)
end
end
end
describe "Scenario-Driven Discovery" do
context "with parameterized examples" do
it "verifies all example variations" do
# Parameterized testing
end
end
end
end
3. Pattern Matching on Syntax Trees
module MathematicalPatternMatching
# Pattern: ax^n + bx^(n-1) + ... + c (polynomial)
POLYNOMIAL_PATTERN = /^([^+\-]+)([\+\-][^+\-]+)*$/
# Pattern: (expression)^exponent
POWER_PATTERN = /^\(([^)]+)\)\^(\d+)$/
# Match polynomial coefficients
# In: "3*x^2 + 2*x + 1"
# Out: {degree: 2, coefficients: [3, 2, 1], terms: [...]}
def parse_polynomial(formula_str)
# Returns AST (Abstract Syntax Tree)
# Each node: {type: :term, coefficient: n, variable: 'x', exponent: m}
end
def verify_form(formula_ast, required_form)
# required_form: :expanded, :factored, :simplified
case required_form
when :expanded
all_terms_distributed?(formula_ast)
when :factored
has_minimal_complexity?(formula_ast)
when :simplified
no_like_terms_combinable?(formula_ast)
end
end
end
4. mathpix-gem Integration
require 'mathpix'
class MathematicalContentExtractor
def initialize(api_key: ENV['MATHPIX_API_KEY'])
@client = Mathpix::Client.new(api_key: api_key)
end
# Image → LaTeX
def extract_from_image(image_path)
result = @client.process_image(
image_path: image_path,
output_format: :latex
)
{
latex: result.latex,
confidence: result.confidence,
format: :latex
}
end
# Document → Markdown with embedded LaTeX
def extract_from_document(pdf_path)
result = @client.process_document(
document_path: pdf_path,
output_format: :markdown
)
{
content: result.markdown,
formulas: extract_formulas(result.markdown),
format: :markdown
}
end
# Chemistry → SMILES
def extract_from_chemistry(image_path)
result = @client.process_image(
image_path: image_path,
output_format: :smiles
)
{
smiles: result.smiles,
format: :smiles
}
end
private
def extract_formulas(markdown_content)
# Extract all $...$ and $$...$$ blocks
formulas = []
markdown_content.scan(/\$\$?([^\$]+)\$\$?/) do |match|
formulas << {latex: match[0], inline: match[0].include?('\$')}
end
formulas
end
end
5. Cucumber Step Definitions
# features/step_definitions/mathematical_steps
Установить bdd-mathematical-verification в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bdd-mathematical-verification?
BDD-Driven Mathematical Content Verification Skill Combines Behavior-Driven Development with mathematical formula extraction, verification, and transformation using: - Cucumber/Gherkin for specification - RSpec for implementation verification - mathpix-gem for LaTeX/mathematical content extraction - Pattern matching on syntax trees for formula validation Enables iterative discovery and verification of mathematical properties through executable specifications.
Как установить скилл bdd-mathematical-verification?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bdd-mathematical-verification запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic