@aslomon/effectum 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/README.md +633 -0
- package/bin/install.js +652 -0
- package/package.json +29 -0
- package/system/README.md +118 -0
- package/system/commands/build-fix.md +89 -0
- package/system/commands/cancel-ralph.md +90 -0
- package/system/commands/checkpoint.md +63 -0
- package/system/commands/code-review.md +120 -0
- package/system/commands/e2e.md +92 -0
- package/system/commands/plan.md +111 -0
- package/system/commands/ralph-loop.md +163 -0
- package/system/commands/refactor-clean.md +104 -0
- package/system/commands/tdd.md +84 -0
- package/system/commands/verify.md +71 -0
- package/system/stacks/generic.md +96 -0
- package/system/stacks/nextjs-supabase.md +114 -0
- package/system/stacks/python-fastapi.md +140 -0
- package/system/stacks/swift-ios.md +136 -0
- package/system/templates/AUTONOMOUS-WORKFLOW.md +1368 -0
- package/system/templates/CLAUDE.md.tmpl +141 -0
- package/system/templates/guardrails.md.tmpl +39 -0
- package/system/templates/settings.json.tmpl +201 -0
- package/workshop/knowledge/01-prd-template.md +275 -0
- package/workshop/knowledge/02-questioning-framework.md +209 -0
- package/workshop/knowledge/03-decomposition-guide.md +234 -0
- package/workshop/knowledge/04-examples.md +435 -0
- package/workshop/knowledge/05-quality-checklist.md +166 -0
- package/workshop/knowledge/06-network-map-guide.md +413 -0
- package/workshop/knowledge/07-prompt-templates.md +315 -0
- package/workshop/knowledge/08-workflow-modes.md +198 -0
- package/workshop/projects/_example-project/PROJECT.md +33 -0
- package/workshop/projects/_example-project/notes/decisions.md +15 -0
- package/workshop/projects/_example-project/notes/discovery-log.md +9 -0
- package/workshop/templates/PROJECT.md +25 -0
- package/workshop/templates/network-map.mmd +13 -0
- package/workshop/templates/prd.md +133 -0
- package/workshop/templates/requirements-map.md +48 -0
- package/workshop/templates/shared-contracts.md +89 -0
- package/workshop/templates/vision.md +66 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Stack Preset: Python + FastAPI
|
|
2
|
+
|
|
3
|
+
> Backend services and APIs with Python, FastAPI, Pydantic, and SQLAlchemy.
|
|
4
|
+
|
|
5
|
+
## TECH_STACK
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
- Python 3.12+
|
|
9
|
+
- FastAPI (latest stable)
|
|
10
|
+
- Pydantic v2 for data validation and serialization
|
|
11
|
+
- SQLAlchemy 2.0 with async support
|
|
12
|
+
- Alembic for database migrations
|
|
13
|
+
- pytest + pytest-asyncio for testing
|
|
14
|
+
- httpx for async test client
|
|
15
|
+
- ruff for linting and formatting
|
|
16
|
+
- uv for package management (fallback: pip)
|
|
17
|
+
- Docker + Docker Compose for local dev and deployment
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## ARCHITECTURE_PRINCIPLES
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
- ASYNC BY DEFAULT: use async/await for all I/O-bound operations. Sync only for CPU-bound work.
|
|
24
|
+
- TYPE HINTS EVERYWHERE: all function signatures, return types, and variables must have type annotations.
|
|
25
|
+
- DEPENDENCY INJECTION: use FastAPI's Depends() for all shared resources (DB sessions, auth, config).
|
|
26
|
+
- PYDANTIC MODELS: use Pydantic BaseModel for ALL request/response schemas. Never pass raw dicts across boundaries.
|
|
27
|
+
- REPOSITORY PATTERN: separate data access from business logic. Services call repositories, not ORM directly.
|
|
28
|
+
- MULTI-TENANT: include tenant_id/org_id in all data models from day one.
|
|
29
|
+
- MIGRATIONS ONLY: DB changes through Alembic migrations exclusively. Never run raw DDL.
|
|
30
|
+
- RESULT PATTERN: return typed results instead of raising exceptions for expected errors. Use exceptions only for truly exceptional situations.
|
|
31
|
+
- SETTINGS VIA PYDANTIC: all configuration through pydantic-settings with env var validation.
|
|
32
|
+
- STRUCTURED LOGGING: use structlog or similar. No print() or bare logging.info() in production.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## PROJECT_STRUCTURE
|
|
36
|
+
|
|
37
|
+
````
|
|
38
|
+
```
|
|
39
|
+
src/
|
|
40
|
+
{project_name}/
|
|
41
|
+
__init__.py
|
|
42
|
+
main.py # FastAPI app factory
|
|
43
|
+
config.py # Pydantic Settings
|
|
44
|
+
dependencies.py # Shared FastAPI dependencies
|
|
45
|
+
api/
|
|
46
|
+
__init__.py
|
|
47
|
+
v1/
|
|
48
|
+
__init__.py
|
|
49
|
+
router.py # API version router
|
|
50
|
+
endpoints/ # Route handlers by domain
|
|
51
|
+
models/
|
|
52
|
+
__init__.py
|
|
53
|
+
base.py # SQLAlchemy Base, mixins
|
|
54
|
+
{domain}.py # Domain models (e.g., user.py, team.py)
|
|
55
|
+
schemas/
|
|
56
|
+
__init__.py
|
|
57
|
+
{domain}.py # Pydantic request/response schemas
|
|
58
|
+
services/
|
|
59
|
+
__init__.py
|
|
60
|
+
{domain}.py # Business logic
|
|
61
|
+
repositories/
|
|
62
|
+
__init__.py
|
|
63
|
+
{domain}.py # Data access layer
|
|
64
|
+
core/
|
|
65
|
+
__init__.py
|
|
66
|
+
security.py # Auth, JWT, permissions
|
|
67
|
+
exceptions.py # Custom exception classes
|
|
68
|
+
middleware.py # Custom middleware
|
|
69
|
+
db/
|
|
70
|
+
__init__.py
|
|
71
|
+
session.py # Async session factory
|
|
72
|
+
migrations.py # Alembic helpers
|
|
73
|
+
alembic/
|
|
74
|
+
versions/ # Migration files
|
|
75
|
+
env.py
|
|
76
|
+
alembic.ini
|
|
77
|
+
tests/
|
|
78
|
+
conftest.py # Fixtures (test DB, client, auth)
|
|
79
|
+
test_{domain}/
|
|
80
|
+
test_endpoints.py
|
|
81
|
+
test_services.py
|
|
82
|
+
test_repositories.py
|
|
83
|
+
pyproject.toml
|
|
84
|
+
Dockerfile
|
|
85
|
+
docker-compose.yml
|
|
86
|
+
```
|
|
87
|
+
````
|
|
88
|
+
|
|
89
|
+
## QUALITY_GATES
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
- Build: `python -m build` or `uv build` — 0 errors
|
|
93
|
+
- Types: `mypy src/` — 0 errors
|
|
94
|
+
- Tests: `pytest --cov=src --cov-report=term-missing` — all pass, 80%+ coverage
|
|
95
|
+
- Lint: `ruff check src/ tests/` — 0 errors
|
|
96
|
+
- Format: `ruff format --check src/ tests/` — 0 differences
|
|
97
|
+
- Security: `bandit -r src/` — no high-severity issues
|
|
98
|
+
- Import Order: `ruff check --select I src/` — sorted
|
|
99
|
+
- No Debug Logs: 0 print() statements in src/ (`grep -r "print(" src/`)
|
|
100
|
+
- Type Safety: No `Any` type annotations in source code
|
|
101
|
+
- File Size: No file exceeds 300 lines
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## FORMATTER
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
ruff format
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## FORMATTER_GLOB
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
py
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## PACKAGE_MANAGER
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
uv
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## STACK_SPECIFIC_GUARDRAILS
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
- **uv, not pip**: This project uses uv for package management. Avoid bare pip install — use `uv add` or `uv pip install`.
|
|
126
|
+
- **Async by default**: All endpoint handlers, service methods, and repository methods must be async unless CPU-bound.
|
|
127
|
+
- **Pydantic v2 syntax**: Use model_validator, field_validator (not validator, root_validator from v1).
|
|
128
|
+
- **SQLAlchemy 2.0 style**: Use Mapped[], mapped_column(), select() — not legacy Column(), query() patterns.
|
|
129
|
+
- **Alembic for all migrations**: Never modify the database schema outside of Alembic. Run `alembic revision --autogenerate` for changes.
|
|
130
|
+
- **Settings validation**: All env vars must go through pydantic-settings. No raw os.getenv() in application code.
|
|
131
|
+
- **Dependency injection**: Never instantiate DB sessions or config directly. Use FastAPI Depends().
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## TOOL_SPECIFIC_GUARDRAILS
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
- **ruff runs automatically**: The PostToolUse hook auto-formats .py files with ruff format. Don't run ruff format manually.
|
|
138
|
+
- **CHANGELOG is auto-updated**: The Stop hook handles CHANGELOG.md. Don't update it manually unless explicitly asked.
|
|
139
|
+
- **Lock files are protected**: poetry.lock, Pipfile.lock cannot be written to directly. Use uv/pip/poetry commands.
|
|
140
|
+
```
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Stack Preset: Swift + iOS/macOS
|
|
2
|
+
|
|
3
|
+
> Native Apple platform apps with Swift, SwiftUI, and SwiftData.
|
|
4
|
+
|
|
5
|
+
## TECH_STACK
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
- Swift 6+ with strict concurrency checking
|
|
9
|
+
- SwiftUI for all UI (no UIKit unless wrapping legacy components)
|
|
10
|
+
- SwiftData for persistence (or CoreData for complex migration needs)
|
|
11
|
+
- Swift Testing framework (preferred) + XCTest for UI tests
|
|
12
|
+
- swift-format for code formatting
|
|
13
|
+
- SwiftLint for linting
|
|
14
|
+
- Swift Package Manager (SPM) for dependencies
|
|
15
|
+
- Xcode 16+ as primary IDE/build system
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ARCHITECTURE_PRINCIPLES
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
- MVVM: Views -> ViewModels -> Services/Repositories. No business logic in Views.
|
|
22
|
+
- PROTOCOL-ORIENTED: define protocols for services and repositories. Use concrete types only at composition root.
|
|
23
|
+
- @Observable MACRO: use @Observable (Swift 5.9+) instead of ObservableObject/Published for ViewModels.
|
|
24
|
+
- ACTOR ISOLATION: use actors for shared mutable state. Mark MainActor for all UI-related code.
|
|
25
|
+
- STRUCTURED CONCURRENCY: use async/await and TaskGroup. No completion handlers for new code.
|
|
26
|
+
- VALUE TYPES: prefer structs over classes. Use classes only for reference semantics or inheritance.
|
|
27
|
+
- DEPENDENCY INJECTION: pass dependencies through initializers or environment. No singletons except at app root.
|
|
28
|
+
- ERROR HANDLING: use typed throws (Swift 6) and Result type. Never force-unwrap (!) in production code.
|
|
29
|
+
- SWIFTDATA MODELS: use @Model macro for persistence. Define schemas with explicit versioning.
|
|
30
|
+
- PREVIEW-DRIVEN: every view must have a working #Preview with mock data.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## PROJECT_STRUCTURE
|
|
34
|
+
|
|
35
|
+
````
|
|
36
|
+
```
|
|
37
|
+
{ProjectName}/
|
|
38
|
+
App/
|
|
39
|
+
{ProjectName}App.swift # @main entry point
|
|
40
|
+
ContentView.swift # Root navigation
|
|
41
|
+
AppState.swift # Global app state
|
|
42
|
+
Features/
|
|
43
|
+
{Feature}/
|
|
44
|
+
Views/
|
|
45
|
+
{Feature}View.swift
|
|
46
|
+
{Feature}DetailView.swift
|
|
47
|
+
ViewModels/
|
|
48
|
+
{Feature}ViewModel.swift
|
|
49
|
+
Models/
|
|
50
|
+
{Feature}Model.swift # SwiftData @Model or domain model
|
|
51
|
+
Core/
|
|
52
|
+
Services/
|
|
53
|
+
{Domain}Service.swift # Business logic services
|
|
54
|
+
NetworkService.swift # API client
|
|
55
|
+
Repositories/
|
|
56
|
+
{Domain}Repository.swift # Data access layer
|
|
57
|
+
Extensions/
|
|
58
|
+
View+Extensions.swift
|
|
59
|
+
String+Extensions.swift
|
|
60
|
+
Protocols/
|
|
61
|
+
{Domain}ServiceProtocol.swift
|
|
62
|
+
Utilities/
|
|
63
|
+
Logger.swift
|
|
64
|
+
Constants.swift
|
|
65
|
+
Resources/
|
|
66
|
+
Assets.xcassets
|
|
67
|
+
Localizable.xcstrings
|
|
68
|
+
Info.plist
|
|
69
|
+
Previews/
|
|
70
|
+
PreviewData.swift # Shared mock data for previews
|
|
71
|
+
{ProjectName}Tests/
|
|
72
|
+
Features/
|
|
73
|
+
{Feature}/
|
|
74
|
+
{Feature}ViewModelTests.swift
|
|
75
|
+
Core/
|
|
76
|
+
Services/
|
|
77
|
+
{Domain}ServiceTests.swift
|
|
78
|
+
{ProjectName}UITests/
|
|
79
|
+
{Feature}UITests.swift
|
|
80
|
+
Package.swift (if SPM-based)
|
|
81
|
+
```
|
|
82
|
+
````
|
|
83
|
+
|
|
84
|
+
## QUALITY_GATES
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
- Build: `swift build` or `xcodebuild build` — 0 errors, 0 warnings
|
|
88
|
+
- Tests: `swift test` or `xcodebuild test` — all pass
|
|
89
|
+
- Lint: `swiftlint lint --strict` — 0 violations
|
|
90
|
+
- Format: `swift-format lint -r Sources/` — 0 differences
|
|
91
|
+
- Concurrency: strict concurrency checking enabled — 0 warnings
|
|
92
|
+
- No Force Unwrap: 0 occurrences of `!` on optionals in production code
|
|
93
|
+
- No Print: 0 print() statements in production code (use Logger)
|
|
94
|
+
- Preview: all views have working #Preview blocks
|
|
95
|
+
- File Size: No file exceeds 300 lines
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## FORMATTER
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
swift-format format -i
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## FORMATTER_GLOB
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
swift
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## PACKAGE_MANAGER
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
swift package (SPM)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## STACK_SPECIFIC_GUARDRAILS
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
- **SPM for dependencies**: Use Swift Package Manager exclusively. No CocoaPods or Carthage.
|
|
120
|
+
- **SwiftUI only**: All new UI must be SwiftUI. UIKit wrappers (UIViewRepresentable) only for components without SwiftUI equivalents.
|
|
121
|
+
- **@Observable over ObservableObject**: Use the @Observable macro (Swift 5.9+) for all new ViewModels. Do not use ObservableObject/Published.
|
|
122
|
+
- **Structured concurrency**: Use async/await and TaskGroup. No DispatchQueue or completion handlers in new code.
|
|
123
|
+
- **Actor isolation**: Use @MainActor for all ViewModel and View-related code. Use custom actors for shared mutable state.
|
|
124
|
+
- **No force unwrap**: Never use `!` to force-unwrap optionals in production code. Use guard-let, if-let, or nil-coalescing.
|
|
125
|
+
- **SwiftData versioning**: Always define schema versions when modifying @Model types. Use VersionedSchema and SchemaMigrationPlan.
|
|
126
|
+
- **Previews are mandatory**: Every View must have a #Preview block with representative mock data.
|
|
127
|
+
- **Localization from day one**: Use String(localized:) for all user-facing strings. Never hardcode display text.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## TOOL_SPECIFIC_GUARDRAILS
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
- **swift-format runs automatically**: The PostToolUse hook auto-formats .swift files. Don't run swift-format manually.
|
|
134
|
+
- **CHANGELOG is auto-updated**: The Stop hook handles CHANGELOG.md. Don't update it manually unless explicitly asked.
|
|
135
|
+
- **Package.resolved is protected**: Package.resolved cannot be written to directly. Use `swift package resolve` or `swift package update`.
|
|
136
|
+
```
|