home/productivity/promptfloater-hardening

Promptfloater Hardening

GPTClaudeDeepSeek··122 copies·updated 2026-07-14
promptfloater-hardening.prompt
# PromptFloater Hardening Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Harden PromptFloater without changing its visual design by adding validated, recoverable persistence, safe rendering, explicit errors, isolated launchers, and automated tests.

**Architecture:** Move data validation and persistence into a small `promptfloater` Python package. Keep window control in `app.py`, expose a narrow application API to the WebView, and make the renderer commit state only after backend validation and persistence succeed.

**Tech Stack:** Python 3.11, standard-library `unittest`, pywebview, pyperclip, HTML/CSS/JavaScript, Node.js syntax checks.

---

## File map

- `promptfloater/schema.py`: validate and normalize persisted prompt data.
- `promptfloater/paths.py`: resolve platform user-data paths.
- `promptfloater/storage.py`: migrate, atomically save, back up, and recover data.
- `promptfloater/logging_setup.py`: configure rotating local logs.
- `promptfloater/api.py`: WebView-facing data and clipboard service with structured results.
- `app.py`: window lifecycle and exposure of `AppApi` methods.
- `demo.html`: safe DOM construction and asynchronous save/import behavior.
- `tests/`: schema, storage, API, and renderer security regression tests.
- `requirements.txt`, `启动.bat`, `启动.command`, `README.md`: reproducible setup and documentation.

### Task 1: Data schema validation

**Files:**
- Create: `promptfloater/__init__.py`
- Create: `promptfloater/schema.py`
- Create: `tests/test_schema.py`

- [ ] **Step 1: Write failing schema tests**

Create tests using `unittest` for a valid document, defaulting `schema_version`, normalizing `desc`/`fav`, rejecting a non-object root, non-list categories, duplicate category IDs, duplicate item IDs, missing content, overlong text, and preserving strings containing HTML-like payloads as plain data.

when to use it

Community prompt sourced from the open-source GitHub repo QQ-L-XX/PromptFloater (no explicit license). A "Promptfloater Hardening" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

QQ-L-XX/PromptFloater · no explicit license