This test validates that the temporal-python.md skill works correctly when actually used in Claude Code to generate a Temporal Python application.
This is a real integration test that:
- ✅ Installs the skill in a test workspace (
.claude/skills/temporal-python.md) - ✅ Uses claude-code CLI to process a prompt that triggers the skill
- ✅ Generates a complete application using claude-code with the skill
- ✅ Validates the generated code:
- Correct file structure
- All required files present
- Code has valid Python syntax
- Uses latest Temporal Python SDK version
- Proper async/await patterns
- ✅ Runs the application with real Temporal workflows (optional, can be skipped with SKIP_EXECUTION=true)
Unlike a simple code validation test, this integration test:
- Tests the actual user workflow - how the skill will really be used
- Validates skill installation - ensures the skill file is correctly formatted
- Tests Claude integration - verifies Claude can parse and use the skill
- Validates end-to-end flow - from prompt to working application
- Catches skill formatting issues - ensures markdown is properly structured
- Validates Python-specific patterns - async/await, type hints, decorators
test/python/skill-integration/
├── setup-test-workspace.sh # Creates test workspace with skill
├── run-integration-test.sh # Runs full integration test
├── test-execution.sh # Tests application execution
├── test-prompt.txt # Prompt for standard test
├── run_claude_code.py # Invokes claude-code CLI for automation
├── automate_test.py.deprecated # Old API-based script (deprecated)
├── .gitignore # Ignores generated workspaces
└── README.md # This file
Generated during test:
test-workspace/
├── .claude/
│ └── skills/
│ └── temporal-python.md # The skill being tested
├── test-prompt.txt # Prompt that triggers the skill
├── validate.sh # Validates structure and syntax
└── [generated code here] # Application created by Claude
- Checks all required Python files exist
- Validates
@workflow.defnand@activity.defnpatterns - Verifies temporalio dependency
- Checks Python syntax with
python -m py_compile - Validates async/await usage
This optional test validates that the generated code actually runs correctly with a real Temporal server:
- Temporal Management:
- Checks if Temporal is running on port 7233
- Starts with
temporal server start-devif not running - Only stops Temporal if we started it
- Dependency Check:
- Verifies temporalio package is installed
- Auto-installs from requirements.txt if needed
- Worker:
- Starts worker.py in background
- Monitors startup and validates it stays running
- Client:
- Executes workflow via client.py with test data
- Validates workflow completes successfully
- Cleanup:
- Stops worker process
- Stops Temporal only if we started it
- Removes log files
How to skip execution test:
SKIP_EXECUTION=true ./run-integration-test.shThis is useful when:
- Temporal CLI is not installed
- You only want to validate code structure/syntax
- Running in CI/CD without Temporal setup
- claude-code CLI - Install with
npm install -g @anthropic-ai/claude-code - Anthropic API Key - Set as
ANTHROPIC_API_KEYenvironment variable - Python 3.10+ (for test orchestration scripts)
- Python 3.10+ (for syntax checking)
- pip or Poetry or uv (for dependency management)
- Temporal CLI installed:
Or follow: https://docs.temporal.io/cli
brew install temporal # macOS
The execution test will automatically start Temporal if it's not running.
Prerequisites:
- Install claude-code:
npm install -g @anthropic-ai/claude-code - Set API key:
export ANTHROPIC_API_KEY='your-api-key-here' - (Optional) Install Temporal CLI for execution tests:
brew install temporal
Run the full test (with execution):
export ANTHROPIC_API_KEY='your-api-key-here'
cd test/python/skill-integration
./run-integration-test.shRun validation-only test (skip execution):
export ANTHROPIC_API_KEY='your-api-key-here'
cd test/python/skill-integration
SKIP_EXECUTION=true ./run-integration-test.shThe full test will:
- Set up a test workspace with the skill installed
- Invoke claude-code CLI with the test prompt
- claude-code auto-loads the skill and generates a complete application
- Validate the generated code (syntax, structure, dependencies)
- Start Temporal server (if not running)
- Execute the worker and client to run a real workflow
- Verify workflow completes successfully
- Report results
# 1. Set up test workspace
./setup-test-workspace.sh
# 2. Use Claude Code in the test workspace
cd test-workspace
# Ask Claude to create a Temporal workflow application
# 3. Validate the generated code
./validate.shThe skill should guide Claude to generate:
- workflows.py - Workflow definitions with
@workflow.defn - activities.py - Activity definitions with
@activity.defn - worker.py - Worker startup code
- client.py - Client code to start workflows
- requirements.txt or pyproject.toml - Dependencies
- README.md - Usage instructions (optional)
- ✅ Async/await syntax throughout
- ✅ Type hints on function signatures
- ✅ Proper decorator usage (
@workflow.defn,@activity.defn,@workflow.run) - ✅ Latest temporalio package version
- ✅ Proper imports from temporalio modules
✓ workflows.py exists
✓ activities.py exists
✓ worker.py exists
✓ client.py exists
✓ requirements.txt or pyproject.toml exists✓ Contains @workflow.defn decorator
✓ Contains @activity.defn decorator
✓ Contains @workflow.run decorator
✓ Uses async/await syntax
✓ Has temporalio imports
✓ Python syntax is valid✓ temporalio package specified
✓ Version is reasonable (>= 1.0.0)Install claude-code:
npm install -g @anthropic-ai/claude-codeOr use npx without installation:
npx @anthropic-ai/claude-codeexport ANTHROPIC_API_KEY='your-api-key-here'- Check that claude-code CLI is working:
claude-code --help - Verify your API key is valid
- Check console output for claude-code errors
- Try running claude-code manually in the workspace directory
- Check that generated code uses proper async/await
- Verify decorators are correctly applied
- Ensure imports are correct
cd test-workspace
pip install temporalio
# or
poetry install
# or
uv syncThe execution test will automatically start Temporal for you. If this fails:
# Install Temporal CLI
brew install temporal # macOS
# Or follow: https://docs.temporal.io/cli
# Or skip execution test
SKIP_EXECUTION=true ./run-integration-test.shThis is treated as a partial success. It means:
- ✅ Generated code structure is correct
- ✅ Python syntax is valid
- ❌ Runtime execution had issues
Check the output for specific errors (missing dependencies, workflow logic issues, etc.)
- Review the validation script output
- Check
test.logfor detailed error messages - Verify skill file is correctly formatted markdown
- Ensure Python 3.10+ is being used
========================================
✅ ALL TESTS PASSED
========================================
The skill correctly guides Claude to generate valid Temporal Python code.
❌ Test failed: [specific error]
Review the error message and generated code to identify issues:
- Syntax errors → Check skill examples use correct Python
- Missing files → Verify skill mentions all required files
- Wrong patterns → Update skill to show correct decorator usage
- Import errors → Check skill shows correct module imports
This test can be integrated into CI/CD. For CI environments, you may want to skip the execution test:
name: Test Python Skill
on: [push, pull_request]
jobs:
test-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Run validation test
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
SKIP_EXECUTION: true
run: |
cd test/python/skill-integration
./run-integration-test.sh
test-full:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install Temporal CLI
run: |
brew install temporal
- name: Run full integration test
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
cd test/python/skill-integration
./run-integration-test.shAfter successful testing:
- Build the skill package:
./build-skill-package.sh - Deploy to Claude Code or Claude Cloud
- Test with real user prompts
- Build Documentation: See
BUILD.mdin repository root - Skill Documentation: See
src/sdks/python/python.md - Java Tests: See
test/java/skill-integration/for comparison