6.4 KiB
Plan: Update FissionPython Skill
Context
The fission-python-skill plugin needs to be updated to meet new requirements for Fission Python projects:
- Build script:
src/build.shmust exist and be referenced correctly in.fission/deployment.json - Dependencies:
src/requirements.txtmust exist and contain necessary packages (pydantic, etc.) - CI/CD: All projects must include
.gitea/workflows/directory with deployment workflows - API Design: HTTP trigger functions must use Pydantic models for request/response validation
- Documentation: All functions must have proper docstrings and code comments
- Portability: Remove hardcoded absolute paths - the plugin should work from any location
Current issues:
create-project.shuses hardcoded path/workspaces/claude-marketplace/data/py-eom-quota- Template resides in
data/examples/which is outside the plugin - No validation of generated projects
- Documentation references incorrect paths
Approach
Step 1: Make Plugin Portable
- Copy the
py-eom-quotatemplate intofission-python-skill/template/ - Update
create-project.shto find template relative to script location usingdirname "$0" - Remove all absolute path references
Step 2: Add Project Validation
Enhance create-project.sh with post-creation validation:
- Check
src/build.shexists and is executable - Verify
.fission/deployment.jsonreferences the correct build command (./build.sh) - Check
src/requirements.txtexists and contains required dependencies:pydantic==2.xflask(for HTTP handlers)psycopg2-binaryorpsycopg2(if database usage)
- Verify
.gitea/workflows/directory exists with the 4 standard workflow files - Validate that function files contain pydantic models (basic grep check)
- Warn if docstrings appear minimal or missing
Step 3: Update Documentation
- Fix
SKILL.mdandreference.mdto reference the correct template path - Document the new validation checks
- Update examples to show portable usage
Step 4: Potentially Add New Tool
Consider adding a separate validation tool (validate-project.sh) that can be run on existing projects to check compliance with standards.
Critical Files to Modify
-
fission-python-skill/create-project.sh- Change
TEMPLATE_DIRto use relative path:$(dirname "$0")/template - Add validation functions after project creation
- Improve error messages
- Add warnings for missing documentation
- Change
-
fission-python-skill/template/(new directory)- Copy entire structure from
data/examples/py-eom-quota/ - Ensure
build.shhas correct permissions (755) - Verify all configuration files
- Copy entire structure from
-
fission-python-skill/SKILL.mdandreference.md- Update template path references
- Document validation behavior
- Update examples
-
.claude-plugin/marketplace.json- No changes needed (plugin registration OK)
Implementation Details
Template Structure
fission-python-skill/
└── template/
├── .fission/
│ ├── deployment.json
│ ├── dev-deployment.json
│ └── local-deployment.json
├── .gitea/
│ └── workflows/
│ ├── dev-deployment.yaml
│ ├── install-dispatch.yaml
│ ├── uninstall-dispatch.yaml
│ └── analystic-dispatch.yaml
├── src/
│ ├── build.sh (executable)
│ ├── requirements.txt (with pydantic, flask, etc.)
│ ├── models.py (with pydantic models)
│ ├── exceptions.py
│ ├── helpers.py
│ ├── vault.py
│ └── <example functions>.py (with docstrings and pydantic usage)
├── test/
├── manifests/
├── migrates/
├── specs/
├── dev-requirements.txt
├── README.md
├── .gitignore
└── .devcontainer/
Validation Checklist in create-project.sh
After copying template and doing substitutions:
[ -f "$PROJECT_PATH/src/build.sh" ]|| warning[ -x "$PROJECT_PATH/src/build.sh" ]|| chmod +x- Check
deployment.jsoncontains"./build.sh"in packages.buildcmd [ -f "$PROJECT_PATH/src/requirements.txt" ]|| error- Check requirements.txt contains
pydantic(grep -q "pydantic") - Check requirements.txt contains
flask(grep -q "flask") [ -d "$PROJECT_PATH/.gitea/workflows" ]|| warning/copy from template- Count workflow files: should have at least 4 .yaml files
- Optional: Check that Python files have docstrings (grep for triple quotes)
- Optional: Check for pydantic BaseModel usage in models.py
Portable Path Resolution
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEMPLATE_DIR="$SCRIPT_DIR/template"
This ensures the plugin works regardless of where it's invoked from.
Verification Steps
-
Test create-project:
- Run
./fission-python-skill/create-project.sh test-project ./tmp/ - Verify all expected directories/files exist
- Check that validation warnings/errors appear appropriately
- Run
-
Test portability:
- Move plugin to a different directory
- Run create-project from there
- Should still work without path adjustments
-
Test validation:
- Manually delete
src/requirements.txtfrom template and create project → should error - Remove pydantic from requirements.txt → should warn
- Remove .gitea/workflows → should warn
- Change build.sh buildcmd to something else → should warn
- Manually delete
-
Test generated project:
- Verify functions have docstrings with fission config blocks
- Verify models.py uses pydantic BaseModel
- Verify HTTP triggers properly defined in deployment.json
Risks and Considerations
- Template duplication: Moving template into plugin duplicates existing examples. That's acceptable - the examples in
data/examples/are finished projects, while the template is a starter. Keep both. - Validation strictness: Start with warnings for most checks, errors only for critical missing files (requirements.txt build.sh). Can tighten later.
- Template maintenance: When updating the template, only modify
fission-python-skill/template/. The examples indata/examples/are independent and can diverge if needed.
Post-Implementation
- Update any scripts or docs that reference the old template path
- Test the skill end-to-end through Claude Code
- Consider adding a
validate-project.shtool for existing projects