@rosetears/aili-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/THIRD_PARTY_NOTICES.md +64 -0
- package/extensions/index.ts +6 -0
- package/install.sh +5 -0
- package/manifests/adapter-evidence.json +45 -0
- package/manifests/capabilities.json +124 -0
- package/manifests/live-verification.json +26 -0
- package/manifests/provenance.json +71 -0
- package/manifests/roles.json +474 -0
- package/manifests/sbom.json +7797 -0
- package/manifests/skill-compatibility.json +8100 -0
- package/manifests/subagent-provenance.json +37 -0
- package/package.json +91 -0
- package/prompts/build.md +8 -0
- package/prompts/define.md +8 -0
- package/prompts/ideate.md +8 -0
- package/prompts/local-review.md +8 -0
- package/prompts/ship.md +8 -0
- package/roles/agent-evaluator.md +47 -0
- package/roles/ai-regression-scout.md +47 -0
- package/roles/browser-qa-runner.md +47 -0
- package/roles/code-reviewer.md +47 -0
- package/roles/code-scout.md +47 -0
- package/roles/convergence-reviewer.md +55 -0
- package/roles/doc-researcher.md +47 -0
- package/roles/e2e-artifact-runner.md +47 -0
- package/roles/implementer.md +47 -0
- package/roles/opensource-sanitizer.md +47 -0
- package/roles/plan-auditor.md +47 -0
- package/roles/pr-test-analyzer.md +47 -0
- package/roles/security-auditor.md +47 -0
- package/roles/silent-failure-reviewer.md +47 -0
- package/roles/spec-miner.md +47 -0
- package/roles/test-coverage-reviewer.md +47 -0
- package/roles/test-engineer.md +48 -0
- package/roles/web-performance-auditor.md +47 -0
- package/roles/web-researcher.md +47 -0
- package/scripts/apply-adapter-evidence.ts +73 -0
- package/scripts/bootstrap.sh +180 -0
- package/scripts/generate-provenance.ts +143 -0
- package/scripts/local-package-e2e.ts +51 -0
- package/scripts/sync-roles.ts +213 -0
- package/scripts/sync-skills.ts +356 -0
- package/scripts/validate-runtime.ts +11 -0
- package/skills/academic-paper-review/SKILL.md +81 -0
- package/skills/agents-md-initialization/SKILL.md +121 -0
- package/skills/agents-md-initialization/references/agents-template.md +83 -0
- package/skills/agents-md-initialization/references/agents_md.py +215 -0
- package/skills/ai-regression-scout/SKILL.md +24 -0
- package/skills/aili-delivery-flow/SKILL.md +125 -0
- package/skills/aili-delivery-flow/references/artifact-contracts.md +138 -0
- package/skills/aili-delivery-flow/references/backend-routing.md +40 -0
- package/skills/aili-delivery-flow/references/build-execution-loop.md +113 -0
- package/skills/aili-delivery-flow/references/build-goal-mode.md +3 -0
- package/skills/aili-delivery-flow/references/direct-vs-delegated-work.md +38 -0
- package/skills/aili-delivery-flow/references/implementation-packages.md +54 -0
- package/skills/aili-delivery-flow/references/lifecycle.md +127 -0
- package/skills/aili-delivery-flow/references/protocols/acceptance-test-plan.md +18 -0
- package/skills/aili-delivery-flow/references/protocols/alignment-questionnaire.md +10 -0
- package/skills/aili-delivery-flow/references/protocols/closeout-report.md +101 -0
- package/skills/aili-delivery-flow/references/protocols/compact-evidence-pack.md +46 -0
- package/skills/aili-delivery-flow/references/protocols/idea-brief.md +10 -0
- package/skills/aili-delivery-flow/references/protocols/implementation-package.md +53 -0
- package/skills/aili-delivery-flow/references/protocols/research-evidence-pack.md +19 -0
- package/skills/aili-delivery-flow/references/protocols/review-report.md +7 -0
- package/skills/aili-delivery-flow/references/protocols/spec-draft.md +12 -0
- package/skills/aili-delivery-flow/references/protocols/subagent-result.md +60 -0
- package/skills/aili-delivery-flow/references/protocols/subagent-task-packet.md +29 -0
- package/skills/aili-delivery-flow/references/protocols/worktree-context.md +109 -0
- package/skills/aili-delivery-flow/references/questionnaire-policy.md +62 -0
- package/skills/aili-delivery-flow/references/review-repair-loop.md +16 -0
- package/skills/aili-delivery-flow/references/test-document-policy.md +35 -0
- package/skills/android-native-dev/SKILL.md +722 -0
- package/skills/android-native-dev/references/accessibility.md +209 -0
- package/skills/android-native-dev/references/adaptive-screens.md +231 -0
- package/skills/android-native-dev/references/design-style-guide.md +365 -0
- package/skills/android-native-dev/references/functional-requirements.md +229 -0
- package/skills/android-native-dev/references/motion-system.md +203 -0
- package/skills/android-native-dev/references/performance-stability.md +223 -0
- package/skills/android-native-dev/references/privacy-security.md +244 -0
- package/skills/android-native-dev/references/testing.md +554 -0
- package/skills/android-native-dev/references/visual-design.md +246 -0
- package/skills/api-and-interface-design/SKILL.md +318 -0
- package/skills/browser-qa/SKILL.md +32 -0
- package/skills/browser-testing-with-devtools/SKILL.md +323 -0
- package/skills/build-failure-repair/SKILL.md +49 -0
- package/skills/chart-visualization/SKILL.md +73 -0
- package/skills/ci-cd-and-automation/SKILL.md +353 -0
- package/skills/code-review-and-quality/SKILL.md +375 -0
- package/skills/code-review-quality-gates/SKILL.md +132 -0
- package/skills/code-simplification/SKILL.md +371 -0
- package/skills/comment-accuracy-review/SKILL.md +37 -0
- package/skills/consulting-analysis/SKILL.md +69 -0
- package/skills/context-engineering/SKILL.md +375 -0
- package/skills/coverage-review/SKILL.md +24 -0
- package/skills/data-analysis/SKILL.md +74 -0
- package/skills/deprecation-and-migration/SKILL.md +222 -0
- package/skills/documentation-and-adrs/SKILL.md +330 -0
- package/skills/e2e-artifact-handling/SKILL.md +30 -0
- package/skills/evidence-scoped-retrospective/SKILL.md +156 -0
- package/skills/explain-by-allegory/SKILL.md +99 -0
- package/skills/flutter-dev/SKILL.md +162 -0
- package/skills/flutter-dev/references/animations.md +497 -0
- package/skills/flutter-dev/references/bloc-state.md +281 -0
- package/skills/flutter-dev/references/forms.md +656 -0
- package/skills/flutter-dev/references/gorouter-navigation.md +257 -0
- package/skills/flutter-dev/references/localization.md +510 -0
- package/skills/flutter-dev/references/networking.md +566 -0
- package/skills/flutter-dev/references/performance.md +305 -0
- package/skills/flutter-dev/references/platform-specific.md +417 -0
- package/skills/flutter-dev/references/project-structure.md +273 -0
- package/skills/flutter-dev/references/riverpod-state.md +232 -0
- package/skills/flutter-dev/references/testing.md +364 -0
- package/skills/flutter-dev/references/widget-patterns.md +233 -0
- package/skills/frontend-dev/SKILL.md +468 -0
- package/skills/frontend-dev/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/DMMono-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/skills/frontend-dev/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Gloock-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Italiana-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Jura-Light.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Jura-Medium.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Jura-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Lora-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Lora-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Lora-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Lora-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Outfit-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/Tektur-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/skills/frontend-dev/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/skills/frontend-dev/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/skills/frontend-dev/references/asset-prompt-guide.md +43 -0
- package/skills/frontend-dev/references/env-setup.md +33 -0
- package/skills/frontend-dev/references/minimax-cli-reference.md +133 -0
- package/skills/frontend-dev/references/minimax-image-guide.md +65 -0
- package/skills/frontend-dev/references/minimax-music-guide.md +216 -0
- package/skills/frontend-dev/references/minimax-tts-guide.md +78 -0
- package/skills/frontend-dev/references/minimax-video-guide.md +82 -0
- package/skills/frontend-dev/references/minimax-voice-catalog.md +685 -0
- package/skills/frontend-dev/references/motion-recipes.md +407 -0
- package/skills/frontend-dev/references/troubleshooting.md +85 -0
- package/skills/frontend-dev/scripts/minimax_image.py +137 -0
- package/skills/frontend-dev/scripts/minimax_music.py +157 -0
- package/skills/frontend-dev/scripts/minimax_tts.py +127 -0
- package/skills/frontend-dev/scripts/minimax_video.py +187 -0
- package/skills/frontend-dev/templates/generator_template.js +223 -0
- package/skills/frontend-dev/templates/viewer.html +599 -0
- package/skills/frontend-ui-engineering/SKILL.md +367 -0
- package/skills/fullstack-dev/SKILL.md +819 -0
- package/skills/fullstack-dev/references/api-design.md +444 -0
- package/skills/fullstack-dev/references/auth-flow.md +165 -0
- package/skills/fullstack-dev/references/db-schema.md +706 -0
- package/skills/fullstack-dev/references/django-best-practices.md +466 -0
- package/skills/fullstack-dev/references/environment-management.md +78 -0
- package/skills/fullstack-dev/references/release-checklist.md +278 -0
- package/skills/fullstack-dev/references/technology-selection.md +254 -0
- package/skills/fullstack-dev/references/testing-strategy.md +404 -0
- package/skills/git-workflow-and-versioning/SKILL.md +446 -0
- package/skills/github-evidence-triage/SKILL.md +115 -0
- package/skills/harness-evolution/SKILL.md +59 -0
- package/skills/harness-evolution/references/activation-matrix.md +13 -0
- package/skills/harness-evolution/references/approval-policy.md +20 -0
- package/skills/harness-evolution/references/change-report-template.md +33 -0
- package/skills/harness-evolution/references/component-taxonomy.md +19 -0
- package/skills/harness-evolution/references/verdict-policy.md +13 -0
- package/skills/harness-issue-triage/SKILL.md +72 -0
- package/skills/harness-issue-triage/references/component-diagnosis.md +25 -0
- package/skills/harness-issue-triage/references/triage-report-template.md +34 -0
- package/skills/harness-optimization-audit/SKILL.md +125 -0
- package/skills/idea-refine/SKILL.md +191 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/LICENSE +21 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/NOTICE.md +9 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/idea-refine/SKILL.upstream.md +178 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/idea-refine/examples.md +238 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/idea-refine/frameworks.md +99 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/idea-refine/refinement-criteria.md +113 -0
- package/skills/idea-refine/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/idea-refine/scripts/idea-refine.upstream.sh +15 -0
- package/skills/incremental-implementation/SKILL.md +252 -0
- package/skills/ios-application-dev/SKILL.md +212 -0
- package/skills/ios-application-dev/references/accessibility.md +259 -0
- package/skills/ios-application-dev/references/graphics-animation.md +350 -0
- package/skills/ios-application-dev/references/layout-system.md +199 -0
- package/skills/ios-application-dev/references/metal-shader.md +178 -0
- package/skills/ios-application-dev/references/navigation-patterns.md +175 -0
- package/skills/ios-application-dev/references/swift-coding-standards.md +757 -0
- package/skills/ios-application-dev/references/swiftui-design-guidelines.md +1167 -0
- package/skills/ios-application-dev/references/system-integration.md +401 -0
- package/skills/ios-application-dev/references/uikit-components.md +297 -0
- package/skills/local-review-gate/SKILL.md +207 -0
- package/skills/local-review-gate/references/addyosmani-code-review-rubric.md +33 -0
- package/skills/local-review-gate/references/codex-github-compatibility.md +26 -0
- package/skills/local-review-gate/references/ecc-code-review-adaptation.md +40 -0
- package/skills/local-review-gate/references/graphify-local-review.md +33 -0
- package/skills/local-review-gate/references/orchestration-adaptation.md +51 -0
- package/skills/local-review-gate/references/review-repair-lane-adaptation.md +46 -0
- package/skills/local-review-gate/references/upstream-provenance.md +61 -0
- package/skills/mature-project-pattern-research/SKILL.md +155 -0
- package/skills/mature-project-pattern-research/references/research-rubric.md +45 -0
- package/skills/minimax-docx/LICENSE +21 -0
- package/skills/minimax-docx/SKILL.md +273 -0
- package/skills/minimax-docx/assets/styles/academic_styles.xml +250 -0
- package/skills/minimax-docx/assets/styles/corporate_styles.xml +284 -0
- package/skills/minimax-docx/assets/styles/default_styles.xml +449 -0
- package/skills/minimax-docx/assets/xsd/aesthetic-rules.xsd +470 -0
- package/skills/minimax-docx/assets/xsd/business-rules.xsd +130 -0
- package/skills/minimax-docx/assets/xsd/common-types.xsd +159 -0
- package/skills/minimax-docx/assets/xsd/wml-subset.xsd +589 -0
- package/skills/minimax-docx/references/cjk_typography.md +357 -0
- package/skills/minimax-docx/references/cjk_university_template_guide.md +184 -0
- package/skills/minimax-docx/references/comments_guide.md +191 -0
- package/skills/minimax-docx/references/design_good_bad_examples.md +829 -0
- package/skills/minimax-docx/references/design_principles.md +819 -0
- package/skills/minimax-docx/references/openxml_element_order.md +308 -0
- package/skills/minimax-docx/references/openxml_encyclopedia_part1.md +4061 -0
- package/skills/minimax-docx/references/openxml_encyclopedia_part2.md +2820 -0
- package/skills/minimax-docx/references/openxml_encyclopedia_part3.md +3381 -0
- package/skills/minimax-docx/references/openxml_namespaces.md +82 -0
- package/skills/minimax-docx/references/openxml_units.md +72 -0
- package/skills/minimax-docx/references/scenario_a_create.md +284 -0
- package/skills/minimax-docx/references/scenario_b_edit_content.md +295 -0
- package/skills/minimax-docx/references/scenario_c_apply_template.md +456 -0
- package/skills/minimax-docx/references/track_changes_guide.md +200 -0
- package/skills/minimax-docx/references/troubleshooting.md +506 -0
- package/skills/minimax-docx/references/typography_guide.md +294 -0
- package/skills/minimax-docx/references/xsd_validation_guide.md +158 -0
- package/skills/minimax-docx/scripts/doc_to_docx.sh +40 -0
- package/skills/minimax-docx/scripts/docx_preview.sh +37 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/MiniMaxAIDocx.Cli.csproj +19 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/Program.cs +18 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/AnalyzeCommand.cs +147 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ApplyTemplateCommand.cs +322 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/CreateCommand.cs +324 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/DiffCommand.cs +155 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/EditContentCommand.cs +487 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/FixOrderCommand.cs +108 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/MergeRunsCommand.cs +122 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ValidateCommand.cs +107 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/MiniMaxAIDocx.Core.csproj +15 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/CommentSynchronizer.cs +169 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/ElementOrder.cs +80 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/NamespaceConstants.cs +42 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/RunMerger.cs +81 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/StyleAnalyzer.cs +81 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/TrackChangesHelper.cs +99 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/UnitConverter.cs +23 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples.cs +1832 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch1.cs +910 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch2.cs +999 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch3.cs +1048 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch4.cs +1038 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/CharacterFormattingSamples.cs +1020 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/DocumentCreationSamples.cs +1121 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FieldAndTocSamples.cs +624 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FootnoteAndCommentSamples.cs +675 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/HeaderFooterSamples.cs +838 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ImageSamples.cs +917 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ListAndNumberingSamples.cs +826 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ParagraphFormattingSamples.cs +1199 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/StyleSystemSamples.cs +1487 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TableSamples.cs +1163 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TrackChangesSamples.cs +595 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/CjkHelper.cs +39 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/FontDefaults.cs +24 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/PageSizes.cs +20 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/BusinessRuleValidator.cs +224 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/GateCheckValidator.cs +148 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/ValidationResult.cs +23 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/XsdValidator.cs +69 -0
- package/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.slnx +4 -0
- package/skills/minimax-docx/scripts/env_check.sh +196 -0
- package/skills/minimax-docx/scripts/setup.ps1 +274 -0
- package/skills/minimax-docx/scripts/setup.sh +504 -0
- package/skills/minimax-pdf/README.md +222 -0
- package/skills/minimax-pdf/SKILL.md +218 -0
- package/skills/minimax-pdf/design/design.md +381 -0
- package/skills/minimax-pdf/scripts/cover.py +1579 -0
- package/skills/minimax-pdf/scripts/fill_inspect.py +200 -0
- package/skills/minimax-pdf/scripts/fill_write.py +242 -0
- package/skills/minimax-pdf/scripts/make.sh +491 -0
- package/skills/minimax-pdf/scripts/merge.py +112 -0
- package/skills/minimax-pdf/scripts/palette.py +521 -0
- package/skills/minimax-pdf/scripts/reformat_parse.py +374 -0
- package/skills/minimax-pdf/scripts/render_body.py +1052 -0
- package/skills/minimax-pdf/scripts/render_cover.js +111 -0
- package/skills/minimax-xlsx/SKILL.md +156 -0
- package/skills/minimax-xlsx/references/create.md +691 -0
- package/skills/minimax-xlsx/references/edit.md +684 -0
- package/skills/minimax-xlsx/references/fix.md +37 -0
- package/skills/minimax-xlsx/references/format.md +768 -0
- package/skills/minimax-xlsx/references/ooxml-cheatsheet.md +231 -0
- package/skills/minimax-xlsx/references/read-analyze.md +97 -0
- package/skills/minimax-xlsx/references/validate.md +772 -0
- package/skills/minimax-xlsx/scripts/formula_check.py +422 -0
- package/skills/minimax-xlsx/scripts/libreoffice_recalc.py +248 -0
- package/skills/minimax-xlsx/scripts/shared_strings_builder.py +163 -0
- package/skills/minimax-xlsx/scripts/style_audit.py +575 -0
- package/skills/minimax-xlsx/scripts/xlsx_add_column.py +395 -0
- package/skills/minimax-xlsx/scripts/xlsx_insert_row.py +274 -0
- package/skills/minimax-xlsx/scripts/xlsx_pack.py +87 -0
- package/skills/minimax-xlsx/scripts/xlsx_reader.py +362 -0
- package/skills/minimax-xlsx/scripts/xlsx_shift_rows.py +396 -0
- package/skills/minimax-xlsx/scripts/xlsx_unpack.py +130 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/[Content_Types].xml +9 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/_rels/.rels +6 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/xl/_rels/workbook.xml.rels +19 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/xl/sharedStrings.xml +33 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/xl/styles.xml +160 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/xl/workbook.xml +30 -0
- package/skills/minimax-xlsx/templates/minimal_xlsx/xl/worksheets/sheet1.xml +70 -0
- package/skills/newsletter-generation/SKILL.md +71 -0
- package/skills/oss-release-readiness/SKILL.md +47 -0
- package/skills/parallel-subagent-dispatch/SKILL.md +58 -0
- package/skills/performance-optimization/SKILL.md +364 -0
- package/skills/planning-and-task-breakdown/SKILL.md +290 -0
- package/skills/pptx-generator/SKILL.md +275 -0
- package/skills/pptx-generator/references/design-system.md +392 -0
- package/skills/pptx-generator/references/editing.md +162 -0
- package/skills/pptx-generator/references/pitfalls.md +112 -0
- package/skills/pptx-generator/references/pptxgenjs.md +420 -0
- package/skills/pptx-generator/references/slide-types.md +413 -0
- package/skills/pr-test-analysis/SKILL.md +24 -0
- package/skills/react-native-dev/SKILL.md +180 -0
- package/skills/react-native-dev/references/animations.md +254 -0
- package/skills/react-native-dev/references/components.md +124 -0
- package/skills/react-native-dev/references/engineering.md +527 -0
- package/skills/react-native-dev/references/forms.md +300 -0
- package/skills/react-native-dev/references/native-capabilities.md +163 -0
- package/skills/react-native-dev/references/navigation.md +271 -0
- package/skills/react-native-dev/references/networking.md +346 -0
- package/skills/react-native-dev/references/performance.md +215 -0
- package/skills/react-native-dev/references/state-management.md +230 -0
- package/skills/react-native-dev/references/styling.md +117 -0
- package/skills/react-native-dev/references/testing.md +341 -0
- package/skills/requirements-grilling/SKILL.md +447 -0
- package/skills/requirements-grilling/references/ADR-FORMAT.md +46 -0
- package/skills/requirements-grilling/references/CONTEXT-FORMAT.md +41 -0
- package/skills/requirements-grilling/references/INTERVIEW-PACKET-FORMAT.md +62 -0
- package/skills/requirements-grilling/references/MIT-LICENSE-MATT-POCOCK.md +25 -0
- package/skills/requirements-grilling/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/LICENSE +21 -0
- package/skills/requirements-grilling/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/NOTICE.md +9 -0
- package/skills/requirements-grilling/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/interview-me/SKILL.upstream.md +225 -0
- package/skills/requirements-grilling/references/upstream/mattpocock-skills/9603c1cc8118d08bc1b3bf34cf714f62178dea3b/LICENSE +21 -0
- package/skills/requirements-grilling/references/upstream/mattpocock-skills/9603c1cc8118d08bc1b3bf34cf714f62178dea3b/NOTICE.md +12 -0
- package/skills/requirements-grilling/references/upstream/mattpocock-skills/9603c1cc8118d08bc1b3bf34cf714f62178dea3b/batch-grill-me/SKILL.upstream.md +15 -0
- package/skills/requirements-grilling/references/upstream/mattpocock-skills/9603c1cc8118d08bc1b3bf34cf714f62178dea3b/grill-me/SKILL.upstream.md +7 -0
- package/skills/requirements-grilling/references/upstream/mattpocock-skills/9603c1cc8118d08bc1b3bf34cf714f62178dea3b/grilling/SKILL.upstream.md +12 -0
- package/skills/review-pipeline/SKILL.md +38 -0
- package/skills/rose-memory/SKILL.md +210 -0
- package/skills/rose-memory/references/README.md +48 -0
- package/skills/rose-memory/references/memory_cli.py +2384 -0
- package/skills/rose-memory/references/schema.sql +315 -0
- package/skills/security-and-hardening/SKILL.md +369 -0
- package/skills/session-handoff/SKILL.md +88 -0
- package/skills/session-handoff/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/LICENSE +21 -0
- package/skills/session-handoff/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/NOTICE.md +9 -0
- package/skills/session-handoff/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/productivity/handoff/SKILL.upstream.md +16 -0
- package/skills/session-handoff/scripts/session_handoff.py +764 -0
- package/skills/shader-dev/SKILL.md +316 -0
- package/skills/shader-dev/reference/ambient-occlusion.md +382 -0
- package/skills/shader-dev/reference/analytic-ray-tracing.md +651 -0
- package/skills/shader-dev/reference/anti-aliasing.md +71 -0
- package/skills/shader-dev/reference/atmospheric-scattering.md +571 -0
- package/skills/shader-dev/reference/camera-effects.md +80 -0
- package/skills/shader-dev/reference/cellular-automata.md +635 -0
- package/skills/shader-dev/reference/color-palette.md +481 -0
- package/skills/shader-dev/reference/csg-boolean-operations.md +466 -0
- package/skills/shader-dev/reference/domain-repetition.md +436 -0
- package/skills/shader-dev/reference/domain-warping.md +419 -0
- package/skills/shader-dev/reference/fluid-simulation.md +425 -0
- package/skills/shader-dev/reference/fractal-rendering.md +525 -0
- package/skills/shader-dev/reference/lighting-model.md +639 -0
- package/skills/shader-dev/reference/matrix-transform.md +535 -0
- package/skills/shader-dev/reference/multipass-buffer.md +571 -0
- package/skills/shader-dev/reference/normal-estimation.md +418 -0
- package/skills/shader-dev/reference/particle-system.md +589 -0
- package/skills/shader-dev/reference/path-tracing-gi.md +602 -0
- package/skills/shader-dev/reference/polar-uv-manipulation.md +521 -0
- package/skills/shader-dev/reference/post-processing.md +375 -0
- package/skills/shader-dev/reference/procedural-2d-pattern.md +439 -0
- package/skills/shader-dev/reference/procedural-noise.md +551 -0
- package/skills/shader-dev/reference/ray-marching.md +396 -0
- package/skills/shader-dev/reference/sdf-2d.md +724 -0
- package/skills/shader-dev/reference/sdf-3d.md +805 -0
- package/skills/shader-dev/reference/sdf-tricks.md +63 -0
- package/skills/shader-dev/reference/shadow-techniques.md +476 -0
- package/skills/shader-dev/reference/simulation-physics.md +644 -0
- package/skills/shader-dev/reference/sound-synthesis.md +578 -0
- package/skills/shader-dev/reference/terrain-rendering.md +839 -0
- package/skills/shader-dev/reference/texture-mapping-advanced.md +87 -0
- package/skills/shader-dev/reference/texture-sampling.md +553 -0
- package/skills/shader-dev/reference/volumetric-rendering.md +608 -0
- package/skills/shader-dev/reference/voronoi-cellular-noise.md +486 -0
- package/skills/shader-dev/reference/voxel-rendering.md +701 -0
- package/skills/shader-dev/reference/water-ocean.md +445 -0
- package/skills/shader-dev/reference/webgl-pitfalls.md +41 -0
- package/skills/shader-dev/techniques/ambient-occlusion.md +364 -0
- package/skills/shader-dev/techniques/analytic-ray-tracing.md +542 -0
- package/skills/shader-dev/techniques/anti-aliasing.md +124 -0
- package/skills/shader-dev/techniques/atmospheric-scattering.md +522 -0
- package/skills/shader-dev/techniques/camera-effects.md +115 -0
- package/skills/shader-dev/techniques/cellular-automata.md +531 -0
- package/skills/shader-dev/techniques/color-palette.md +380 -0
- package/skills/shader-dev/techniques/csg-boolean-operations.md +491 -0
- package/skills/shader-dev/techniques/domain-repetition.md +333 -0
- package/skills/shader-dev/techniques/domain-warping.md +414 -0
- package/skills/shader-dev/techniques/fluid-simulation.md +1175 -0
- package/skills/shader-dev/techniques/fractal-rendering.md +436 -0
- package/skills/shader-dev/techniques/lighting-model.md +527 -0
- package/skills/shader-dev/techniques/matrix-transform.md +455 -0
- package/skills/shader-dev/techniques/multipass-buffer.md +922 -0
- package/skills/shader-dev/techniques/normal-estimation.md +318 -0
- package/skills/shader-dev/techniques/particle-system.md +1203 -0
- package/skills/shader-dev/techniques/path-tracing-gi.md +623 -0
- package/skills/shader-dev/techniques/polar-uv-manipulation.md +373 -0
- package/skills/shader-dev/techniques/post-processing.md +788 -0
- package/skills/shader-dev/techniques/procedural-2d-pattern.md +346 -0
- package/skills/shader-dev/techniques/procedural-noise.md +554 -0
- package/skills/shader-dev/techniques/ray-marching.md +467 -0
- package/skills/shader-dev/techniques/sdf-2d.md +631 -0
- package/skills/shader-dev/techniques/sdf-3d.md +589 -0
- package/skills/shader-dev/techniques/sdf-tricks.md +100 -0
- package/skills/shader-dev/techniques/shadow-techniques.md +776 -0
- package/skills/shader-dev/techniques/simulation-physics.md +1542 -0
- package/skills/shader-dev/techniques/sound-synthesis.md +490 -0
- package/skills/shader-dev/techniques/terrain-rendering.md +408 -0
- package/skills/shader-dev/techniques/texture-mapping-advanced.md +121 -0
- package/skills/shader-dev/techniques/texture-sampling.md +382 -0
- package/skills/shader-dev/techniques/volumetric-rendering.md +375 -0
- package/skills/shader-dev/techniques/voronoi-cellular-noise.md +458 -0
- package/skills/shader-dev/techniques/voxel-rendering.md +985 -0
- package/skills/shader-dev/techniques/water-ocean.md +490 -0
- package/skills/shader-dev/techniques/webgl-pitfalls.md +170 -0
- package/skills/shipping-and-launch/SKILL.md +334 -0
- package/skills/silent-failure-hunting/SKILL.md +24 -0
- package/skills/source-driven-development/SKILL.md +223 -0
- package/skills/spec-driven-development/SKILL.md +235 -0
- package/skills/spec-driven-development/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/LICENSE +21 -0
- package/skills/spec-driven-development/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/NOTICE.md +9 -0
- package/skills/spec-driven-development/references/upstream/addyosmani-agent-skills/6bcfeb9dae52b11eaad23511acc165109746dbc3/spec-driven-development/SKILL.upstream.md +206 -0
- package/skills/strategy-stress-test/SKILL.md +185 -0
- package/skills/systematic-literature-review/SKILL.md +77 -0
- package/skills/test-document-generator/SKILL.md +152 -0
- package/skills/test-document-generator/references/test-document-template.md +45 -0
- package/skills/test-driven-development/SKILL.md +399 -0
- package/skills/write-skills/GLOSSARY.md +113 -0
- package/skills/write-skills/SKILL.md +133 -0
- package/skills/write-skills/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/LICENSE +21 -0
- package/skills/write-skills/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/NOTICE.md +9 -0
- package/skills/write-skills/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/productivity/writing-great-skills/GLOSSARY.md +201 -0
- package/skills/write-skills/references/upstream/mattpocock-skills/391a2701dd948f94f56a39f7533f8eea9a859c87/productivity/writing-great-skills/SKILL.upstream.md +83 -0
- package/src/runtime/child-guard.ts +70 -0
- package/src/runtime/conflicts.ts +25 -0
- package/src/runtime/contracts.ts +9 -0
- package/src/runtime/doctor.ts +134 -0
- package/src/runtime/global-resources.ts +152 -0
- package/src/runtime/index.ts +23 -0
- package/src/runtime/lifecycle.ts +19 -0
- package/src/runtime/native-integrations.ts +44 -0
- package/src/runtime/path-boundaries.ts +69 -0
- package/src/runtime/registry.ts +213 -0
- package/src/runtime/roles.ts +64 -0
- package/src/runtime/rose-context.ts +24 -0
- package/src/runtime/subagents.ts +426 -0
- package/templates/APPEND_SYSTEM.md +12 -0
- package/upstream/aili-workflows.lock.json +3226 -0
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fullstack-dev
|
|
3
|
+
description: |
|
|
4
|
+
Build a backend service or an end-to-end frontend/backend integration when service/API/data boundaries are the primary deliverable; do not trigger for pure UI, contract design only, security review, test workflow, or every feature touching both folders.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Full-Stack Development Practices
|
|
8
|
+
|
|
9
|
+
## Bounded Domain Workflow
|
|
10
|
+
|
|
11
|
+
ROSE/`aili-delivery-flow` selects exactly one primary domain owner; do not also load `frontend-dev` or `frontend-ui-engineering` as process owners. This skill does not invoke API design, security, TDD, frontend, CI, review, or another process skill; return one concrete need to ROSE and stop `complete`, `need-user`, `need-evidence`, `material-delta`, `blocked`, or `Unverified`. Canonical lifecycle approvals and claim-matched verification override generic checklists below.
|
|
12
|
+
|
|
13
|
+
Near misses: interface shape only, pure UI/component work, marketing/media pages, isolated database design, review/hardening only, or browser/test evidence only.
|
|
14
|
+
|
|
15
|
+
### Step 0: Gather Requirements
|
|
16
|
+
|
|
17
|
+
Before scaffolding, resolve only material choices not already established by the request, repository, or accepted contract:
|
|
18
|
+
|
|
19
|
+
1. **Stack**: Language/framework for backend and frontend (e.g., Express + React, Django + Vue, Go + HTMX)
|
|
20
|
+
2. **Service type**: API-only, full-stack monolith, or microservice?
|
|
21
|
+
3. **Database**: SQL (PostgreSQL, SQLite, MySQL) or NoSQL (MongoDB, Redis)?
|
|
22
|
+
4. **Integration**: REST, GraphQL, tRPC, or gRPC?
|
|
23
|
+
5. **Real-time**: Needed? If yes — SSE, WebSocket, or polling?
|
|
24
|
+
6. **Auth**: Needed? If yes — JWT, session, OAuth, or third-party (Clerk, Auth.js)?
|
|
25
|
+
|
|
26
|
+
Ask one decision-shaped question only when an unresolved choice changes the implementation. Do not issue the full questionnaire by default.
|
|
27
|
+
|
|
28
|
+
### Step 1: Architectural Decisions
|
|
29
|
+
|
|
30
|
+
Based on requirements, make and state these decisions before coding:
|
|
31
|
+
|
|
32
|
+
🔴 **CHECKPOINT — architecture/security/db decisions:** stop before choosing or changing architecture, auth/session model, database/schema/migration strategy, CORS/upload behavior, or realtime transport. Proceed only when the user request or repository evidence makes the choice clear; otherwise ask for the missing decision instead of inventing it.
|
|
33
|
+
|
|
34
|
+
| Decision | Options | Reference |
|
|
35
|
+
|----------|---------|-----------|
|
|
36
|
+
| Project structure | Feature-first (recommended) vs layer-first | [Section 1](#1-project-structure--layering-critical) |
|
|
37
|
+
| API client approach | Typed fetch / React Query / tRPC / OpenAPI codegen | [Section 5](#5-api-client-patterns-medium) |
|
|
38
|
+
| Auth strategy | JWT + refresh / session / third-party | [Section 6](#6-authentication--middleware-high) |
|
|
39
|
+
| Real-time method | Polling / SSE / WebSocket | [Section 11](#11-real-time-patterns-medium) |
|
|
40
|
+
| Error handling | Typed error hierarchy + global handler | [Section 3](#3-error-handling--resilience-high) |
|
|
41
|
+
|
|
42
|
+
Briefly explain each choice (1 sentence per decision).
|
|
43
|
+
|
|
44
|
+
### Step 2: Scaffold with Checklist
|
|
45
|
+
|
|
46
|
+
Use only checklist rows applicable to the accepted scope; they are domain prompts, not an automatic expansion of the product or verification contract.
|
|
47
|
+
|
|
48
|
+
### Step 3: Implement Following Patterns
|
|
49
|
+
|
|
50
|
+
Write code following the patterns in this document. Reference specific sections as you implement each part.
|
|
51
|
+
|
|
52
|
+
### Step 4: Test & Verify
|
|
53
|
+
|
|
54
|
+
After implementation, return candidate evidence to the canonical verification owner. It selects the smallest check supporting the exact claim; the examples below are not an automatic suite:
|
|
55
|
+
|
|
56
|
+
1. **Build check**: Ensure both backend and frontend compile without errors
|
|
57
|
+
```bash
|
|
58
|
+
# Backend
|
|
59
|
+
cd server && npm run build
|
|
60
|
+
# Frontend
|
|
61
|
+
cd client && npm run build
|
|
62
|
+
```
|
|
63
|
+
2. **Start & smoke test**: Start the server, verify key endpoints return expected responses
|
|
64
|
+
```bash
|
|
65
|
+
# Start server, then test
|
|
66
|
+
curl http://localhost:3000/health
|
|
67
|
+
curl http://localhost:3000/api/<resource>
|
|
68
|
+
```
|
|
69
|
+
3. **Integration check when affected**: Verify the exact changed frontend/backend boundary.
|
|
70
|
+
4. **Real-time check when affected**: Verify only the accepted synchronization claim.
|
|
71
|
+
|
|
72
|
+
If the selected check fails, make at most one in-scope targeted repair/recheck, then report the blocker.
|
|
73
|
+
|
|
74
|
+
| Failure | First response | If still failing |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| Build/typecheck fails | Fix the changed package or shared type causing the error | Do not rewrite the stack; report blocker if dependency/schema changes are needed |
|
|
77
|
+
| Auth/CORS/upload smoke test fails | Keep restrictive defaults and inspect middleware/order/config | Return the exact security-sensitive relaxation decision to ROSE |
|
|
78
|
+
| Database migration/schema mismatch | Stop and inspect existing migration pattern | Return the exact schema/API contract change to ROSE; do not edit production schema manually |
|
|
79
|
+
| Frontend cannot reach backend | Verify base URL, env loading, proxy, and health endpoint | Report environment gap rather than hardcoding URLs |
|
|
80
|
+
|
|
81
|
+
### Step 5: Handoff Summary
|
|
82
|
+
|
|
83
|
+
Provide a brief summary to the user:
|
|
84
|
+
|
|
85
|
+
- **What was built**: List of implemented features and endpoints
|
|
86
|
+
- **How to run**: Exact commands to start backend and frontend
|
|
87
|
+
- **What's missing / next steps**: Any deferred items, known limitations, or recommended improvements
|
|
88
|
+
- **Key files**: List the most important files the user should know about
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Scope
|
|
93
|
+
|
|
94
|
+
**USE this skill when:**
|
|
95
|
+
- Building a full-stack application (backend + frontend)
|
|
96
|
+
- Scaffolding a new backend service or API
|
|
97
|
+
- Designing service layers and module boundaries
|
|
98
|
+
- Implementing database access, caching, or background jobs
|
|
99
|
+
- Writing error handling, logging, or configuration management
|
|
100
|
+
- Explicitly implementing the accepted backend/service behavior or cross-boundary integration
|
|
101
|
+
- Setting up API clients, auth flows, file uploads, or real-time features
|
|
102
|
+
|
|
103
|
+
**NOT for:**
|
|
104
|
+
- Pure frontend/UI concerns (use your frontend framework's docs)
|
|
105
|
+
- Pure database schema design without backend context
|
|
106
|
+
|
|
107
|
+
## Routing Boundaries
|
|
108
|
+
|
|
109
|
+
| Request | Prefer | Boundary |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| Backend + frontend integration, API client wiring, auth flow, file upload, realtime app | `fullstack-dev` | End-to-end service/application implementation |
|
|
112
|
+
| Interface contract only, REST/GraphQL shape, type boundary design | `api-and-interface-design` | Design the public contract before implementation |
|
|
113
|
+
| Existing app UI components/layout/state only | `frontend-ui-engineering` | No backend/service integration needed |
|
|
114
|
+
| Marketing page, cinematic animation, AI media, persuasive copy | `frontend-dev` | Rich visual frontend experience, not app architecture |
|
|
115
|
+
| Threat modeling, auth hardening, untrusted input risk | `security-and-hardening` | Security review or hardening focus |
|
|
116
|
+
| CI, deployment pipeline, automated gates | `ci-cd-and-automation` | Automation infrastructure focus |
|
|
117
|
+
| Explicit TDD or accepted reproduction-first proof | return need to ROSE | Never auto-pair a test workflow with this skill |
|
|
118
|
+
|
|
119
|
+
### Trigger Validation
|
|
120
|
+
|
|
121
|
+
| User says | Trigger? | Reason |
|
|
122
|
+
|---|---:|---|
|
|
123
|
+
| "Build an Express + React CRUD app with auth" | Yes | Backend + frontend + auth integration |
|
|
124
|
+
| "Create a REST API and connect the frontend" | Yes | Full-stack boundary crossing |
|
|
125
|
+
| "Design the API response schema only" | No | Return to ROSE; contract design is the narrower candidate owner |
|
|
126
|
+
| "Polish this button component" | No | Return to ROSE; app UI is the narrower candidate owner |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Quick Start — New Backend Service Reference Checklist
|
|
131
|
+
|
|
132
|
+
- [ ] Project scaffolded with **feature-first** structure
|
|
133
|
+
- [ ] Configuration **centralized**, env vars **validated at startup** (fail fast)
|
|
134
|
+
- [ ] **Typed error hierarchy** defined (not generic `Error`)
|
|
135
|
+
- [ ] **Global error handler** middleware
|
|
136
|
+
- [ ] **Structured JSON logging** with request ID propagation
|
|
137
|
+
- [ ] Database: **migrations** set up, **connection pooling** configured
|
|
138
|
+
- [ ] **Input validation** on all endpoints (Zod / Pydantic / Go validator)
|
|
139
|
+
- [ ] **Authentication middleware** in place
|
|
140
|
+
- [ ] **Health check** endpoints (`/health`, `/ready`)
|
|
141
|
+
- [ ] **Graceful shutdown** handling (SIGTERM)
|
|
142
|
+
- [ ] **CORS** configured (explicit origins, not `*`)
|
|
143
|
+
- [ ] **Security headers** (helmet or equivalent)
|
|
144
|
+
- [ ] `.env.example` committed (no real secrets)
|
|
145
|
+
|
|
146
|
+
## Quick Start — Frontend-Backend Integration Reference Checklist
|
|
147
|
+
|
|
148
|
+
- [ ] **API client** configured (typed fetch wrapper, React Query, tRPC, or OpenAPI generated)
|
|
149
|
+
- [ ] **Base URL** from environment variable (not hardcoded)
|
|
150
|
+
- [ ] **Auth token** attached to requests automatically (interceptor / middleware)
|
|
151
|
+
- [ ] **Error handling** — API errors mapped to user-facing messages
|
|
152
|
+
- [ ] **Loading states** handled (skeleton/spinner, not blank screen)
|
|
153
|
+
- [ ] **Type safety** across the boundary (shared types, OpenAPI, or tRPC)
|
|
154
|
+
- [ ] **CORS** configured with explicit origins (not `*` in production)
|
|
155
|
+
- [ ] **Refresh token** flow implemented (httpOnly cookie + transparent retry on 401)
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Quick Navigation
|
|
160
|
+
|
|
161
|
+
| Need to… | Jump to |
|
|
162
|
+
|----------|---------|
|
|
163
|
+
| Organize project folders | [1. Project Structure](#1-project-structure--layering-critical) |
|
|
164
|
+
| Manage config + secrets | [2. Configuration](#2-configuration--environment-critical) |
|
|
165
|
+
| Handle errors properly | [3. Error Handling](#3-error-handling--resilience-high) |
|
|
166
|
+
| Write database code | [4. Database Access Patterns](#4-database-access-patterns-high) |
|
|
167
|
+
| Set up API client from frontend | [5. API Client Patterns](#5-api-client-patterns-medium) |
|
|
168
|
+
| Add auth middleware | [6. Auth & Middleware](#6-authentication--middleware-high) |
|
|
169
|
+
| Set up logging | [7. Logging & Observability](#7-logging--observability-medium-high) |
|
|
170
|
+
| Add background jobs | [8. Background Jobs](#8-background-jobs--async-medium) |
|
|
171
|
+
| Implement caching | [9. Caching](#9-caching-patterns-medium) |
|
|
172
|
+
| Upload files (presigned URL, multipart) | [10. File Upload Patterns](#10-file-upload-patterns-medium) |
|
|
173
|
+
| Add real-time features (SSE, WebSocket) | [11. Real-Time Patterns](#11-real-time-patterns-medium) |
|
|
174
|
+
| Handle API errors in frontend UI | [12. Cross-Boundary Error Handling](#12-cross-boundary-error-handling-medium) |
|
|
175
|
+
| Harden for production | [13. Production Hardening](#13-production-hardening-medium) |
|
|
176
|
+
| Design API endpoints | [API Design](references/api-design.md) |
|
|
177
|
+
| Design database schema | [Database Schema](references/db-schema.md) |
|
|
178
|
+
| Auth flow (JWT, refresh, Next.js SSR, RBAC) | [references/auth-flow.md](references/auth-flow.md) |
|
|
179
|
+
| CORS, env vars, environment management | [references/environment-management.md](references/environment-management.md) |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Core Principles (7 Iron Rules)
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
1. ✅ Organize by FEATURE, not by technical layer
|
|
187
|
+
2. ✅ Controllers never contain business logic
|
|
188
|
+
3. ✅ Services never import HTTP request/response types
|
|
189
|
+
4. ✅ All config from env vars, validated at startup, fail fast
|
|
190
|
+
5. ✅ Every error is typed, logged, and returns consistent format
|
|
191
|
+
6. ✅ All input validated at the boundary — trust nothing from client
|
|
192
|
+
7. ✅ Structured JSON logging with request ID — not console.log
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 1. Project Structure & Layering (CRITICAL)
|
|
198
|
+
|
|
199
|
+
### Feature-First Organization
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
✅ Feature-first ❌ Layer-first
|
|
203
|
+
src/ src/
|
|
204
|
+
orders/ controllers/
|
|
205
|
+
order.controller.ts order.controller.ts
|
|
206
|
+
order.service.ts user.controller.ts
|
|
207
|
+
order.repository.ts services/
|
|
208
|
+
order.dto.ts order.service.ts
|
|
209
|
+
order.test.ts user.service.ts
|
|
210
|
+
users/ repositories/
|
|
211
|
+
user.controller.ts ...
|
|
212
|
+
user.service.ts
|
|
213
|
+
shared/
|
|
214
|
+
database/
|
|
215
|
+
middleware/
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Three-Layer Architecture
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
Controller (HTTP) → Service (Business Logic) → Repository (Data Access)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
| Layer | Responsibility | ❌ Never |
|
|
225
|
+
|-------|---------------|---------|
|
|
226
|
+
| Controller | Parse request, validate, call service, format response | Business logic, DB queries |
|
|
227
|
+
| Service | Business rules, orchestration, transaction mgmt | HTTP types (req/res), direct DB |
|
|
228
|
+
| Repository | Database queries, external API calls | Business logic, HTTP types |
|
|
229
|
+
|
|
230
|
+
### Dependency Injection (All Languages)
|
|
231
|
+
|
|
232
|
+
Inject repositories, clients, and side-effect services through constructors or framework providers. Services should depend on interfaces/protocols where the language supports them, not concrete HTTP or database details.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 2. Configuration & Environment (CRITICAL)
|
|
237
|
+
|
|
238
|
+
### Centralized, Typed, Fail-Fast
|
|
239
|
+
|
|
240
|
+
**TypeScript:**
|
|
241
|
+
```typescript
|
|
242
|
+
const config = {
|
|
243
|
+
port: parseInt(process.env.PORT || '3000', 10),
|
|
244
|
+
database: { url: requiredEnv('DATABASE_URL'), poolSize: intEnv('DB_POOL_SIZE', 10) },
|
|
245
|
+
auth: { jwtSecret: requiredEnv('JWT_SECRET'), expiresIn: process.env.JWT_EXPIRES_IN || '1h' },
|
|
246
|
+
} as const;
|
|
247
|
+
|
|
248
|
+
function requiredEnv(name: string): string {
|
|
249
|
+
const value = process.env[name];
|
|
250
|
+
if (!value) throw new Error(`Missing required env var: ${name}`); // fail fast
|
|
251
|
+
return value;
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Rules
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
✅ All config via environment variables (Twelve-Factor)
|
|
259
|
+
✅ Validate required vars at startup — fail fast
|
|
260
|
+
✅ Type-cast at config layer, not at usage sites
|
|
261
|
+
✅ Commit .env.example with dummy values
|
|
262
|
+
|
|
263
|
+
❌ Never hardcode secrets, URLs, or credentials
|
|
264
|
+
❌ Never commit .env files
|
|
265
|
+
❌ Never scatter process.env / os.environ throughout code
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 3. Error Handling & Resilience (HIGH)
|
|
271
|
+
|
|
272
|
+
### Typed Error Hierarchy
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
// Base (TypeScript)
|
|
276
|
+
class AppError extends Error {
|
|
277
|
+
constructor(
|
|
278
|
+
message: string,
|
|
279
|
+
public readonly code: string,
|
|
280
|
+
public readonly statusCode: number,
|
|
281
|
+
public readonly isOperational: boolean = true,
|
|
282
|
+
) { super(message); }
|
|
283
|
+
}
|
|
284
|
+
class NotFoundError extends AppError {
|
|
285
|
+
constructor(resource: string, id: string) {
|
|
286
|
+
super(`${resource} not found: ${id}`, 'NOT_FOUND', 404);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
class ValidationError extends AppError {
|
|
290
|
+
constructor(public readonly errors: FieldError[]) {
|
|
291
|
+
super('Validation failed', 'VALIDATION_ERROR', 422);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Global Error Handler
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
// TypeScript (Express)
|
|
300
|
+
app.use((err, req, res, next) => {
|
|
301
|
+
if (err instanceof AppError && err.isOperational) {
|
|
302
|
+
return res.status(err.statusCode).json({
|
|
303
|
+
title: err.code, status: err.statusCode,
|
|
304
|
+
detail: err.message, request_id: req.id,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
logger.error('Unexpected error', { error: err.message, stack: err.stack, request_id: req.id });
|
|
308
|
+
res.status(500).json({ title: 'Internal Error', status: 500, request_id: req.id });
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Rules
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
✅ Typed, domain-specific error classes
|
|
316
|
+
✅ Global error handler catches everything
|
|
317
|
+
✅ Operational errors → structured response
|
|
318
|
+
✅ Programming errors → log + generic 500
|
|
319
|
+
✅ Retry transient failures with exponential backoff
|
|
320
|
+
|
|
321
|
+
❌ Never catch and ignore errors silently
|
|
322
|
+
❌ Never return stack traces to client
|
|
323
|
+
❌ Never throw generic Error('something')
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## 4. Database Access Patterns (HIGH)
|
|
329
|
+
|
|
330
|
+
### Migrations Always
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# TypeScript (Prisma) # Python (Alembic) # Go (golang-migrate)
|
|
334
|
+
npx prisma migrate dev alembic revision --autogenerate migrate -source file://migrations
|
|
335
|
+
npx prisma migrate deploy alembic upgrade head migrate -database $DB up
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
✅ Schema changes via migrations, never manual SQL
|
|
340
|
+
✅ Migrations must be reversible
|
|
341
|
+
✅ Review migration SQL before production
|
|
342
|
+
❌ Never modify production schema manually
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### N+1 Prevention
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
// ❌ N+1: 1 query + N queries
|
|
349
|
+
const orders = await db.order.findMany();
|
|
350
|
+
for (const o of orders) { o.items = await db.item.findMany({ where: { orderId: o.id } }); }
|
|
351
|
+
|
|
352
|
+
// ✅ Single JOIN query
|
|
353
|
+
const orders = await db.order.findMany({ include: { items: true } });
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Transactions for Multi-Step Writes
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
await db.$transaction(async (tx) => {
|
|
360
|
+
const order = await tx.order.create({ data: orderData });
|
|
361
|
+
await tx.inventory.decrement({ productId, quantity });
|
|
362
|
+
await tx.payment.create({ orderId: order.id, amount });
|
|
363
|
+
});
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Connection Pooling
|
|
367
|
+
|
|
368
|
+
Pool size = `(CPU cores × 2) + spindle_count` (start with 10-20). Always set connection timeout. Use PgBouncer for serverless.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 5. API Client Patterns (MEDIUM)
|
|
373
|
+
|
|
374
|
+
The "glue layer" between frontend and backend. Choose the approach that fits your team and stack.
|
|
375
|
+
|
|
376
|
+
### Option A: Typed Fetch Wrapper (Simple, No Dependencies)
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
// lib/api-client.ts
|
|
380
|
+
const BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
|
|
381
|
+
|
|
382
|
+
class ApiError extends Error {
|
|
383
|
+
constructor(public status: number, public body: any) {
|
|
384
|
+
super(body?.detail || body?.message || `API error ${status}`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
async function api<T>(path: string, options: RequestInit = {}): Promise<T> {
|
|
389
|
+
const token = getAuthToken(); // from cookie / memory / context
|
|
390
|
+
|
|
391
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
392
|
+
...options,
|
|
393
|
+
headers: {
|
|
394
|
+
'Content-Type': 'application/json',
|
|
395
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
396
|
+
...options.headers,
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
if (!res.ok) {
|
|
401
|
+
const body = await res.json().catch(() => null);
|
|
402
|
+
throw new ApiError(res.status, body);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (res.status === 204) return undefined as T;
|
|
406
|
+
return res.json();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export const apiClient = {
|
|
410
|
+
get: <T>(path: string) => api<T>(path),
|
|
411
|
+
post: <T>(path: string, data: unknown) => api<T>(path, { method: 'POST', body: JSON.stringify(data) }),
|
|
412
|
+
put: <T>(path: string, data: unknown) => api<T>(path, { method: 'PUT', body: JSON.stringify(data) }),
|
|
413
|
+
patch: <T>(path: string, data: unknown) => api<T>(path, { method: 'PATCH', body: JSON.stringify(data) }),
|
|
414
|
+
delete: <T>(path: string) => api<T>(path, { method: 'DELETE' }),
|
|
415
|
+
};
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Option B: React Query + Typed Client (Recommended for React)
|
|
419
|
+
|
|
420
|
+
Wrap the typed client in `useQuery` / `useMutation`, use stable query keys, invalidate affected resources on mutation success, and render loading/error states at the component boundary.
|
|
421
|
+
|
|
422
|
+
### Option C: tRPC (Same Team Owns Both Sides)
|
|
423
|
+
|
|
424
|
+
Use tRPC when both sides are TypeScript and the same team owns the contract. Keep procedures validated, protected where needed, and exported through the inferred `AppRouter` type.
|
|
425
|
+
|
|
426
|
+
### Option D: OpenAPI Generated Client (Public / Multi-Consumer APIs)
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
npx openapi-typescript-codegen \
|
|
430
|
+
--input http://localhost:3001/api/openapi.json \
|
|
431
|
+
--output src/generated/api \
|
|
432
|
+
--client axios
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Decision: Which API Client?
|
|
436
|
+
|
|
437
|
+
| Approach | When | Type Safety | Effort |
|
|
438
|
+
|----------|------|-------------|--------|
|
|
439
|
+
| Typed fetch wrapper | Simple apps, small teams | Manual types | Low |
|
|
440
|
+
| React Query + fetch | React apps, server state | Manual types | Medium |
|
|
441
|
+
| tRPC | Same team, TypeScript both sides | Automatic | Low |
|
|
442
|
+
| OpenAPI generated | Public API, multi-consumer | Automatic | Medium |
|
|
443
|
+
| GraphQL codegen | GraphQL APIs | Automatic | Medium |
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## 6. Authentication & Middleware (HIGH)
|
|
448
|
+
|
|
449
|
+
> **Full reference:** [references/auth-flow.md](references/auth-flow.md) — JWT bearer flow, automatic token refresh, Next.js server-side auth, RBAC pattern, backend middleware order.
|
|
450
|
+
|
|
451
|
+
### Standard Middleware Order
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
Request → 1.RequestID → 2.Logging → 3.CORS → 4.RateLimit → 5.BodyParse
|
|
455
|
+
→ 6.Auth → 7.Authz → 8.Validation → 9.Handler → 10.ErrorHandler → Response
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### JWT Rules
|
|
459
|
+
|
|
460
|
+
```
|
|
461
|
+
✅ Short expiry access token (15min) + refresh token (server-stored)
|
|
462
|
+
✅ Minimal claims: userId, roles (not entire user object)
|
|
463
|
+
✅ Rotate signing keys periodically
|
|
464
|
+
|
|
465
|
+
❌ Never store tokens in localStorage (XSS risk)
|
|
466
|
+
❌ Never pass tokens in URL query params
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### RBAC Pattern
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
function authorize(...roles: Role[]) {
|
|
473
|
+
return (req, res, next) => {
|
|
474
|
+
if (!req.user) throw new UnauthorizedError();
|
|
475
|
+
if (!roles.some(r => req.user.roles.includes(r))) throw new ForbiddenError();
|
|
476
|
+
next();
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
router.delete('/users/:id', authenticate, authorize('admin'), deleteUser);
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Auth Token Automatic Refresh
|
|
483
|
+
|
|
484
|
+
On 401, call the refresh endpoint once with the httpOnly refresh cookie, update in-memory access token state, retry the original request once, then fail closed and redirect to login if refresh fails.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## 7. Logging & Observability (MEDIUM-HIGH)
|
|
489
|
+
|
|
490
|
+
### Structured JSON Logging
|
|
491
|
+
|
|
492
|
+
Log structured objects (`logger.info('Order created', { orderId, userId, duration_ms })`) instead of string interpolation. Include request IDs and never log passwords, tokens, PII, or secrets.
|
|
493
|
+
|
|
494
|
+
### Log Levels
|
|
495
|
+
|
|
496
|
+
| Level | When | Production? |
|
|
497
|
+
|-------|------|------------|
|
|
498
|
+
| error | Requires immediate attention | ✅ Always |
|
|
499
|
+
| warn | Unexpected but handled | ✅ Always |
|
|
500
|
+
| info | Normal operations, audit trail | ✅ Always |
|
|
501
|
+
| debug | Dev troubleshooting | ❌ Dev only |
|
|
502
|
+
|
|
503
|
+
### Rules
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
✅ Request ID in every log entry (propagated via middleware)
|
|
507
|
+
✅ Log at layer boundaries (request in, response out, external call)
|
|
508
|
+
❌ Never log passwords, tokens, PII, or secrets
|
|
509
|
+
❌ Never use console.log in production code
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## 8. Background Jobs & Async (MEDIUM)
|
|
515
|
+
|
|
516
|
+
### Rules
|
|
517
|
+
|
|
518
|
+
```
|
|
519
|
+
✅ All jobs must be IDEMPOTENT (same job running twice = same result)
|
|
520
|
+
✅ Failed jobs → retry (max 3) → dead letter queue → alert
|
|
521
|
+
✅ Workers run as SEPARATE processes (not threads in API server)
|
|
522
|
+
|
|
523
|
+
❌ Never put long-running tasks in request handlers
|
|
524
|
+
❌ Never assume job runs exactly once
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Idempotent Job Pattern
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
async function processPayment(data: { orderId: string }) {
|
|
531
|
+
const order = await orderRepo.findById(data.orderId);
|
|
532
|
+
if (order.paymentStatus === 'completed') return; // already processed
|
|
533
|
+
await paymentGateway.charge(order);
|
|
534
|
+
await orderRepo.updatePaymentStatus(order.id, 'completed');
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## 9. Caching Patterns (MEDIUM)
|
|
541
|
+
|
|
542
|
+
### Cache-Aside (Lazy Loading)
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
async function getUser(id: string): Promise<User> {
|
|
546
|
+
const cached = await redis.get(`user:${id}`);
|
|
547
|
+
if (cached) return JSON.parse(cached);
|
|
548
|
+
|
|
549
|
+
const user = await userRepo.findById(id);
|
|
550
|
+
if (!user) throw new NotFoundError('User', id);
|
|
551
|
+
|
|
552
|
+
await redis.set(`user:${id}`, JSON.stringify(user), 'EX', 900); // 15min TTL
|
|
553
|
+
return user;
|
|
554
|
+
}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### Rules
|
|
558
|
+
|
|
559
|
+
```
|
|
560
|
+
✅ ALWAYS set TTL — never cache without expiry
|
|
561
|
+
✅ Invalidate on write (delete cache key after update)
|
|
562
|
+
✅ Use cache for reads, never for authoritative state
|
|
563
|
+
|
|
564
|
+
❌ Never cache without TTL (stale data is worse than slow data)
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
| Data Type | Suggested TTL |
|
|
568
|
+
|-----------|---------------|
|
|
569
|
+
| User profile | 5-15 min |
|
|
570
|
+
| Product catalog | 1-5 min |
|
|
571
|
+
| Config / feature flags | 30-60 sec |
|
|
572
|
+
| Session | Match session duration |
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## 10. File Upload Patterns (MEDIUM)
|
|
577
|
+
|
|
578
|
+
### Option A: Presigned URL (Recommended for Large Files)
|
|
579
|
+
|
|
580
|
+
```
|
|
581
|
+
Client → GET /api/uploads/presign?filename=photo.jpg&type=image/jpeg
|
|
582
|
+
Server → { uploadUrl: "https://s3.../presigned", fileKey: "uploads/abc123.jpg" }
|
|
583
|
+
Client → PUT uploadUrl (direct to S3, bypasses your server)
|
|
584
|
+
Client → POST /api/photos { fileKey: "uploads/abc123.jpg" } (save reference)
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
Backend returns a short-lived upload URL and storage key after validating auth, filename, content type, and size policy. Frontend uploads directly to storage, then sends the returned key to the API to create the domain record.
|
|
588
|
+
|
|
589
|
+
### Option B: Multipart (Small Files < 10MB)
|
|
590
|
+
|
|
591
|
+
```typescript
|
|
592
|
+
// Frontend
|
|
593
|
+
const formData = new FormData();
|
|
594
|
+
formData.append('file', file);
|
|
595
|
+
formData.append('description', 'Profile photo');
|
|
596
|
+
const res = await fetch('/api/upload', { method: 'POST', body: formData });
|
|
597
|
+
// Note: do NOT set Content-Type header — browser sets boundary automatically
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### Decision
|
|
601
|
+
|
|
602
|
+
| Method | File Size | Server Load | Complexity |
|
|
603
|
+
|--------|-----------|-------------|------------|
|
|
604
|
+
| Presigned URL | Any (recommended > 5MB) | None (direct to storage) | Medium |
|
|
605
|
+
| Multipart | < 10MB | High (streams through server) | Low |
|
|
606
|
+
| Chunked / Resumable | > 100MB | Medium | High |
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
## 11. Real-Time Patterns (MEDIUM)
|
|
611
|
+
|
|
612
|
+
### Option A: Server-Sent Events (SSE) — One-Way Server → Client
|
|
613
|
+
|
|
614
|
+
Best for notifications, live feeds, and streaming AI responses. Authenticate the stream, send typed events, clean up subscriptions on close, and rely on browser reconnection with bounded backoff.
|
|
615
|
+
|
|
616
|
+
### Option B: WebSocket — Bidirectional
|
|
617
|
+
|
|
618
|
+
Best for chat, collaborative editing, and gaming. Authenticate during connection, validate every message, heartbeat idle sockets, clean up user state on close, and reconnect on the client with backoff.
|
|
619
|
+
|
|
620
|
+
### Option C: Polling (Simplest, No Infrastructure)
|
|
621
|
+
|
|
622
|
+
Use bounded polling for simple status checks. Stop polling when terminal state is reached and avoid using it as a substitute for high-volume realtime workloads.
|
|
623
|
+
|
|
624
|
+
### Decision
|
|
625
|
+
|
|
626
|
+
| Method | Direction | Complexity | When |
|
|
627
|
+
|--------|-----------|------------|------|
|
|
628
|
+
| Polling | Client → Server | Low | Simple status checks, < 10 clients |
|
|
629
|
+
| SSE | Server → Client | Medium | Notifications, feeds, AI streaming |
|
|
630
|
+
| WebSocket | Bidirectional | High | Chat, collaboration, gaming |
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## 12. Cross-Boundary Error Handling (MEDIUM)
|
|
635
|
+
|
|
636
|
+
### API Error → User-Facing Message
|
|
637
|
+
|
|
638
|
+
```typescript
|
|
639
|
+
// lib/error-handler.ts
|
|
640
|
+
export function getErrorMessage(error: unknown): string {
|
|
641
|
+
if (error instanceof ApiError) {
|
|
642
|
+
switch (error.status) {
|
|
643
|
+
case 401: return 'Please log in to continue.';
|
|
644
|
+
case 403: return 'You don\'t have permission to do this.';
|
|
645
|
+
case 404: return 'The item you\'re looking for doesn\'t exist.';
|
|
646
|
+
case 409: return 'This conflicts with an existing item.';
|
|
647
|
+
case 422:
|
|
648
|
+
const fields = error.body?.errors;
|
|
649
|
+
if (fields?.length) return fields.map((f: any) => f.message).join('. ');
|
|
650
|
+
return 'Please check your input.';
|
|
651
|
+
case 429: return 'Too many requests. Please wait a moment.';
|
|
652
|
+
default: return 'Something went wrong. Please try again.';
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (error instanceof TypeError && error.message === 'Failed to fetch') {
|
|
656
|
+
return 'Cannot connect to server. Check your internet connection.';
|
|
657
|
+
}
|
|
658
|
+
return 'An unexpected error occurred.';
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### React Query Global Error Handler
|
|
663
|
+
|
|
664
|
+
```typescript
|
|
665
|
+
const queryClient = new QueryClient({
|
|
666
|
+
defaultOptions: {
|
|
667
|
+
mutations: { onError: (error) => toast.error(getErrorMessage(error)) },
|
|
668
|
+
queries: {
|
|
669
|
+
retry: (failureCount, error) => {
|
|
670
|
+
if (error instanceof ApiError && error.status < 500) return false;
|
|
671
|
+
return failureCount < 3;
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
});
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Rules
|
|
679
|
+
|
|
680
|
+
```
|
|
681
|
+
✅ Map every API error code to a human-readable message
|
|
682
|
+
✅ Show field-level validation errors next to form inputs
|
|
683
|
+
✅ Auto-retry on 5xx (max 3, with backoff), never on 4xx
|
|
684
|
+
✅ Redirect to login on 401 (after refresh attempt fails)
|
|
685
|
+
✅ Show "offline" banner when fetch fails with TypeError
|
|
686
|
+
|
|
687
|
+
❌ Never show raw API error messages to users ("NullPointerException")
|
|
688
|
+
❌ Never silently swallow errors (show toast or log)
|
|
689
|
+
❌ Never retry 4xx errors (client is wrong, retrying won't help)
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### Integration Decision Tree
|
|
693
|
+
|
|
694
|
+
```
|
|
695
|
+
Same team owns frontend + backend?
|
|
696
|
+
│
|
|
697
|
+
├─ YES, both TypeScript
|
|
698
|
+
│ └─ tRPC (end-to-end type safety, zero codegen)
|
|
699
|
+
│
|
|
700
|
+
├─ YES, different languages
|
|
701
|
+
│ └─ OpenAPI spec → generated client (type safety via codegen)
|
|
702
|
+
│
|
|
703
|
+
├─ NO, public API
|
|
704
|
+
│ └─ REST + OpenAPI → generated SDKs for consumers
|
|
705
|
+
│
|
|
706
|
+
└─ Complex data needs, multiple frontends
|
|
707
|
+
└─ GraphQL + codegen (flexible queries per client)
|
|
708
|
+
|
|
709
|
+
Real-time needed?
|
|
710
|
+
│
|
|
711
|
+
├─ Server → Client only (notifications, feeds, AI streaming)
|
|
712
|
+
│ └─ SSE (simplest, auto-reconnect, works through proxies)
|
|
713
|
+
│
|
|
714
|
+
├─ Bidirectional (chat, collaboration)
|
|
715
|
+
│ └─ WebSocket (need heartbeat + reconnection logic)
|
|
716
|
+
│
|
|
717
|
+
└─ Simple status polling (< 10 clients)
|
|
718
|
+
└─ React Query refetchInterval (no infrastructure needed)
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
## 13. Production Hardening (MEDIUM)
|
|
724
|
+
|
|
725
|
+
### Health Checks
|
|
726
|
+
|
|
727
|
+
```typescript
|
|
728
|
+
app.get('/health', (req, res) => res.json({ status: 'ok' })); // liveness
|
|
729
|
+
app.get('/ready', async (req, res) => { // readiness
|
|
730
|
+
const checks = {
|
|
731
|
+
database: await checkDb(), redis: await checkRedis(),
|
|
732
|
+
};
|
|
733
|
+
const ok = Object.values(checks).every(c => c.status === 'ok');
|
|
734
|
+
res.status(ok ? 200 : 503).json({ status: ok ? 'ok' : 'degraded', checks });
|
|
735
|
+
});
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
### Graceful Shutdown
|
|
739
|
+
|
|
740
|
+
```typescript
|
|
741
|
+
process.on('SIGTERM', async () => {
|
|
742
|
+
logger.info('SIGTERM received');
|
|
743
|
+
server.close(); // stop new connections
|
|
744
|
+
await drainConnections(); // finish in-flight
|
|
745
|
+
await closeDatabase();
|
|
746
|
+
process.exit(0);
|
|
747
|
+
});
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### Security Checklist
|
|
751
|
+
|
|
752
|
+
```
|
|
753
|
+
✅ CORS: explicit origins (never '*' in production)
|
|
754
|
+
✅ Security headers (helmet / equivalent)
|
|
755
|
+
✅ Rate limiting on public endpoints
|
|
756
|
+
✅ Input validation on ALL endpoints (trust nothing)
|
|
757
|
+
✅ HTTPS enforced
|
|
758
|
+
❌ Never expose internal errors to clients
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
## Anti-Patterns
|
|
764
|
+
|
|
765
|
+
| # | ❌ Don't | ✅ Do Instead |
|
|
766
|
+
|---|---------|--------------|
|
|
767
|
+
| 1 | Business logic in routes/controllers | Move to service layer |
|
|
768
|
+
| 2 | `process.env` scattered everywhere | Centralized typed config |
|
|
769
|
+
| 3 | `console.log` for logging | Structured JSON logger |
|
|
770
|
+
| 4 | Generic `Error('oops')` | Typed error hierarchy |
|
|
771
|
+
| 5 | Direct DB calls in controllers | Repository pattern |
|
|
772
|
+
| 6 | No input validation | Validate at boundary (Zod/Pydantic) |
|
|
773
|
+
| 7 | Catching errors silently | Log + rethrow or return error |
|
|
774
|
+
| 8 | No health check endpoints | `/health` + `/ready` |
|
|
775
|
+
| 9 | Hardcoded config/secrets | Environment variables |
|
|
776
|
+
| 10 | No graceful shutdown | Handle SIGTERM properly |
|
|
777
|
+
| 11 | Hardcode API URL in frontend | Environment variable (`NEXT_PUBLIC_API_URL`) |
|
|
778
|
+
| 12 | Store JWT in localStorage | Memory + httpOnly refresh cookie |
|
|
779
|
+
| 13 | Show raw API errors to users | Map to human-readable messages |
|
|
780
|
+
| 14 | Retry 4xx errors | Only retry 5xx (server failures) |
|
|
781
|
+
| 15 | Skip loading states | Skeleton/spinner while fetching |
|
|
782
|
+
| 16 | Upload large files through API server | Presigned URL → direct to S3 |
|
|
783
|
+
| 17 | Poll for real-time data | SSE or WebSocket |
|
|
784
|
+
| 18 | Duplicate types frontend + backend | Shared types, tRPC, or OpenAPI codegen |
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
## Common Issues
|
|
789
|
+
|
|
790
|
+
### Issue 1: "Where does this business rule go?"
|
|
791
|
+
|
|
792
|
+
**Rule:** If it involves HTTP (request parsing, status codes, headers) → controller. If it involves business decisions (pricing, permissions, rules) → service. If it touches the database → repository.
|
|
793
|
+
|
|
794
|
+
### Issue 2: "Service is getting too big"
|
|
795
|
+
|
|
796
|
+
**Symptom:** One service file > 500 lines with 20+ methods.
|
|
797
|
+
|
|
798
|
+
**Fix:** Split by sub-domain. `OrderService` → `OrderCreationService` + `OrderFulfillmentService` + `OrderQueryService`. Each focused on one workflow.
|
|
799
|
+
|
|
800
|
+
### Issue 3: "Tests are slow because they hit the database"
|
|
801
|
+
|
|
802
|
+
**Fix:** Unit tests mock the repository layer (fast). Integration tests use test containers or transaction rollback (real DB, still fast). Never mock the service layer in integration tests.
|
|
803
|
+
|
|
804
|
+
---
|
|
805
|
+
|
|
806
|
+
## Reference Documents
|
|
807
|
+
|
|
808
|
+
This skill includes deep-dive references for specialized topics. Read the relevant reference when you need detailed guidance.
|
|
809
|
+
|
|
810
|
+
| Need to… | Reference |
|
|
811
|
+
|----------|-----------|
|
|
812
|
+
| Write backend tests (unit, integration, e2e, contract, performance) | [references/testing-strategy.md](references/testing-strategy.md) |
|
|
813
|
+
| Validate a release before deployment (6-gate checklist) | [references/release-checklist.md](references/release-checklist.md) |
|
|
814
|
+
| Choose a tech stack (language, framework, database, infra) | [references/technology-selection.md](references/technology-selection.md) |
|
|
815
|
+
| Build with Django / DRF (models, views, serializers, admin) | [references/django-best-practices.md](references/django-best-practices.md) |
|
|
816
|
+
| Design REST/GraphQL/gRPC endpoints (URLs, status codes, pagination) | [references/api-design.md](references/api-design.md) |
|
|
817
|
+
| Design database schema, indexes, migrations, multi-tenancy | [references/db-schema.md](references/db-schema.md) |
|
|
818
|
+
| Auth flow (JWT bearer, token refresh, Next.js SSR, RBAC, middleware order) | [references/auth-flow.md](references/auth-flow.md) |
|
|
819
|
+
| CORS config, env vars per environment, common CORS issues | [references/environment-management.md](references/environment-management.md) |
|