Equation solver

From masharratt/claude-flow-novice · View interactive version

Equation solver is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. A production-grade algebraic equation solver with comprehensive security hardening to prevent template injection, command injection, and other code execution vulnerabilities.

How to use this skill

Skill file

Equation-Solver Skill

Overview

A production-grade algebraic equation solver with comprehensive security hardening to prevent template injection, command injection, and other code execution vulnerabilities.

Status: Active

Security Score: 0.95 (Target: ≥0.85)

Maturity: Production

Test Coverage: 42 tests (100% passing)

Features

Usage

# Basic usage
./.claude/skills/equation-solver/solve.sh "x + 2 = 5"

# Specify variable to solve for
./.claude/skills/equation-solver/solve.sh "x^2 + 5x + 6 = 0" x

# Verbose output
./.claude/skills/equation-solver/solve.sh -v "2x - 4 = 0"

# Help
./.claude/skills/equation-solver/solve.sh --help

Examples

Linear Equations

$ ./.claude/skills/equation-solver/solve.sh "x + 2 = 5"
{"solutions":["3"],"message":"One solution found"}

$ ./.claude/skills/equation-solver/solve.sh "2x - 4 = 0"
{"solutions":["2"],"message":"One solution found"}

Quadratic Equations

$ ./.claude/skills/equation-solver/solve.sh "x^2 + 5x + 6 = 0"
{"solutions":["-2","-3"],"message":"2 solutions found"}

$ ./.claude/skills/equation-solver/solve.sh "(x + 2)(x + 3) = 0"
{"solutions":["-2","-3"],"message":"2 solutions found"}

Polynomial Equations

$ ./.claude/skills/equation-solver/solve.sh "x^3 - 6x^2 + 11x - 6 = 0"
{"solutions":["1","2","3"],"message":"3 solutions found"}

Different Variables

$ ./.claude/skills/equation-solver/solve.sh "y^2 - 4 = 0" y
{"solutions":["2","-2"],"message":"2 solutions found"}

Security Guarantees

Input Validation

Vulnerability Prevention

| Vulnerability | Status | Evidence |

|---|---|---|

| Template Injection | ✓ Blocked | 20 injection tests passing |

| Command Injection | ✓ Blocked | Shell metacharacters filtered |

| Path Traversal | ✓ Blocked | Input validation prevents paths |

| DoS via Long Input | ✓ Limited | 500 char limit enforced |

| Temporary File Races | ✓ Fixed | mktemp with mode 600 |

| Code Execution | ✓ Prevented | No eval/exec used |

Secure Coding Practices

Testing

Running Tests

# Run all tests
./.claude/skills/equation-solver/test-equation-solver.sh

# View test results
cat .artifacts/test-results/equation-solver/test-summary.txt

Test Summary

Test Results:

Performance

| Equation Type | Typical Time | Max Time | Notes |

|---|---|---|---|

| Linear | <100ms | <150ms | x + 2 = 5 |

| Quadratic | <150ms | <200ms | x^2 + 5x + 6 = 0 |

| Cubic | <200ms | <300ms | x^3 - 6x^2 + 11x - 6 = 0 |

| Complex | <500ms | <1000ms | Higher degree or many terms |

Dependencies

Installation

# Install dependencies
cd ./.claude/skills/equation-solver
npm install

# Verify installation
npm test

Files

equation-solver/
├── solve.sh                 # Main solver script (secure)
├── test-equation-solver.sh  # Comprehensive test suite
├── package.json             # Node.js dependencies
├── SKILL.md                 # This file (metadata)
├── SECURITY.md              # Security audit and documentation
└── README.md                # User guide

API Reference

solve.sh

Usage: solve.sh [OPTIONS] EQUATION [VARIABLE]

Arguments:

Options:

Exit Codes:

Output Format (JSON):

{
  "solutions": ["solution1", "solution2", ...],
  "message": "N solutions found"
}

Limitations

  1. Limited to single-variable equations
  2. Some transcendental equations may not solve completely
  3. Very high-degree polynomials (>10) may timeout
  4. Complex number display depends on nerdamer version

Security Considerations

Troubleshooting

"Invalid characters in equation"

Check that equation contains only allowed characters:

Invalid characters include: ;, ', ", ` `, $, &, |, \`

"Equation too long"

Equations are limited to 500 characters. Simplify or break into multiple equations.

"Unbalanced parentheses"

Check that all opening ( parentheses have matching closing ) parentheses.

"Invalid variable name"

Variable names must:

Valid: x, x_1, var_name

Invalid: 1x, x-y, x+y

Maintenance

Regular Reviews

Update Process

  1. Check nerdamer changelog for breaking changes
  2. Update version in package.json
  3. Run full test suite
  4. Update documentation
  5. Create commit with change details
  6. Request security review before merge

Compliance

Related Skills

Support

For issues or questions:

  1. Check SECURITY.md for known vulnerabilities
  2. Review test failures in .artifacts/test-results/
  3. Enable verbose mode: ./solve.sh -v "equation"
  4. File issue with: reproduction steps, equation tested, error output

License

MIT License - See LICENSE file in project root

Changelog

v1.0.0 (2025-12-04)

Initial Release

Security Fixes Applied:

Test Coverage:


Last Updated: 2025-12-04

Maintainer: Security Specialist Agent

Status: Active and Production-Ready

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.