From data-science
PolicyEngine standards for Rules Engineer and Reviewer agents: authoritative source citations, parameter/variable metadata, vectorized formulas, and integration tests.
npx claudepluginhub policyengine/policyengine-claude --plugin data-scienceThis document contains the shared standards and guidelines that all PolicyEngine agents must follow, particularly the Rules Engineer and Reviewer agents. Sources must be cited in this order of preference: 1. **Statutes/Laws** (e.g., 42 USC § 1382) 2. **Regulations** (e.g., 7 CFR 273.9) 3. **Official Program Manuals** 4. **Government websites** (only as last resort) Every parameter and variable ...
Validator for PolicyEngine implementations of government benefit programs, checking quality standards, domain patterns like federal/state separation, naming conventions, no hard-coded values, parameter organization, and code structure.
SEO specialist for technical audits, on-page optimization, structured data, Core Web Vitals, and keyword mapping. Delegate site audits, meta tag reviews, schema markup, sitemaps/robots issues, and remediation plans.
Share bugs, ideas, or general feedback.
This document contains the shared standards and guidelines that all PolicyEngine agents must follow, particularly the Rules Engineer and Reviewer agents.
Sources must be cited in this order of preference:
Every parameter and variable MUST have:
description: Federal minimum wage # ACTIVE VOICE, no "The" prefix
values:
2024-01-01: 7.25
metadata:
unit: currency-USD
period: hour
reference:
- title: 29 USC § 206(a)(1) # Law first
href: https://www.law.cornell.edu/uscode/text/29/206
- title: DOL Minimum Wage # Agency guidance second
href: https://www.dol.gov/agencies/whd/minimum-wage
class variable_name(Variable):
value_type = float
entity = Person
label = "Clear, concise label" # ACTIVE VOICE
unit = USD
definition_period = YEAR
reference = "https://www.law.cornell.edu/cfr/text/7/273.9" # SPECIFIC section with full URL
# NOTE: Do NOT use documentation field - use reference URL instead
where(), select(), or boolean multiplicationmax_(0, value) to prevent negative values- name: Descriptive test name matching scenario
period: 2024
input:
# Complete inputs needed
output:
# Expected values with comments showing calculation
# Per 7 CFR 273.9: $1,000 - $100 = $900
variable_name: 900
Every non-trivial test should include:
Non-vectorized code (if-elif-else)
# ✅ OK - parameter condition only
if p.program.enabled:
rate = p.program.rate
else:
rate = 0
# ❌ WRONG - depends on household data
if person("age") > 65:
benefit = amount
where(), select(), or boolean multiplicationHardcoded values in formulas
if income > 50000: (hardcoded threshold)if income > p.income_threshold (parameter)Missing defined_for when needed
defined_fordefined_for = "is_ssi_eligible"Not using adds for aggregation
adds in metadataadds = ["gov.irs.income.wages", "gov.irs.income.interest"]Missing thousands separators
income: 50000income: 50_000Incorrect period format
period: 2024-01-01period: 2024 (for annual)period: 2024-01 (for monthly)Parameter doesn't match cited source
Missing primary sources
Calculation doesn't follow regulation order
Description style
Variable naming
Test clarity
Always check:
The goal is to ensure every calculation in PolicyEngine can be traced back to authoritative law or regulation. When in doubt: