Guidelines for contributing to the QuantEcon Style Guide Checker.
Development Setup¶
Prerequisites¶
Python 3.11+
Git
GitHub account
Local Development¶
# Clone and install
git clone https://github.com/QuantEcon/action-style-guide.git
cd action-style-guide
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
# Set up API keys
export ANTHROPIC_API_KEY="your-key"
export GITHUB_TOKEN="your-token"Code Style¶
Follow PEP 8
Use type hints
Add docstrings to all functions/classes
Keep functions focused and small
Comment complex logic (explain “why”, not “what”)
Guiding Principles¶
Simplicity above all — write the simplest code that works
Direct over abstract — don’t abstract until you have 3+ use cases
Readable over concise — explicit is better than implicit
Less code = less bugs — every line is a liability
# Good: Simple, clear, explicit
def apply_fix(content: str, violation: dict) -> str:
"""Apply a single fix to content."""
old_text = violation['current_text']
new_text = violation['suggested_fix']
return content.replace(old_text, new_text, 1)
# Avoid: Clever, requires mental parsing
def apply_fix(c, v):
return c.replace(v['ct'], v['sf'], 1) if 'ct' in v and 'sf' in v else cAdding New Rules¶
Rules are in style_checker/rules/ and are read directly by the LLM — no code changes needed.
Edit the appropriate rules file (e.g.,
style_checker/rules/writing-rules.md)Follow the existing format:
### Rule: qe-writing-001 **Type:** rule **Title:** Use one sentence per paragraph **Description:** [Detailed explanation] **Check for:** [Specific patterns to identify] **Examples:** [Good and bad examples]Update corresponding prompt file in
style_checker/prompts/if neededTest with real lecture files
Adding a New Category¶
Create
prompts/category-prompt.mdCreate
rules/category-rules.mdAdd category to
VALID_CATEGORIESingithub_handler.pyandprompt_loader.pyAdd to category list in
review_lecture_smart()Test end-to-end
Pull Request Process¶
Fork the repository
Create feature branch:
git checkout -b feature/your-feature-nameMake changes — write clean, documented code
Run tests:
pytest tests/ -vCommit with clear messages using conventional commits
Push and create PR with clear description
Commit Message Format¶
feat:New featurefix:Bug fixdocs:Documentation changesrefactor:Code refactoringtest:Adding testschore:Maintenance tasks
Version Management¶
# In __init__.py — bump for every release
__version__ = "0.7.2"Release Process¶
Make changes
Run full test suite:
pytest tests/ -vUpdate
__version__instyle_checker/__init__.pyUpdate prompt versions if prompts were modified
Update
CHANGELOG.mdCommit:
Release vX.Y.Z - DescriptionCreate GitHub release:
gh release create vX.Y.ZUpdate floating tag:
git tag -f v0.7 && git push origin v0.7 --force
Debugging LLM Issues¶
Check the prompt — is it clear and explicit?
Add more examples to rules
Strengthen language (e.g., “do NOT” instead of “don’t”)
Add “Important:” or “Critical:” sections
Test with isolated examples first
Reporting Issues¶
Include:
Description of the problem
Steps to reproduce
Expected vs actual behavior
Environment details (OS, Python version)
Relevant logs or error messages