AgentSkillsCN

sparkgen-template-test

运行Cookiecutter矩阵测试,以验证模板在所有变量组合下均能正确生成。

SKILL.md
--- frontmatter
name: sparkgen-template-test
description: Run cookiecutter matrix tests to verify template generates correctly across all variable combinations
user_invokable: true
auto_invokable: true
auto_invoke_hint: Invoke when discussing template testing, generation issues, or after modifying template files
arguments: "[--combo N] or no args for all combos"

SparkGen Template Test

Run the cookiecutter matrix test to verify the template generates correctly.

Dynamic Context

Before testing:

  1. Verify test_cookiecutter_matrix.sh exists
  2. Check cookiecutter is installed: cookiecutter --version
  3. Check Python is available: python --version

Actions

Run All Combos (/sparkgen-template-test)

bash
bash test_cookiecutter_matrix.sh

This script:

  • Generates projects with multiple variable combinations
  • Runs python -m compileall on each generated project
  • Reports pass/fail for each combo
  • Cleans up generated directories

Run Specific Combo (/sparkgen-template-test --combo N)

Run only combination N from the matrix. Useful for debugging a specific failure.

Interpreting Results

For each combo, check:

  • PASS: Project generated and compiled successfully
  • FAIL: Either generation or compilation failed

Common failure causes:

  • Jinja2 rendering error: A {{ }} expression inside {{cookiecutter.project_slug}}/ is not wrapped in {% raw %}...{% endraw %}
  • Missing file: Post-generation hook removed a file that's imported elsewhere
  • Syntax error: Template conditional ({% if %}) produced invalid Python/YAML

After Failures

  1. Look at the specific combo that failed
  2. Check which cookiecutter variables were used
  3. Look for Jinja2 escaping issues in the relevant files
  4. Fix the template file
  5. Re-run the test to verify