sdg-agents 1.0.5

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.
Files changed (130) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +161 -0
  3. package/package.json +88 -0
  4. package/src/assets/dev-guides/agent-deep-flow.md +139 -0
  5. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/01-project-scope-and-mvp.md +45 -0
  6. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/02-stack-and-data-model.md +56 -0
  7. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/03-external-integrations.md +44 -0
  8. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/04-launch-checklist.md +26 -0
  9. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/01-project-vision.md +77 -0
  10. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/02-problem-definition.md +63 -0
  11. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/03-success-metrics.md +48 -0
  12. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/05-engineering-culture-and-silos.md +41 -0
  13. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/06-foundation-approval.md +57 -0
  14. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/01-tech-stack.md +62 -0
  15. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/02-local-environment.md +50 -0
  16. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/03-version-control-and-tracking.md +65 -0
  17. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/04-hello-world-validation.md +37 -0
  18. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/05-setup-approval.md +61 -0
  19. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/01-folder-structure.md +49 -0
  20. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/02-design-patterns.md +59 -0
  21. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/03-apis-and-communication.md +55 -0
  22. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/04-security-and-access.md +63 -0
  23. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/05-security-audit.md +64 -0
  24. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/06-design-system-ux.md +72 -0
  25. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/07-ai-strategy.md +72 -0
  26. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/08-observability.md +65 -0
  27. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/09-technical-documentation.md +64 -0
  28. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/10-infrastructure-and-costs.md +40 -0
  29. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/11-data-privacy-compliance.md +41 -0
  30. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/12-performance-and-scale.md +46 -0
  31. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/13-disaster-recovery.md +39 -0
  32. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/14-architecture-approval.md +81 -0
  33. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/01-ci-cd-pipeline.md +49 -0
  34. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/02-quality-standards.md +46 -0
  35. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/03-delivery-approval.md +58 -0
  36. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/00-feature-template.md +30 -0
  37. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/01-context-and-scope.md +46 -0
  38. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/02-business-rules.md +39 -0
  39. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/03-architecture-and-design.md +50 -0
  40. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/04-testing-strategy.md +48 -0
  41. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/05-implementation-plan.md +45 -0
  42. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/06-feature-approval.md +46 -0
  43. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/01-rfcs-and-changes.md +63 -0
  44. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/02-incident-postmortems.md +64 -0
  45. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/03-adr-template.md +66 -0
  46. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/00-foundation/01-legacy-vision.md +73 -0
  47. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/00-foundation/02-foundation-approval.md +53 -0
  48. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/01-tech-debt-inventory.md +55 -0
  49. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/02-security-audit.md +63 -0
  50. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/03-regression-baseline.md +49 -0
  51. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/04-analysis-approval.md +65 -0
  52. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/01-modernization-approach.md +60 -0
  53. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/02-versioning-and-coexistence.md +57 -0
  54. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/03-new-demands-triage.md +41 -0
  55. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/04-strategy-approval.md +56 -0
  56. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/03-refactor/01-cleanup-backlog.md +45 -0
  57. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/03-refactor/02-refactor-approval.md +53 -0
  58. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/01-migration-roadmap.md +47 -0
  59. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/02-data-sync-strategy.md +56 -0
  60. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/03-migration-approval.md +55 -0
  61. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/05-sunset/01-decommission-plan.md +47 -0
  62. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/05-sunset/02-sunset-approval.md +60 -0
  63. package/src/assets/dev-guides/prompt-tracks/README.md +144 -0
  64. package/src/assets/dev-guides/software-development-lifecycle-sdlc.md +147 -0
  65. package/src/assets/dev-guides/spec-driven-dev-guide.md +81 -0
  66. package/src/assets/dev-guides/ui-prompt-guide.md +181 -0
  67. package/src/assets/img/sdg-agents-icon-dark.svg +55 -0
  68. package/src/assets/img/sdg-agents-icon-light.svg +55 -0
  69. package/src/assets/img/sdg-agents-menu-v1.png +0 -0
  70. package/src/assets/img/sdg-icon.svg +110 -0
  71. package/src/assets/instructions/commands/sdg-docs.md +69 -0
  72. package/src/assets/instructions/commands/sdg-feat.md +45 -0
  73. package/src/assets/instructions/commands/sdg-fix.md +41 -0
  74. package/src/assets/instructions/commands/sdg-land.md +128 -0
  75. package/src/assets/instructions/competencies/backend.md +353 -0
  76. package/src/assets/instructions/competencies/frontend.md +439 -0
  77. package/src/assets/instructions/core/agent-roles.md +104 -0
  78. package/src/assets/instructions/core/api-design.md +65 -0
  79. package/src/assets/instructions/core/ci-cd.md +144 -0
  80. package/src/assets/instructions/core/cloud.md +63 -0
  81. package/src/assets/instructions/core/code-style.md +144 -0
  82. package/src/assets/instructions/core/containers.md +115 -0
  83. package/src/assets/instructions/core/data-access.md +119 -0
  84. package/src/assets/instructions/core/engineering-standards.md +502 -0
  85. package/src/assets/instructions/core/naming.md +136 -0
  86. package/src/assets/instructions/core/observability.md +73 -0
  87. package/src/assets/instructions/core/security-pipeline.md +209 -0
  88. package/src/assets/instructions/core/security.md +45 -0
  89. package/src/assets/instructions/core/sql-style.md +138 -0
  90. package/src/assets/instructions/core/staff-dna.md +72 -0
  91. package/src/assets/instructions/core/testing-principles.md +212 -0
  92. package/src/assets/instructions/core/ui/architecture.md +171 -0
  93. package/src/assets/instructions/core/ui/design-thinking.md +319 -0
  94. package/src/assets/instructions/core/ui/presets.md +200 -0
  95. package/src/assets/instructions/core/ui/standards.md +144 -0
  96. package/src/assets/instructions/core/writing-soul.md +82 -0
  97. package/src/assets/instructions/flavors/legacy/principles.md +64 -0
  98. package/src/assets/instructions/flavors/lite/principles.md +39 -0
  99. package/src/assets/instructions/flavors/mvc/principles.md +124 -0
  100. package/src/assets/instructions/flavors/vertical-slice/principles.md +178 -0
  101. package/src/assets/instructions/idioms/csharp/patterns.md +367 -0
  102. package/src/assets/instructions/idioms/flutter/patterns.md +97 -0
  103. package/src/assets/instructions/idioms/go/patterns.md +193 -0
  104. package/src/assets/instructions/idioms/java/patterns.md +233 -0
  105. package/src/assets/instructions/idioms/javascript/patterns.md +223 -0
  106. package/src/assets/instructions/idioms/kotlin/patterns.md +94 -0
  107. package/src/assets/instructions/idioms/python/patterns.md +185 -0
  108. package/src/assets/instructions/idioms/rust/patterns.md +189 -0
  109. package/src/assets/instructions/idioms/scripts/patterns.md +81 -0
  110. package/src/assets/instructions/idioms/sql/patterns.md +109 -0
  111. package/src/assets/instructions/idioms/swift/patterns.md +97 -0
  112. package/src/assets/instructions/idioms/typescript/patterns.md +304 -0
  113. package/src/assets/instructions/idioms/vbnet/patterns.md +96 -0
  114. package/src/assets/instructions/idioms/vbnet-legacy/patterns.md +104 -0
  115. package/src/assets/instructions/templates/workflow.md +244 -0
  116. package/src/assets/instructions/workflows/governance.md +162 -0
  117. package/src/engine/bin/add-idiom.mjs +186 -0
  118. package/src/engine/bin/index.mjs +226 -0
  119. package/src/engine/config/stack-display.mjs +75 -0
  120. package/src/engine/config/stack-versions.mjs +76 -0
  121. package/src/engine/lib/cli-parser.mjs +80 -0
  122. package/src/engine/lib/display-utils.mjs +20 -0
  123. package/src/engine/lib/fs-utils.mjs +99 -0
  124. package/src/engine/lib/instruction-assembler.mjs +487 -0
  125. package/src/engine/lib/manifest-utils.mjs +128 -0
  126. package/src/engine/lib/prompt-utils.mjs +137 -0
  127. package/src/engine/lib/result-utils.mjs +14 -0
  128. package/src/engine/lib/ruleset-injector.mjs +183 -0
  129. package/src/engine/lib/ui-utils.mjs +216 -0
  130. package/src/engine/lib/wizard.mjs +472 -0
@@ -0,0 +1,47 @@
1
+ # 01 - Migration Roadmap
2
+
3
+ ## Migration Steps
4
+
5
+ 1. [ ] Parallel infrastructure setup.
6
+ 2. [ ] Database migration.
7
+
8
+ ## Final Checklist
9
+
10
+ - [ ] 0 critical bugs in the new system.
11
+
12
+ ---
13
+
14
+ ## Learn by Examples
15
+
16
+ ### ❌ Bad Example
17
+
18
+ ```markdown
19
+ # 01 - Migration Roadmap
20
+
21
+ ## Steps
22
+
23
+ Move everything tomorrow and re-test.
24
+
25
+ ## Checklist
26
+
27
+ App 100% live.
28
+ ```
29
+
30
+ > **Rationale**: "Tomorrow" is not a roadmap. "100% live" ignores quality or consistency.
31
+
32
+ ### ✅ Good Example
33
+
34
+ ```markdown
35
+ # 01 - Migration Roadmap
36
+
37
+ ## Steps
38
+
39
+ Configure RDS Read Replica -> New Cloud Instance from October 1st to 31st.
40
+
41
+ ## Checklist
42
+
43
+ - [x] Data Sync < 10ms (replica lag).
44
+ - [x] 100% of users migrated via DNS redirection.
45
+ ```
46
+
47
+ > **Rationale**: Defines technologies (RDS, DNS) and technical success metrics (latency and users).
@@ -0,0 +1,56 @@
1
+ # 02 - Data Sync and Load Strategy
2
+
3
+ ## Synchronization Model (Sync)
4
+
5
+ - Will data need to be synchronized in real-time between the Legacy and New systems? Or will there be an asynchronous maintenance window (e.g., Midnight Batch)?
6
+ - Will the synchronization flow be Unidirectional (Legacy -> New) or Bidirectional (updates in one reflect in the other)?
7
+
8
+ ## ETL Track (Extract, Transform, Load)
9
+
10
+ - Which tool or script will ensure the conversion of old data (e.g., a formatted string `"1"`) to the new typing in the database (pure _Boolean_)?
11
+ - Will there be a mirror table or _Read-replica_ to offload the main legacy database during migration?
12
+
13
+ ## Rollback and Legacy Disposal
14
+
15
+ - What are the criteria and estimated timeframe for safely "switching off" the old database after the new one becomes operational?
16
+ - How will an emergency rollback re-synchronize data that had already been persisted only in the modern database?
17
+
18
+ ---
19
+
20
+ ## Learn by Examples
21
+
22
+ ### ❌ Bad Example
23
+
24
+ ```markdown
25
+ # 02 - Data Synchronization
26
+
27
+ ## Sync Model
28
+
29
+ We'll keep writing to the new API and hope the legacy system doesn't need to read it.
30
+
31
+ ## ETL Track
32
+
33
+ Copy MySQL data using a Python script at the end of the day.
34
+ ```
35
+
36
+ > **Rationale**: How does the operation remain online while the Python script runs freely? If the script fails halfway through, we break both databases simultaneously.
37
+
38
+ ### ✅ Good Example
39
+
40
+ ```markdown
41
+ # 02 - Data Synchronization
42
+
43
+ ## Sync Model
44
+
45
+ - **Continuous Bidirectional**: We will use Debezium (CDC - Change Data Capture) to listen for changes from MongoDB (Legacy) to PostgreSQL (New) via Kafka. The user microservice will trigger the reverse via the Legacy API in the callback.
46
+
47
+ ## ETL Track
48
+
49
+ - **Clean Load Batch**: Heavy historical migrations will be done at 03:00 AM (Sunday) using optimized routines via AWS Glue, mapping obsolete columns to `.jsonb`.
50
+
51
+ ## Disposal
52
+
53
+ - **Shadow DB Period**: The old database will run in _Read-Only_ mode for 14 days post-migration. If PostgreSQL breaks irreversibly, we use a reverse Glue script and flip the router switch back to MongoDB.
54
+ ```
55
+
56
+ > **Rationale**: Fault-tolerant approach. Based on the industrial CDC model (real-time events), drastically reducing inconsistencies for users of the mixed system.
@@ -0,0 +1,55 @@
1
+ # 03 - Migration Approval
2
+
3
+ ## Artifacts Checklist
4
+
5
+ - [ ] 01-migration-roadmap.md (Defined)
6
+ - [ ] 02-data-sync-strategy.md (Successfully tested n-times)
7
+
8
+ ## Operational Approval
9
+
10
+ - **SRE / DevOps**: [Signature/Date]
11
+ - **Operations / Support Team**: [Signature/Date]
12
+
13
+ ## Definition of Readiness (Ready for Rollout)
14
+
15
+ - [ ] _Dry-run_ (Shadow Load) of data migration completed successfully.
16
+ - [ ] Rollback plan tested and time limit metrics approved (e.g., MTTR < 10min).
17
+ - [ ] Maintenance window officially communicated to corporate stakeholders.
18
+
19
+ ---
20
+
21
+ ## Learn by Examples
22
+
23
+ ### ❌ Bad Example
24
+
25
+ ```markdown
26
+ # 03 - Migration Approval
27
+
28
+ ## Checklist
29
+
30
+ - [x] Migrate and re-test.
31
+
32
+ ## Definition of Readiness
33
+
34
+ - [x] Script is on the machine and ready to run and switch the APIs.
35
+ ```
36
+
37
+ > **Rationale**: How do you prove that the migration script doesn't corrupt Database B? And worse, if it does, how do you switch the user back to an intact Database A?
38
+
39
+ ### ✅ Good Example
40
+
41
+ ```markdown
42
+ # 03 - Migration Approval
43
+
44
+ ## Operational Approval
45
+
46
+ - **DevOps**: Bruno Costa (Approved on 2026-07-20)
47
+
48
+ ## Definition of Readiness
49
+
50
+ - [x] 01-migration-roadmap.md (Window set for Saturday 02:00 AM)
51
+ - [x] 02-data-sync-strategy.md (Bidirectional Kafka synchronization tested)
52
+ - [x] Rollback tested in an isolated environment (DNS router takes 59 seconds to cancel the migration if the new infra health check turns red).
53
+ ```
54
+
55
+ > **Rationale**: Showcases high operational maturity evidence. Data synchronization and rollback activation times are metered, converting the chaotic, critical moment of a legacy deployment into a controlled procedure.
@@ -0,0 +1,47 @@
1
+ # 01 - Decommissioning Plan (Sunset Plan)
2
+
3
+ The Sunset Plan is the final stage of modernizing a legacy (Brownfield) system. Once 100% of routes and data are in the new system, the old one MUST be deactivated. Unmaintained code left online becomes the primary gateway for security failures in the company.
4
+
5
+ ## Phase 1: Isolation and Read-Only Modes
6
+
7
+ - **Redirection:** Is all legacy domain traffic now (via proxy/DNS) traveling strictly to the new software?
8
+ - **Freezing:** Was the legacy database locked as `Read-Only` to prevent forgotten users or routines from continuing to create technical trash?
9
+
10
+ ## Phase 2: Termination and Physical Decommissioning
11
+
12
+ - **Orphan Dependencies:** Did we delete all crons and scheduled routines (background jobs)?
13
+ - **The End:** Official shutdown of the legacy virtual machine (EC2), cluster, or app service.
14
+ - **Data Retention & Backups:** Was the legacy database dump stored in cold storage (e.g., Amazon S3 Glacier) for the legal retention period before deleting the hot database in the cloud?
15
+
16
+ ---
17
+
18
+ ## Learn by Examples
19
+
20
+ ### ❌ Bad Example
21
+
22
+ ```markdown
23
+ # Shutdown
24
+
25
+ The new software launched last week. We stopped using the old one. At the end of the year, the sysadmin deletes the server.
26
+ ```
27
+
28
+ > **Rationale**: Extremely dangerous. What ensures that no B2B customer continues using the old backend API? If the old dashboard has vulnerabilities and continues running without maintenance until the end of the year, hackers will use this bridge to steal data (Shadow IT).
29
+
30
+ ### ✅ Good Example
31
+
32
+ ```markdown
33
+ # Decommissioning Plan: Sales Module V1
34
+
35
+ ## Phase 1: Isolation
36
+
37
+ - The `/v1/sales` routes were configured via Nginx to trigger a `301 Redirect` to the new `/v2/sales`.
38
+ - The Legacy MySQL DB had its `writer` password revoked, operating only as a `read-only replica`. It will remain this way for 15 days (Smoke Monitoring Period).
39
+
40
+ ## Phase 2: Physical Decommissioning (2026-08-20)
41
+
42
+ - Shutdown of all V1 EC2 instances identified under the AWS Tag `env:legacy-sales`.
43
+ - Full dump generated and sent to **S3 Deep Glacier** with a Lifecycle rule for definitive purge in 5 years (Tax/Legal Compliance).
44
+ - Definitive Drop of the legacy RDS database, resulting in a saving of $850/month of Cloud TCO.
45
+ ```
46
+
47
+ > **Rationale**: Pure professionalism. Shutting down software is as technically considered as building it. We mitigate failures, handle accounting data retention, and celebrate the exact savings in infrastructure dollars.
@@ -0,0 +1,60 @@
1
+ # 02 - Approval: Sunset and Final Decommissioning
2
+
3
+ ## Artifacts Checklist
4
+
5
+ - [ ] 01-decommission-plan.md (Evidence of Read-Only applied and DNS redirections).
6
+
7
+ ## Executive Approval (The Farewell)
8
+
9
+ - **Migration Tech Lead**: [Signature/Date]
10
+ - **Cost/Finance Team (FinOps)**: [Signature/Date]
11
+ - **Product Owner (PM)**: [Signature/Date]
12
+
13
+ ## Modernization Completion Definition
14
+
15
+ - [ ] Legacy domain no longer routes active traffic (0 status usage in API Gateway).
16
+ - [ ] Final backup exported for retention (Cold Storage).
17
+ - [ ] Invoices (Billing) confirm that legacy instances have been removed from the cloud cost.
18
+ - [ ] Old DNS officially pointing 100% to the New Ingress Controller.
19
+
20
+ ---
21
+
22
+ ## Learn by Examples
23
+
24
+ ### ❌ Bad Example
25
+
26
+ ```markdown
27
+ # Sunset Approval
28
+
29
+ ## Checklist
30
+
31
+ - [x] We turned everything off.
32
+
33
+ ## Completion Definition
34
+
35
+ - [x] The system stopped billing.
36
+ ```
37
+
38
+ > **Rationale**: Turned everything off "when" and "how"? What about the 5 years of backups required by law? The migration failed at a quiet point.
39
+
40
+ ### ✅ Good Example
41
+
42
+ ```markdown
43
+ # Sunset Approval: Complete Extinction
44
+
45
+ ## Final Approvals
46
+
47
+ - **Tech Lead**: Renato Vanes (2026-09-20) confirmed via Datadog 0 RPS in the Legacy Node for 30 uninterrupted days.
48
+ - **FinOps**: Claire River (2026-09-21) proved the removal of the old AKS cluster and the T3 RDS database in the Cost panel. ~$2,500 reduction validated!
49
+
50
+ ## Completion Definition (The Trophy)
51
+
52
+ - [x] Glacier retention approved by the Chief Legal Officer.
53
+ - [x] Legacy CNAME DNS changed to ALB v2.
54
+
55
+ ## Project Completion Ceremony
56
+
57
+ Modernization officially Closed. The legacy GitHub repository `vendas-delphi-legacy` has been Archived. 🚀
58
+ ```
59
+
60
+ > **Rationale**: Monumental closing of Staff-level work. No loose ends, official cost reduction with FinOps endorsing the project's ROI, dead files secured, and repo "Archived." Everyone celebrates a shielded transition.
@@ -0,0 +1,144 @@
1
+ # Specification Pipeline
2
+
3
+ This directory establishes the technical governance and architectural baseline for the project. The core protocol mandates that **no implementation should precede its corresponding specification**.
4
+
5
+ > [!TIP]
6
+ > **AI Orchestration**: These templates provide high-context engineering standards for AI agents. Proper specification ensures technical density and prevents architectural drift.
7
+
8
+ ---
9
+
10
+ ## Development Tracks
11
+
12
+ ### 00 - Lite Mode (Freelance & MVP)
13
+
14
+ Standardized flow for rapid iteration on small-scale projects, proofs of concept, and utility tools.
15
+
16
+ - **Pipeline**: Scope → Stack → Integration.
17
+ - **Location**: `.ai/prompts/dev-tracks/00-lite-mode/`
18
+
19
+ ### 01 - New Evolution (Greenfield)
20
+
21
+ Primary flow for new system features, domain modules, or greenfield project architecture.
22
+
23
+ - **Pipeline**: Foundation → Setup → Architecture → Security → Delivery → Features → Evolution.
24
+ - **Location**: `.ai/prompts/dev-tracks/01-new-evolution/`
25
+
26
+ ### 02 - Legacy Modernization (Brownfield)
27
+
28
+ Standardized protocol for technical rescue, refactoring, and legacy system migration.
29
+
30
+ - **Pipeline**: Foundation → Analysis → Strategy → Refactoring → Migration.
31
+ - **Location**: `.ai/prompts/dev-tracks/02-legacy-modernization/`
32
+
33
+ ---
34
+
35
+ ## Engineering Principles
36
+
37
+ 1. **Mandatory Sequential Execution**: Never advance to the next pipeline stage without completing the previous one.
38
+ 2. **Logic over Code**: A feature implementation is only permitted after the **Architecture & Data Model** are consolidated.
39
+ 3. **Local Numeric Prefixing**: All files maintain sequential numbering within their respective folders to preserve the logical order of each stage.
40
+ 4. **Gatekeepers**: Feature development (Phase 04) is only permitted after the Delivery stage (Phase 03) is ready (CI/CD, Linting, and Quality).
41
+
42
+ ---
43
+
44
+ ## Specification Standard (Feature)
45
+
46
+ Every new functionality in the `04-features` directory follows this standard:
47
+
48
+ ```markdown
49
+ # [ID]- [Feature Name]
50
+
51
+ ## Context
52
+
53
+ - Problem to be solved and expected business/system impact.
54
+
55
+ ## Scope
56
+
57
+ - Planned deliverables vs. Non-goals (what will NOT be covered).
58
+
59
+ ## Business Rules
60
+
61
+ - Critical validations, success cases, and exception flows.
62
+
63
+ ## Architecture & Design
64
+
65
+ - Integration points, API contracts, and Schema changes.
66
+
67
+ ## Implementation Roadmap
68
+
69
+ - Concrete steps for the AI Agent or Developer to follow.
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Staff Engineering Examples
75
+
76
+ ### ❌ Bad Example (AI Slop / Generic)
77
+
78
+ ```markdown
79
+ # 04-01 - System Improvement
80
+
81
+ ## Context
82
+
83
+ Improve the system for users and increase sales.
84
+
85
+ ## Scope
86
+
87
+ Everything to make it good. No non-goals.
88
+
89
+ ## Business Rules
90
+
91
+ Fast system. Users can buy things.
92
+
93
+ ## Architecture & Design
94
+
95
+ Market best practices. DB integration.
96
+
97
+ ## Implementation Roadmap
98
+
99
+ 1. [ ] Code it. 2. [ ] Test it.
100
+
101
+ ## Testing Strategy
102
+
103
+ Test everything.
104
+ ```
105
+
106
+ > **Rationale**: Vague, lacks metrics, no technical definitions, and no clear acceptance criteria. Pure "AI slop".
107
+
108
+ ### ✅ Good Example (Staff Quality)
109
+
110
+ ```markdown
111
+ # 04-01 - One-Click Checkout (Stripe)
112
+
113
+ ## Context
114
+
115
+ Reduce cart abandonment during the final payment stage.
116
+ **Success Metric**: 15% increase in conversion for returning users.
117
+
118
+ ## Scope
119
+
120
+ - Integration with Stripe Vault for saved tokens.
121
+ - **Non-Goals**: Full gateway migration or local card storage (PCI Compliance).
122
+
123
+ ## Business Rules
124
+
125
+ - Only logged-in users with a valid `stripe_customer_id`.
126
+ - Synchronous stock check before `PaymentIntent` confirmation.
127
+
128
+ ## Architecture & Design
129
+
130
+ - **Integration**: `StripeService` + `OrderOrchestrator`.
131
+ - **Constraint**: All IDs must follow the `chkt_` prefix for traceability.
132
+
133
+ ## Implementation Roadmap
134
+
135
+ 1. [ ] Create inventory pre-validation webhook.
136
+ 2. [ ] Implement Stripe Elements in the Guest Checkout flow.
137
+
138
+ ## Testing Strategy
139
+
140
+ - **Scenario A**: Success with cached card and >0 stock.
141
+ - **Scenario B**: Atomic rollback if payment fails after stock reservation.
142
+ ```
143
+
144
+ > **Rationale**: Specific objectives, business metrics, clear boundaries, and atomic error handling strategies.
@@ -0,0 +1,147 @@
1
+ # Software Development Life Cycle — SDLC (8-Phase Core Trail)
2
+
3
+ This document defines the technical standards for the project lifecycle. It establishes the baseline for developer onboarding and architectural alignment through 8 cumulative phases.
4
+
5
+ > [!IMPORTANT]
6
+ > **Documentation Governance**: Update **README**, **CHANGELOG**, and **ROADMAP** at the end of every phase. Documentation must remain synchronized with the implementation to prevent knowledge debt.
7
+
8
+ ## Pipeline Summary
9
+
10
+ ```
11
+ | 01 Foundation → Project boots and lints cleanly
12
+ | 02 Observability → Internal state is transparent
13
+ | 03 CI/CD → Code quality gates are enforced
14
+ | 04 Access Control → Identity and permissions are established
15
+ | 05 Design System → UI is consistent and reusable
16
+ | 06 Features → Domain logic is isolated
17
+ | 07 Production Ready → Deployment readiness verified
18
+ | 08 Ops Governance → System health is monitored
19
+ ```
20
+
21
+ Not every project requires all 8 phases. A CLI tool implements focused subsets (e.g., 01, 03, 06), while a SaaS product requires the full trail.
22
+
23
+ > [!IMPORTANT]
24
+ > **Lifecycle Protocol**: No phase is complete until the implementation is synchronized with the project metadata.
25
+
26
+ ---
27
+
28
+ ## How to read this guide
29
+
30
+ The pipeline follows a **strict cumulative logic**. Each phase establishes the security and stability required for subsequent steps. Select the appropriate scope for the project stack while maintaining the 01-08 sequence.
31
+
32
+ ---
33
+
34
+ ## 01 — Foundation
35
+
36
+ Set up the project so that every contributor starts from the same baseline.
37
+
38
+ 1. Initialize git with a **Hardened .gitignore**. Block environment noise (`.DS_Store`, `local.*`) and tool-specific artifacts.
39
+ 2. Enforce **Secret Isolation**. Explicitly block `.env*` and credential files. Never commit secrets to the repository history.
40
+ 3. Create the **Documentation Baseline**. Initialize `README.md`, `CHANGELOG.md`, and `ROADMAP.md`.
41
+ 4. Create `.editorconfig` to enforce indentation and encoding standards.
42
+ 5. Configure a linter (e.g., ESLint) aligned with the project scope.
43
+ 6. Create a HelloWorld entry point to validate the execution stack.
44
+ 7. Install core dependencies. Avoid speculative package installation.
45
+ 8. Configure environment variables via `.env` with startup validation.
46
+ 9. Structure the entry point as a table of contents. Keep implementation details in secondary modules.
47
+
48
+ **Criteria**: The project boots, lints, and allows a contributor to run the suite in under 5 minutes.
49
+
50
+ ---
51
+
52
+ ## 02 — Observability & Security
53
+
54
+ Make the project observable and defensible before writing business logic.
55
+
56
+ 1. Validate all external inputs at the boundary (request body, query params, headers). Reject invalid data early.
57
+ 2. Add a `/health` endpoint that returns the application status and dependency connectivity.
58
+ 3. Set up structured logging (JSON format). Include request ID, timestamp, and severity. Never log secrets or PII.
59
+ 4. If applicable, add distributed tracing (OpenTelemetry or equivalent) so requests can be followed across services.
60
+ 5. Define your testing strategy: what gets unit tests, what gets integration tests, what gets E2E.
61
+
62
+ **Done when:** you can answer "is the app healthy?" and "what happened to request X?" without reading code.
63
+
64
+ ---
65
+
66
+ ## 03 — CI/CD Pipeline
67
+
68
+ Automate quality gates so that broken code never reaches production.
69
+
70
+ 1. Define your environments: local, staging, production. Document the differences.
71
+ 2. Centralize secrets management (vault, CI secrets, cloud KMS). No secrets in code or git history.
72
+ 3. Set up CI: on every pull request, run linter + tests + build. Block merge on failure.
73
+ 4. Set up CD: define how code gets to staging and production. Prefer automated deploys with manual approval for production.
74
+ 5. Validate the full pipeline end-to-end: push a change and watch it flow through all stages.
75
+
76
+ **Done when:** a PR cannot be merged without passing all quality gates, and deploying to staging is a single action.
77
+
78
+ ---
79
+
80
+ ## 04 — Access Control (if applicable)
81
+
82
+ Implement identity and permissions before building features that depend on them.
83
+
84
+ 1. Choose your identity strategy based on your users: OAuth for B2B, magic links for low-friction, passkeys for security-critical.
85
+ 2. Define roles and permissions. Start simple (admin/user) and expand as needed. Use deny-by-default.
86
+ 3. Secure tokens: HttpOnly cookies for web, short-lived JWTs with refresh rotation. Protect against XSS and CSRF.
87
+ 4. Implement session control: concurrent session limits, remote revocation, idle timeout.
88
+ 5. Build user CRUD as your reference implementation — the first feature that exercises the full pipeline.
89
+
90
+ **Done when:** you can create a user, log in, access a protected route, and get rejected from an unauthorized one.
91
+
92
+ ---
93
+
94
+ ## 05 — Design System & UI/UX (if applicable)
95
+
96
+ Establish visual consistency before building screens.
97
+
98
+ 1. Define design tokens: colors, spacing (4/8px system), typography scale, border radius, shadows.
99
+ 2. Build a theme matrix: light and dark. Use CSS variables or a utility-first system.
100
+ 3. Establish a visual baseline: consistent spacing, WCAG-compliant contrast, and typography hierarchy.
101
+ 4. Add micro-interactions: loading states, hover feedback, transitions. The interface should feel responsive.
102
+ 5. Scaffold reusable components (Button, Input, Card, Modal) so feature development doesn't reinvent them.
103
+
104
+ **Done when:** a new screen can be built using existing tokens and components without ad-hoc styling.
105
+
106
+ ---
107
+
108
+ ## 06 — Feature Evolution
109
+
110
+ Build features with clear domain boundaries and safe delivery.
111
+
112
+ 1. Model the domain first: identify entities, value objects, and aggregates. Name things in business language, not technical jargon.
113
+ 2. Implement use cases as orchestrators: they call validators, domain logic, and repositories. They don't contain implementation details.
114
+ 3. Use feature flags for anything risky or incomplete. Ship to production behind a flag, validate, then enable.
115
+ 4. Practice defensive development: validate assumptions, handle edge cases at the boundary, and follow **The Law of Resilience** (Result Pattern).
116
+ 5. Refactor continuously: if a module grows beyond its responsibility, split it. Don't wait for a "refactoring sprint."
117
+
118
+ **Done when:** each feature is isolated, testable, and can be toggled or rolled back independently.
119
+
120
+ ---
121
+
122
+ ## 07 — Production Readiness
123
+
124
+ Verify everything before going live.
125
+
126
+ 1. Run through a pre-deploy checklist: environment variables set, secrets rotated, dependencies up to date, no debug flags.
127
+ 2. Prepare database changes: migrations tested, rollback plan documented, data integrity validated.
128
+ 3. Run smoke tests against the staging environment: happy path, error paths, edge cases.
129
+ 4. Deploy to production with a defined strategy (blue/green, canary, or rolling). Never deploy on a Friday without a rollback plan.
130
+
131
+ **Done when:** production is live, monitored, and you have a documented way to roll back in under 5 minutes.
132
+
133
+ ---
134
+
135
+ ## 08 — Operational Governance
136
+
137
+ Keep the system healthy after launch.
138
+
139
+ 1. Monitor real-time metrics for the first 24-48 hours after deploy: error rates, latency, resource usage.
140
+ 2. Have an incident protocol: who gets paged, how to triage, where to communicate (war room or channel).
141
+ 3. For critical issues: fix forward if small, rollback if large. Document the decision.
142
+ 4. Execute **Documentation Synchronization**. Update `CHANGELOG.md` with version results and evolve the `ROADMAP.md` based on new insights.
143
+ 5. Run retrospectives after incidents: what happened, why, what changes prevent recurrence. Update the pipeline.
144
+
145
+ **Done when:** the team can respond to a production issue without panic, and every incident leaves the system stronger.
146
+
147
+ ---
@@ -0,0 +1,81 @@
1
+ # Spec-Driven Development Guide (5-Phase Task Cycle)
2
+
3
+ The **Spec-Driven Guide (SDG)** enforces a standardized lifecycle for every task, ensuring that code is only written after the intent and implementation plan are fully approved.
4
+
5
+ The cycle follows five mandatory phases: **SPEC → PLAN → CODE → TEST → END**.
6
+
7
+ > [!TIP]
8
+ > **Deep Dive**: Want to see what happens "Under the Hood"? Read the [**Agent Deep-Flow Guide**](agent-deep-flow.md) for a visual breakdown of internal sub-steps and decision gates.
9
+
10
+ ---
11
+
12
+ ## 1. Phase: SPEC (The Contract)
13
+
14
+ **Goal:** Define the implementation contract and verification criteria.
15
+
16
+ - **Process**: The agent analyzes the request (e.g., via `/sdg-feat` or `/sdg-fix`) and produces a formal specification.
17
+ - **Standards**:
18
+ - Identify the domain (Backend, Frontend, Fullstack).
19
+ - **Feature Cycle**: Focus on domain modeling and business logic.
20
+ - **Fix Cycle**: Execute **Root Cause Analysis (RCA)** to identify the specific layer or contract violation.
21
+ - Define inputs, outputs, and hardware/software constraints.
22
+ - Create a **Verification Checklist** (binary pass/fail items).
23
+ - **Mandate**: The agent must halt for explicit Developer approval of the Spec before moving to the Plan.
24
+ - **Reasoning Exception**: Modern reasoning models may proceed after emitting an internal `<thought>` block validating the criteria.
25
+
26
+ ---
27
+
28
+ ## 2. Phase: PLAN (The Strategy)
29
+
30
+ **Goal:** Sequence the Spec into atomic, executable tasks.
31
+
32
+ - **Process**: The agent drafts a logical roadmap based on the approved Spec.
33
+ - **Standards**:
34
+ - Produce a numbered task list.
35
+ - Use the Action Verb + Object pattern (e.g., "1. Create User domain type").
36
+ - **Task Decomposition**: Split complex tasks into sub-tasks to maintain vertical density and prevent context exhaustion.
37
+ - **Mandate**: The agent must halt for explicit Developer approval of the Plan.
38
+ - **Reasoning Exception**: Autonomous models with built-in reasoning may proceed to Code after validating that the plan reflects the project's engineering rules.
39
+
40
+ ---
41
+
42
+ ## 3. Phase: CODE (The Execution)
43
+
44
+ **Goal:** Implement the plan following architectural standards.
45
+
46
+ - **Process**: The agent performs the implementation tasks.
47
+ - **Standards**:
48
+ - Follow the **Narrative Cascade** (callers above callees).
49
+ - Adhere to the project's flavor (Vertical Slice, MVC, etc.).
50
+ - Implement only according to the approved Plan (YAGNI).
51
+ - Surface blockers immediately; do not work around them.
52
+
53
+ ---
54
+
55
+ ## 4. Phase: TEST (The Verification)
56
+
57
+ **Goal:** Ensure the implementation matches the Spec's Verification Checklist.
58
+
59
+ - **What happens:** The Agent runs/writes tests and verifies each item on the checklist.
60
+ - **Agent Behavior:**
61
+ - Writes new tests if the checklist items aren't covered by existing ones.
62
+ - Reports PASS/FAIL for every checklist item.
63
+ - **Refactor Loop:** If a test fails, the agent refactors the code and tries again (up to 3 times before stopping to report a blocker).
64
+
65
+ ---
66
+
67
+ ## 5. Phase: END (The Delivery)
68
+
69
+ **Goal:** Finalize the task, document changes, and prepare for version control.
70
+
71
+ - **What happens:** The Agent summarizes the work and updates project logs.
72
+ - **Agent Behavior:**
73
+ - Summarizes what was implemented (linking to PLAN tasks).
74
+ - Appends entries to `CHANGELOG.md` following the [Keep a Changelog](https://keepachangelog.com/) standard (`### Added` for features, `### Fixed` for bugs).
75
+ - Proposes a semantic git commit message (e.g., `feat: ...` or `fix: ...`).
76
+ - Offers next steps (Push, Deploy, or start a new task).
77
+
78
+ ---
79
+
80
+ > [!IMPORTANT]
81
+ > The agent only writes code after SPEC and PLAN are approved. This is the mechanism that keeps changes traceable to an explicit decision, not a guess.