policyengine-code-style

Refactor PolicyEngine formulas for direct parameter access and minimal intermediates.

31|6|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/PolicyEngine/policyengine-claude --skill policyengine-code-style
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: policyengine-code-style
Source: https://github.com/PolicyEngine/policyengine-claude/tree/main/skills/technical-patterns/policyengine-code-style-skill
Command: npx skills add https://github.com/PolicyEngine/policyengine-claude --skill policyengine-code-style

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a concise, actionable style guide to write clean, maintainable PolicyEngine formulas without unnecessary complexity.

Core Features & Use Cases

  • Direct Parameter Access: Guidance to access parameters and variables without intermediate temporaries.
  • Return Simplicity: Encourage direct returns and minimal intermediate results.
  • Best Practices: Patterns to improve readability and reduce bugs in formulas.

Quick Start

Refactor a small function to remove an unused intermediate variable and return the result directly.

Frequently Asked Questions about policyengine-code-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write cleaner PolicyEngine formulas without unnecessary variables?

Clean PolicyEngine formulas use direct parameter access and return results immediately instead of storing intermediate values. Remove unused variables, access parameters directly, and return computed values in a single expression to improve readability and reduce bugs.

What are best practices for combining boolean logic in PolicyEngine formulas?

PolicyEngine best practices combine boolean logic directly in conditions rather than splitting across multiple steps. Use combined boolean operators inline, avoid redundant intermediates, and structure logic for clarity while maintaining efficiency in eligibility checks and governance policies.

How do I handle periods correctly in PolicyEngine formulas?

Correct period access in PolicyEngine formulas means referencing time windows explicitly and directly within parameter calls. Apply period handling inline without temporary variables, ensuring formulas accurately reflect resource limits and policy intervals without unnecessary complexity.

Can I use hardcoded values in PolicyEngine formulas, or should I parameterize them?

PolicyEngine style requires parameterized constants instead of hardcoded values to maintain flexibility and readability. Replace inline numbers with named parameters so governance policies, resource limits, and eligibility thresholds remain maintainable and auditable.

What's the best way to refactor inefficient PolicyEngine formulas?

Refactor PolicyEngine formulas by eliminating intermediate results, accessing parameters directly, combining boolean logic, and ensuring correct period handling. Apply these patterns across governance policies and eligibility checks to reduce cognitive load and formula complexity.