@mohammadhprp/system-prompt 0.10.1
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 +35 -0
- package/bin/system-prompt.js +8 -0
- package/framework/README.md +163 -0
- package/framework/agents/README.md +49 -0
- package/framework/agents/backend-architect.md +146 -0
- package/framework/agents/researcher.md +79 -0
- package/framework/agents/reviewer.md +183 -0
- package/framework/agents/security-auditor.md +131 -0
- package/framework/commands/README.md +43 -0
- package/framework/commands/changelog.md +44 -0
- package/framework/commands/commit.md +31 -0
- package/framework/commands/learn.md +24 -0
- package/framework/commands/mr.md +46 -0
- package/framework/commands/pr.md +39 -0
- package/framework/commands/release.md +34 -0
- package/framework/commands/review.md +24 -0
- package/framework/commands/summarize-changes.md +49 -0
- package/framework/mcps/README.md +78 -0
- package/framework/mcps/excalidraw/README.md +37 -0
- package/framework/mcps/excalidraw/capabilities.md +54 -0
- package/framework/mcps/excalidraw/configs/opencode.json +8 -0
- package/framework/mcps/excalidraw/install.md +92 -0
- package/framework/mcps/excalidraw/troubleshooting.md +67 -0
- package/framework/mcps/figma-mcp-go/README.md +51 -0
- package/framework/mcps/figma-mcp-go/capabilities.md +190 -0
- package/framework/mcps/figma-mcp-go/configs/opencode.json +9 -0
- package/framework/mcps/figma-mcp-go/install.md +74 -0
- package/framework/mcps/figma-mcp-go/troubleshooting.md +99 -0
- package/framework/mcps/github-mcp/README.md +51 -0
- package/framework/mcps/github-mcp/capabilities.md +83 -0
- package/framework/mcps/github-mcp/configs/.env.example +1 -0
- package/framework/mcps/github-mcp/configs/opencode.json +13 -0
- package/framework/mcps/github-mcp/install.md +60 -0
- package/framework/mcps/github-mcp/troubleshooting.md +79 -0
- package/framework/mcps/gitlab-mcp/README.md +54 -0
- package/framework/mcps/gitlab-mcp/capabilities.md +216 -0
- package/framework/mcps/gitlab-mcp/configs/.env.example +2 -0
- package/framework/mcps/gitlab-mcp/configs/opencode.json +13 -0
- package/framework/mcps/gitlab-mcp/install.md +99 -0
- package/framework/mcps/gitlab-mcp/troubleshooting.md +116 -0
- package/framework/mcps/jira-mcp/README.md +53 -0
- package/framework/mcps/jira-mcp/capabilities.md +79 -0
- package/framework/mcps/jira-mcp/configs/.env.example +2 -0
- package/framework/mcps/jira-mcp/configs/opencode.json +13 -0
- package/framework/mcps/jira-mcp/install.md +94 -0
- package/framework/mcps/jira-mcp/troubleshooting.md +113 -0
- package/framework/mcps/laravel-boost/README.md +53 -0
- package/framework/mcps/laravel-boost/capabilities.md +92 -0
- package/framework/mcps/laravel-boost/configs/opencode.json +9 -0
- package/framework/mcps/laravel-boost/install.md +106 -0
- package/framework/mcps/laravel-boost/troubleshooting.md +119 -0
- package/framework/mcps/notion-mcp/README.md +58 -0
- package/framework/mcps/notion-mcp/capabilities.md +118 -0
- package/framework/mcps/notion-mcp/configs/opencode.json +9 -0
- package/framework/mcps/notion-mcp/install.md +70 -0
- package/framework/mcps/notion-mcp/troubleshooting.md +95 -0
- package/framework/mcps/playwright-mcp/README.md +50 -0
- package/framework/mcps/playwright-mcp/capabilities.md +149 -0
- package/framework/mcps/playwright-mcp/configs/opencode.json +9 -0
- package/framework/mcps/playwright-mcp/install.md +136 -0
- package/framework/mcps/playwright-mcp/troubleshooting.md +154 -0
- package/framework/mcps/supabase-mcp/README.md +66 -0
- package/framework/mcps/supabase-mcp/capabilities.md +127 -0
- package/framework/mcps/supabase-mcp/configs/opencode.json +9 -0
- package/framework/mcps/supabase-mcp/install.md +85 -0
- package/framework/mcps/supabase-mcp/troubleshooting.md +113 -0
- package/framework/memory/README.md +17 -0
- package/framework/memory/codebase-insights.md +6 -0
- package/framework/memory/user-preferences.md +5 -0
- package/framework/modes/README.md +52 -0
- package/framework/modes/audit.md +88 -0
- package/framework/plugins/README.md +65 -0
- package/framework/plugins/opencode-goal-plugin/README.md +45 -0
- package/framework/plugins/opencode-goal-plugin/capabilities.md +127 -0
- package/framework/plugins/opencode-goal-plugin/install.md +71 -0
- package/framework/plugins/opencode-goal-plugin/troubleshooting.md +112 -0
- package/framework/plugins/ponytail/README.md +44 -0
- package/framework/plugins/ponytail/capabilities.md +112 -0
- package/framework/plugins/ponytail/install.md +77 -0
- package/framework/plugins/ponytail/troubleshooting.md +116 -0
- package/framework/references/standards/api.md +44 -0
- package/framework/references/standards/architecture.md +43 -0
- package/framework/references/standards/database.md +43 -0
- package/framework/references/standards/debugging.md +44 -0
- package/framework/references/standards/documentation.md +43 -0
- package/framework/references/standards/logging.md +43 -0
- package/framework/references/standards/naming.md +43 -0
- package/framework/references/standards/observability.md +43 -0
- package/framework/references/standards/performance.md +43 -0
- package/framework/references/standards/pull-requests.md +43 -0
- package/framework/references/standards/security.md +43 -0
- package/framework/references/standards/testing.md +43 -0
- package/framework/references/templates/adr.md +28 -0
- package/framework/references/templates/api-spec.md +56 -0
- package/framework/references/templates/design-document.md +39 -0
- package/framework/references/templates/incident-report.md +38 -0
- package/framework/references/templates/postmortem.md +41 -0
- package/framework/references/templates/pull-request.md +34 -0
- package/framework/references/templates/runbook.md +48 -0
- package/framework/references/templates/task.md +27 -0
- package/framework/skills/README.md +68 -0
- package/framework/skills/agent-browser/SKILL.md +51 -0
- package/framework/skills/backend-best-practices/SKILL.md +136 -0
- package/framework/skills/backend-best-practices/examples.md +31 -0
- package/framework/skills/backend-best-practices/references/api-design.md +79 -0
- package/framework/skills/backend-best-practices/references/architecture-review.md +77 -0
- package/framework/skills/backend-best-practices/references/database-design.md +78 -0
- package/framework/skills/backend-best-practices/references/debugging.md +76 -0
- package/framework/skills/backend-best-practices/references/observability.md +78 -0
- package/framework/skills/backend-best-practices/references/performance.md +78 -0
- package/framework/skills/backend-best-practices/references/refactoring.md +77 -0
- package/framework/skills/backend-best-practices/references/security.md +80 -0
- package/framework/skills/backend-best-practices/references/testing.md +77 -0
- package/framework/skills/backend-engineer/SKILL.md +76 -0
- package/framework/skills/backend-engineer/examples.md +31 -0
- package/framework/skills/brainstorming/SKILL.md +159 -0
- package/framework/skills/brainstorming/examples.md +49 -0
- package/framework/skills/brainstorming/scripts/frame-template.html +213 -0
- package/framework/skills/brainstorming/scripts/helper.js +167 -0
- package/framework/skills/brainstorming/scripts/server.cjs +723 -0
- package/framework/skills/brainstorming/scripts/start-server.sh +209 -0
- package/framework/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/framework/skills/brainstorming/visual-companion.md +291 -0
- package/framework/skills/brand-guidelines/LICENSE.txt +202 -0
- package/framework/skills/brand-guidelines/SKILL.md +73 -0
- package/framework/skills/code-review/SKILL.md +72 -0
- package/framework/skills/code-review/examples.md +31 -0
- package/framework/skills/design/SKILL.md +399 -0
- package/framework/skills/design/examples.md +34 -0
- package/framework/skills/diagram-design/SKILL.md +485 -0
- package/framework/skills/diagram-design/assets/example-architecture-dark.html +180 -0
- package/framework/skills/diagram-design/assets/example-architecture-full.html +192 -0
- package/framework/skills/diagram-design/assets/example-architecture.html +181 -0
- package/framework/skills/diagram-design/assets/example-bar-dark.html +127 -0
- package/framework/skills/diagram-design/assets/example-bar-full.html +103 -0
- package/framework/skills/diagram-design/assets/example-bar.html +127 -0
- package/framework/skills/diagram-design/assets/example-data-flow-dark.html +143 -0
- package/framework/skills/diagram-design/assets/example-data-flow-full.html +185 -0
- package/framework/skills/diagram-design/assets/example-data-flow.html +143 -0
- package/framework/skills/diagram-design/assets/example-datalake-dark.html +241 -0
- package/framework/skills/diagram-design/assets/example-datalake-full.html +246 -0
- package/framework/skills/diagram-design/assets/example-datalake.html +267 -0
- package/framework/skills/diagram-design/assets/example-dp-integration-dark.html +78 -0
- package/framework/skills/diagram-design/assets/example-dp-integration-full.html +88 -0
- package/framework/skills/diagram-design/assets/example-dp-integration.html +78 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix-dark.html +31 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix-full.html +32 -0
- package/framework/skills/diagram-design/assets/example-dp-security-matrix.html +88 -0
- package/framework/skills/diagram-design/assets/example-er-dark.html +200 -0
- package/framework/skills/diagram-design/assets/example-er-full.html +203 -0
- package/framework/skills/diagram-design/assets/example-er.html +200 -0
- package/framework/skills/diagram-design/assets/example-flowchart-dark.html +154 -0
- package/framework/skills/diagram-design/assets/example-flowchart-full.html +157 -0
- package/framework/skills/diagram-design/assets/example-flowchart.html +154 -0
- package/framework/skills/diagram-design/assets/example-gantt-dark.html +135 -0
- package/framework/skills/diagram-design/assets/example-gantt-full.html +125 -0
- package/framework/skills/diagram-design/assets/example-gantt.html +135 -0
- package/framework/skills/diagram-design/assets/example-high-level-dark.html +249 -0
- package/framework/skills/diagram-design/assets/example-high-level-full.html +245 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical-dark.html +272 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical-full.html +250 -0
- package/framework/skills/diagram-design/assets/example-high-level-vertical.html +323 -0
- package/framework/skills/diagram-design/assets/example-high-level.html +299 -0
- package/framework/skills/diagram-design/assets/example-it-state-dark.html +90 -0
- package/framework/skills/diagram-design/assets/example-it-state-full.html +69 -0
- package/framework/skills/diagram-design/assets/example-it-state.html +128 -0
- package/framework/skills/diagram-design/assets/example-layers-dark.html +121 -0
- package/framework/skills/diagram-design/assets/example-layers-full.html +124 -0
- package/framework/skills/diagram-design/assets/example-layers.html +121 -0
- package/framework/skills/diagram-design/assets/example-line-dark.html +109 -0
- package/framework/skills/diagram-design/assets/example-line-full.html +103 -0
- package/framework/skills/diagram-design/assets/example-line.html +109 -0
- package/framework/skills/diagram-design/assets/example-loop-dark.html +100 -0
- package/framework/skills/diagram-design/assets/example-loop-full.html +137 -0
- package/framework/skills/diagram-design/assets/example-loop-terminal.html +347 -0
- package/framework/skills/diagram-design/assets/example-loop.html +100 -0
- package/framework/skills/diagram-design/assets/example-medallion-dark.html +159 -0
- package/framework/skills/diagram-design/assets/example-medallion-full.html +201 -0
- package/framework/skills/diagram-design/assets/example-medallion.html +159 -0
- package/framework/skills/diagram-design/assets/example-nested-dark.html +130 -0
- package/framework/skills/diagram-design/assets/example-nested-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-nested.html +134 -0
- package/framework/skills/diagram-design/assets/example-org-chart-dark.html +45 -0
- package/framework/skills/diagram-design/assets/example-org-chart-full.html +45 -0
- package/framework/skills/diagram-design/assets/example-org-chart.html +45 -0
- package/framework/skills/diagram-design/assets/example-process-dark.html +62 -0
- package/framework/skills/diagram-design/assets/example-process-full.html +72 -0
- package/framework/skills/diagram-design/assets/example-process.html +62 -0
- package/framework/skills/diagram-design/assets/example-pyramid-dark.html +117 -0
- package/framework/skills/diagram-design/assets/example-pyramid-full.html +120 -0
- package/framework/skills/diagram-design/assets/example-pyramid.html +117 -0
- package/framework/skills/diagram-design/assets/example-quadrant-consultant.html +164 -0
- package/framework/skills/diagram-design/assets/example-quadrant-dark.html +133 -0
- package/framework/skills/diagram-design/assets/example-quadrant-full.html +136 -0
- package/framework/skills/diagram-design/assets/example-quadrant.html +133 -0
- package/framework/skills/diagram-design/assets/example-radar-dark.html +137 -0
- package/framework/skills/diagram-design/assets/example-radar-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-radar.html +137 -0
- package/framework/skills/diagram-design/assets/example-scatter-dark.html +139 -0
- package/framework/skills/diagram-design/assets/example-scatter-full.html +114 -0
- package/framework/skills/diagram-design/assets/example-scatter.html +139 -0
- package/framework/skills/diagram-design/assets/example-sequence-dark.html +220 -0
- package/framework/skills/diagram-design/assets/example-sequence-full.html +386 -0
- package/framework/skills/diagram-design/assets/example-sequence.html +220 -0
- package/framework/skills/diagram-design/assets/example-state-dark.html +145 -0
- package/framework/skills/diagram-design/assets/example-state-full.html +148 -0
- package/framework/skills/diagram-design/assets/example-state.html +145 -0
- package/framework/skills/diagram-design/assets/example-swimlane-dark.html +170 -0
- package/framework/skills/diagram-design/assets/example-swimlane-full.html +173 -0
- package/framework/skills/diagram-design/assets/example-swimlane.html +170 -0
- package/framework/skills/diagram-design/assets/example-timeline-dark.html +133 -0
- package/framework/skills/diagram-design/assets/example-timeline-full.html +136 -0
- package/framework/skills/diagram-design/assets/example-timeline.html +133 -0
- package/framework/skills/diagram-design/assets/example-tree-dark.html +171 -0
- package/framework/skills/diagram-design/assets/example-tree-full.html +174 -0
- package/framework/skills/diagram-design/assets/example-tree.html +171 -0
- package/framework/skills/diagram-design/assets/example-venn-dark.html +130 -0
- package/framework/skills/diagram-design/assets/example-venn-full.html +133 -0
- package/framework/skills/diagram-design/assets/example-venn.html +108 -0
- package/framework/skills/diagram-design/assets/icons.html +230 -0
- package/framework/skills/diagram-design/assets/index.html +333 -0
- package/framework/skills/diagram-design/assets/template-dark.html +82 -0
- package/framework/skills/diagram-design/assets/template-full.html +410 -0
- package/framework/skills/diagram-design/assets/template-terminal.html +170 -0
- package/framework/skills/diagram-design/assets/template.html +83 -0
- package/framework/skills/diagram-design/references/export.md +107 -0
- package/framework/skills/diagram-design/references/onboarding.md +268 -0
- package/framework/skills/diagram-design/references/primitive-annotation.md +36 -0
- package/framework/skills/diagram-design/references/primitive-icons.md +821 -0
- package/framework/skills/diagram-design/references/primitive-sketchy.md +43 -0
- package/framework/skills/diagram-design/references/primitive-terminal.md +76 -0
- package/framework/skills/diagram-design/references/style-guide.md +139 -0
- package/framework/skills/diagram-design/references/type-architecture.md +78 -0
- package/framework/skills/diagram-design/references/type-bar.md +48 -0
- package/framework/skills/diagram-design/references/type-data-flow.md +374 -0
- package/framework/skills/diagram-design/references/type-dp-integration.md +410 -0
- package/framework/skills/diagram-design/references/type-dp-security-matrix.md +379 -0
- package/framework/skills/diagram-design/references/type-er.md +23 -0
- package/framework/skills/diagram-design/references/type-flowchart.md +23 -0
- package/framework/skills/diagram-design/references/type-gantt.md +45 -0
- package/framework/skills/diagram-design/references/type-high-level.md +458 -0
- package/framework/skills/diagram-design/references/type-it-state.md +470 -0
- package/framework/skills/diagram-design/references/type-layers.md +26 -0
- package/framework/skills/diagram-design/references/type-line.md +44 -0
- package/framework/skills/diagram-design/references/type-loop.md +223 -0
- package/framework/skills/diagram-design/references/type-medallion.md +356 -0
- package/framework/skills/diagram-design/references/type-nested.md +22 -0
- package/framework/skills/diagram-design/references/type-org-chart.md +44 -0
- package/framework/skills/diagram-design/references/type-process.md +495 -0
- package/framework/skills/diagram-design/references/type-pyramid.md +33 -0
- package/framework/skills/diagram-design/references/type-quadrant.md +81 -0
- package/framework/skills/diagram-design/references/type-radar.md +80 -0
- package/framework/skills/diagram-design/references/type-scatter.md +39 -0
- package/framework/skills/diagram-design/references/type-sequence.md +35 -0
- package/framework/skills/diagram-design/references/type-state.md +21 -0
- package/framework/skills/diagram-design/references/type-swimlane.md +20 -0
- package/framework/skills/diagram-design/references/type-timeline.md +20 -0
- package/framework/skills/diagram-design/references/type-tree.md +24 -0
- package/framework/skills/diagram-design/references/type-venn.md +26 -0
- package/framework/skills/documentation/SKILL.md +74 -0
- package/framework/skills/documentation/examples.md +31 -0
- package/framework/skills/find-skills/SKILL.md +141 -0
- package/framework/skills/find-skills/examples.md +35 -0
- package/framework/skills/gitlab-mcp/SKILL.md +83 -0
- package/framework/skills/gitlab-mcp/examples.md +31 -0
- package/framework/skills/gitlab-mcp/references/code-review.md +110 -0
- package/framework/skills/gitlab-mcp/references/issues.md +141 -0
- package/framework/skills/gitlab-mcp/references/merge-requests.md +120 -0
- package/framework/skills/gitlab-mcp/references/pipelines.md +67 -0
- package/framework/skills/gitlab-mcp/references/search.md +17 -0
- package/framework/skills/gitlab-mcp/references/webhooks.md +32 -0
- package/framework/skills/gitlab-mcp/references/work-items.md +50 -0
- package/framework/skills/jira-mcp/SKILL.md +57 -0
- package/framework/skills/jira-mcp/examples.md +31 -0
- package/framework/skills/jira-mcp/references/comments.md +27 -0
- package/framework/skills/jira-mcp/references/issues.md +97 -0
- package/framework/skills/jira-mcp/references/projects.md +39 -0
- package/framework/skills/laravel-best-practices/SKILL.md +229 -0
- package/framework/skills/laravel-best-practices/examples.md +31 -0
- package/framework/skills/laravel-best-practices/references/advanced-queries.md +106 -0
- package/framework/skills/laravel-best-practices/references/architecture.md +202 -0
- package/framework/skills/laravel-best-practices/references/blade-views.md +36 -0
- package/framework/skills/laravel-best-practices/references/caching.md +70 -0
- package/framework/skills/laravel-best-practices/references/collections.md +44 -0
- package/framework/skills/laravel-best-practices/references/config.md +73 -0
- package/framework/skills/laravel-best-practices/references/db-performance.md +192 -0
- package/framework/skills/laravel-best-practices/references/eloquent.md +148 -0
- package/framework/skills/laravel-best-practices/references/error-handling.md +72 -0
- package/framework/skills/laravel-best-practices/references/events-notifications.md +52 -0
- package/framework/skills/laravel-best-practices/references/http-client.md +160 -0
- package/framework/skills/laravel-best-practices/references/mail.md +27 -0
- package/framework/skills/laravel-best-practices/references/migrations.md +121 -0
- package/framework/skills/laravel-best-practices/references/passport.md +197 -0
- package/framework/skills/laravel-best-practices/references/pennant.md +61 -0
- package/framework/skills/laravel-best-practices/references/pest-testing.md +166 -0
- package/framework/skills/laravel-best-practices/references/pulse.md +196 -0
- package/framework/skills/laravel-best-practices/references/queue-jobs.md +144 -0
- package/framework/skills/laravel-best-practices/references/routing.md +99 -0
- package/framework/skills/laravel-best-practices/references/scheduling.md +39 -0
- package/framework/skills/laravel-best-practices/references/scout.md +176 -0
- package/framework/skills/laravel-best-practices/references/security.md +198 -0
- package/framework/skills/laravel-best-practices/references/spatie-laravel-backup.md +222 -0
- package/framework/skills/laravel-best-practices/references/spatie-laravel-permission.md +272 -0
- package/framework/skills/laravel-best-practices/references/spatie-medialibrary.md +672 -0
- package/framework/skills/laravel-best-practices/references/style.md +125 -0
- package/framework/skills/laravel-best-practices/references/tailwindcss.md +112 -0
- package/framework/skills/laravel-best-practices/references/testing.md +43 -0
- package/framework/skills/laravel-best-practices/references/validation.md +75 -0
- package/framework/skills/lavish/SKILL.md +67 -0
- package/framework/skills/lavish/examples.md +31 -0
- package/framework/skills/notion-mcp/SKILL.md +57 -0
- package/framework/skills/notion-mcp/examples.md +31 -0
- package/framework/skills/notion-mcp/references/comments.md +112 -0
- package/framework/skills/notion-mcp/references/databases.md +193 -0
- package/framework/skills/notion-mcp/references/pages.md +235 -0
- package/framework/skills/skill-creator/LICENSE.txt +202 -0
- package/framework/skills/skill-creator/SKILL.md +485 -0
- package/framework/skills/skill-creator/agents/analyzer.md +274 -0
- package/framework/skills/skill-creator/agents/comparator.md +202 -0
- package/framework/skills/skill-creator/agents/grader.md +223 -0
- package/framework/skills/skill-creator/assets/eval_review.html +146 -0
- package/framework/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/framework/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/framework/skills/skill-creator/examples.md +31 -0
- package/framework/skills/skill-creator/references/schemas.md +430 -0
- package/framework/skills/skill-creator/scripts/__init__.py +0 -0
- package/framework/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/framework/skills/skill-creator/scripts/generate_report.py +326 -0
- package/framework/skills/skill-creator/scripts/improve_description.py +247 -0
- package/framework/skills/skill-creator/scripts/package_skill.py +136 -0
- package/framework/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/framework/skills/skill-creator/scripts/run_eval.py +310 -0
- package/framework/skills/skill-creator/scripts/run_loop.py +328 -0
- package/framework/skills/skill-creator/scripts/utils.py +47 -0
- package/framework/styles/README.md +35 -0
- package/framework/styles/linear/DESIGN.md +478 -0
- package/framework/styles/linear/README.md +36 -0
- package/framework/styles/linear/assets/preview.jpg +0 -0
- package/framework/styles/raycast/DESIGN.md +495 -0
- package/framework/styles/raycast/README.md +35 -0
- package/framework/styles/raycast/assets/preview.jpg +0 -0
- package/package.json +33 -0
- package/src/agent-configs.js +96 -0
- package/src/catalog.js +145 -0
- package/src/cli.js +254 -0
- package/src/installer.js +303 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Observability Reference
|
|
2
|
+
|
|
3
|
+
Design logs, metrics, traces, health checks, dashboards, and alerts for production operations.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this when the task involves structured logging, metrics, distributed tracing, health checks, dashboards, alerting, service-level indicators, or incident readiness. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not use it for trivial text edits unless the edit changes engineering guidance.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Correctness and data integrity come before speed of implementation.
|
|
12
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
13
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
14
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
15
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
16
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
17
|
+
- Security and privacy are design inputs, not final review steps.
|
|
18
|
+
|
|
19
|
+
- Structured logs should describe events with stable fields and no sensitive data.
|
|
20
|
+
- Metrics should track rates, errors, durations, saturation, and business outcomes.
|
|
21
|
+
- Traces should show cross-boundary latency and failure points.
|
|
22
|
+
- Health checks should distinguish process liveness from dependency readiness.
|
|
23
|
+
- Alerts should be actionable, tied to user impact, and include runbook guidance.
|
|
24
|
+
- Dashboards should support both real-time triage and trend review.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Identify the operational signals needed: what questions will operators ask during normal operation and incidents?
|
|
29
|
+
2. Add structured logs with stable field names, correlation IDs, and severity levels.
|
|
30
|
+
3. Define metrics: rates (RPS), errors, durations (latency), saturation (CPU, memory, connections), and business outcomes.
|
|
31
|
+
4. Add distributed tracing for requests that cross service boundaries.
|
|
32
|
+
5. Implement health check endpoints that distinguish liveness (process alive) from readiness (able to serve traffic).
|
|
33
|
+
6. Set up dashboards for triage (real-time) and trends (daily/weekly).
|
|
34
|
+
7. Configure alerts that are actionable, documented with runbooks, and free of noise.
|
|
35
|
+
8. Test observability: verify logs appear, metrics have values, traces propagate, alerts fire.
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
40
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
41
|
+
- Do not hide breaking changes in refactors.
|
|
42
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
43
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
44
|
+
- Reference related standards: references/standards/observability.md, references/standards/logging.md.
|
|
45
|
+
|
|
46
|
+
## Deliverables
|
|
47
|
+
|
|
48
|
+
- Structured logging schema with field names and severity levels.
|
|
49
|
+
- Metrics definition: rates, errors, durations, saturation, business outcomes.
|
|
50
|
+
- Distributed tracing configuration and propagation plan.
|
|
51
|
+
- Health check implementation (liveness vs readiness).
|
|
52
|
+
- Dashboard layouts and alert rules with runbook links.
|
|
53
|
+
- Observability test plan.
|
|
54
|
+
|
|
55
|
+
## Common Mistakes
|
|
56
|
+
|
|
57
|
+
- Logging everything at the same level, making it impossible to distinguish critical from noise.
|
|
58
|
+
- Creating dashboards that look impressive but cannot be used to diagnose an incident.
|
|
59
|
+
- Setting alerts that page without a clear mitigation step.
|
|
60
|
+
- Adding tracing to only some services, breaking the end-to-end trace.
|
|
61
|
+
- Forgetting to log or metric business outcomes (orders placed, payments completed).
|
|
62
|
+
|
|
63
|
+
## Failure Modes
|
|
64
|
+
|
|
65
|
+
- An incident cannot be diagnosed because logs are too verbose or too sparse.
|
|
66
|
+
- An alert fires but no one knows what to do because there is no runbook.
|
|
67
|
+
- Metrics have high cardinality labels, causing monitoring infrastructure to fail.
|
|
68
|
+
- Traces are sampled away for the exact request that failed.
|
|
69
|
+
|
|
70
|
+
## Checklist
|
|
71
|
+
|
|
72
|
+
- [ ] Logs are structured with consistent field names and correlation IDs.
|
|
73
|
+
- [ ] Sensitive data is excluded from logs, metrics, and traces.
|
|
74
|
+
- [ ] Metrics track rates, errors, durations, saturation, and business outcomes.
|
|
75
|
+
- [ ] Health checks distinguish liveness from readiness.
|
|
76
|
+
- [ ] Alerts are actionable and linked to a runbook.
|
|
77
|
+
- [ ] Dashboards support both triage and trend analysis.
|
|
78
|
+
- [ ] Tracing covers all services in the request path.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Performance Reference
|
|
2
|
+
|
|
3
|
+
Diagnose and improve CPU, memory, network, storage, caching, and query behavior using evidence.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this when the task involves CPU, memory, network, caching, query optimization, parallelism, profiling, benchmarking, latency, throughput, or resource cost. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not use it for trivial text edits unless the edit changes engineering guidance.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Correctness and data integrity come before speed of implementation.
|
|
12
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
13
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
14
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
15
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
16
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
17
|
+
- Security and privacy are design inputs, not final review steps.
|
|
18
|
+
|
|
19
|
+
- Measure before optimizing and define the target metric: latency, throughput, cost, or capacity.
|
|
20
|
+
- CPU work should be bounded and avoid repeated expensive computation.
|
|
21
|
+
- Memory use should avoid unbounded aggregation, buffering, and cache growth.
|
|
22
|
+
- Network calls need timeouts, batching where appropriate, and payload discipline.
|
|
23
|
+
- Caching requires invalidation, freshness expectations, and failure behavior.
|
|
24
|
+
- Parallelism must preserve correctness and respect downstream limits.
|
|
25
|
+
- Benchmarks should reflect realistic data sizes and access patterns.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
1. Define the performance target: latency p50/p95/p99, throughput RPS, resource budget.
|
|
30
|
+
2. Measure the current state before proposing any change. Profile CPU, memory, I/O, network.
|
|
31
|
+
3. Identify the bottleneck: slowest path, most allocated memory, most frequent call.
|
|
32
|
+
4. Formulate a targeted optimization based on evidence, not intuition.
|
|
33
|
+
5. Implement the smallest change that addresses the bottleneck.
|
|
34
|
+
6. Re-measure to confirm improvement and verify no regressions in other paths.
|
|
35
|
+
7. Add performance regression tests for critical paths.
|
|
36
|
+
8. Document the optimization: baseline, result, tradeoffs (complexity, readability, maintainability).
|
|
37
|
+
|
|
38
|
+
## Rules
|
|
39
|
+
|
|
40
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
41
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
42
|
+
- Do not hide breaking changes in refactors.
|
|
43
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
44
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
45
|
+
- Reference related standards: references/standards/performance.md.
|
|
46
|
+
|
|
47
|
+
## Deliverables
|
|
48
|
+
|
|
49
|
+
- Baseline measurement and profiling results.
|
|
50
|
+
- Bottleneck identification with evidence.
|
|
51
|
+
- Targeted optimization with before/after comparison.
|
|
52
|
+
- Performance regression tests for critical paths.
|
|
53
|
+
- Tradeoff documentation: complexity, readability, maintainability.
|
|
54
|
+
|
|
55
|
+
## Common Mistakes
|
|
56
|
+
|
|
57
|
+
- Optimizing without measuring first, leading to wasted effort on non-bottlenecks.
|
|
58
|
+
- Adding caching without defining invalidation strategy, freshness requirements, or failure behavior.
|
|
59
|
+
- Premature optimization that adds complexity for unproven gains.
|
|
60
|
+
- Ignoring the performance impact of N+1 queries, unbounded data loading, and missing indexes.
|
|
61
|
+
- Optimizing for throughput at the expense of p99 latency or vice versa without understanding the requirement.
|
|
62
|
+
|
|
63
|
+
## Failure Modes
|
|
64
|
+
|
|
65
|
+
- An optimization improves p50 but makes p99 worse (tail at scale).
|
|
66
|
+
- A cache introduces stale data because invalidation was not designed.
|
|
67
|
+
- A query optimization breaks on a different database version or data distribution.
|
|
68
|
+
- A performance improvement reduces readability without sufficient documentation.
|
|
69
|
+
|
|
70
|
+
## Checklist
|
|
71
|
+
|
|
72
|
+
- [ ] A baseline measurement exists before the change.
|
|
73
|
+
- [ ] The bottleneck is identified through profiling, not guessing.
|
|
74
|
+
- [ ] Caching has defined invalidation, freshness, and failure behavior.
|
|
75
|
+
- [ ] N+1 queries and unbounded data loading are resolved.
|
|
76
|
+
- [ ] Performance regression tests cover critical paths.
|
|
77
|
+
- [ ] Tradeoffs against readability, complexity, and maintainability are documented.
|
|
78
|
+
- [ ] P50, P95, P99 latency targets are defined and measured.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Refactoring Reference
|
|
2
|
+
|
|
3
|
+
Improve code structure safely while preserving behavior through small verified steps.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this when the task involves removing duplication, simplifying code, reducing complexity, improving naming, preserving behavior, or making small incremental changes. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not use it for trivial text edits unless the edit changes engineering guidance.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Correctness and data integrity come before speed of implementation.
|
|
12
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
13
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
14
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
15
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
16
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
17
|
+
- Security and privacy are design inputs, not final review steps.
|
|
18
|
+
|
|
19
|
+
- Preserve externally visible behavior unless a behavior change is explicitly requested.
|
|
20
|
+
- Make one conceptual change at a time.
|
|
21
|
+
- Remove duplication by extracting the stable idea, not by forcing unrelated code through one abstraction.
|
|
22
|
+
- Improve names when they reduce cognitive load for future changes.
|
|
23
|
+
- Characterization tests are useful before touching risky legacy behavior.
|
|
24
|
+
- Stop refactoring when the code is simpler enough for the current goal.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Identify the improvement goal: reduce duplication, simplify logic, improve naming, extract module.
|
|
29
|
+
2. Verify existing test coverage. If coverage is weak, add characterization tests first.
|
|
30
|
+
3. Make one conceptual change at a time. Commit or stage after each safe step.
|
|
31
|
+
4. Preserve external behavior: same inputs produce same outputs, same errors, same side effects.
|
|
32
|
+
5. Run the full test suite after each change step.
|
|
33
|
+
6. Compare before and after: verify the improvement did not introduce subtle behavioral differences.
|
|
34
|
+
7. Remove dead code, commented code, and unused dependencies found during the refactor.
|
|
35
|
+
8. Stop when the code is clear enough for the current maintenance needs - avoid over-refactoring.
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
40
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
41
|
+
- Do not hide breaking changes in refactors.
|
|
42
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
43
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
44
|
+
- Reference related standards: references/standards/naming.md, references/standards/testing.md.
|
|
45
|
+
|
|
46
|
+
## Deliverables
|
|
47
|
+
|
|
48
|
+
- Improved code with one conceptual change per step.
|
|
49
|
+
- Passing test suite before and after each step.
|
|
50
|
+
- Characterization tests for legacy code with weak coverage.
|
|
51
|
+
- Before/after comparison confirming behavior preservation.
|
|
52
|
+
- Removed dead code, commented code, and unused dependencies.
|
|
53
|
+
|
|
54
|
+
## Common Mistakes
|
|
55
|
+
|
|
56
|
+
- Refactoring and changing behavior in the same step.
|
|
57
|
+
- Removing tests or code that seems unused but is actually relied upon implicitly.
|
|
58
|
+
- Over-abstracting: creating interfaces, base classes, or indirection before a clear need exists.
|
|
59
|
+
- Refactoring for performance without measuring the baseline.
|
|
60
|
+
- Leaving the code in a half-refactored state.
|
|
61
|
+
|
|
62
|
+
## Failure Modes
|
|
63
|
+
|
|
64
|
+
- A refactor introduces a subtle behavior change that tests do not catch.
|
|
65
|
+
- Over-refactoring produces a more complex design than the original.
|
|
66
|
+
- A rename misses a reference, causing a production issue.
|
|
67
|
+
- A shared abstraction created during refactoring becomes a coupling point that is hard to undo.
|
|
68
|
+
|
|
69
|
+
## Checklist
|
|
70
|
+
|
|
71
|
+
- [ ] Existing tests pass before and after each refactoring step.
|
|
72
|
+
- [ ] One conceptual change is made at a time.
|
|
73
|
+
- [ ] External behavior is preserved (same inputs, outputs, errors, side effects).
|
|
74
|
+
- [ ] Dead code, commented code, and unused dependencies are removed.
|
|
75
|
+
- [ ] Naming reflects business meaning after the refactor.
|
|
76
|
+
- [ ] Refactored code is simpler, not more complex.
|
|
77
|
+
- [ ] Characterization tests exist for legacy code with weak coverage.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Security Reference
|
|
2
|
+
|
|
3
|
+
Apply practical security review across identity, access, secrets, data handling, and abuse resistance.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this when the task involves authentication, authorization, secrets, encryption, OWASP-style risks, injection, input validation, output encoding, rate limiting, abuse prevention, or least privilege. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not use it for trivial text edits unless the edit changes engineering guidance.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Correctness and data integrity come before speed of implementation.
|
|
12
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
13
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
14
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
15
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
16
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
17
|
+
- Security and privacy are design inputs, not final review steps.
|
|
18
|
+
|
|
19
|
+
- Treat all input as untrusted, including internal calls, background jobs, files, and message payloads.
|
|
20
|
+
- Enforce least privilege for users, services, tokens, storage, and operational access.
|
|
21
|
+
- Secrets must never appear in source, logs, errors, metrics, traces, or examples.
|
|
22
|
+
- Use encryption deliberately for data in transit and sensitive data at rest.
|
|
23
|
+
- Prevent injection by separating commands from data and validating allowed shapes.
|
|
24
|
+
- Output encoding and safe error responses prevent data disclosure.
|
|
25
|
+
- Abuse controls such as rate limits should protect expensive and sensitive actions.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
1. Identify data assets, entry points, and trust boundaries in the system.
|
|
30
|
+
2. Review authentication: is identity verified at every entry point?
|
|
31
|
+
3. Review authorization: is access checked against the resource, not assumed from the caller?
|
|
32
|
+
4. Review input handling: are all inputs validated, sanitized, or parameterized at every boundary?
|
|
33
|
+
5. Review secrets: are any credentials, tokens, or keys exposed in code, logs, configs, or errors?
|
|
34
|
+
6. Review data protection: is encryption applied for data in transit and sensitive data at rest?
|
|
35
|
+
7. Review abuse controls: rate limiting, payload limits, request throttling for expensive actions.
|
|
36
|
+
8. Test security boundaries: attempt injection, forced browsing, privilege escalation.
|
|
37
|
+
9. Document residual risks and recommended mitigations.
|
|
38
|
+
|
|
39
|
+
## Rules
|
|
40
|
+
|
|
41
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
42
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
43
|
+
- Do not hide breaking changes in refactors.
|
|
44
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
45
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
46
|
+
- Reference related standards: references/standards/security.md.
|
|
47
|
+
|
|
48
|
+
## Deliverables
|
|
49
|
+
|
|
50
|
+
- Security review of authentication, authorization, and input handling.
|
|
51
|
+
- Secrets exposure analysis.
|
|
52
|
+
- Data protection review (in transit and at rest).
|
|
53
|
+
- Abuse control assessment.
|
|
54
|
+
- Residual risks and recommended mitigations.
|
|
55
|
+
|
|
56
|
+
## Common Mistakes
|
|
57
|
+
|
|
58
|
+
- Performing authorization checks only in the UI or frontend and not at the API boundary.
|
|
59
|
+
- Storing secrets in source code, environment files committed to git, or inline configs.
|
|
60
|
+
- Trusting input from internal services, background jobs, or message queues without validation.
|
|
61
|
+
- Using weak or outdated cryptographic algorithms.
|
|
62
|
+
- Ignoring rate limiting on authentication endpoints, allowing brute force.
|
|
63
|
+
|
|
64
|
+
## Failure Modes
|
|
65
|
+
|
|
66
|
+
- A vulnerability is introduced because input validation is missing on a new endpoint.
|
|
67
|
+
- A secret is exposed in logs or error responses, causing a credential leak.
|
|
68
|
+
- Authorization is checked on the first request but not re-verified for subsequent operations in a workflow.
|
|
69
|
+
- A security review misses an issue because it focused on code and ignored infrastructure config.
|
|
70
|
+
|
|
71
|
+
## Checklist
|
|
72
|
+
|
|
73
|
+
- [ ] Authentication is enforced at every external entry point.
|
|
74
|
+
- [ ] Authorization checks happen at the resource boundary, not just in the UI.
|
|
75
|
+
- [ ] All inputs are validated, sanitized, or parameterized.
|
|
76
|
+
- [ ] Secrets are never in source code, logs, errors, or example configs.
|
|
77
|
+
- [ ] Encryption is applied for data in transit (TLS) and sensitive data at rest.
|
|
78
|
+
- [ ] Rate limiting protects authentication and expensive endpoints.
|
|
79
|
+
- [ ] Output encoding prevents injection in responses to other systems.
|
|
80
|
+
- [ ] Dependencies are scanned for known vulnerabilities.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Testing Reference
|
|
2
|
+
|
|
3
|
+
Design deterministic unit, integration, contract, and end-to-end testing strategies.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this when the task involves unit, integration, contract, end-to-end, testability, mocking, deterministic behavior, or release confidence. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not use it for trivial text edits unless the edit changes engineering guidance.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
- Correctness and data integrity come before speed of implementation.
|
|
12
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
13
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
14
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
15
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
16
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
17
|
+
- Security and privacy are design inputs, not final review steps.
|
|
18
|
+
|
|
19
|
+
- Unit tests prove local rules and edge cases quickly.
|
|
20
|
+
- Integration tests prove persistence, transactions, serialization, and external boundaries.
|
|
21
|
+
- Contract tests protect clients and providers from incompatible changes.
|
|
22
|
+
- End-to-end tests should cover critical user journeys, not every branch.
|
|
23
|
+
- Deterministic tests avoid time, order, randomness, and shared-state flakiness.
|
|
24
|
+
- Mocks should model behavior and failure, not implementation trivia.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Identify what is being tested: a unit of logic, an integration boundary, a contract, or an end-to-end journey.
|
|
29
|
+
2. Choose the narrowest test type that provides sufficient confidence for the risk level.
|
|
30
|
+
3. Write the test starting with the expected behavior: given X, when Y, then Z.
|
|
31
|
+
4. Cover normal paths, edge cases (empty, null, boundary values), and failure paths (timeouts, errors, invalid input).
|
|
32
|
+
5. Keep tests deterministic: no dependence on time, random values, shared state, or external service availability.
|
|
33
|
+
6. Use mocks at integration boundaries to model real behavior and realistic failures, not implementation details.
|
|
34
|
+
7. Run the full test suite locally before pushing.
|
|
35
|
+
8. Review test coverage: are there untested branches, error paths, or concurrent scenarios?
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
40
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
41
|
+
- Do not hide breaking changes in refactors.
|
|
42
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
43
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
44
|
+
- Reference related standards: references/standards/testing.md.
|
|
45
|
+
|
|
46
|
+
## Deliverables
|
|
47
|
+
|
|
48
|
+
- Test plan covering normal paths, edge cases, and failure paths.
|
|
49
|
+
- Deterministic tests with given/when/then structure.
|
|
50
|
+
- Mock strategy modeling boundary behavior.
|
|
51
|
+
- Contract tests for public API boundaries.
|
|
52
|
+
- Coverage analysis of untested branches and error paths.
|
|
53
|
+
|
|
54
|
+
## Common Mistakes
|
|
55
|
+
|
|
56
|
+
- Writing tests that mirror implementation details, breaking when the code is refactored.
|
|
57
|
+
- Testing only the happy path and ignoring error handling and edge cases.
|
|
58
|
+
- Using mocks that model framework internals instead of boundary behavior.
|
|
59
|
+
- Creating flaky tests that depend on timing, ordering, or shared state.
|
|
60
|
+
- Writing overly broad integration tests that are slow and brittle.
|
|
61
|
+
|
|
62
|
+
## Failure Modes
|
|
63
|
+
|
|
64
|
+
- A test passes in CI but fails locally (or vice versa) because of environment differences.
|
|
65
|
+
- A refactor breaks many tests because they were coupled to implementation instead of behavior.
|
|
66
|
+
- An integration test becomes a maintenance burden because it exercises too many paths at once.
|
|
67
|
+
- False-positive tests give false confidence while real bugs exist in untested paths.
|
|
68
|
+
|
|
69
|
+
## Checklist
|
|
70
|
+
|
|
71
|
+
- [ ] Tests cover normal paths, edge cases, and failure paths.
|
|
72
|
+
- [ ] Tests are deterministic: no flakiness from time, randomness, or shared state.
|
|
73
|
+
- [ ] Mocks model boundary behavior, not implementation internals.
|
|
74
|
+
- [ ] The test suite runs in CI and is fast enough for quick feedback.
|
|
75
|
+
- [ ] Coverage includes error handling and concurrent scenarios where applicable.
|
|
76
|
+
- [ ] Tests are readable: given/when/then structure with descriptive names.
|
|
77
|
+
- [ ] Contract tests exist for public API boundaries.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backend-engineer
|
|
3
|
+
description: Analyze backend requirements, risks, and implementation plans before coding.
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
# Purpose
|
|
7
|
+
Analyze backend requirements, risks, and implementation plans before coding. This skill guides an AI agent to act with senior backend judgment: clarify the outcome, identify constraints, choose the least complex safe path, and make production impact visible.
|
|
8
|
+
|
|
9
|
+
# When to Activate
|
|
10
|
+
Use this skill when the task involves general backend planning, requirement analysis, problem breakdown, complexity estimates, risk evaluation, and simple solution selection. It is also useful when a request is vague, risky, touches production behavior, changes contracts, changes data, or needs a reviewable engineering plan. Do not activate it for trivial text edits unless the edit changes engineering guidance.
|
|
11
|
+
|
|
12
|
+
# Principles
|
|
13
|
+
- Correctness and data integrity come before speed of implementation.
|
|
14
|
+
- Simplicity is a feature: fewer moving parts means fewer failure modes.
|
|
15
|
+
- Existing contracts must remain compatible unless a breaking change is approved.
|
|
16
|
+
- Every important decision should have a reason, an alternative considered, and an operational consequence.
|
|
17
|
+
- Work should be testable, observable, deployable, and reversible.
|
|
18
|
+
- Prefer explicit boundaries, clear names, and local reasoning over clever shared abstractions.
|
|
19
|
+
- Security and privacy are design inputs, not final review steps.
|
|
20
|
+
|
|
21
|
+
- Requirements analysis must identify users, workflows, data ownership, invariants, and constraints.
|
|
22
|
+
- Break problems into contract, domain, persistence, operations, and delivery concerns.
|
|
23
|
+
- Estimate complexity by counting boundaries, state transitions, migration steps, and failure modes.
|
|
24
|
+
- Evaluate risks before implementation: data loss, authorization gaps, compatibility breaks, latency, and operational burden.
|
|
25
|
+
- Choose the simplest solution that satisfies current known needs and can evolve safely.
|
|
26
|
+
|
|
27
|
+
# Workflow
|
|
28
|
+
1. Restate the user goal in concrete backend terms with explicit scope and non-goals.
|
|
29
|
+
2. Identify actors, data entities, invariants, and failure modes.
|
|
30
|
+
3. Identify external dependencies, integration points, and data flows.
|
|
31
|
+
4. Inspect existing project patterns and conventions before proposing changes.
|
|
32
|
+
5. Decide whether clarifying questions are needed. Ask only questions that materially affect design or risk.
|
|
33
|
+
6. Produce a small plan: contract, data changes, behavior changes, tests, observability, deployment, rollback.
|
|
34
|
+
7. Compare at least one simpler alternative when the proposed solution adds complexity.
|
|
35
|
+
8. Verify with the narrowest meaningful tests, then broader checks when risk justifies them.
|
|
36
|
+
9. Summarize tradeoffs, residual risks, and follow-up work.
|
|
37
|
+
|
|
38
|
+
# Rules
|
|
39
|
+
- Never assume hidden requirements, traffic scale, compliance needs, or data retention rules.
|
|
40
|
+
- Do not introduce new infrastructure unless the current requirement cannot be met safely without it.
|
|
41
|
+
- Do not hide breaking changes in refactors.
|
|
42
|
+
- Do not weaken authorization, validation, transaction safety, or error handling to make implementation easier.
|
|
43
|
+
- Keep public contracts, migrations, and operational changes explicit in the deliverable.
|
|
44
|
+
- Reference related standards: references/standards/architecture.md, references/standards/testing.md.
|
|
45
|
+
|
|
46
|
+
# Deliverables
|
|
47
|
+
- A concise engineering plan or review summary.
|
|
48
|
+
- Explicit assumptions and clarifying questions when needed.
|
|
49
|
+
- Contract, data, test, observability, deployment, and rollback notes for production changes.
|
|
50
|
+
- Concrete risks with mitigations.
|
|
51
|
+
- A checklist showing completion evidence.
|
|
52
|
+
|
|
53
|
+
# Common Mistakes
|
|
54
|
+
- Starting with code before understanding invariants, data ownership, or failure modes.
|
|
55
|
+
- Designing for imagined future scale while ignoring present correctness.
|
|
56
|
+
- Treating validation, authorization, logging, and tests as optional polish.
|
|
57
|
+
- Creating generic abstractions after seeing only one use case.
|
|
58
|
+
- Optimizing without measurement or failing to define the target metric.
|
|
59
|
+
- Writing documents that describe implementation but omit failure handling.
|
|
60
|
+
|
|
61
|
+
# Failure Modes
|
|
62
|
+
- A simple request becomes a broad rewrite because scope was not bounded.
|
|
63
|
+
- A change works locally but cannot be safely deployed or rolled back.
|
|
64
|
+
- Data becomes inconsistent because constraints or transactions were skipped.
|
|
65
|
+
- Operators cannot diagnose incidents because logs and metrics are missing.
|
|
66
|
+
- Reviewers cannot evaluate risk because decisions and assumptions are implicit.
|
|
67
|
+
|
|
68
|
+
# Checklist
|
|
69
|
+
- [ ] Goal, scope, and non-goals are clearly defined.
|
|
70
|
+
- [ ] Simpler alternatives were considered and documented.
|
|
71
|
+
- [ ] Data integrity and backward compatibility are protected.
|
|
72
|
+
- [ ] Security and authorization impact is reviewed.
|
|
73
|
+
- [ ] Tests cover normal paths, edge cases, and failure paths.
|
|
74
|
+
- [ ] Logs, metrics, traces, or health signals are included when operationally relevant.
|
|
75
|
+
- [ ] Deployment and rollback are understood and tested.
|
|
76
|
+
- [ ] The deliverable explains reasoning and evidence, not just code.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Backend Engineer Examples
|
|
2
|
+
|
|
3
|
+
## Example 1: User Settings API
|
|
4
|
+
|
|
5
|
+
Implement an endpoint that reads and updates user notification preferences. Good agent behavior:
|
|
6
|
+
|
|
7
|
+
- Identify actors (user, admin) and data ownership rules—user sees own settings, admin sees tenant-wide defaults.
|
|
8
|
+
- Choose a caching strategy: cache by user_id with a short TTL; invalidate on write via cache-aside pattern.
|
|
9
|
+
- Validate setting keys against an allowlist, reject unknown keys with a 422 error and a list of valid options.
|
|
10
|
+
- Design the update to be partial (PATCH) so clients send only changed fields; merge with stored defaults.
|
|
11
|
+
- Add a rate limit on writes to prevent abuse; reads can be higher but still bounded.
|
|
12
|
+
|
|
13
|
+
## Example 2: Notification Service
|
|
14
|
+
|
|
15
|
+
Design a service that sends email and push notifications when orders are placed. Good agent behavior:
|
|
16
|
+
|
|
17
|
+
- Evaluate sync vs async delivery: accept the notification request synchronously but hand delivery off to a queue for resilience.
|
|
18
|
+
- Implement a retry mechanism with exponential backoff for transient failures; dead-letter after 3 attempts.
|
|
19
|
+
- Deduplicate by notification_id so the same event is not sent twice if the producer retries.
|
|
20
|
+
- Template notifications server-side so copy changes don't require app releases.
|
|
21
|
+
- Emit telemetry for each notification channel (sent, delivered, bounced, opened) to track provider health.
|
|
22
|
+
|
|
23
|
+
## Example 3: Inventory Reservation
|
|
24
|
+
|
|
25
|
+
Design inventory reservation for a checkout flow with a 15-minute payment window. Good agent behavior:
|
|
26
|
+
|
|
27
|
+
- Reserve inventory atomically at checkout time; release the reservation if payment is not completed within the window.
|
|
28
|
+
- Handle concurrent requests: use SELECT FOR UPDATE or optimistic locking to prevent overselling.
|
|
29
|
+
- On payment failure, roll back the reservation immediately and asynchronously notify the warehouse.
|
|
30
|
+
- Implement a background job that releases expired reservations every minute; log releases for audit.
|
|
31
|
+
- Add metrics for reservation success, expiration, and contention rate to tune the timeout and capacity.
|