contextos-agents 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/AGENTS.md +53 -33
- package/.agents/adapters/aider/export.js +41 -14
- package/.agents/adapters/claude/export.js +54 -3
- package/.agents/adapters/copilot/export.js +1 -1
- package/.agents/adapters/cursor/export.js +1 -1
- package/.agents/adapters/drift-detector.js +86 -10
- package/.agents/adapters/gemini/export.js +1 -1
- package/.agents/adapters/pure-compiler.js +28 -6
- package/.agents/adapters/shared.js +13 -4
- package/.agents/adapters/zed/export.js +1 -1
- package/.agents/compiled/registry.v2.json +29 -25
- package/.agents/compiled/registry.v2.sha256 +1 -1
- package/.agents/core/skills/context-os/SKILL.md +34 -37
- package/.agents/core/skills/engineering-workflow/SKILL.md +24 -24
- package/.agents/core/skills/gemini-precision/EXAMPLES.md +72 -0
- package/.agents/core/skills/gemini-precision/SKILL.md +2 -1
- package/.agents/core/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +2 -0
- package/.agents/core/skills/gstack-roles/SKILL.md +7 -6
- package/.agents/core/skills/security/SKILL.md +44 -16
- package/.agents/core/skills/security/skill.yaml +0 -1
- package/.agents/ctx.js +20 -14
- package/.agents/generated/claude/skills/context-os/SKILL.md +34 -37
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +24 -24
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +102 -1
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +7 -6
- package/.agents/generated/claude/skills/security/SKILL.md +44 -16
- package/.agents/generated/gemini/skills/context-os/SKILL.md +34 -37
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +24 -24
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +105 -1
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +7 -6
- package/.agents/generated/gemini/skills/security/SKILL.md +44 -125
- package/.agents/plugins.js +105 -8
- package/.agents/profiles.js +32 -11
- package/.agents/resolver/canonical-resolver.js +7 -7
- package/.agents/validate.js +69 -1
- package/README.md +81 -24
- package/bin/commands/hook.js +167 -0
- package/bin/commands/scan.js +77 -0
- package/bin/commands.js +39 -1
- package/bin/index.js +151 -34
- package/bin/lib/gate.js +171 -0
- package/bin/lib/git-snapshot.js +214 -0
- package/bin/lib/scan.js +461 -0
- package/catalog/skills/adapters/EXAMPLES.md +19 -0
- package/catalog/skills/adapters/SKILL.md +101 -0
- package/catalog/skills/adapters/TROUBLESHOOTING.md +7 -0
- package/catalog/skills/adapters/VALIDATION.json +12 -0
- package/catalog/skills/adapters/skill.yaml +13 -0
- package/catalog/skills/api-design/EXAMPLES.md +91 -0
- package/catalog/skills/api-design/SKILL.md +63 -0
- package/catalog/skills/api-design/TROUBLESHOOTING.md +54 -0
- package/catalog/skills/api-design/VALIDATION.json +11 -0
- package/catalog/skills/api-design/skill.yaml +14 -0
- package/catalog/skills/architecture-diagrams/SKILL.md +108 -0
- package/catalog/skills/architecture-diagrams/VALIDATION.json +12 -0
- package/catalog/skills/architecture-diagrams/skill.yaml +9 -0
- package/catalog/skills/brutalist-design/EXAMPLES.md +59 -0
- package/catalog/skills/brutalist-design/SKILL.md +150 -0
- package/catalog/skills/brutalist-design/VALIDATION.json +12 -0
- package/catalog/skills/brutalist-design/skill.yaml +10 -0
- package/catalog/skills/ci-cd/EXAMPLES.md +79 -0
- package/catalog/skills/ci-cd/SKILL.md +69 -0
- package/catalog/skills/ci-cd/TROUBLESHOOTING.md +52 -0
- package/catalog/skills/ci-cd/VALIDATION.json +11 -0
- package/catalog/skills/ci-cd/skill.yaml +13 -0
- package/catalog/skills/database/EXAMPLES.md +74 -0
- package/catalog/skills/database/SKILL.md +101 -0
- package/catalog/skills/database/TROUBLESHOOTING.md +18 -0
- package/catalog/skills/database/VALIDATION.json +11 -0
- package/catalog/skills/database/skill.yaml +14 -0
- package/catalog/skills/ddd/EXAMPLES.md +42 -0
- package/catalog/skills/ddd/SKILL.md +247 -0
- package/catalog/skills/ddd/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/ddd/VALIDATION.json +12 -0
- package/catalog/skills/ddd/skill.yaml +14 -0
- package/catalog/skills/decisions/EXAMPLES.md +35 -0
- package/catalog/skills/decisions/SKILL.md +90 -0
- package/catalog/skills/decisions/TROUBLESHOOTING.md +13 -0
- package/catalog/skills/decisions/VALIDATION.json +12 -0
- package/catalog/skills/decisions/skill.yaml +13 -0
- package/catalog/skills/docker/EXAMPLES.md +56 -0
- package/catalog/skills/docker/SKILL.md +169 -0
- package/catalog/skills/docker/TROUBLESHOOTING.md +18 -0
- package/catalog/skills/docker/VALIDATION.json +11 -0
- package/catalog/skills/docker/skill.yaml +13 -0
- package/catalog/skills/fastapi/EXAMPLES.md +36 -0
- package/catalog/skills/fastapi/SKILL.md +171 -0
- package/catalog/skills/fastapi/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/fastapi/VALIDATION.json +12 -0
- package/catalog/skills/fastapi/skill.yaml +14 -0
- package/catalog/skills/generators/EXAMPLES.md +19 -0
- package/catalog/skills/generators/SKILL.md +110 -0
- package/catalog/skills/generators/TROUBLESHOOTING.md +7 -0
- package/catalog/skills/generators/VALIDATION.json +12 -0
- package/catalog/skills/generators/skill.yaml +22 -0
- package/catalog/skills/generators/templates/API.md +77 -0
- package/catalog/skills/generators/templates/ARCHITECTURE.md +70 -0
- package/catalog/skills/generators/templates/DATABASE.md +42 -0
- package/catalog/skills/generators/templates/DECISION.md +46 -0
- package/catalog/skills/generators/templates/PRD.md +67 -0
- package/catalog/skills/generators/templates/PROJECT_GRAPH.md +56 -0
- package/catalog/skills/generators/templates/ROADMAP.md +51 -0
- package/catalog/skills/generators/templates/TASKS.md +43 -0
- package/catalog/skills/generators/templates/UI.md +73 -0
- package/catalog/skills/graphify/EXAMPLES.md +73 -0
- package/catalog/skills/graphify/SKILL.md +130 -0
- package/catalog/skills/graphify/VALIDATION.json +12 -0
- package/catalog/skills/graphify/skill.yaml +13 -0
- package/catalog/skills/impeccable-design/EXAMPLES.md +26 -0
- package/catalog/skills/impeccable-design/SKILL.md +201 -0
- package/catalog/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/impeccable-design/VALIDATION.json +12 -0
- package/catalog/skills/impeccable-design/skill.yaml +15 -0
- package/catalog/skills/interview-me/SKILL.md +97 -0
- package/catalog/skills/interview-me/VALIDATION.json +12 -0
- package/catalog/skills/interview-me/skill.yaml +9 -0
- package/catalog/skills/microservices/EXAMPLES.md +38 -0
- package/catalog/skills/microservices/SKILL.md +164 -0
- package/catalog/skills/microservices/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/microservices/VALIDATION.json +12 -0
- package/catalog/skills/microservices/skill.yaml +14 -0
- package/catalog/skills/minimalist-design/EXAMPLES.md +58 -0
- package/catalog/skills/minimalist-design/SKILL.md +113 -0
- package/catalog/skills/minimalist-design/VALIDATION.json +12 -0
- package/catalog/skills/minimalist-design/skill.yaml +10 -0
- package/catalog/skills/nestjs/EXAMPLES.md +40 -0
- package/catalog/skills/nestjs/SKILL.md +139 -0
- package/catalog/skills/nestjs/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/nestjs/VALIDATION.json +12 -0
- package/catalog/skills/nestjs/skill.yaml +14 -0
- package/catalog/skills/nextjs/EXAMPLES.md +40 -0
- package/catalog/skills/nextjs/SKILL.md +163 -0
- package/catalog/skills/nextjs/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/nextjs/VALIDATION.json +12 -0
- package/catalog/skills/nextjs/skill.yaml +14 -0
- package/catalog/skills/node/EXAMPLES.md +80 -0
- package/catalog/skills/node/SKILL.md +128 -0
- package/catalog/skills/node/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/node/VALIDATION.json +12 -0
- package/catalog/skills/node/skill.yaml +14 -0
- package/catalog/skills/performance/EXAMPLES.md +30 -0
- package/catalog/skills/performance/SKILL.md +75 -0
- package/catalog/skills/performance/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/performance/VALIDATION.json +12 -0
- package/catalog/skills/performance/skill.yaml +14 -0
- package/catalog/skills/react/EXAMPLES.md +79 -0
- package/catalog/skills/react/SKILL.md +132 -0
- package/catalog/skills/react/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/react/VALIDATION.json +12 -0
- package/catalog/skills/react/skill.yaml +14 -0
- package/catalog/skills/react-best-practices/SKILL.md +158 -0
- package/catalog/skills/react-best-practices/VALIDATION.json +12 -0
- package/catalog/skills/react-best-practices/skill.yaml +13 -0
- package/catalog/skills/redesign-audit/SKILL.md +117 -0
- package/catalog/skills/redesign-audit/VALIDATION.json +12 -0
- package/catalog/skills/redesign-audit/skill.yaml +9 -0
- package/catalog/skills/security-audit/EXAMPLES.md +79 -0
- package/catalog/skills/security-audit/SKILL.md +91 -0
- package/catalog/skills/security-audit/TROUBLESHOOTING.md +46 -0
- package/catalog/skills/security-audit/VALIDATION.json +11 -0
- package/catalog/skills/security-audit/skill.yaml +14 -0
- package/catalog/skills/soft-design/EXAMPLES.md +51 -0
- package/catalog/skills/soft-design/SKILL.md +108 -0
- package/catalog/skills/soft-design/VALIDATION.json +12 -0
- package/catalog/skills/soft-design/skill.yaml +10 -0
- package/catalog/skills/state-management/EXAMPLES.md +56 -0
- package/catalog/skills/state-management/SKILL.md +168 -0
- package/catalog/skills/state-management/TROUBLESHOOTING.md +18 -0
- package/catalog/skills/state-management/VALIDATION.json +11 -0
- package/catalog/skills/state-management/skill.yaml +14 -0
- package/catalog/skills/subagent-orchestrator/SKILL.md +117 -0
- package/catalog/skills/subagent-orchestrator/VALIDATION.json +12 -0
- package/catalog/skills/subagent-orchestrator/skill.yaml +9 -0
- package/catalog/skills/system-design/EXAMPLES.md +75 -0
- package/catalog/skills/system-design/SKILL.md +419 -0
- package/catalog/skills/system-design/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/system-design/VALIDATION.json +12 -0
- package/catalog/skills/system-design/skill.yaml +14 -0
- package/catalog/skills/terraform/EXAMPLES.md +74 -0
- package/catalog/skills/terraform/SKILL.md +55 -0
- package/catalog/skills/terraform/TROUBLESHOOTING.md +53 -0
- package/catalog/skills/terraform/VALIDATION.json +11 -0
- package/catalog/skills/terraform/skill.yaml +14 -0
- package/catalog/skills/testing/EXAMPLES.md +122 -0
- package/catalog/skills/testing/SKILL.md +70 -0
- package/catalog/skills/testing/TROUBLESHOOTING.md +18 -0
- package/catalog/skills/testing/VALIDATION.json +11 -0
- package/catalog/skills/testing/skill.yaml +14 -0
- package/catalog/skills/typescript/EXAMPLES.md +64 -0
- package/catalog/skills/typescript/SKILL.md +112 -0
- package/catalog/skills/typescript/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/typescript/VALIDATION.json +12 -0
- package/catalog/skills/typescript/skill.yaml +14 -0
- package/catalog/skills/ui-design/EXAMPLES.md +21 -0
- package/catalog/skills/ui-design/SKILL.md +124 -0
- package/catalog/skills/ui-design/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/ui-design/VALIDATION.json +12 -0
- package/catalog/skills/ui-design/skill.yaml +16 -0
- package/catalog/skills/ui-ux-pro/EXAMPLES.md +62 -0
- package/catalog/skills/ui-ux-pro/SKILL.md +418 -0
- package/catalog/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/ui-ux-pro/VALIDATION.json +12 -0
- package/catalog/skills/ui-ux-pro/skill.yaml +14 -0
- package/catalog/skills/ux-design/EXAMPLES.md +36 -0
- package/catalog/skills/ux-design/SKILL.md +116 -0
- package/catalog/skills/ux-design/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/ux-design/VALIDATION.json +12 -0
- package/catalog/skills/ux-design/skill.yaml +16 -0
- package/catalog/skills/vercel-optimize/SKILL.md +83 -0
- package/catalog/skills/vercel-optimize/VALIDATION.json +12 -0
- package/catalog/skills/vercel-optimize/scripts/collect-signals.mjs +131 -0
- package/catalog/skills/vercel-optimize/scripts/gate-investigations.mjs +142 -0
- package/catalog/skills/vercel-optimize/scripts/merge-signals.mjs +143 -0
- package/catalog/skills/vercel-optimize/scripts/scan-codebase.mjs +174 -0
- package/catalog/skills/vercel-optimize/skill.yaml +15 -0
- package/catalog/skills/web-accessibility/EXAMPLES.md +39 -0
- package/catalog/skills/web-accessibility/SKILL.md +151 -0
- package/catalog/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
- package/catalog/skills/web-accessibility/VALIDATION.json +12 -0
- package/catalog/skills/web-accessibility/skill.yaml +14 -0
- package/package.json +5 -2
- package/.agents/core/skills/security/security.md +0 -106
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: decision-engine
|
|
3
|
+
description: >
|
|
4
|
+
Architecture Decision Records (ADR) management. Creates, tracks, and queries
|
|
5
|
+
decisions so the AI agent understands WHY choices were made, not just WHAT was chosen.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# decision-engine
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Architecture Decision Record (ADR) system following Michael Nygard format. Captures context, options considered, tradeoffs, and consequences to prevent architectural regression and knowledge loss across AI sessions.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
Activate when choosing or switching database engines, authentication strategies, state libraries, or significant architectural patterns.
|
|
17
|
+
|
|
18
|
+
## Rules & Patterns
|
|
19
|
+
|
|
20
|
+
You manage **Architecture Decision Records** (ADRs).
|
|
21
|
+
|
|
22
|
+
## Why Decisions Matter
|
|
23
|
+
|
|
24
|
+
Without ADRs, the AI agent sees:
|
|
25
|
+
|
|
26
|
+
- "Database: PostgreSQL" - but doesn't know WHY
|
|
27
|
+
- "Auth: JWT" - but doesn't know what alternatives were considered
|
|
28
|
+
- "Framework: Next.js" - but doesn't know the tradeoffs
|
|
29
|
+
|
|
30
|
+
With ADRs, the agent understands the reasoning and won't accidentally contradict prior decisions.
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
### Create a Decision
|
|
35
|
+
|
|
36
|
+
When an architectural choice is made during any pipeline stage:
|
|
37
|
+
|
|
38
|
+
1. Auto-increment the decision number
|
|
39
|
+
2. Use the template from `generators/templates/DECISION.md`
|
|
40
|
+
3. Save to `docs/decisions/NNNN-decision-name.md`
|
|
41
|
+
4. Update the Project Graph if the decision affects modules
|
|
42
|
+
|
|
43
|
+
**Naming convention:** `docs/decisions/0001-use-postgresql.md`
|
|
44
|
+
|
|
45
|
+
### Query Decisions
|
|
46
|
+
|
|
47
|
+
Before making changes that touch architecture:
|
|
48
|
+
|
|
49
|
+
1. Check `docs/decisions/` for related decisions
|
|
50
|
+
2. If a decision exists, follow it
|
|
51
|
+
3. If a decision needs to change, create a new ADR that **supersedes** the old one
|
|
52
|
+
|
|
53
|
+
### Decision Lifecycle
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
proposed → accepted → [deprecated | superseded]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- **proposed**: Under discussion, not yet committed
|
|
60
|
+
- **accepted**: The team agreed, this is the standard
|
|
61
|
+
- **deprecated**: No longer relevant (project evolved)
|
|
62
|
+
- **superseded**: Replaced by a newer decision (link to it)
|
|
63
|
+
|
|
64
|
+
## Auto-Detection
|
|
65
|
+
|
|
66
|
+
The Decision Engine should suggest creating an ADR when it detects:
|
|
67
|
+
|
|
68
|
+
- A new database/ORM is introduced
|
|
69
|
+
- A new framework is added
|
|
70
|
+
- Authentication strategy changes
|
|
71
|
+
- API versioning approach is chosen
|
|
72
|
+
- Deployment strategy is decided
|
|
73
|
+
- A significant library is added (state management, testing framework, etc.)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Code Examples
|
|
77
|
+
|
|
78
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
79
|
+
|
|
80
|
+
## Validation Checklist
|
|
81
|
+
|
|
82
|
+
What to verify during the review phase before completing the task.
|
|
83
|
+
|
|
84
|
+
## Common Mistakes
|
|
85
|
+
|
|
86
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
87
|
+
|
|
88
|
+
## Integration Notes
|
|
89
|
+
|
|
90
|
+
How this skill interacts with other skills.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# decisions Troubleshooting & Common Mistakes
|
|
2
|
+
|
|
3
|
+
## 1. Post-Hoc Justifications
|
|
4
|
+
|
|
5
|
+
- **Symptom**: ADR written weeks after code is merged, omitting all rejected options.
|
|
6
|
+
- **Root Cause**: Treating ADRs as paperwork rather than decision-making tools.
|
|
7
|
+
- **Fix**: Write the ADR during the PLAN phase _before_ implementing the decision.
|
|
8
|
+
|
|
9
|
+
## 2. Omitting Trade-offs
|
|
10
|
+
|
|
11
|
+
- **Symptom**: ADR lists only benefits, claiming the chosen tech has zero downsides.
|
|
12
|
+
- **Root Cause**: Confirmation bias.
|
|
13
|
+
- **Fix**: Every architecture decision has costs. Explicitly document negative trade-offs and operational overhead.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
schemaVersion: 2
|
|
2
|
+
name: decisions
|
|
3
|
+
category: architecture
|
|
4
|
+
type: instruction-only
|
|
5
|
+
description: >
|
|
6
|
+
Architecture Decision Records (ADR) management. Creates, tracks, and queries
|
|
7
|
+
architectural decisions so AI assistants understand why choices were made.
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
resources:
|
|
10
|
+
- EXAMPLES.md
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- TROUBLESHOOTING.md
|
|
13
|
+
- VALIDATION.json
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Docker Examples - Anti-patterns vs ContextOS Standard
|
|
2
|
+
|
|
3
|
+
## Example 1: Multi-Stage Build & Layer Caching
|
|
4
|
+
|
|
5
|
+
### Anti-pattern: Anti-pattern (Fat single-stage image running as root)
|
|
6
|
+
|
|
7
|
+
```dockerfile
|
|
8
|
+
# BAD: 1.2GB image, runs as root, breaks caching on every file edit
|
|
9
|
+
FROM node:latest
|
|
10
|
+
WORKDIR /app
|
|
11
|
+
COPY . .
|
|
12
|
+
RUN npm install
|
|
13
|
+
RUN npm run build
|
|
14
|
+
EXPOSE 3000
|
|
15
|
+
CMD ["npm", "start"]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Best practice: ContextOS Standard (Slim multi-stage build with non-root user)
|
|
19
|
+
|
|
20
|
+
```dockerfile
|
|
21
|
+
# GOOD: 95MB image, non-root user, optimized layer caching
|
|
22
|
+
FROM node:20.12.2-alpine3.19 AS builder
|
|
23
|
+
WORKDIR /app
|
|
24
|
+
COPY package.json package-lock.json ./
|
|
25
|
+
RUN npm ci
|
|
26
|
+
COPY . .
|
|
27
|
+
RUN npm run build && npm prune --production
|
|
28
|
+
|
|
29
|
+
FROM node:20.12.2-alpine3.19 AS runner
|
|
30
|
+
WORKDIR /app
|
|
31
|
+
ENV NODE_ENV=production
|
|
32
|
+
RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 appuser -G appgroup
|
|
33
|
+
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
|
|
34
|
+
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
|
|
35
|
+
USER appuser
|
|
36
|
+
CMD ["node", "dist/main.js"]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Example 2: Docker Ignore File (`.dockerignore`)
|
|
42
|
+
|
|
43
|
+
### Best practice: ContextOS Standard `.dockerignore`
|
|
44
|
+
|
|
45
|
+
```gitignore
|
|
46
|
+
node_modules
|
|
47
|
+
npm-debug.log
|
|
48
|
+
.git
|
|
49
|
+
.gitignore
|
|
50
|
+
.env
|
|
51
|
+
.env.*
|
|
52
|
+
dist
|
|
53
|
+
coverage
|
|
54
|
+
.DS_Store
|
|
55
|
+
*.md
|
|
56
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker
|
|
3
|
+
description: Docker containerization, multi-stage builds, non-root security, layer caching optimization, and docker-compose standards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Docker
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Containerization, Dockerfile architecture, multi-stage compilation, security hardening, and container orchestration for production workloads.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Activate when creating or optimizing Dockerfiles, docker-compose configurations, container security audits, CI/CD container build stages, or production container deployments.
|
|
15
|
+
|
|
16
|
+
## Rules & Patterns
|
|
17
|
+
|
|
18
|
+
### Negative Constraints (What NOT to Do)
|
|
19
|
+
|
|
20
|
+
1. **NEVER run containers as `root` in production**: Always create and switch to an unprivileged non-root user (e.g. `USER node` or `USER nonroot`).
|
|
21
|
+
2. **NEVER use the `latest` tag**: Always pin base images to specific immutable version digests or explicit minor tags (e.g. `node:22-alpine3.20` or `python:3.12-slim-bookworm`).
|
|
22
|
+
3. **NEVER copy source code before dependency manifests**: Always copy package manifests (`package.json`, `pnpm-lock.yaml`, `pyproject.toml`) and install dependencies first to maximize Docker layer cache hits.
|
|
23
|
+
4. **NEVER bake secrets, API keys, or `.env` files into image layers**: Pass secrets via build-time secret mounts (`--mount=type=secret`) or runtime environment variables injected by the orchestrator.
|
|
24
|
+
5. **NEVER include build tools or devDependencies in the final runner image**: Always use multi-stage builds to discard compilers, package managers, and temporary build caches from production images.
|
|
25
|
+
6. **NEVER run without a `.dockerignore` file**: Always exclude `.git`, `node_modules`, `.env*`, and build outputs from the Docker build context.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### Pattern 1: Node.js / Next.js Standalone Multi-Stage Dockerfile
|
|
30
|
+
|
|
31
|
+
Optimized multi-stage build producing minimal production images (<120MB) with non-root security:
|
|
32
|
+
|
|
33
|
+
```dockerfile
|
|
34
|
+
# ── Stage 1: Dependencies ─────────────────────────────────────────────
|
|
35
|
+
FROM node:22-alpine3.20 AS deps
|
|
36
|
+
RUN apk add --no-cache libc6-compat
|
|
37
|
+
WORKDIR /app
|
|
38
|
+
|
|
39
|
+
COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
|
|
40
|
+
RUN \
|
|
41
|
+
if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
|
42
|
+
elif [ -f package-lock.json ]; then npm ci; \
|
|
43
|
+
else yarn --frozen-lockfile; \
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# ── Stage 2: Builder ──────────────────────────────────────────────────
|
|
47
|
+
FROM node:22-alpine3.20 AS builder
|
|
48
|
+
WORKDIR /app
|
|
49
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
50
|
+
COPY . .
|
|
51
|
+
|
|
52
|
+
ENV NEXT_TELEMETRY_DISABLED=1
|
|
53
|
+
ENV NODE_ENV=production
|
|
54
|
+
RUN npm run build
|
|
55
|
+
|
|
56
|
+
# ── Stage 3: Production Runner ────────────────────────────────────────
|
|
57
|
+
FROM node:22-alpine3.20 AS runner
|
|
58
|
+
WORKDIR /app
|
|
59
|
+
|
|
60
|
+
ENV NODE_ENV=production
|
|
61
|
+
ENV PORT=3000
|
|
62
|
+
ENV HOSTNAME="0.0.0.0"
|
|
63
|
+
|
|
64
|
+
RUN addgroup --system --gid 1001 nodejs && \
|
|
65
|
+
adduser --system --uid 1001 nextjs
|
|
66
|
+
|
|
67
|
+
# Copy standalone output and static assets
|
|
68
|
+
COPY --from=builder /app/public ./public
|
|
69
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
70
|
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
71
|
+
|
|
72
|
+
USER nextjs
|
|
73
|
+
EXPOSE 3000
|
|
74
|
+
|
|
75
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
76
|
+
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health || exit 1
|
|
77
|
+
|
|
78
|
+
CMD ["node", "server.js"]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### Pattern 2: Python / FastAPI Multi-Stage Dockerfile (uv)
|
|
84
|
+
|
|
85
|
+
High-performance Python build utilizing `uv` for sub-second installs and slim final layers:
|
|
86
|
+
|
|
87
|
+
```dockerfile
|
|
88
|
+
# ── Stage 1: Build virtual environment ────────────────────────────────
|
|
89
|
+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
|
|
90
|
+
WORKDIR /app
|
|
91
|
+
|
|
92
|
+
ENV UV_COMPILE_BYTECODE=1
|
|
93
|
+
ENV UV_LINK_MODE=copy
|
|
94
|
+
|
|
95
|
+
# Install dependencies before code to leverage layer cache
|
|
96
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
97
|
+
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
98
|
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
99
|
+
uv sync --frozen --no-install-project --no-dev
|
|
100
|
+
|
|
101
|
+
COPY . /app
|
|
102
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
103
|
+
uv sync --frozen --no-dev
|
|
104
|
+
|
|
105
|
+
# ── Stage 2: Runtime Runner ───────────────────────────────────────────
|
|
106
|
+
FROM python:3.12-slim-bookworm AS runner
|
|
107
|
+
WORKDIR /app
|
|
108
|
+
|
|
109
|
+
# Create unprivileged application user
|
|
110
|
+
RUN groupadd -r appgroup && useradd -r -g appgroup appuser
|
|
111
|
+
|
|
112
|
+
COPY --from=builder --chown=appuser:appgroup /app /app
|
|
113
|
+
|
|
114
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
115
|
+
ENV PYTHONUNBUFFERED=1
|
|
116
|
+
|
|
117
|
+
USER appuser
|
|
118
|
+
EXPOSE 8000
|
|
119
|
+
|
|
120
|
+
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
|
|
121
|
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health').read()" || exit 1
|
|
122
|
+
|
|
123
|
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### Pattern 3: Essential `.dockerignore` Template
|
|
129
|
+
|
|
130
|
+
Every repository must include a `.dockerignore` to prevent uploading secrets and heavy cache folders:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
.git
|
|
134
|
+
.github
|
|
135
|
+
node_modules
|
|
136
|
+
npm-debug.log
|
|
137
|
+
.env
|
|
138
|
+
.env.*
|
|
139
|
+
!.env.example
|
|
140
|
+
dist
|
|
141
|
+
build
|
|
142
|
+
.next
|
|
143
|
+
.cache
|
|
144
|
+
coverage
|
|
145
|
+
*.md
|
|
146
|
+
Dockerfile*
|
|
147
|
+
docker-compose*.yml
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Validation Checklist
|
|
153
|
+
|
|
154
|
+
- [ ] Multi-stage build separates build compilers from production runtime.
|
|
155
|
+
- [ ] Non-root `USER` directive is active in the final image stage.
|
|
156
|
+
- [ ] Base images are pinned to explicit, immutable release tags.
|
|
157
|
+
- [ ] `HEALTHCHECK` directive is defined with reasonable interval and timeout.
|
|
158
|
+
- [ ] `.dockerignore` prevents leaking local `.env` files and `node_modules`.
|
|
159
|
+
- [ ] Dependencies are copied and installed before copying source code.
|
|
160
|
+
|
|
161
|
+
## Common Mistakes
|
|
162
|
+
|
|
163
|
+
- **Running as root**: Leaves the host system vulnerable if a container breakout vulnerability occurs.
|
|
164
|
+
- **Copying entire source before install**: Invalidates the Docker layer cache on every code edit, slowing CI builds.
|
|
165
|
+
- **Omitting HEALTHCHECK**: Orchestrators cannot detect frozen or zombie worker processes.
|
|
166
|
+
|
|
167
|
+
## Integration Notes
|
|
168
|
+
|
|
169
|
+
Interacts with `security` (container hardening) and `node` / `nextjs` / `fastapi`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Docker Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
## Common Issues & Fixes
|
|
4
|
+
|
|
5
|
+
### 1. Slow Docker builds rebuilding node_modules every time
|
|
6
|
+
|
|
7
|
+
- **Cause**: Copying the entire directory (`COPY . .`) before running `npm ci`.
|
|
8
|
+
- **Fix**: Copy `package.json` and `package-lock.json` separately first, run `npm ci`, and only then copy application source code.
|
|
9
|
+
|
|
10
|
+
### 2. Permission Denied Errors with Non-Root Users
|
|
11
|
+
|
|
12
|
+
- **Cause**: Files copied from builder without changing ownership.
|
|
13
|
+
- **Fix**: Always use `--chown=appuser:appgroup` when copying files in Dockerfile.
|
|
14
|
+
|
|
15
|
+
### 3. Missing native build dependencies on Alpine Linux
|
|
16
|
+
|
|
17
|
+
- **Cause**: Packages requiring C bindings (e.g. `sharp`, `bcrypt`) fail on musl libc.
|
|
18
|
+
- **Fix**: Add `RUN apk add --no-cache libc6-compat python3 make g++` in the builder stage.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill": "docker",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"checks": [
|
|
5
|
+
"Multi-stage Dockerfile architecture",
|
|
6
|
+
"Non-root USER directive present",
|
|
7
|
+
"Layer caching optimization (lockfiles copied first)",
|
|
8
|
+
"Specific image version tags (no :latest)",
|
|
9
|
+
".dockerignore excludes node_modules and secrets"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
schemaVersion: 2
|
|
2
|
+
name: docker
|
|
3
|
+
description: Docker containerization, multi-stage builds, non-root security, layer caching optimization, and docker-compose standards.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
category: devops
|
|
6
|
+
type: instruction-only
|
|
7
|
+
requires:
|
|
8
|
+
- security
|
|
9
|
+
resources:
|
|
10
|
+
- EXAMPLES.md
|
|
11
|
+
- SKILL.md
|
|
12
|
+
- TROUBLESHOOTING.md
|
|
13
|
+
- VALIDATION.json
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# fastapi Examples - Anti-patterns vs ContextOS Standard
|
|
2
|
+
|
|
3
|
+
## Example 1: Asynchronous Route Handlers
|
|
4
|
+
|
|
5
|
+
### Anti-pattern: Blocking I/O inside `async def`
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
# BAD: time.sleep or synchronous requests blocks the entire asyncio event loop!
|
|
9
|
+
import time
|
|
10
|
+
import requests
|
|
11
|
+
|
|
12
|
+
@app.get("/slow")
|
|
13
|
+
async def slow_route():
|
|
14
|
+
time.sleep(5) # BLOCKS ALL CONCURRENT USERS!
|
|
15
|
+
return {"status": "done"}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Best practice: ContextOS Standard (Non-blocking Async or Def Offload)
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
# GOOD: Use async non-blocking client (httpx) or standard def for sync CPU work
|
|
22
|
+
import asyncio
|
|
23
|
+
import httpx
|
|
24
|
+
|
|
25
|
+
@app.get("/fast")
|
|
26
|
+
async def fast_route():
|
|
27
|
+
async with httpx.AsyncClient() as client:
|
|
28
|
+
response = await client.get("https://api.example.com/data")
|
|
29
|
+
return response.json()
|
|
30
|
+
|
|
31
|
+
# Or standard def (FastAPI automatically runs it in a background threadpool):
|
|
32
|
+
@app.get("/sync-worker")
|
|
33
|
+
def sync_worker():
|
|
34
|
+
time.sleep(5) # Runs in worker thread without blocking event loop
|
|
35
|
+
return {"status": "done"}
|
|
36
|
+
```
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: FastAPI
|
|
3
|
+
description: >
|
|
4
|
+
ContextOS skill for FastAPI
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# FastAPI
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
High-performance Python backend engineering using FastAPI, Pydantic v2, and async SQLAlchemy/Tortoise ORM. Enforces type-driven request validation, OpenAPI contracts, and async non-blocking endpoints.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
Activate when building Python REST APIs, microservices, asynchronous background jobs, or integrating Python ML services into web backends.
|
|
16
|
+
|
|
17
|
+
## Rules & Patterns
|
|
18
|
+
<!-- Source: fastapi.md -->
|
|
19
|
+
|
|
20
|
+
## FastAPI - Best Practices
|
|
21
|
+
|
|
22
|
+
## Project Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
app/
|
|
26
|
+
├── main.py # App entry, CORS, middleware
|
|
27
|
+
├── config.py # Settings with Pydantic BaseSettings
|
|
28
|
+
├── database.py # Database session, engine
|
|
29
|
+
├── models/ # SQLAlchemy models
|
|
30
|
+
│ ├── __init__.py
|
|
31
|
+
│ └── user.py
|
|
32
|
+
├── schemas/ # Pydantic schemas (request/response)
|
|
33
|
+
│ ├── __init__.py
|
|
34
|
+
│ └── user.py
|
|
35
|
+
├── api/ # Route handlers
|
|
36
|
+
│ ├── __init__.py
|
|
37
|
+
│ ├── deps.py # Dependency injection
|
|
38
|
+
│ └── v1/
|
|
39
|
+
│ ├── __init__.py
|
|
40
|
+
│ └── users.py
|
|
41
|
+
├── services/ # Business logic
|
|
42
|
+
│ └── user_service.py
|
|
43
|
+
├── repositories/ # Database access
|
|
44
|
+
│ └── user_repo.py
|
|
45
|
+
└── tests/
|
|
46
|
+
└── test_users.py
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Pydantic Models
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from pydantic import BaseModel, EmailStr, Field, ConfigDict
|
|
53
|
+
|
|
54
|
+
class UserCreate(BaseModel):
|
|
55
|
+
email: EmailStr
|
|
56
|
+
name: str = Field(..., min_length=1, max_length=100)
|
|
57
|
+
|
|
58
|
+
class UserResponse(BaseModel):
|
|
59
|
+
id: int
|
|
60
|
+
email: str
|
|
61
|
+
name: str
|
|
62
|
+
|
|
63
|
+
model_config = ConfigDict(from_attributes=True)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Dependency Injection
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from typing import AsyncGenerator
|
|
70
|
+
from fastapi import Depends, HTTPException, status
|
|
71
|
+
from fastapi.security import OAuth2PasswordBearer
|
|
72
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
73
|
+
import jwt
|
|
74
|
+
|
|
75
|
+
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="api/v1/auth/token")
|
|
76
|
+
|
|
77
|
+
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
78
|
+
async with async_session() as session:
|
|
79
|
+
yield session
|
|
80
|
+
|
|
81
|
+
async def get_current_user(
|
|
82
|
+
token: str = Depends(oauth2_scheme),
|
|
83
|
+
db: AsyncSession = Depends(get_db)
|
|
84
|
+
) -> User:
|
|
85
|
+
try:
|
|
86
|
+
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
|
|
87
|
+
user_id: str = payload.get("sub")
|
|
88
|
+
if user_id is None:
|
|
89
|
+
raise HTTPException(
|
|
90
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
91
|
+
detail="Could not validate credentials",
|
|
92
|
+
headers={"WWW-Authenticate": "Bearer"},
|
|
93
|
+
)
|
|
94
|
+
except jwt.PyJWTError:
|
|
95
|
+
raise HTTPException(
|
|
96
|
+
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
97
|
+
detail="Invalid token signature or expired token",
|
|
98
|
+
headers={"WWW-Authenticate": "Bearer"},
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
user = await user_repo.get_by_id(db, user_id=user_id)
|
|
102
|
+
if user is None:
|
|
103
|
+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="User not found")
|
|
104
|
+
return user
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Async
|
|
108
|
+
|
|
109
|
+
- **Use async** for all I/O operations (database, HTTP calls, file I/O)
|
|
110
|
+
- **Never block the event loop** - no sync I/O in async endpoints
|
|
111
|
+
- **Use `asyncio.gather`** for parallel async operations
|
|
112
|
+
- **Background tasks** - use `BackgroundTasks` for non-critical work
|
|
113
|
+
|
|
114
|
+
## Error Handling
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from fastapi import HTTPException
|
|
118
|
+
|
|
119
|
+
class AppException(HTTPException):
|
|
120
|
+
def __init__(self, status_code: int, detail: str, code: str):
|
|
121
|
+
super().__init__(status_code=status_code, detail=detail)
|
|
122
|
+
self.code = code
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Security
|
|
126
|
+
|
|
127
|
+
- **OAuth2 with JWT** - use `python-jose`
|
|
128
|
+
- **Password hashing** - bcrypt via `passlib`
|
|
129
|
+
- **CORS** - configure explicitly
|
|
130
|
+
- **Rate limiting** - use `slowapi`
|
|
131
|
+
- **Input validation** - Pydantic handles this automatically
|
|
132
|
+
|
|
133
|
+
## Testing
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import pytest
|
|
137
|
+
from httpx import AsyncClient
|
|
138
|
+
|
|
139
|
+
@pytest.mark.asyncio
|
|
140
|
+
async def test_create_user(client: AsyncClient):
|
|
141
|
+
response = await client.post("/api/v1/users", json={
|
|
142
|
+
"email": "test@example.com",
|
|
143
|
+
"name": "Test User"
|
|
144
|
+
})
|
|
145
|
+
assert response.status_code == 201
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Anti-Patterns
|
|
149
|
+
|
|
150
|
+
- [FAIL] Business logic in route handlers - use services
|
|
151
|
+
- [FAIL] Raw SQL without ORM - use SQLAlchemy
|
|
152
|
+
- [FAIL] Sync database calls - use async drivers
|
|
153
|
+
- [FAIL] Hardcoded settings - use Pydantic BaseSettings
|
|
154
|
+
- [FAIL] No schema validation - always use Pydantic models
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Code Examples
|
|
158
|
+
|
|
159
|
+
See `EXAMPLES.md` for detailed code examples.
|
|
160
|
+
|
|
161
|
+
## Validation Checklist
|
|
162
|
+
|
|
163
|
+
What to verify during the review phase before completing the task.
|
|
164
|
+
|
|
165
|
+
## Common Mistakes
|
|
166
|
+
|
|
167
|
+
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
168
|
+
|
|
169
|
+
## Integration Notes
|
|
170
|
+
|
|
171
|
+
How this skill interacts with other skills.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# fastapi Troubleshooting & Common Mistakes
|
|
2
|
+
|
|
3
|
+
## 1. Pydantic v1 vs v2 Deprecations
|
|
4
|
+
|
|
5
|
+
- **Symptom**: Warnings or crashes regarding @validator or .dict() methods.
|
|
6
|
+
- **Root Cause**: FastAPI projects upgrading to Pydantic v2.
|
|
7
|
+
- **Fix**: Use @field_validator instead of @validator, and .model_dump() instead of .dict().
|
|
8
|
+
|
|
9
|
+
## 2. Database Session Leaks
|
|
10
|
+
|
|
11
|
+
- **Symptom**: Database pool runs out of connections after a few requests.
|
|
12
|
+
- **Root Cause**: Database sessions opened manually without proper try...finally or dependency injection.
|
|
13
|
+
- **Fix**: Always provide database sessions via Depends(get_db) with a yield block.
|
|
14
|
+
|
|
15
|
+
## 3. Unhandled Validation Errors Returning Inconsistent JSON
|
|
16
|
+
|
|
17
|
+
- **Symptom**: Frontend receives raw 422 arrays without matching standard API error response envelope.
|
|
18
|
+
- **Root Cause**: Missing custom RequestValidationError handler.
|
|
19
|
+
- **Fix**: Register an app-level exception handler for RequestValidationError that normalizes error shapes.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
schemaVersion: 2
|
|
2
|
+
id: fastapi
|
|
3
|
+
name: FastAPI
|
|
4
|
+
category: backend
|
|
5
|
+
type: instruction-only
|
|
6
|
+
requires: []
|
|
7
|
+
optional: [postgres, redis, docker]
|
|
8
|
+
conflicts: [nestjs, express]
|
|
9
|
+
weight: 8
|
|
10
|
+
resources:
|
|
11
|
+
- EXAMPLES.md
|
|
12
|
+
- SKILL.md
|
|
13
|
+
- TROUBLESHOOTING.md
|
|
14
|
+
- VALIDATION.json
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# generators Examples - Anti-patterns vs ContextOS Standard
|
|
2
|
+
|
|
3
|
+
## Example 1: Technical Documentation Generation
|
|
4
|
+
|
|
5
|
+
### Anti-pattern: Scaffolding from Scratch Without Templates
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Agent drafts a 2-paragraph "architecture overview" missing databases, security, and hosting models.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Best practice: ContextOS Standard (ctx init Template Generation)
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Generates complete engineering suite:
|
|
15
|
+
- PRD.md (User personas, in-scope, out-of-scope, acceptance criteria)
|
|
16
|
+
- ARCHITECTURE.md (C4 model, data flow, scaling boundaries)
|
|
17
|
+
- DATABASE.md (ERD, indexing strategy, migration plans)
|
|
18
|
+
- API.md (OpenAPI 3.1 endpoints, error codes, authentication)
|
|
19
|
+
```
|