@softspark/ai-toolkit 1.0.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/AGENTS.md +412 -0
- package/CHANGELOG.md +68 -0
- package/LICENSE +21 -0
- package/README.md +632 -0
- package/action.yml +53 -0
- package/app/.claude-plugin/plugin.json +44 -0
- package/app/ARCHITECTURE.md +306 -0
- package/app/CLAUDE.md.template +23 -0
- package/app/agents/ai-engineer.md +128 -0
- package/app/agents/backend-specialist.md +193 -0
- package/app/agents/business-intelligence.md +54 -0
- package/app/agents/chaos-monkey.md +67 -0
- package/app/agents/chief-of-staff.md +51 -0
- package/app/agents/code-archaeologist.md +127 -0
- package/app/agents/code-reviewer.md +184 -0
- package/app/agents/command-expert.md +131 -0
- package/app/agents/data-analyst.md +205 -0
- package/app/agents/data-scientist.md +151 -0
- package/app/agents/database-architect.md +317 -0
- package/app/agents/debugger.md +238 -0
- package/app/agents/devops-implementer.md +194 -0
- package/app/agents/documenter.md +364 -0
- package/app/agents/explorer-agent.md +145 -0
- package/app/agents/fact-checker.md +172 -0
- package/app/agents/frontend-specialist.md +209 -0
- package/app/agents/game-developer.md +216 -0
- package/app/agents/incident-responder.md +226 -0
- package/app/agents/infrastructure-architect.md +127 -0
- package/app/agents/infrastructure-validator.md +247 -0
- package/app/agents/llm-ops-engineer.md +237 -0
- package/app/agents/mcp-expert.md +228 -0
- package/app/agents/mcp-server-architect.md +195 -0
- package/app/agents/mcp-testing-engineer.md +292 -0
- package/app/agents/meta-architect.md +58 -0
- package/app/agents/ml-engineer.md +136 -0
- package/app/agents/mobile-developer.md +190 -0
- package/app/agents/night-watchman.md +55 -0
- package/app/agents/nlp-engineer.md +154 -0
- package/app/agents/orchestrator.md +437 -0
- package/app/agents/performance-optimizer.md +254 -0
- package/app/agents/predictive-analyst.md +57 -0
- package/app/agents/product-manager.md +194 -0
- package/app/agents/project-planner.md +287 -0
- package/app/agents/prompt-engineer.md +103 -0
- package/app/agents/qa-automation-engineer.md +182 -0
- package/app/agents/rag-engineer.md +201 -0
- package/app/agents/research-synthesizer.md +138 -0
- package/app/agents/search-specialist.md +101 -0
- package/app/agents/security-architect.md +62 -0
- package/app/agents/security-auditor.md +293 -0
- package/app/agents/seo-specialist.md +111 -0
- package/app/agents/system-governor.md +57 -0
- package/app/agents/tech-lead.md +62 -0
- package/app/agents/technical-researcher.md +103 -0
- package/app/agents/test-engineer.md +264 -0
- package/app/constitution.md +38 -0
- package/app/hooks/_profile-check.sh +11 -0
- package/app/hooks/guard-destructive.sh +74 -0
- package/app/hooks/guard-path.sh +73 -0
- package/app/hooks/post-tool-use.sh +35 -0
- package/app/hooks/pre-compact.sh +31 -0
- package/app/hooks/quality-check.sh +22 -0
- package/app/hooks/quality-gate.sh +49 -0
- package/app/hooks/save-session.sh +24 -0
- package/app/hooks/session-end.sh +37 -0
- package/app/hooks/session-start.sh +29 -0
- package/app/hooks/subagent-start.sh +16 -0
- package/app/hooks/subagent-stop.sh +16 -0
- package/app/hooks/track-usage.sh +50 -0
- package/app/hooks/user-prompt-submit.sh +25 -0
- package/app/hooks.json +178 -0
- package/app/mcp-defaults.json +23 -0
- package/app/output-styles/golden-rules.md +43 -0
- package/app/plugins/README.md +19 -0
- package/app/plugins/csharp-pack/README.md +11 -0
- package/app/plugins/csharp-pack/plugin.json +18 -0
- package/app/plugins/enterprise-pack/README.md +16 -0
- package/app/plugins/enterprise-pack/hooks/output-style.sh +6 -0
- package/app/plugins/enterprise-pack/hooks/status-line.sh +8 -0
- package/app/plugins/enterprise-pack/plugin.json +24 -0
- package/app/plugins/frontend-pack/README.md +14 -0
- package/app/plugins/frontend-pack/plugin.json +22 -0
- package/app/plugins/java-pack/README.md +11 -0
- package/app/plugins/java-pack/plugin.json +18 -0
- package/app/plugins/kotlin-pack/README.md +11 -0
- package/app/plugins/kotlin-pack/plugin.json +18 -0
- package/app/plugins/memory-pack/README.md +24 -0
- package/app/plugins/memory-pack/hooks/observation-capture.sh +67 -0
- package/app/plugins/memory-pack/hooks/session-summary.sh +71 -0
- package/app/plugins/memory-pack/plugin.json +22 -0
- package/app/plugins/memory-pack/scripts/init_db.py +81 -0
- package/app/plugins/memory-pack/scripts/strip_private.py +22 -0
- package/app/plugins/memory-pack/skills/mem-search/SKILL.md +70 -0
- package/app/plugins/research-pack/README.md +14 -0
- package/app/plugins/research-pack/plugin.json +22 -0
- package/app/plugins/ruby-pack/README.md +11 -0
- package/app/plugins/ruby-pack/plugin.json +18 -0
- package/app/plugins/rust-pack/README.md +11 -0
- package/app/plugins/rust-pack/plugin.json +18 -0
- package/app/plugins/security-pack/README.md +15 -0
- package/app/plugins/security-pack/plugin.json +23 -0
- package/app/plugins/swift-pack/README.md +11 -0
- package/app/plugins/swift-pack/plugin.json +18 -0
- package/app/rules/claude-toolkit-rules.md +21 -0
- package/app/rules/git-conventions.md +5 -0
- package/app/rules/quality-gates.md +10 -0
- package/app/skills/_lib/__init__.py +1 -0
- package/app/skills/_lib/detect_utils.py +150 -0
- package/app/skills/agent-creator/SKILL.md +82 -0
- package/app/skills/analyze/SKILL.md +92 -0
- package/app/skills/analyze/scripts/complexity.py +165 -0
- package/app/skills/api-patterns/SKILL.md +305 -0
- package/app/skills/app-builder/SKILL.md +187 -0
- package/app/skills/architecture-audit/SKILL.md +141 -0
- package/app/skills/architecture-decision/SKILL.md +55 -0
- package/app/skills/architecture-decision/templates/adr-template.md +36 -0
- package/app/skills/biz-scan/SKILL.md +30 -0
- package/app/skills/briefing/SKILL.md +27 -0
- package/app/skills/build/SKILL.md +97 -0
- package/app/skills/build/scripts/detect-build.py +151 -0
- package/app/skills/chaos/SKILL.md +32 -0
- package/app/skills/ci/SKILL.md +77 -0
- package/app/skills/ci/scripts/ci-detect.py +135 -0
- package/app/skills/ci/templates/github-actions-node.yml +38 -0
- package/app/skills/ci/templates/github-actions-python.yml +42 -0
- package/app/skills/ci-cd-patterns/SKILL.md +299 -0
- package/app/skills/clean-code/SKILL.md +110 -0
- package/app/skills/clean-code/reference/dart.md +18 -0
- package/app/skills/clean-code/reference/go.md +23 -0
- package/app/skills/clean-code/reference/php.md +32 -0
- package/app/skills/clean-code/reference/python.md +180 -0
- package/app/skills/clean-code/reference/typescript.md +26 -0
- package/app/skills/command-creator/SKILL.md +83 -0
- package/app/skills/commit/SKILL.md +98 -0
- package/app/skills/commit/scripts/pre-commit-check.py +87 -0
- package/app/skills/commit/templates/conventional-commit.md +52 -0
- package/app/skills/csharp-patterns/SKILL.md +450 -0
- package/app/skills/database-patterns/SKILL.md +297 -0
- package/app/skills/debug/SKILL.md +154 -0
- package/app/skills/debug/scripts/error-parser.py +187 -0
- package/app/skills/debugging-tactics/SKILL.md +136 -0
- package/app/skills/deploy/SKILL.md +130 -0
- package/app/skills/deploy/scripts/pre_deploy_check.py +171 -0
- package/app/skills/deploy/templates/deployment-checklist.md +31 -0
- package/app/skills/design-an-interface/SKILL.md +105 -0
- package/app/skills/design-engineering/SKILL.md +260 -0
- package/app/skills/docker-devops/SKILL.md +303 -0
- package/app/skills/docs/SKILL.md +145 -0
- package/app/skills/docs/scripts/doc-inventory.py +176 -0
- package/app/skills/docs/templates/adr-template.md +36 -0
- package/app/skills/docs/templates/readme-template.md +67 -0
- package/app/skills/documentation-standards/SKILL.md +191 -0
- package/app/skills/ecommerce-patterns/SKILL.md +209 -0
- package/app/skills/evaluate/SKILL.md +132 -0
- package/app/skills/evolve/SKILL.md +27 -0
- package/app/skills/explain/SKILL.md +54 -0
- package/app/skills/explain/scripts/dependency-graph.py +215 -0
- package/app/skills/explore/SKILL.md +112 -0
- package/app/skills/explore/scripts/visualize.py +117 -0
- package/app/skills/fix/SKILL.md +78 -0
- package/app/skills/fix/scripts/error-classifier.py +191 -0
- package/app/skills/flutter-patterns/SKILL.md +254 -0
- package/app/skills/git-mastery/SKILL.md +70 -0
- package/app/skills/grill-me/SKILL.md +38 -0
- package/app/skills/health/SKILL.md +91 -0
- package/app/skills/health/scripts/health_check.py +162 -0
- package/app/skills/hive-mind/SKILL.md +56 -0
- package/app/skills/hook-creator/SKILL.md +107 -0
- package/app/skills/index/SKILL.md +74 -0
- package/app/skills/instinct-review/SKILL.md +77 -0
- package/app/skills/java-patterns/SKILL.md +442 -0
- package/app/skills/kotlin-patterns/SKILL.md +446 -0
- package/app/skills/lint/SKILL.md +103 -0
- package/app/skills/lint/scripts/detect-linters.py +112 -0
- package/app/skills/mcp-patterns/SKILL.md +270 -0
- package/app/skills/mem-search/SKILL.md +70 -0
- package/app/skills/migrate/SKILL.md +90 -0
- package/app/skills/migrate/scripts/migration-status.py +195 -0
- package/app/skills/migration-patterns/SKILL.md +260 -0
- package/app/skills/night-watch/SKILL.md +28 -0
- package/app/skills/observability-patterns/SKILL.md +203 -0
- package/app/skills/onboard/SKILL.md +76 -0
- package/app/skills/orchestrate/SKILL.md +86 -0
- package/app/skills/panic/SKILL.md +30 -0
- package/app/skills/performance-profiling/SKILL.md +59 -0
- package/app/skills/plan/SKILL.md +110 -0
- package/app/skills/plan/templates/plan-template.md +40 -0
- package/app/skills/plan-writing/SKILL.md +201 -0
- package/app/skills/plugin-creator/SKILL.md +78 -0
- package/app/skills/pr/SKILL.md +129 -0
- package/app/skills/pr/scripts/pr-summary.py +175 -0
- package/app/skills/prd-to-issues/SKILL.md +108 -0
- package/app/skills/prd-to-plan/SKILL.md +120 -0
- package/app/skills/predict/SKILL.md +30 -0
- package/app/skills/qa-session/SKILL.md +110 -0
- package/app/skills/rag-patterns/SKILL.md +203 -0
- package/app/skills/refactor/SKILL.md +124 -0
- package/app/skills/refactor/scripts/refactor-scan.py +210 -0
- package/app/skills/refactor-plan/SKILL.md +112 -0
- package/app/skills/repeat/SKILL.md +149 -0
- package/app/skills/research-mastery/SKILL.md +56 -0
- package/app/skills/review/SKILL.md +141 -0
- package/app/skills/review/scripts/diff-analyzer.py +170 -0
- package/app/skills/rollback/SKILL.md +87 -0
- package/app/skills/rollback/scripts/rollback_info.py +149 -0
- package/app/skills/ruby-patterns/SKILL.md +454 -0
- package/app/skills/rust-patterns/SKILL.md +446 -0
- package/app/skills/search/SKILL.md +64 -0
- package/app/skills/security-patterns/SKILL.md +91 -0
- package/app/skills/security-patterns/reference/authentication.md +37 -0
- package/app/skills/security-patterns/reference/authorization.md +22 -0
- package/app/skills/security-patterns/reference/input-validation.md +30 -0
- package/app/skills/security-patterns/reference/oauth-csrf-audit.md +131 -0
- package/app/skills/skill-creator/SKILL.md +154 -0
- package/app/skills/skill-creator/templates/dashboard/index.html +130 -0
- package/app/skills/skill-creator/templates/reasoning-engine/assets/example.json +12 -0
- package/app/skills/skill-creator/templates/reasoning-engine/search.py +110 -0
- package/app/skills/subagent-development/SKILL.md +225 -0
- package/app/skills/subagent-development/reference/code-quality-reviewer-prompt.md +145 -0
- package/app/skills/subagent-development/reference/implementer-prompt.md +118 -0
- package/app/skills/subagent-development/reference/spec-reviewer-prompt.md +100 -0
- package/app/skills/swarm/SKILL.md +81 -0
- package/app/skills/swift-patterns/SKILL.md +500 -0
- package/app/skills/tdd/SKILL.md +174 -0
- package/app/skills/tdd/reference/deep-modules.md +32 -0
- package/app/skills/tdd/reference/interface-design.md +32 -0
- package/app/skills/tdd/reference/mocking.md +52 -0
- package/app/skills/tdd/reference/refactoring.md +10 -0
- package/app/skills/tdd/reference/tests.md +59 -0
- package/app/skills/teams/SKILL.md +101 -0
- package/app/skills/test/SKILL.md +107 -0
- package/app/skills/test/scripts/detect-runner.py +113 -0
- package/app/skills/testing-patterns/SKILL.md +73 -0
- package/app/skills/testing-patterns/reference/flutter-testing.md +33 -0
- package/app/skills/testing-patterns/reference/go-testing.md +52 -0
- package/app/skills/testing-patterns/reference/php-phpunit.md +39 -0
- package/app/skills/testing-patterns/reference/python-pytest.md +228 -0
- package/app/skills/testing-patterns/reference/typescript-vitest.md +50 -0
- package/app/skills/triage-issue/SKILL.md +120 -0
- package/app/skills/typescript-patterns/SKILL.md +256 -0
- package/app/skills/ubiquitous-language/SKILL.md +74 -0
- package/app/skills/verification-before-completion/SKILL.md +108 -0
- package/app/skills/workflow/SKILL.md +250 -0
- package/app/skills/write-a-prd/SKILL.md +129 -0
- package/app/skills/write-a-prd/reference/visual-companion.md +78 -0
- package/app/skills/write-a-prd/scripts/frame-template.html +111 -0
- package/app/skills/write-a-prd/scripts/visual-server.cjs +79 -0
- package/app/templates/skill/generator/SKILL.md.template +40 -0
- package/app/templates/skill/knowledge/SKILL.md.template +52 -0
- package/app/templates/skill/linter/SKILL.md.template +34 -0
- package/app/templates/skill/reviewer/SKILL.md.template +51 -0
- package/app/templates/skill/workflow/SKILL.md.template +49 -0
- package/benchmarks/README.md +111 -0
- package/benchmarks/ecosystem-dashboard.json +148 -0
- package/benchmarks/ecosystem-harvest.json +148 -0
- package/benchmarks/results.json +38 -0
- package/benchmarks/run.py +351 -0
- package/bin/ai-toolkit.js +345 -0
- package/kb/best-practices/README.md +11 -0
- package/kb/howto/README.md +11 -0
- package/kb/procedures/maintenance-sop.md +306 -0
- package/kb/reference/agents-catalog.md +124 -0
- package/kb/reference/anti-pattern-registry-format.md +221 -0
- package/kb/reference/architecture-overview.md +232 -0
- package/kb/reference/benchmark-config.md +62 -0
- package/kb/reference/ci-integration.md +66 -0
- package/kb/reference/claude-ecosystem-benchmark-snapshot.md +80 -0
- package/kb/reference/claude-ecosystem-expansion-foundations.md +102 -0
- package/kb/reference/commands-catalog.md +21 -0
- package/kb/reference/distribution-model.md +63 -0
- package/kb/reference/global-install-model.md +56 -0
- package/kb/reference/hierarchical-override-pattern.md +200 -0
- package/kb/reference/hooks-catalog.md +306 -0
- package/kb/reference/integrations.md +88 -0
- package/kb/reference/language-packs.md +52 -0
- package/kb/reference/merge-friendly-install-model.md +58 -0
- package/kb/reference/plugin-pack-conventions.md +151 -0
- package/kb/reference/quick-wins-implementation-summary.md +70 -0
- package/kb/reference/skill-templates.md +50 -0
- package/kb/reference/skills-catalog.md +215 -0
- package/kb/reference/skills-unification.md +57 -0
- package/kb/reference/stats.md +69 -0
- package/kb/reference/sync.md +76 -0
- package/kb/troubleshooting/README.md +11 -0
- package/llms-full.txt +3068 -0
- package/llms.txt +39 -0
- package/package.json +75 -0
- package/scripts/_common.py +160 -0
- package/scripts/add_rule.py +50 -0
- package/scripts/benchmark_config.py +127 -0
- package/scripts/benchmark_ecosystem.py +288 -0
- package/scripts/check_deps.py +260 -0
- package/scripts/create_skill.py +118 -0
- package/scripts/doctor.py +504 -0
- package/scripts/eject.py +113 -0
- package/scripts/emission.py +256 -0
- package/scripts/evaluate_skills.py +260 -0
- package/scripts/frontmatter.py +58 -0
- package/scripts/generate_agents_md.py +91 -0
- package/scripts/generate_aider_conf.py +51 -0
- package/scripts/generate_cline.py +35 -0
- package/scripts/generate_copilot.py +30 -0
- package/scripts/generate_cursor_rules.py +35 -0
- package/scripts/generate_gemini.py +28 -0
- package/scripts/generate_llms_txt.py +164 -0
- package/scripts/generate_roo_modes.py +80 -0
- package/scripts/generate_windsurf.py +35 -0
- package/scripts/generator_base.py +140 -0
- package/scripts/harvest_ecosystem.py +50 -0
- package/scripts/inject_rule_cli.py +101 -0
- package/scripts/inject_section_cli.py +47 -0
- package/scripts/injection.py +180 -0
- package/scripts/install.py +236 -0
- package/scripts/install_git_hooks.py +71 -0
- package/scripts/install_steps/__init__.py +5 -0
- package/scripts/install_steps/ai_tools.py +261 -0
- package/scripts/install_steps/hooks.py +90 -0
- package/scripts/install_steps/markers.py +79 -0
- package/scripts/install_steps/symlinks.py +87 -0
- package/scripts/merge-hooks.py +192 -0
- package/scripts/plugin.py +642 -0
- package/scripts/plugin_schema.py +138 -0
- package/scripts/remove_rule.py +58 -0
- package/scripts/stats.py +81 -0
- package/scripts/sync.py +215 -0
- package/scripts/uninstall.py +292 -0
- package/scripts/validate.py +700 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-patterns
|
|
3
|
+
description: "Loaded when user asks about REST API design or GraphQL patterns"
|
|
4
|
+
effort: medium
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API Patterns Skill
|
|
9
|
+
|
|
10
|
+
## REST API Design
|
|
11
|
+
|
|
12
|
+
### Resource Naming
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
# Collection
|
|
16
|
+
GET /api/v1/documents # List documents
|
|
17
|
+
POST /api/v1/documents # Create document
|
|
18
|
+
|
|
19
|
+
# Single resource
|
|
20
|
+
GET /api/v1/documents/{id} # Get document
|
|
21
|
+
PUT /api/v1/documents/{id} # Replace document
|
|
22
|
+
PATCH /api/v1/documents/{id} # Update document
|
|
23
|
+
DELETE /api/v1/documents/{id} # Delete document
|
|
24
|
+
|
|
25
|
+
# Nested resources
|
|
26
|
+
GET /api/v1/users/{id}/documents # User's documents
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### HTTP Status Codes
|
|
30
|
+
|
|
31
|
+
| Code | Meaning | When to Use |
|
|
32
|
+
|------|---------|-------------|
|
|
33
|
+
| 200 | OK | Successful GET/PUT/PATCH |
|
|
34
|
+
| 201 | Created | Successful POST |
|
|
35
|
+
| 204 | No Content | Successful DELETE |
|
|
36
|
+
| 400 | Bad Request | Invalid input |
|
|
37
|
+
| 401 | Unauthorized | Missing/invalid auth |
|
|
38
|
+
| 403 | Forbidden | No permission |
|
|
39
|
+
| 404 | Not Found | Resource doesn't exist |
|
|
40
|
+
| 409 | Conflict | Duplicate resource |
|
|
41
|
+
| 422 | Unprocessable | Validation error |
|
|
42
|
+
| 429 | Too Many Requests | Rate limited |
|
|
43
|
+
| 500 | Internal Error | Server error |
|
|
44
|
+
|
|
45
|
+
### Response Format
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"data": {
|
|
50
|
+
"id": "123",
|
|
51
|
+
"type": "document",
|
|
52
|
+
"attributes": {
|
|
53
|
+
"title": "Example",
|
|
54
|
+
"content": "..."
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"meta": {
|
|
58
|
+
"total": 100,
|
|
59
|
+
"page": 1,
|
|
60
|
+
"per_page": 10
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Error Response
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"error": {
|
|
70
|
+
"code": "VALIDATION_ERROR",
|
|
71
|
+
"message": "Invalid input",
|
|
72
|
+
"details": [
|
|
73
|
+
{"field": "title", "message": "Title is required"},
|
|
74
|
+
{"field": "limit", "message": "Must be between 1 and 100"}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## FastAPI Implementation
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from fastapi import FastAPI, HTTPException, Query, Path
|
|
86
|
+
from pydantic import BaseModel, Field
|
|
87
|
+
|
|
88
|
+
app = FastAPI(title="RAG-MCP API", version="1.0.0")
|
|
89
|
+
|
|
90
|
+
class SearchRequest(BaseModel):
|
|
91
|
+
query: str = Field(..., min_length=1, description="Search query")
|
|
92
|
+
limit: int = Field(10, ge=1, le=100, description="Max results")
|
|
93
|
+
|
|
94
|
+
class SearchResult(BaseModel):
|
|
95
|
+
id: str
|
|
96
|
+
title: str
|
|
97
|
+
score: float
|
|
98
|
+
content: str
|
|
99
|
+
|
|
100
|
+
class SearchResponse(BaseModel):
|
|
101
|
+
results: list[SearchResult]
|
|
102
|
+
total: int
|
|
103
|
+
|
|
104
|
+
@app.post("/api/v1/search", response_model=SearchResponse)
|
|
105
|
+
async def search(request: SearchRequest):
|
|
106
|
+
"""Search the knowledge base.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
request: Search parameters
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Search results with scores
|
|
113
|
+
"""
|
|
114
|
+
try:
|
|
115
|
+
results = await perform_search(request.query, request.limit)
|
|
116
|
+
return SearchResponse(results=results, total=len(results))
|
|
117
|
+
except ValueError as e:
|
|
118
|
+
raise HTTPException(status_code=400, detail=str(e))
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## JSON-RPC 2.0 (MCP Pattern)
|
|
124
|
+
|
|
125
|
+
### Request
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"jsonrpc": "2.0",
|
|
130
|
+
"id": 1,
|
|
131
|
+
"method": "tools/call",
|
|
132
|
+
"params": {
|
|
133
|
+
"name": "search",
|
|
134
|
+
"arguments": {"query": "test"}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Success Response
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"jsonrpc": "2.0",
|
|
144
|
+
"id": 1,
|
|
145
|
+
"result": {
|
|
146
|
+
"content": [
|
|
147
|
+
{"type": "text", "text": "Results..."}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Error Response
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"jsonrpc": "2.0",
|
|
158
|
+
"id": 1,
|
|
159
|
+
"error": {
|
|
160
|
+
"code": -32602,
|
|
161
|
+
"message": "Invalid params",
|
|
162
|
+
"data": {"field": "query", "message": "Required"}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Pagination
|
|
170
|
+
|
|
171
|
+
### Offset-based
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
GET /api/v1/documents?page=2&per_page=20
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"data": [...],
|
|
180
|
+
"meta": {
|
|
181
|
+
"total": 150,
|
|
182
|
+
"page": 2,
|
|
183
|
+
"per_page": 20,
|
|
184
|
+
"total_pages": 8
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Cursor-based (Recommended for Large Datasets)
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
GET /api/v1/documents?cursor=abc123&limit=20
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"data": [...],
|
|
198
|
+
"meta": {
|
|
199
|
+
"next_cursor": "xyz789",
|
|
200
|
+
"has_more": true
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Rate Limiting
|
|
208
|
+
|
|
209
|
+
### Headers
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
X-RateLimit-Limit: 100
|
|
213
|
+
X-RateLimit-Remaining: 95
|
|
214
|
+
X-RateLimit-Reset: 1699999999
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Implementation
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
from fastapi import Request
|
|
221
|
+
from slowapi import Limiter
|
|
222
|
+
from slowapi.util import get_remote_address
|
|
223
|
+
|
|
224
|
+
limiter = Limiter(key_func=get_remote_address)
|
|
225
|
+
|
|
226
|
+
@app.get("/api/v1/search")
|
|
227
|
+
@limiter.limit("100/minute")
|
|
228
|
+
async def search(request: Request, query: str):
|
|
229
|
+
...
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Authentication
|
|
235
|
+
|
|
236
|
+
### API Key (Simple)
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
from fastapi import Depends, HTTPException, Security
|
|
240
|
+
from fastapi.security import APIKeyHeader
|
|
241
|
+
|
|
242
|
+
api_key_header = APIKeyHeader(name="X-API-Key")
|
|
243
|
+
|
|
244
|
+
async def verify_api_key(api_key: str = Security(api_key_header)):
|
|
245
|
+
if api_key != settings.API_KEY:
|
|
246
|
+
raise HTTPException(status_code=401, detail="Invalid API key")
|
|
247
|
+
return api_key
|
|
248
|
+
|
|
249
|
+
@app.get("/api/v1/protected")
|
|
250
|
+
async def protected_endpoint(api_key: str = Depends(verify_api_key)):
|
|
251
|
+
...
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### JWT (Production)
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
from fastapi import Depends
|
|
258
|
+
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
|
259
|
+
import jwt
|
|
260
|
+
|
|
261
|
+
security = HTTPBearer()
|
|
262
|
+
|
|
263
|
+
async def verify_jwt(credentials: HTTPAuthorizationCredentials = Depends(security)):
|
|
264
|
+
try:
|
|
265
|
+
payload = jwt.decode(
|
|
266
|
+
credentials.credentials,
|
|
267
|
+
settings.JWT_SECRET,
|
|
268
|
+
algorithms=["HS256"]
|
|
269
|
+
)
|
|
270
|
+
return payload
|
|
271
|
+
except jwt.InvalidTokenError:
|
|
272
|
+
raise HTTPException(status_code=401, detail="Invalid token")
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Versioning
|
|
278
|
+
|
|
279
|
+
### URL Path (Recommended)
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
/api/v1/documents
|
|
283
|
+
/api/v2/documents
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Header
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
Accept: application/vnd.myapi.v1+json
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Best Practices
|
|
295
|
+
|
|
296
|
+
- [ ] Use HTTPS only
|
|
297
|
+
- [ ] Version your API
|
|
298
|
+
- [ ] Validate all inputs
|
|
299
|
+
- [ ] Use proper HTTP methods and status codes
|
|
300
|
+
- [ ] Implement rate limiting
|
|
301
|
+
- [ ] Include pagination for lists
|
|
302
|
+
- [ ] Return consistent error format
|
|
303
|
+
- [ ] Document with OpenAPI/Swagger
|
|
304
|
+
- [ ] Log requests for debugging
|
|
305
|
+
- [ ] Set reasonable timeouts
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: app-builder
|
|
3
|
+
description: "Loaded when user asks to scaffold or build a full-stack app"
|
|
4
|
+
effort: medium
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# App Builder Skill
|
|
9
|
+
|
|
10
|
+
## Project Type Detection
|
|
11
|
+
|
|
12
|
+
| Keywords | Project Type | Primary Agents |
|
|
13
|
+
|----------|--------------|----------------|
|
|
14
|
+
| landing, website, marketing | Static Site | frontend-specialist |
|
|
15
|
+
| dashboard, admin, crud | Web App | frontend + backend |
|
|
16
|
+
| api, rest, graphql | API Only | backend-specialist |
|
|
17
|
+
| mobile, ios, android | Mobile App | mobile-developer |
|
|
18
|
+
| cli, command, terminal | CLI Tool | backend-specialist |
|
|
19
|
+
| game, unity, godot | Game | game-developer |
|
|
20
|
+
| ai, ml, rag | AI/ML | rag-engineer |
|
|
21
|
+
| e-commerce, shop, store | E-commerce | backend + frontend |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Tech Stack Selection (2025)
|
|
26
|
+
|
|
27
|
+
### Web Applications
|
|
28
|
+
|
|
29
|
+
| Scenario | Stack |
|
|
30
|
+
|----------|-------|
|
|
31
|
+
| Full-stack, SSR | Next.js 14+ (App Router) |
|
|
32
|
+
| SPA with API | React + Vite |
|
|
33
|
+
| Vue ecosystem | Nuxt 3 |
|
|
34
|
+
| Static/Blog | Astro |
|
|
35
|
+
| E-commerce | Next.js + Medusa/Shopify |
|
|
36
|
+
|
|
37
|
+
### Mobile Applications
|
|
38
|
+
|
|
39
|
+
| Scenario | Stack |
|
|
40
|
+
|----------|-------|
|
|
41
|
+
| Cross-platform (JS team) | React Native + Expo |
|
|
42
|
+
| Cross-platform (any) | Flutter |
|
|
43
|
+
| iOS only | SwiftUI |
|
|
44
|
+
| Android only | Kotlin + Jetpack Compose |
|
|
45
|
+
|
|
46
|
+
### Backend/API
|
|
47
|
+
|
|
48
|
+
| Scenario | Stack |
|
|
49
|
+
|----------|-------|
|
|
50
|
+
| Node.js, edge-ready | Hono |
|
|
51
|
+
| Node.js, high perf | Fastify |
|
|
52
|
+
| Python, async | FastAPI |
|
|
53
|
+
| PHP, full-featured | Laravel |
|
|
54
|
+
| E-commerce | Magento/Sylius/PrestaShop |
|
|
55
|
+
|
|
56
|
+
### Database
|
|
57
|
+
|
|
58
|
+
| Scenario | Stack |
|
|
59
|
+
|----------|-------|
|
|
60
|
+
| General purpose | PostgreSQL |
|
|
61
|
+
| Serverless | Neon (PG), Turso (SQLite) |
|
|
62
|
+
| Document store | MongoDB |
|
|
63
|
+
| Vector search | PostgreSQL + pgvector |
|
|
64
|
+
| Cache | Redis / Upstash |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Project Templates
|
|
69
|
+
|
|
70
|
+
### Next.js Full-Stack
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
project/
|
|
74
|
+
├── src/
|
|
75
|
+
│ ├── app/ # App Router
|
|
76
|
+
│ │ ├── (auth)/ # Auth group
|
|
77
|
+
│ │ ├── api/ # API routes
|
|
78
|
+
│ │ ├── layout.tsx
|
|
79
|
+
│ │ └── page.tsx
|
|
80
|
+
│ ├── components/ # Shared components
|
|
81
|
+
│ │ └── ui/ # UI primitives
|
|
82
|
+
│ ├── lib/ # Utilities
|
|
83
|
+
│ └── server/ # Server-only code
|
|
84
|
+
├── prisma/ # Database schema
|
|
85
|
+
├── public/
|
|
86
|
+
├── next.config.ts
|
|
87
|
+
├── tailwind.config.ts
|
|
88
|
+
└── package.json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### FastAPI Backend
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
project/
|
|
95
|
+
├── app/
|
|
96
|
+
│ ├── api/
|
|
97
|
+
│ │ └── v1/
|
|
98
|
+
│ │ └── endpoints/
|
|
99
|
+
│ ├── core/ # Config, security
|
|
100
|
+
│ ├── models/ # Pydantic models
|
|
101
|
+
│ ├── db/ # Database
|
|
102
|
+
│ └── main.py
|
|
103
|
+
├── tests/
|
|
104
|
+
├── alembic/ # Migrations
|
|
105
|
+
├── pyproject.toml
|
|
106
|
+
└── Dockerfile
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### React Native + Expo
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
project/
|
|
113
|
+
├── app/ # Expo Router
|
|
114
|
+
│ ├── (tabs)/
|
|
115
|
+
│ ├── _layout.tsx
|
|
116
|
+
│ └── index.tsx
|
|
117
|
+
├── components/
|
|
118
|
+
├── hooks/
|
|
119
|
+
├── store/ # State management
|
|
120
|
+
├── services/ # API clients
|
|
121
|
+
├── app.json
|
|
122
|
+
└── package.json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Agent Coordination
|
|
128
|
+
|
|
129
|
+
### New Project Flow
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
1. project-planner → Task breakdown
|
|
133
|
+
2. database-architect → Schema design
|
|
134
|
+
3. backend-specialist → API implementation
|
|
135
|
+
4. frontend-specialist → UI implementation
|
|
136
|
+
5. test-engineer → Test coverage
|
|
137
|
+
6. devops-implementer → Deployment
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Feature Addition Flow
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
1. explorer-agent → Understand codebase
|
|
144
|
+
2. project-planner → Plan changes
|
|
145
|
+
3. [appropriate agent] → Implement
|
|
146
|
+
4. test-engineer → Add tests
|
|
147
|
+
5. code-reviewer → Review
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Common Patterns
|
|
153
|
+
|
|
154
|
+
### Authentication
|
|
155
|
+
- JWT for APIs
|
|
156
|
+
- Session for web apps
|
|
157
|
+
- OAuth for third-party
|
|
158
|
+
|
|
159
|
+
### State Management
|
|
160
|
+
- Server state: TanStack Query
|
|
161
|
+
- Client state: Zustand/Jotai
|
|
162
|
+
- Form state: React Hook Form
|
|
163
|
+
|
|
164
|
+
### Styling
|
|
165
|
+
- Tailwind CSS as default
|
|
166
|
+
- CSS Modules for isolation
|
|
167
|
+
- Styled Components for dynamic
|
|
168
|
+
|
|
169
|
+
### Testing
|
|
170
|
+
- Unit: Jest/Vitest
|
|
171
|
+
- E2E: Playwright
|
|
172
|
+
- API: Supertest
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Best Practices
|
|
177
|
+
|
|
178
|
+
- ✅ Start with TypeScript
|
|
179
|
+
- ✅ Add linting (ESLint/Biome)
|
|
180
|
+
- ✅ Use environment variables
|
|
181
|
+
- ✅ Set up CI/CD from start
|
|
182
|
+
- ✅ Document as you build
|
|
183
|
+
|
|
184
|
+
- ❌ Don't skip tests
|
|
185
|
+
- ❌ Don't hardcode config
|
|
186
|
+
- ❌ Don't ignore accessibility
|
|
187
|
+
- ❌ Don't over-engineer early
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-audit
|
|
3
|
+
description: "Explore codebase organically for architectural friction, discover shallow modules, and propose module-deepening refactors as GitHub issue RFCs using parallel sub-agent interface designs. Use when user wants to improve architecture, find shallow modules, deepen modules, or reduce coupling."
|
|
4
|
+
user-invocable: true
|
|
5
|
+
effort: high
|
|
6
|
+
argument-hint: "[area to audit or 'full codebase']"
|
|
7
|
+
allowed-tools: Read, Grep, Glob, Bash, Agent
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Architecture Audit
|
|
11
|
+
|
|
12
|
+
$ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Explore a codebase organically, surface architectural friction, and propose module-deepening refactors as GitHub issue RFCs.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
/architecture-audit [area to audit or 'full codebase']
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What This Command Does
|
|
23
|
+
|
|
24
|
+
1. **Explores** codebase organically — friction IS the signal
|
|
25
|
+
2. **Presents** deepening candidates to user
|
|
26
|
+
3. **Frames** problem space for chosen candidate
|
|
27
|
+
4. **Spawns** 3+ parallel sub-agents for radically different interface designs
|
|
28
|
+
5. **Compares** and recommends
|
|
29
|
+
6. **Files** RFC as GitHub issue
|
|
30
|
+
|
|
31
|
+
## Key Concept
|
|
32
|
+
|
|
33
|
+
A **deep module** (Ousterhout) has a small interface hiding a large implementation. Deep modules enhance testability, AI navigation, and enable boundary testing.
|
|
34
|
+
|
|
35
|
+
A **shallow module** has a large interface with thin implementation — avoid.
|
|
36
|
+
|
|
37
|
+
## Process
|
|
38
|
+
|
|
39
|
+
### 1. Organic Exploration
|
|
40
|
+
|
|
41
|
+
Use Agent (subagent_type=Explore) to navigate the codebase naturally. Note friction:
|
|
42
|
+
|
|
43
|
+
- Where does understanding one concept require bouncing between many small files?
|
|
44
|
+
- Where are modules so shallow the interface is nearly as complex as the implementation?
|
|
45
|
+
- Where have pure functions been extracted just for testability but real bugs hide in how they're called?
|
|
46
|
+
- Where do tightly-coupled modules create integration risk in the seams?
|
|
47
|
+
- What is untested or hard to test?
|
|
48
|
+
|
|
49
|
+
### 2. Present Candidates
|
|
50
|
+
|
|
51
|
+
Numbered list. For each candidate show:
|
|
52
|
+
|
|
53
|
+
| Field | Content |
|
|
54
|
+
|-------|---------|
|
|
55
|
+
| Cluster | Which modules/concepts are involved |
|
|
56
|
+
| Why coupled | Shared types, call patterns, co-ownership |
|
|
57
|
+
| Dependency category | In-process, Local-substitutable, Ports & Adapters, or True external (see reference/) |
|
|
58
|
+
| Test impact | What existing tests would be replaced by boundary tests |
|
|
59
|
+
|
|
60
|
+
Do NOT propose interfaces yet. Ask: "Which would you like to explore?"
|
|
61
|
+
|
|
62
|
+
### 3. Frame the Problem Space
|
|
63
|
+
|
|
64
|
+
For the chosen candidate, write a user-facing explanation:
|
|
65
|
+
- Constraints any new interface would satisfy
|
|
66
|
+
- Dependencies it would rely on
|
|
67
|
+
- Rough illustrative code sketch (not a proposal — just grounding)
|
|
68
|
+
|
|
69
|
+
Show to user, then immediately proceed to step 4.
|
|
70
|
+
|
|
71
|
+
### 4. Design Multiple Interfaces
|
|
72
|
+
|
|
73
|
+
Spawn 3+ sub-agents in parallel via Agent tool. Each gets a different constraint:
|
|
74
|
+
|
|
75
|
+
| Agent | Constraint |
|
|
76
|
+
|-------|-----------|
|
|
77
|
+
| Agent 1 | Minimize interface — 1-3 entry points max |
|
|
78
|
+
| Agent 2 | Maximize flexibility — many use cases and extension |
|
|
79
|
+
| Agent 3 | Optimize for most common caller — default case trivial |
|
|
80
|
+
| Agent 4 | Ports & adapters pattern (if cross-boundary) |
|
|
81
|
+
|
|
82
|
+
Each outputs: interface signature, usage example, what it hides, dependency strategy, trade-offs.
|
|
83
|
+
|
|
84
|
+
Present sequentially, compare in prose, give opinionated recommendation.
|
|
85
|
+
|
|
86
|
+
### 5. Create GitHub Issue RFC
|
|
87
|
+
|
|
88
|
+
Use `gh issue create` with template below. Don't ask for review.
|
|
89
|
+
|
|
90
|
+
## Issue Template
|
|
91
|
+
|
|
92
|
+
<issue-template>
|
|
93
|
+
|
|
94
|
+
## Problem
|
|
95
|
+
|
|
96
|
+
Architectural friction:
|
|
97
|
+
- Which modules are shallow and tightly coupled
|
|
98
|
+
- Integration risk in the seams
|
|
99
|
+
- Why this makes the codebase harder to navigate/maintain
|
|
100
|
+
|
|
101
|
+
## Proposed Interface
|
|
102
|
+
|
|
103
|
+
- Interface signature (types, methods, params)
|
|
104
|
+
- Usage example
|
|
105
|
+
- What complexity it hides
|
|
106
|
+
|
|
107
|
+
## Dependency Strategy
|
|
108
|
+
|
|
109
|
+
- **In-process**: merged directly
|
|
110
|
+
- **Local-substitutable**: tested with [specific stand-in]
|
|
111
|
+
- **Ports & adapters**: port definition, production adapter, test adapter
|
|
112
|
+
- **Mock**: mock boundary for external services
|
|
113
|
+
|
|
114
|
+
## Testing Strategy
|
|
115
|
+
|
|
116
|
+
- New boundary tests to write
|
|
117
|
+
- Old shallow tests to delete
|
|
118
|
+
- Test environment needs
|
|
119
|
+
|
|
120
|
+
## Implementation Recommendations
|
|
121
|
+
|
|
122
|
+
Durable guidance NOT coupled to file paths:
|
|
123
|
+
- What the module should own
|
|
124
|
+
- What it should hide
|
|
125
|
+
- What it should expose
|
|
126
|
+
- How callers migrate
|
|
127
|
+
|
|
128
|
+
</issue-template>
|
|
129
|
+
|
|
130
|
+
## Dependency Categories
|
|
131
|
+
|
|
132
|
+
| Category | Description | Deepenable? |
|
|
133
|
+
|----------|-------------|-------------|
|
|
134
|
+
| In-process | Pure computation, no I/O | Always |
|
|
135
|
+
| Local-substitutable | Has local test stand-ins (PGLite, in-memory FS) | If stand-in exists |
|
|
136
|
+
| Remote but owned | Your services across network (Ports & Adapters) | Via port injection |
|
|
137
|
+
| True external | Third-party (Stripe, Twilio) — mock at boundary | Via mock injection |
|
|
138
|
+
|
|
139
|
+
## Testing Principle
|
|
140
|
+
|
|
141
|
+
**Replace, don't layer.** Old unit tests on shallow modules are waste once boundary tests exist — delete them. Tests assert on observable outcomes through public interface, not internal state.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-decision
|
|
3
|
+
description: "Loaded when user asks about architecture decisions or architecture note writing"
|
|
4
|
+
effort: medium
|
|
5
|
+
user-invocable: false
|
|
6
|
+
allowed-tools: Read, Write
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Architecture Decision Skill
|
|
10
|
+
|
|
11
|
+
## Core Philosophy: "Everything is a Trade-off"
|
|
12
|
+
There are no "best solutions", only solutions with the right set of trade-offs for the specific context.
|
|
13
|
+
|
|
14
|
+
## Decision Making Process (RFD / RFC)
|
|
15
|
+
1. **Context**: What is the problem? Why now?
|
|
16
|
+
2. **Constraints**: Budget, Time, Skillset, Legacy.
|
|
17
|
+
3. **Options**: Propose at least 3 viable options.
|
|
18
|
+
4. **Trade-off Analysis**: Compare constraints vs options.
|
|
19
|
+
5. **Recommendation**: Choose one and justify.
|
|
20
|
+
|
|
21
|
+
## Trade-off Analysis Matrix (Template)
|
|
22
|
+
|
|
23
|
+
| Feature | Option A (e.g. SQL) | Option B (e.g. NoSQL) | Option C (e.g. File) |
|
|
24
|
+
|---------|---------------------|-----------------------|----------------------|
|
|
25
|
+
| **Scalability** | Medium (Vertical) | High (Horizontal) | Low |
|
|
26
|
+
| **Consistency** | Strong (ACID) | Eventual (BASE) | N/A |
|
|
27
|
+
| **Complexity** | Low (Known) | Medium (New tech) | Low |
|
|
28
|
+
| **Cost** | $$ | $$$ | $ |
|
|
29
|
+
|
|
30
|
+
## Architecture Note
|
|
31
|
+
When a decision is made, document it.
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
# Architecture Note: Use PostgreSQL for Main Database
|
|
35
|
+
|
|
36
|
+
## Status
|
|
37
|
+
Accepted
|
|
38
|
+
|
|
39
|
+
## Context
|
|
40
|
+
We need a reliable, relational database for user data...
|
|
41
|
+
|
|
42
|
+
## Decision
|
|
43
|
+
We will use PostgreSQL 16.
|
|
44
|
+
|
|
45
|
+
## Consequences
|
|
46
|
+
- Positive: ACID compliance, rich ecosystem.
|
|
47
|
+
- Negative: Scaling writes requires sharding later.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Critical Factors to Evaluate
|
|
51
|
+
- **Reliability** (Availability, Fault tolerance)
|
|
52
|
+
- **Scalability** (Throughput, Latency)
|
|
53
|
+
- **Maintainability** (Simple vs Easy, Ecosystem)
|
|
54
|
+
- **Security** (AuthN/Z, Encryption)
|
|
55
|
+
- **Cost** (Infrastructure, License, Cognitive load)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Architecture Note: [Title]
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
[Draft | Accepted | Deprecated | Superseded]
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
[What is the issue that we're seeing that is motivating this decision or change?]
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
[What is the change that we're proposing and/or doing?]
|
|
14
|
+
|
|
15
|
+
## Consequences
|
|
16
|
+
|
|
17
|
+
### Positive
|
|
18
|
+
- [Benefit 1]
|
|
19
|
+
- [Benefit 2]
|
|
20
|
+
|
|
21
|
+
### Negative
|
|
22
|
+
- [Drawback 1]
|
|
23
|
+
- [Drawback 2]
|
|
24
|
+
|
|
25
|
+
### Risks
|
|
26
|
+
- [Risk 1 and mitigation]
|
|
27
|
+
|
|
28
|
+
## Alternatives Considered
|
|
29
|
+
|
|
30
|
+
### Option A: [Name]
|
|
31
|
+
- Pros: [...]
|
|
32
|
+
- Cons: [...]
|
|
33
|
+
|
|
34
|
+
### Option B: [Name]
|
|
35
|
+
- Pros: [...]
|
|
36
|
+
- Cons: [...]
|