flyee 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/bin/install.js +357 -0
- package/bridge/bridge.py +1780 -0
- package/bridge/local_tracker.py +722 -0
- package/core/agents/backend-specialist.md +266 -0
- package/core/agents/code-archaeologist.md +106 -0
- package/core/agents/database-architect.md +226 -0
- package/core/agents/debugger.md +225 -0
- package/core/agents/devops-engineer.md +323 -0
- package/core/agents/documentation-writer.md +104 -0
- package/core/agents/explorer-agent.md +73 -0
- package/core/agents/frontend-specialist.md +743 -0
- package/core/agents/game-developer.md +162 -0
- package/core/agents/mobile-developer.md +377 -0
- package/core/agents/orchestrator.md +416 -0
- package/core/agents/penetration-tester.md +188 -0
- package/core/agents/performance-optimizer.md +187 -0
- package/core/agents/product-manager.md +112 -0
- package/core/agents/product-owner.md +95 -0
- package/core/agents/project-planner.md +470 -0
- package/core/agents/qa-automation-engineer.md +103 -0
- package/core/agents/security-auditor.md +170 -0
- package/core/agents/seo-specialist.md +111 -0
- package/core/agents/stitch-designer.md +190 -0
- package/core/agents/tdd-reviewer.md +282 -0
- package/core/agents/test-engineer.md +158 -0
- package/core/scripts/auto_preview.py +148 -0
- package/core/scripts/checklist.py +243 -0
- package/core/scripts/cost_report.py +149 -0
- package/core/scripts/doc-sync-check.py +461 -0
- package/core/scripts/parse_user_stories.py +79 -0
- package/core/scripts/prepare_notion_updates.py +172 -0
- package/core/scripts/print_create_payload.py +18 -0
- package/core/scripts/session_manager.py +120 -0
- package/core/scripts/task_complete.py +127 -0
- package/core/scripts/verify_all.py +327 -0
- package/core/skills/analytics-strategy/SKILL.md +128 -0
- package/core/skills/api-patterns/SKILL.md +81 -0
- package/core/skills/api-patterns/api-style.md +42 -0
- package/core/skills/api-patterns/auth.md +24 -0
- package/core/skills/api-patterns/documentation.md +26 -0
- package/core/skills/api-patterns/graphql.md +41 -0
- package/core/skills/api-patterns/rate-limiting.md +31 -0
- package/core/skills/api-patterns/response.md +37 -0
- package/core/skills/api-patterns/rest.md +40 -0
- package/core/skills/api-patterns/scripts/api_validator.py +211 -0
- package/core/skills/api-patterns/security-testing.md +122 -0
- package/core/skills/api-patterns/trpc.md +41 -0
- package/core/skills/api-patterns/versioning.md +22 -0
- package/core/skills/app-builder/SKILL.md +75 -0
- package/core/skills/app-builder/agent-coordination.md +71 -0
- package/core/skills/app-builder/feature-building.md +53 -0
- package/core/skills/app-builder/project-detection.md +34 -0
- package/core/skills/app-builder/scaffolding.md +118 -0
- package/core/skills/app-builder/tech-stack.md +40 -0
- package/core/skills/app-builder/templates/SKILL.md +39 -0
- package/core/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/core/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/core/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/core/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/core/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/core/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/core/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/core/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/core/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/core/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/core/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/core/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/core/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/core/skills/architecture/SKILL.md +55 -0
- package/core/skills/architecture/context-discovery.md +43 -0
- package/core/skills/architecture/examples.md +94 -0
- package/core/skills/architecture/pattern-selection.md +68 -0
- package/core/skills/architecture/patterns-reference.md +50 -0
- package/core/skills/architecture/trade-off-analysis.md +77 -0
- package/core/skills/atomic-design/SKILL.md +282 -0
- package/core/skills/atomic-design/references/classification-guide.md +132 -0
- package/core/skills/atomic-design/references/quality-checklist.md +60 -0
- package/core/skills/atomic-design/references/stacks/stack-blade.md +254 -0
- package/core/skills/atomic-design/references/stacks/stack-nextjs.md +272 -0
- package/core/skills/atomic-design/references/stacks/stack-react.md +239 -0
- package/core/skills/atomic-design/references/stacks/stack-vue.md +224 -0
- package/core/skills/bash-linux/SKILL.md +199 -0
- package/core/skills/behavioral-modes/SKILL.md +242 -0
- package/core/skills/brainstorming/SKILL.md +163 -0
- package/core/skills/brainstorming/dynamic-questioning.md +373 -0
- package/core/skills/checkpointing-patterns/SKILL.md +163 -0
- package/core/skills/clean-code/SKILL.md +201 -0
- package/core/skills/code-review-checklist/SKILL.md +109 -0
- package/core/skills/code-truth-validation/SKILL.md +149 -0
- package/core/skills/component-library-discovery/SKILL.md +154 -0
- package/core/skills/content-strategy/SKILL.md +222 -0
- package/core/skills/context-budget/SKILL.md +155 -0
- package/core/skills/context-gathering-patterns/SKILL.md +278 -0
- package/core/skills/cost-tracking/SKILL.md +206 -0
- package/core/skills/database-design/SKILL.md +52 -0
- package/core/skills/database-design/database-selection.md +43 -0
- package/core/skills/database-design/indexing.md +39 -0
- package/core/skills/database-design/migrations.md +48 -0
- package/core/skills/database-design/optimization.md +36 -0
- package/core/skills/database-design/orm-selection.md +30 -0
- package/core/skills/database-design/schema-design.md +56 -0
- package/core/skills/database-design/scripts/schema_validator.py +172 -0
- package/core/skills/deployment-procedures/SKILL.md +295 -0
- package/core/skills/design-md/README.md +34 -0
- package/core/skills/design-md/SKILL.md +172 -0
- package/core/skills/design-md/examples/DESIGN.md +154 -0
- package/core/skills/design-system-enforcement/SKILL.md +339 -0
- package/core/skills/doc.md +177 -0
- package/core/skills/document-registry/SKILL.md +130 -0
- package/core/skills/documentation-publishing/SKILL.md +174 -0
- package/core/skills/documentation-templates/SKILL.md +194 -0
- package/core/skills/enhance-prompt/README.md +34 -0
- package/core/skills/enhance-prompt/SKILL.md +204 -0
- package/core/skills/enhance-prompt/references/KEYWORDS.md +114 -0
- package/core/skills/frontend-design/SKILL.md +430 -0
- package/core/skills/frontend-design/animation-guide.md +331 -0
- package/core/skills/frontend-design/color-system.md +311 -0
- package/core/skills/frontend-design/decision-trees.md +418 -0
- package/core/skills/frontend-design/motion-graphics.md +306 -0
- package/core/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/core/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/core/skills/frontend-design/typography-system.md +345 -0
- package/core/skills/frontend-design/ux-psychology.md +541 -0
- package/core/skills/frontend-design/visual-effects.md +383 -0
- package/core/skills/game-development/2d-games/SKILL.md +119 -0
- package/core/skills/game-development/3d-games/SKILL.md +135 -0
- package/core/skills/game-development/SKILL.md +167 -0
- package/core/skills/game-development/game-art/SKILL.md +185 -0
- package/core/skills/game-development/game-audio/SKILL.md +190 -0
- package/core/skills/game-development/game-design/SKILL.md +129 -0
- package/core/skills/game-development/mobile-games/SKILL.md +108 -0
- package/core/skills/game-development/multiplayer/SKILL.md +132 -0
- package/core/skills/game-development/pc-games/SKILL.md +144 -0
- package/core/skills/game-development/vr-ar/SKILL.md +123 -0
- package/core/skills/game-development/web-games/SKILL.md +150 -0
- package/core/skills/geo-fundamentals/SKILL.md +156 -0
- package/core/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/core/skills/git-workflow/SKILL.md +263 -0
- package/core/skills/history-check-patterns/SKILL.md +125 -0
- package/core/skills/i18n-localization/SKILL.md +154 -0
- package/core/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/core/skills/integration-completeness/SKILL.md +219 -0
- package/core/skills/intelligent-routing/SKILL.md +370 -0
- package/core/skills/lint-and-validate/SKILL.md +45 -0
- package/core/skills/lint-and-validate/scripts/lint_runner.py +173 -0
- package/core/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/core/skills/local-verification/SKILL.md +195 -0
- package/core/skills/mcp-builder/SKILL.md +176 -0
- package/core/skills/mobile-design/SKILL.md +394 -0
- package/core/skills/mobile-design/decision-trees.md +516 -0
- package/core/skills/mobile-design/mobile-backend.md +491 -0
- package/core/skills/mobile-design/mobile-color-system.md +420 -0
- package/core/skills/mobile-design/mobile-debugging.md +122 -0
- package/core/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/core/skills/mobile-design/mobile-navigation.md +458 -0
- package/core/skills/mobile-design/mobile-performance.md +767 -0
- package/core/skills/mobile-design/mobile-testing.md +356 -0
- package/core/skills/mobile-design/mobile-typography.md +433 -0
- package/core/skills/mobile-design/platform-android.md +666 -0
- package/core/skills/mobile-design/platform-ios.md +561 -0
- package/core/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/core/skills/mobile-design/touch-psychology.md +537 -0
- package/core/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
- package/core/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/core/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/core/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/core/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/core/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/core/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/core/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/core/skills/nextjs-react-expert/SKILL.md +267 -0
- package/core/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/core/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/core/skills/nodejs-best-practices/SKILL.md +333 -0
- package/core/skills/notion-task-patterns/SKILL.md +2529 -0
- package/core/skills/page-specifications/SKILL.md +367 -0
- package/core/skills/parallel-agents/SKILL.md +175 -0
- package/core/skills/performance-profiling/SKILL.md +143 -0
- package/core/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/core/skills/plan-writing/SKILL.md +190 -0
- package/core/skills/powershell-windows/SKILL.md +167 -0
- package/core/skills/project-foundation/SKILL.md +117 -0
- package/core/skills/project-setup/SKILL.md +141 -0
- package/core/skills/project-tracking-patterns/SKILL.md +357 -0
- package/core/skills/project-type-discovery/SKILL.md +239 -0
- package/core/skills/python-patterns/SKILL.md +441 -0
- package/core/skills/qa-test-generation/SKILL.md +156 -0
- package/core/skills/react-components/README.md +36 -0
- package/core/skills/react-components/SKILL.md +47 -0
- package/core/skills/react-components/examples/gold-standard-card.tsx +80 -0
- package/core/skills/react-components/package-lock.json +231 -0
- package/core/skills/react-components/package.json +16 -0
- package/core/skills/react-components/resources/architecture-checklist.md +15 -0
- package/core/skills/react-components/resources/component-template.tsx +37 -0
- package/core/skills/react-components/resources/stitch-api-reference.md +14 -0
- package/core/skills/react-components/resources/style-guide.json +27 -0
- package/core/skills/react-components/scripts/fetch-stitch.sh +30 -0
- package/core/skills/react-components/scripts/validate.js +68 -0
- package/core/skills/red-team-tactics/SKILL.md +199 -0
- package/core/skills/remotion/README.md +105 -0
- package/core/skills/remotion/SKILL.md +393 -0
- package/core/skills/remotion/examples/WalkthroughComposition.tsx +78 -0
- package/core/skills/remotion/examples/screens.json +56 -0
- package/core/skills/remotion/resources/composition-checklist.md +124 -0
- package/core/skills/remotion/resources/screen-slide-template.tsx +123 -0
- package/core/skills/remotion/scripts/download-stitch-asset.sh +38 -0
- package/core/skills/seo-fundamentals/SKILL.md +129 -0
- package/core/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/core/skills/server-management/SKILL.md +161 -0
- package/core/skills/session-resilience/SKILL.md +199 -0
- package/core/skills/shadcn-ui/README.md +248 -0
- package/core/skills/shadcn-ui/SKILL.md +326 -0
- package/core/skills/shadcn-ui/examples/auth-layout.tsx +177 -0
- package/core/skills/shadcn-ui/examples/data-table.tsx +313 -0
- package/core/skills/shadcn-ui/examples/form-pattern.tsx +177 -0
- package/core/skills/shadcn-ui/resources/component-catalog.md +481 -0
- package/core/skills/shadcn-ui/resources/customization-guide.md +516 -0
- package/core/skills/shadcn-ui/resources/migration-guide.md +463 -0
- package/core/skills/shadcn-ui/resources/setup-guide.md +412 -0
- package/core/skills/shadcn-ui/scripts/verify-setup.sh +134 -0
- package/core/skills/state-machine/SKILL.md +264 -0
- package/core/skills/stitch-loop/README.md +54 -0
- package/core/skills/stitch-loop/SKILL.md +203 -0
- package/core/skills/stitch-loop/examples/SITE.md +73 -0
- package/core/skills/stitch-loop/examples/next-prompt.md +25 -0
- package/core/skills/stitch-loop/resources/baton-schema.md +61 -0
- package/core/skills/stitch-loop/resources/site-template.md +104 -0
- package/core/skills/systematic-debugging/SKILL.md +109 -0
- package/core/skills/tailwind-patterns/SKILL.md +284 -0
- package/core/skills/tdd-validation/SKILL.md +243 -0
- package/core/skills/tdd-workflow/SKILL.md +284 -0
- package/core/skills/testing-patterns/SKILL.md +196 -0
- package/core/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/core/skills/ui-ux-discovery/SKILL.md +329 -0
- package/core/skills/ui-validation/SKILL.md +190 -0
- package/core/skills/ui-validation/scripts/ui_antipattern_check.py +317 -0
- package/core/skills/verification-gate/SKILL.md +205 -0
- package/core/skills/vulnerability-scanner/SKILL.md +276 -0
- package/core/skills/vulnerability-scanner/checklists.md +121 -0
- package/core/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/core/skills/web-design-guidelines/SKILL.md +57 -0
- package/core/skills/webapp-testing/SKILL.md +187 -0
- package/core/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/core/templates/ARCHITECTURE.template.md +407 -0
- package/core/templates/project-resources.example.json +71 -0
- package/core/workflows/atomic.md +182 -0
- package/core/workflows/brainstorm.md +134 -0
- package/core/workflows/check-task.md +242 -0
- package/core/workflows/copy-collect.md +306 -0
- package/core/workflows/create-agent.md +33 -0
- package/core/workflows/create-skill.md +39 -0
- package/core/workflows/create-workflow.md +33 -0
- package/core/workflows/create.md +92 -0
- package/core/workflows/debug.md +186 -0
- package/core/workflows/demand.md +443 -0
- package/core/workflows/deploy.md +260 -0
- package/core/workflows/discovery.md +267 -0
- package/core/workflows/document.md +272 -0
- package/core/workflows/ds-components.md +296 -0
- package/core/workflows/ds-init.md +58 -0
- package/core/workflows/ds-refactor.md +245 -0
- package/core/workflows/ds-references.md +197 -0
- package/core/workflows/ds-styleguide.md +237 -0
- package/core/workflows/ds-token-diff.md +103 -0
- package/core/workflows/ds-tokens.md +317 -0
- package/core/workflows/ds-validate.md +309 -0
- package/core/workflows/execute.md +483 -0
- package/core/workflows/extract-template.md +278 -0
- package/core/workflows/fix-failed-tests.md +160 -0
- package/core/workflows/init-project.md +386 -0
- package/core/workflows/legacy-project.md +849 -0
- package/core/workflows/log.md +97 -0
- package/core/workflows/new-project.md +610 -0
- package/core/workflows/new-project.md.bak +3292 -0
- package/core/workflows/new-task.md +404 -0
- package/core/workflows/orchestrate.md +237 -0
- package/core/workflows/page-build.md +296 -0
- package/core/workflows/plan.md +89 -0
- package/core/workflows/prd.md +255 -0
- package/core/workflows/preview.md +81 -0
- package/core/workflows/review-page.md +304 -0
- package/core/workflows/status.md +86 -0
- package/core/workflows/stitch.md +226 -0
- package/core/workflows/task-complete.md +473 -0
- package/core/workflows/task-update.md +163 -0
- package/core/workflows/tdd.md +344 -0
- package/core/workflows/test.md +251 -0
- package/core/workflows/ui-ux-pro-max.md +437 -0
- package/core/workflows/ux-mobile-optimize.md +262 -0
- package/core/workflows/ux-mobile-validate.md +297 -0
- package/engine-files/GEMINI.md +69 -0
- package/package.json +47 -0
- package/runtime-adapters/antigravity.js +26 -0
- package/runtime-adapters/claude.js +57 -0
- package/runtime-adapters/codex.js +51 -0
- package/runtime-adapters/copilot.js +51 -0
- package/runtime-adapters/cursor.js +51 -0
- package/runtime-adapters/gemini-cli.js +30 -0
- package/runtime-adapters/opencode.js +51 -0
- package/runtime-adapters/windsurf.js +51 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-patterns
|
|
3
|
+
description: Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Python Patterns
|
|
8
|
+
|
|
9
|
+
> Python development principles and decision-making for 2025.
|
|
10
|
+
> **Learn to THINK, not memorize patterns.**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## โ ๏ธ How to Use This Skill
|
|
15
|
+
|
|
16
|
+
This skill teaches **decision-making principles**, not fixed code to copy.
|
|
17
|
+
|
|
18
|
+
- ASK user for framework preference when unclear
|
|
19
|
+
- Choose async vs sync based on CONTEXT
|
|
20
|
+
- Don't default to same framework every time
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Framework Selection (2025)
|
|
25
|
+
|
|
26
|
+
### Decision Tree
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
What are you building?
|
|
30
|
+
โ
|
|
31
|
+
โโโ API-first / Microservices
|
|
32
|
+
โ โโโ FastAPI (async, modern, fast)
|
|
33
|
+
โ
|
|
34
|
+
โโโ Full-stack web / CMS / Admin
|
|
35
|
+
โ โโโ Django (batteries-included)
|
|
36
|
+
โ
|
|
37
|
+
โโโ Simple / Script / Learning
|
|
38
|
+
โ โโโ Flask (minimal, flexible)
|
|
39
|
+
โ
|
|
40
|
+
โโโ AI/ML API serving
|
|
41
|
+
โ โโโ FastAPI (Pydantic, async, uvicorn)
|
|
42
|
+
โ
|
|
43
|
+
โโโ Background workers
|
|
44
|
+
โโโ Celery + any framework
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Comparison Principles
|
|
48
|
+
|
|
49
|
+
| Factor | FastAPI | Django | Flask |
|
|
50
|
+
|--------|---------|--------|-------|
|
|
51
|
+
| **Best for** | APIs, microservices | Full-stack, CMS | Simple, learning |
|
|
52
|
+
| **Async** | Native | Django 5.0+ | Via extensions |
|
|
53
|
+
| **Admin** | Manual | Built-in | Via extensions |
|
|
54
|
+
| **ORM** | Choose your own | Django ORM | Choose your own |
|
|
55
|
+
| **Learning curve** | Low | Medium | Low |
|
|
56
|
+
|
|
57
|
+
### Selection Questions to Ask:
|
|
58
|
+
1. Is this API-only or full-stack?
|
|
59
|
+
2. Need admin interface?
|
|
60
|
+
3. Team familiar with async?
|
|
61
|
+
4. Existing infrastructure?
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 2. Async vs Sync Decision
|
|
66
|
+
|
|
67
|
+
### When to Use Async
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
async def is better when:
|
|
71
|
+
โโโ I/O-bound operations (database, HTTP, file)
|
|
72
|
+
โโโ Many concurrent connections
|
|
73
|
+
โโโ Real-time features
|
|
74
|
+
โโโ Microservices communication
|
|
75
|
+
โโโ FastAPI/Starlette/Django ASGI
|
|
76
|
+
|
|
77
|
+
def (sync) is better when:
|
|
78
|
+
โโโ CPU-bound operations
|
|
79
|
+
โโโ Simple scripts
|
|
80
|
+
โโโ Legacy codebase
|
|
81
|
+
โโโ Team unfamiliar with async
|
|
82
|
+
โโโ Blocking libraries (no async version)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### The Golden Rule
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
I/O-bound โ async (waiting for external)
|
|
89
|
+
CPU-bound โ sync + multiprocessing (computing)
|
|
90
|
+
|
|
91
|
+
Don't:
|
|
92
|
+
โโโ Mix sync and async carelessly
|
|
93
|
+
โโโ Use sync libraries in async code
|
|
94
|
+
โโโ Force async for CPU work
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Async Library Selection
|
|
98
|
+
|
|
99
|
+
| Need | Async Library |
|
|
100
|
+
|------|---------------|
|
|
101
|
+
| HTTP client | httpx |
|
|
102
|
+
| PostgreSQL | asyncpg |
|
|
103
|
+
| Redis | aioredis / redis-py async |
|
|
104
|
+
| File I/O | aiofiles |
|
|
105
|
+
| Database ORM | SQLAlchemy 2.0 async, Tortoise |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 3. Type Hints Strategy
|
|
110
|
+
|
|
111
|
+
### When to Type
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Always type:
|
|
115
|
+
โโโ Function parameters
|
|
116
|
+
โโโ Return types
|
|
117
|
+
โโโ Class attributes
|
|
118
|
+
โโโ Public APIs
|
|
119
|
+
|
|
120
|
+
Can skip:
|
|
121
|
+
โโโ Local variables (let inference work)
|
|
122
|
+
โโโ One-off scripts
|
|
123
|
+
โโโ Tests (usually)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Common Type Patterns
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# These are patterns, understand them:
|
|
130
|
+
|
|
131
|
+
# Optional โ might be None
|
|
132
|
+
from typing import Optional
|
|
133
|
+
def find_user(id: int) -> Optional[User]: ...
|
|
134
|
+
|
|
135
|
+
# Union โ one of multiple types
|
|
136
|
+
def process(data: str | dict) -> None: ...
|
|
137
|
+
|
|
138
|
+
# Generic collections
|
|
139
|
+
def get_items() -> list[Item]: ...
|
|
140
|
+
def get_mapping() -> dict[str, int]: ...
|
|
141
|
+
|
|
142
|
+
# Callable
|
|
143
|
+
from typing import Callable
|
|
144
|
+
def apply(fn: Callable[[int], str]) -> str: ...
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Pydantic for Validation
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
When to use Pydantic:
|
|
151
|
+
โโโ API request/response models
|
|
152
|
+
โโโ Configuration/settings
|
|
153
|
+
โโโ Data validation
|
|
154
|
+
โโโ Serialization
|
|
155
|
+
|
|
156
|
+
Benefits:
|
|
157
|
+
โโโ Runtime validation
|
|
158
|
+
โโโ Auto-generated JSON schema
|
|
159
|
+
โโโ Works with FastAPI natively
|
|
160
|
+
โโโ Clear error messages
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 4. Project Structure Principles
|
|
166
|
+
|
|
167
|
+
### Structure Selection
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
Small project / Script:
|
|
171
|
+
โโโ main.py
|
|
172
|
+
โโโ utils.py
|
|
173
|
+
โโโ requirements.txt
|
|
174
|
+
|
|
175
|
+
Medium API:
|
|
176
|
+
โโโ app/
|
|
177
|
+
โ โโโ __init__.py
|
|
178
|
+
โ โโโ main.py
|
|
179
|
+
โ โโโ models/
|
|
180
|
+
โ โโโ routes/
|
|
181
|
+
โ โโโ services/
|
|
182
|
+
โ โโโ schemas/
|
|
183
|
+
โโโ tests/
|
|
184
|
+
โโโ pyproject.toml
|
|
185
|
+
|
|
186
|
+
Large application:
|
|
187
|
+
โโโ src/
|
|
188
|
+
โ โโโ myapp/
|
|
189
|
+
โ โโโ core/
|
|
190
|
+
โ โโโ api/
|
|
191
|
+
โ โโโ services/
|
|
192
|
+
โ โโโ models/
|
|
193
|
+
โ โโโ ...
|
|
194
|
+
โโโ tests/
|
|
195
|
+
โโโ pyproject.toml
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### FastAPI Structure Principles
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Organize by feature or layer:
|
|
202
|
+
|
|
203
|
+
By layer:
|
|
204
|
+
โโโ routes/ (API endpoints)
|
|
205
|
+
โโโ services/ (business logic)
|
|
206
|
+
โโโ models/ (database models)
|
|
207
|
+
โโโ schemas/ (Pydantic models)
|
|
208
|
+
โโโ dependencies/ (shared deps)
|
|
209
|
+
|
|
210
|
+
By feature:
|
|
211
|
+
โโโ users/
|
|
212
|
+
โ โโโ routes.py
|
|
213
|
+
โ โโโ service.py
|
|
214
|
+
โ โโโ schemas.py
|
|
215
|
+
โโโ products/
|
|
216
|
+
โโโ ...
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 5. Django Principles (2025)
|
|
222
|
+
|
|
223
|
+
### Django Async (Django 5.0+)
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Django supports async:
|
|
227
|
+
โโโ Async views
|
|
228
|
+
โโโ Async middleware
|
|
229
|
+
โโโ Async ORM (limited)
|
|
230
|
+
โโโ ASGI deployment
|
|
231
|
+
|
|
232
|
+
When to use async in Django:
|
|
233
|
+
โโโ External API calls
|
|
234
|
+
โโโ WebSocket (Channels)
|
|
235
|
+
โโโ High-concurrency views
|
|
236
|
+
โโโ Background task triggering
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Django Best Practices
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Model design:
|
|
243
|
+
โโโ Fat models, thin views
|
|
244
|
+
โโโ Use managers for common queries
|
|
245
|
+
โโโ Abstract base classes for shared fields
|
|
246
|
+
|
|
247
|
+
Views:
|
|
248
|
+
โโโ Class-based for complex CRUD
|
|
249
|
+
โโโ Function-based for simple endpoints
|
|
250
|
+
โโโ Use viewsets with DRF
|
|
251
|
+
|
|
252
|
+
Queries:
|
|
253
|
+
โโโ select_related() for FKs
|
|
254
|
+
โโโ prefetch_related() for M2M
|
|
255
|
+
โโโ Avoid N+1 queries
|
|
256
|
+
โโโ Use .only() for specific fields
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 6. FastAPI Principles
|
|
262
|
+
|
|
263
|
+
### async def vs def in FastAPI
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Use async def when:
|
|
267
|
+
โโโ Using async database drivers
|
|
268
|
+
โโโ Making async HTTP calls
|
|
269
|
+
โโโ I/O-bound operations
|
|
270
|
+
โโโ Want to handle concurrency
|
|
271
|
+
|
|
272
|
+
Use def when:
|
|
273
|
+
โโโ Blocking operations
|
|
274
|
+
โโโ Sync database drivers
|
|
275
|
+
โโโ CPU-bound work
|
|
276
|
+
โโโ FastAPI runs in threadpool automatically
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Dependency Injection
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
Use dependencies for:
|
|
283
|
+
โโโ Database sessions
|
|
284
|
+
โโโ Current user / Auth
|
|
285
|
+
โโโ Configuration
|
|
286
|
+
โโโ Shared resources
|
|
287
|
+
|
|
288
|
+
Benefits:
|
|
289
|
+
โโโ Testability (mock dependencies)
|
|
290
|
+
โโโ Clean separation
|
|
291
|
+
โโโ Automatic cleanup (yield)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Pydantic v2 Integration
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
# FastAPI + Pydantic are tightly integrated:
|
|
298
|
+
|
|
299
|
+
# Request validation
|
|
300
|
+
@app.post("/users")
|
|
301
|
+
async def create(user: UserCreate) -> UserResponse:
|
|
302
|
+
# user is already validated
|
|
303
|
+
...
|
|
304
|
+
|
|
305
|
+
# Response serialization
|
|
306
|
+
# Return type becomes response schema
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 7. Background Tasks
|
|
312
|
+
|
|
313
|
+
### Selection Guide
|
|
314
|
+
|
|
315
|
+
| Solution | Best For |
|
|
316
|
+
|----------|----------|
|
|
317
|
+
| **BackgroundTasks** | Simple, in-process tasks |
|
|
318
|
+
| **Celery** | Distributed, complex workflows |
|
|
319
|
+
| **ARQ** | Async, Redis-based |
|
|
320
|
+
| **RQ** | Simple Redis queue |
|
|
321
|
+
| **Dramatiq** | Actor-based, simpler than Celery |
|
|
322
|
+
|
|
323
|
+
### When to Use Each
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
FastAPI BackgroundTasks:
|
|
327
|
+
โโโ Quick operations
|
|
328
|
+
โโโ No persistence needed
|
|
329
|
+
โโโ Fire-and-forget
|
|
330
|
+
โโโ Same process
|
|
331
|
+
|
|
332
|
+
Celery/ARQ:
|
|
333
|
+
โโโ Long-running tasks
|
|
334
|
+
โโโ Need retry logic
|
|
335
|
+
โโโ Distributed workers
|
|
336
|
+
โโโ Persistent queue
|
|
337
|
+
โโโ Complex workflows
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 8. Error Handling Principles
|
|
343
|
+
|
|
344
|
+
### Exception Strategy
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
In FastAPI:
|
|
348
|
+
โโโ Create custom exception classes
|
|
349
|
+
โโโ Register exception handlers
|
|
350
|
+
โโโ Return consistent error format
|
|
351
|
+
โโโ Log without exposing internals
|
|
352
|
+
|
|
353
|
+
Pattern:
|
|
354
|
+
โโโ Raise domain exceptions in services
|
|
355
|
+
โโโ Catch and transform in handlers
|
|
356
|
+
โโโ Client gets clean error response
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Error Response Philosophy
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
Include:
|
|
363
|
+
โโโ Error code (programmatic)
|
|
364
|
+
โโโ Message (human readable)
|
|
365
|
+
โโโ Details (field-level when applicable)
|
|
366
|
+
โโโ NOT stack traces (security)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 9. Testing Principles
|
|
372
|
+
|
|
373
|
+
### Testing Strategy
|
|
374
|
+
|
|
375
|
+
| Type | Purpose | Tools |
|
|
376
|
+
|------|---------|-------|
|
|
377
|
+
| **Unit** | Business logic | pytest |
|
|
378
|
+
| **Integration** | API endpoints | pytest + httpx/TestClient |
|
|
379
|
+
| **E2E** | Full workflows | pytest + DB |
|
|
380
|
+
|
|
381
|
+
### Async Testing
|
|
382
|
+
|
|
383
|
+
```python
|
|
384
|
+
# Use pytest-asyncio for async tests
|
|
385
|
+
|
|
386
|
+
import pytest
|
|
387
|
+
from httpx import AsyncClient
|
|
388
|
+
|
|
389
|
+
@pytest.mark.asyncio
|
|
390
|
+
async def test_endpoint():
|
|
391
|
+
async with AsyncClient(app=app, base_url="http://test") as client:
|
|
392
|
+
response = await client.get("/users")
|
|
393
|
+
assert response.status_code == 200
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Fixtures Strategy
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
Common fixtures:
|
|
400
|
+
โโโ db_session โ Database connection
|
|
401
|
+
โโโ client โ Test client
|
|
402
|
+
โโโ authenticated_user โ User with token
|
|
403
|
+
โโโ sample_data โ Test data setup
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## 10. Decision Checklist
|
|
409
|
+
|
|
410
|
+
Before implementing:
|
|
411
|
+
|
|
412
|
+
- [ ] **Asked user about framework preference?**
|
|
413
|
+
- [ ] **Chosen framework for THIS context?** (not just default)
|
|
414
|
+
- [ ] **Decided async vs sync?**
|
|
415
|
+
- [ ] **Planned type hint strategy?**
|
|
416
|
+
- [ ] **Defined project structure?**
|
|
417
|
+
- [ ] **Planned error handling?**
|
|
418
|
+
- [ ] **Considered background tasks?**
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## 11. Anti-Patterns to Avoid
|
|
423
|
+
|
|
424
|
+
### โ DON'T:
|
|
425
|
+
- Default to Django for simple APIs (FastAPI may be better)
|
|
426
|
+
- Use sync libraries in async code
|
|
427
|
+
- Skip type hints for public APIs
|
|
428
|
+
- Put business logic in routes/views
|
|
429
|
+
- Ignore N+1 queries
|
|
430
|
+
- Mix async and sync carelessly
|
|
431
|
+
|
|
432
|
+
### โ
DO:
|
|
433
|
+
- Choose framework based on context
|
|
434
|
+
- Ask about async requirements
|
|
435
|
+
- Use Pydantic for validation
|
|
436
|
+
- Separate concerns (routes โ services โ repos)
|
|
437
|
+
- Test critical paths
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
> **Remember**: Python patterns are about decision-making for YOUR specific context. Don't copy codeโthink about what serves your application best.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qa-test-generation
|
|
3
|
+
description: Heuristics for generating comprehensive test checklists by change type. Used by /task-complete Etapa 1.7 to auto-create test steps.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# QA Test Generation
|
|
7
|
+
|
|
8
|
+
> Generate structured test checklists from acceptance criteria + modified files.
|
|
9
|
+
> Output: `TestStep[]` for `task.meta.test_checklist`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ๐ฏ PURPOSE
|
|
14
|
+
|
|
15
|
+
Automatically produce a comprehensive, multi-path test checklist when a task is being completed. The checklist covers **happy path, error cases, edge cases, boundary values, empty states, and permissions** โ never just the happy path.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ๐ HEURISTICS BY CHANGE TYPE
|
|
20
|
+
|
|
21
|
+
### 1. UI Component Changes
|
|
22
|
+
|
|
23
|
+
**Detect:** Files matching `*.tsx`, `*.css`, `*.module.css` in `components/`, `features/`, `pages/`
|
|
24
|
+
|
|
25
|
+
| # | Test Step Template | Type | Category |
|
|
26
|
+
|---|-------------------|------|----------|
|
|
27
|
+
| 1 | Component renders without errors | auto | unit |
|
|
28
|
+
| 2 | All interactive elements are clickable (cursor: pointer) | manual | visual |
|
|
29
|
+
| 3 | Responsive: renders correctly on mobile (โค640px) | manual | visual |
|
|
30
|
+
| 4 | Responsive: renders correctly on tablet (641โ1024px) | manual | visual |
|
|
31
|
+
| 5 | Dark mode: colors adapt correctly | manual | visual |
|
|
32
|
+
| 6 | Empty state: shows fallback when no data | manual | e2e |
|
|
33
|
+
| 7 | Loading state: shows skeleton/spinner during fetch | manual | visual |
|
|
34
|
+
| 8 | Error state: shows error message on API failure | manual | e2e |
|
|
35
|
+
| 9 | Hover/focus states match DS tokens | manual | visual |
|
|
36
|
+
| 10 | Accessibility: keyboard navigable (Tab/Enter/Escape) | manual | manual |
|
|
37
|
+
| 11 | Text content does not overflow containers | manual | visual |
|
|
38
|
+
|
|
39
|
+
### 2. API Endpoint Changes
|
|
40
|
+
|
|
41
|
+
**Detect:** Files matching `api/*.py`, `routes/*.ts`
|
|
42
|
+
|
|
43
|
+
| # | Test Step Template | Type | Category |
|
|
44
|
+
|---|-------------------|------|----------|
|
|
45
|
+
| 1 | Returns 200 with valid input | auto | integration |
|
|
46
|
+
| 2 | Returns 400 with invalid/missing fields | auto | integration |
|
|
47
|
+
| 3 | Returns 404 for non-existent resource | auto | integration |
|
|
48
|
+
| 4 | Returns 401/403 without authentication | auto | integration |
|
|
49
|
+
| 5 | Handles empty request body | auto | integration |
|
|
50
|
+
| 6 | Handles duplicate/conflict data (409) | auto | integration |
|
|
51
|
+
| 7 | Response schema matches TypeScript types | auto | unit |
|
|
52
|
+
| 8 | Pagination works correctly (if applicable) | auto | integration |
|
|
53
|
+
| 9 | Large payload doesn't timeout | manual | integration |
|
|
54
|
+
|
|
55
|
+
### 3. Backend Logic Changes
|
|
56
|
+
|
|
57
|
+
**Detect:** Files matching `crud/*.py`, `services/*.py`, `utils/*.py`, `schemas/*.py`
|
|
58
|
+
|
|
59
|
+
| # | Test Step Template | Type | Category |
|
|
60
|
+
|---|-------------------|------|----------|
|
|
61
|
+
| 1 | Function returns expected result for valid input | auto | unit |
|
|
62
|
+
| 2 | Function raises/returns error for invalid input | auto | unit |
|
|
63
|
+
| 3 | Edge case: empty/null/zero values handled | auto | unit |
|
|
64
|
+
| 4 | Edge case: boundary values (max int, empty string) | auto | unit |
|
|
65
|
+
| 5 | Concurrent operations don't corrupt data | manual | integration |
|
|
66
|
+
| 6 | Database constraints enforced (unique, foreign key) | auto | integration |
|
|
67
|
+
|
|
68
|
+
### 4. Styling Changes
|
|
69
|
+
|
|
70
|
+
**Detect:** Files matching `*.css`, `*.module.css`, `tokens.*`
|
|
71
|
+
|
|
72
|
+
| # | Test Step Template | Type | Category |
|
|
73
|
+
|---|-------------------|------|----------|
|
|
74
|
+
| 1 | Uses DS tokens (not hardcoded values) | auto | unit |
|
|
75
|
+
| 2 | Color contrast ratio โฅ 4.5:1 (AA) | manual | visual |
|
|
76
|
+
| 3 | Animations are smooth (no jank) | manual | visual |
|
|
77
|
+
| 4 | No layout shifts on load | manual | visual |
|
|
78
|
+
|
|
79
|
+
### 5. SDK/Type Changes
|
|
80
|
+
|
|
81
|
+
**Detect:** Files matching `sdk/*.ts`, `types.ts`, `domain/*.ts`
|
|
82
|
+
|
|
83
|
+
| # | Test Step Template | Type | Category |
|
|
84
|
+
|---|-------------------|------|----------|
|
|
85
|
+
| 1 | TypeScript build passes (`tsc --noEmit`) | auto | unit |
|
|
86
|
+
| 2 | New types are exported from index | auto | unit |
|
|
87
|
+
| 3 | SDK method calls correct API endpoint | auto | integration |
|
|
88
|
+
| 4 | Response type matches API schema | auto | unit |
|
|
89
|
+
|
|
90
|
+
### 6. Workflow/Skill Changes
|
|
91
|
+
|
|
92
|
+
**Detect:** Files matching `workflows/*.md`, `skills/*/SKILL.md`
|
|
93
|
+
|
|
94
|
+
| # | Test Step Template | Type | Category |
|
|
95
|
+
|---|-------------------|------|----------|
|
|
96
|
+
| 1 | Markdown syntax is valid | auto | unit |
|
|
97
|
+
| 2 | Referenced files/paths exist | auto | unit |
|
|
98
|
+
| 3 | Referenced commands run without error | manual | integration |
|
|
99
|
+
| 4 | Workflow steps are in logical order | manual | manual |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## ๐ GENERATION PROCESS
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
1. Read acceptance criteria from task body/meta
|
|
107
|
+
2. Read list of modified files from Resumo de Execuรงรฃo
|
|
108
|
+
3. For each file:
|
|
109
|
+
a. Classify by change type (UI/API/Backend/Styling/SDK/Workflow)
|
|
110
|
+
b. Select applicable heuristic table
|
|
111
|
+
c. Generate TestStep for each row, customizing description to actual change
|
|
112
|
+
4. Add acceptance-criteria-specific steps (from task body)
|
|
113
|
+
5. Deduplicate (same test from different files โ keep one)
|
|
114
|
+
6. Assign IDs: ts-1, ts-2, ...
|
|
115
|
+
7. Save via bridge.py --generate-tests OR direct API
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## โ๏ธ OUTPUT FORMAT
|
|
121
|
+
|
|
122
|
+
Each generated step follows this schema:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"id": "ts-1",
|
|
127
|
+
"description": "OKR card renders without errors when key_results is empty",
|
|
128
|
+
"type": "auto",
|
|
129
|
+
"category": "unit",
|
|
130
|
+
"status": "pending",
|
|
131
|
+
"result_comment": null,
|
|
132
|
+
"tested_by": null,
|
|
133
|
+
"tested_at": null
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## ๐ซ ANTI-PATTERNS
|
|
140
|
+
|
|
141
|
+
| โ Don't | โ
Do |
|
|
142
|
+
|----------|-------|
|
|
143
|
+
| Generate only happy path tests | Cover error, edge, boundary, empty states |
|
|
144
|
+
| Generic descriptions ("test UI") | Specific ("OKRCardExpanded shows 0% when no KRs") |
|
|
145
|
+
| All tests as `manual` | Classify auto vs manual based on tooling |
|
|
146
|
+
| Skip styling/visual tests | Include visual checks even if manual |
|
|
147
|
+
| Over-generate for trivial changes | Scale tests proportionally to change complexity |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## ๐ USED BY
|
|
152
|
+
|
|
153
|
+
| Workflow | Step |
|
|
154
|
+
|----------|------|
|
|
155
|
+
| `/task-complete` | Etapa 1.7 (QA Test Checklist Gate) |
|
|
156
|
+
| `/fix-tests` | Step 2 (Analyze + regenerate if needed) |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Stitch to React Components Skill
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx add-skill google-labs-code/stitch-skills --skill react:components --global
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Example Prompt
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Convert my Landing Page screen in my Podcast Stitch Project to a React component system.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Skill Structure
|
|
16
|
+
|
|
17
|
+
This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, validation scripts, and design tokens.
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
skills/react-components/
|
|
21
|
+
โโโ SKILL.md โ Core instructions & workflow
|
|
22
|
+
โโโ package.json โ Validator dependencies
|
|
23
|
+
โโโ scripts/ โ Networking & AST validation
|
|
24
|
+
โโโ resources/ โ Style guides & API references
|
|
25
|
+
โโโ examples/ โ Gold-standard code samples
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## How it Works
|
|
29
|
+
|
|
30
|
+
When activated, the agent follows a high-fidelity engineering pipeline:
|
|
31
|
+
|
|
32
|
+
1. **Retrieval**: Uses a system-level `curl` script to bypass TLS/SNI issues on Google Cloud Storage.
|
|
33
|
+
2. **Mapping**: Cross-references Stitch metadata with the local `style-guide.json` to ensure token consistency.
|
|
34
|
+
3. **Generation**: Scaffolds components using a strict Atomic Design pattern.
|
|
35
|
+
4. **Validation**: Runs an automated AST check using `@swc/core` to prevent hardcoded hex values or missing interfaces.
|
|
36
|
+
5. **Audit**: Performs a final self-correction check against a 20-point architecture checklist.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react:components
|
|
3
|
+
description: Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- "stitch*:*"
|
|
6
|
+
- "Bash"
|
|
7
|
+
- "Read"
|
|
8
|
+
- "Write"
|
|
9
|
+
- "web_fetch"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Stitch to React Components
|
|
13
|
+
|
|
14
|
+
You are a frontend engineer focused on transforming designs into clean React code. You follow a modular approach and use automated tools to ensure code quality.
|
|
15
|
+
|
|
16
|
+
## Retrieval and networking
|
|
17
|
+
1. **Namespace discovery**: Run `list_tools` to find the Stitch MCP prefix. Use this prefix (e.g., `stitch:`) for all subsequent calls.
|
|
18
|
+
2. **Metadata fetch**: Call `[prefix]:get_screen` to retrieve the design JSON.
|
|
19
|
+
3. **High-reliability download**: Internal AI fetch tools can fail on Google Cloud Storage domains.
|
|
20
|
+
- Use the `Bash` tool to run: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"`.
|
|
21
|
+
- This script handles the necessary redirects and security handshakes.
|
|
22
|
+
4. **Visual audit**: Check `screenshot.downloadUrl` to confirm the design intent and layout details.
|
|
23
|
+
|
|
24
|
+
## Architectural rules
|
|
25
|
+
* **Modular components**: Break the design into independent files. Avoid large, single-file outputs.
|
|
26
|
+
* **Logic isolation**: Move event handlers and business logic into custom hooks in `src/hooks/`.
|
|
27
|
+
* **Data decoupling**: Move all static text, image URLs, and lists into `src/data/mockData.ts`.
|
|
28
|
+
* **Type safety**: Every component must include a `Readonly` TypeScript interface named `[ComponentName]Props`.
|
|
29
|
+
* **Project specific**: Focus on the target project's needs and constraints. Leave Google license headers out of the generated React components.
|
|
30
|
+
* **Style mapping**:
|
|
31
|
+
* Extract the `tailwind.config` from the HTML `<head>`.
|
|
32
|
+
* Sync these values with `resources/style-guide.json`.
|
|
33
|
+
* Use theme-mapped Tailwind classes instead of arbitrary hex codes.
|
|
34
|
+
|
|
35
|
+
## Execution steps
|
|
36
|
+
1. **Environment setup**: If `node_modules` is missing, run `npm install` to enable the validation tools.
|
|
37
|
+
2. **Data layer**: Create `src/data/mockData.ts` based on the design content.
|
|
38
|
+
3. **Component drafting**: Use `resources/component-template.tsx` as a base. Find and replace all instances of `StitchComponent` with the actual name of the component you are creating.
|
|
39
|
+
4. **Application wiring**: Update the project entry point (like `App.tsx`) to render the new components.
|
|
40
|
+
5. **Quality check**:
|
|
41
|
+
* Run `npm run validate <file_path>` for each component.
|
|
42
|
+
* Verify the final output against the `resources/architecture-checklist.md`.
|
|
43
|
+
* Start the dev server with `npm run dev` to verify the live result.
|
|
44
|
+
|
|
45
|
+
## Troubleshooting
|
|
46
|
+
* **Fetch errors**: Ensure the URL is quoted in the bash command to prevent shell errors.
|
|
47
|
+
* **Validation errors**: Review the AST report and fix any missing interfaces or hardcoded styles.
|