contextos-agents 1.6.1 → 2.0.0-beta.2
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 +6 -1
- package/.agents/adapters/aider/export.js +117 -97
- package/.agents/adapters/claude/export.js +68 -26
- package/.agents/adapters/copilot/export.js +90 -51
- package/.agents/adapters/cursor/export.js +83 -68
- package/.agents/adapters/drift-detector.js +196 -0
- package/.agents/adapters/gemini/export.js +76 -45
- package/.agents/adapters/pure-compiler.js +443 -0
- package/.agents/adapters/zed/export.js +109 -62
- package/.agents/compiled/registry.v2.json +504 -0
- package/.agents/compiled/registry.v2.sha256 +1 -0
- package/.agents/compiler/manifest-compiler.js +963 -0
- package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
- package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
- package/.agents/compiler/vendor/yaml.js +139 -0
- package/.agents/core/profiles/init.yaml +25 -0
- package/.agents/core/skills/context-manager/references/context-rules.md +59 -0
- package/.agents/core/skills/context-manager/skill.yaml +10 -5
- package/.agents/core/skills/context-os/SKILL.md +3 -6
- package/.agents/core/skills/context-os/skill.yaml +14 -8
- package/.agents/core/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/core/skills/engineering-workflow/skill.yaml +7 -7
- package/.agents/core/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +5 -6
- package/.agents/core/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/core/skills/gstack-roles/skill.yaml +9 -6
- package/.agents/core/skills/ponytail-mindset/skill.yaml +7 -7
- package/.agents/core/skills/security/skill.yaml +21 -2
- package/.agents/ctx.js +587 -111
- package/.agents/customization-dx.js +282 -0
- package/.agents/doctor.js +877 -33
- package/.agents/filesystem/index.js +71 -0
- package/.agents/filesystem/journaled-transaction.js +451 -0
- package/.agents/filesystem/lockfile-v2.js +275 -0
- package/.agents/filesystem/platform-hardening.js +222 -0
- package/.agents/filesystem/project-lock.js +218 -0
- package/.agents/filesystem/safe-path.js +256 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/plugins/contextos/hooks.json +25 -0
- package/.agents/plugins/contextos/plugin.json +19 -0
- package/.agents/plugins.js +432 -73
- package/.agents/profiles.js +507 -46
- package/.agents/resolver.js +50 -414
- package/.agents/schemas/attestation.review.v1.json +111 -0
- package/.agents/schemas/attestation.verification.v1.json +85 -0
- package/.agents/schemas/lockfile.v2.schema.json +134 -0
- package/.agents/schemas/profile.v2.schema.json +114 -0
- package/.agents/schemas/runtime.thread.v1.json +192 -0
- package/.agents/schemas/skill.manifest.v2.json +177 -0
- package/.agents/schemas/verification.spec.v1.json +39 -0
- package/.agents/schemas/workspace.graph.schema.json +106 -0
- package/.agents/stats.js +22 -9
- package/.agents/transaction-core/event-store.js +288 -0
- package/.agents/transaction-core/idempotency.js +129 -0
- package/.agents/transaction-core/ipc-lock.js +311 -0
- package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
- package/.agents/validate.js +143 -14
- package/.agents/watch.js +354 -102
- package/.agents/workspace/workspace-graph.js +778 -0
- package/README.md +59 -387
- package/benchmarks/v2/analysis/statistics.js +140 -0
- package/benchmarks/v2/analysis/stats.js +69 -0
- package/benchmarks/v2/arms/arm-definitions.js +79 -0
- package/benchmarks/v2/dataset.schema.json +34 -0
- package/benchmarks/v2/evaluators/index.js +25 -0
- package/benchmarks/v2/evaluators/verified-success.js +116 -0
- package/benchmarks/v2/harness/runner.js +88 -0
- package/benchmarks/v2/pilot-tasks.json +392 -0
- package/bin/commands/recover.js +88 -0
- package/bin/commands/uninstall.js +207 -0
- package/bin/commands/update.js +325 -0
- package/bin/commands.js +342 -0
- package/bin/index.js +326 -149
- package/bin/lib/detector.js +106 -0
- package/bin/lib/lockfile.js +253 -0
- package/bin/lib/safe-writer.js +290 -0
- package/package.json +85 -73
- package/registry.json +15 -7
- package/registry.schema.json +3 -1
- package/registry.v2.schema.json +86 -0
- package/.agents/core/profiles/backend.yaml +0 -47
- package/.agents/core/profiles/enterprise.yaml +0 -46
- package/.agents/core/profiles/frontend.yaml +0 -46
- package/.agents/core/profiles/hackathon.yaml +0 -45
- package/.agents/core/profiles/mvp.yaml +0 -44
- package/.agents/core/profiles/startup.yaml +0 -48
- package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
- package/.agents/core/skills/adapters/SKILL.md +0 -105
- package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
- package/.agents/core/skills/adapters/VALIDATION.json +0 -12
- package/.agents/core/skills/adapters/skill.yaml +0 -10
- package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
- package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
- package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -8
- package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
- package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
- package/.agents/core/skills/brutalist-design/skill.yaml +0 -8
- package/.agents/core/skills/database/EXAMPLES.md +0 -74
- package/.agents/core/skills/database/SKILL.md +0 -101
- package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/database/VALIDATION.json +0 -11
- package/.agents/core/skills/database/skill.yaml +0 -25
- package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
- package/.agents/core/skills/ddd/SKILL.md +0 -247
- package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ddd/VALIDATION.json +0 -12
- package/.agents/core/skills/ddd/ddd.md +0 -178
- package/.agents/core/skills/ddd/skill.yaml +0 -10
- package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
- package/.agents/core/skills/decisions/SKILL.md +0 -90
- package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
- package/.agents/core/skills/decisions/VALIDATION.json +0 -12
- package/.agents/core/skills/decisions/skill.yaml +0 -10
- package/.agents/core/skills/docker/EXAMPLES.md +0 -56
- package/.agents/core/skills/docker/SKILL.md +0 -63
- package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/docker/VALIDATION.json +0 -11
- package/.agents/core/skills/docker/skill.yaml +0 -23
- package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
- package/.agents/core/skills/fastapi/SKILL.md +0 -148
- package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
- package/.agents/core/skills/fastapi/fastapi.md +0 -112
- package/.agents/core/skills/fastapi/skill.yaml +0 -10
- package/.agents/core/skills/generators/EXAMPLES.md +0 -19
- package/.agents/core/skills/generators/SKILL.md +0 -112
- package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
- package/.agents/core/skills/generators/VALIDATION.json +0 -12
- package/.agents/core/skills/generators/skill.yaml +0 -10
- package/.agents/core/skills/generators/templates/API.md +0 -77
- package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
- package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
- package/.agents/core/skills/generators/templates/DECISION.md +0 -46
- package/.agents/core/skills/generators/templates/PRD.md +0 -67
- package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
- package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
- package/.agents/core/skills/generators/templates/TASKS.md +0 -43
- package/.agents/core/skills/generators/templates/UI.md +0 -73
- package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
- package/.agents/core/skills/graphify/SKILL.md +0 -130
- package/.agents/core/skills/graphify/VALIDATION.json +0 -12
- package/.agents/core/skills/graphify/skill.yaml +0 -13
- package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
- package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
- package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
- package/.agents/core/skills/impeccable-design/skill.yaml +0 -14
- package/.agents/core/skills/interview-me/SKILL.md +0 -97
- package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
- package/.agents/core/skills/interview-me/skill.yaml +0 -8
- package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
- package/.agents/core/skills/microservices/SKILL.md +0 -164
- package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/microservices/VALIDATION.json +0 -12
- package/.agents/core/skills/microservices/microservices.md +0 -119
- package/.agents/core/skills/microservices/skill.yaml +0 -10
- package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
- package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
- package/.agents/core/skills/minimalist-design/skill.yaml +0 -8
- package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
- package/.agents/core/skills/nestjs/SKILL.md +0 -139
- package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
- package/.agents/core/skills/nestjs/nestjs.md +0 -103
- package/.agents/core/skills/nestjs/skill.yaml +0 -10
- package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
- package/.agents/core/skills/nextjs/SKILL.md +0 -163
- package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
- package/.agents/core/skills/nextjs/nextjs.md +0 -67
- package/.agents/core/skills/nextjs/skill.yaml +0 -10
- package/.agents/core/skills/node/EXAMPLES.md +0 -80
- package/.agents/core/skills/node/SKILL.md +0 -128
- package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/node/VALIDATION.json +0 -12
- package/.agents/core/skills/node/node.md +0 -87
- package/.agents/core/skills/node/skill.yaml +0 -10
- package/.agents/core/skills/performance/EXAMPLES.md +0 -30
- package/.agents/core/skills/performance/SKILL.md +0 -75
- package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/performance/VALIDATION.json +0 -12
- package/.agents/core/skills/performance/performance.md +0 -52
- package/.agents/core/skills/performance/skill.yaml +0 -10
- package/.agents/core/skills/react/EXAMPLES.md +0 -79
- package/.agents/core/skills/react/SKILL.md +0 -132
- package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/react/VALIDATION.json +0 -12
- package/.agents/core/skills/react/react.md +0 -93
- package/.agents/core/skills/react/skill.yaml +0 -10
- package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
- package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
- package/.agents/core/skills/react-best-practices/skill.yaml +0 -10
- package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
- package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
- package/.agents/core/skills/redesign-audit/skill.yaml +0 -8
- package/.agents/core/skills/soft-design/SKILL.md +0 -108
- package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
- package/.agents/core/skills/soft-design/skill.yaml +0 -8
- package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
- package/.agents/core/skills/state-management/SKILL.md +0 -48
- package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/state-management/VALIDATION.json +0 -11
- package/.agents/core/skills/state-management/skill.yaml +0 -22
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -100
- package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -8
- package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
- package/.agents/core/skills/system-design/SKILL.md +0 -419
- package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/system-design/VALIDATION.json +0 -12
- package/.agents/core/skills/system-design/skill.yaml +0 -13
- package/.agents/core/skills/system-design/system-design.md +0 -112
- package/.agents/core/skills/testing/EXAMPLES.md +0 -71
- package/.agents/core/skills/testing/SKILL.md +0 -70
- package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/testing/VALIDATION.json +0 -11
- package/.agents/core/skills/testing/skill.yaml +0 -26
- package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
- package/.agents/core/skills/typescript/SKILL.md +0 -112
- package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/typescript/VALIDATION.json +0 -12
- package/.agents/core/skills/typescript/skill.yaml +0 -10
- package/.agents/core/skills/typescript/typescript.md +0 -71
- package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
- package/.agents/core/skills/ui-design/SKILL.md +0 -124
- package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
- package/.agents/core/skills/ui-design/skill.yaml +0 -10
- package/.agents/core/skills/ui-design/ui.md +0 -88
- package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
- package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
- package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
- package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -13
- package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
- package/.agents/core/skills/ux-design/SKILL.md +0 -116
- package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
- package/.agents/core/skills/ux-design/skill.yaml +0 -10
- package/.agents/core/skills/ux-design/ux.md +0 -80
- package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
- package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
- package/.agents/core/skills/vercel-optimize/skill.yaml +0 -10
- package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
- package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
- package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
- package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
- package/.agents/core/skills/web-accessibility/skill.yaml +0 -10
- package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
- package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
- package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
- package/.agents/generated/claude/skills/database/SKILL.md +0 -191
- package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
- package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
- package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
- package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
- package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
- package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
- package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
- package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
- package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
- package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
- package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
- package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
- package/.agents/generated/claude/skills/node/SKILL.md +0 -224
- package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
- package/.agents/generated/claude/skills/react/SKILL.md +0 -227
- package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
- package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
- package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
- package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -93
- package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
- package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
- package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
- package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
- package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
- package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
- package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
- package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
- package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
- package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
- package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
- package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
- package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
- package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
- package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
- package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
- package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
- package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
- package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
- package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
- package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
- package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
- package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
- package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
- package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
- package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
- package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
- package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
- package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
- package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
- package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -99
- package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
- package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
- package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
- package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
- package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
- package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
- package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
- package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
- package/.agents/mcp/runtime.py +0 -470
- package/.agents/mcp/server.mjs +0 -189271
- package/benchmarks/gemini-issues.js +0 -533
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,63 +0,0 @@
|
|
|
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, security best practices, 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, or CI/CD container builds.
|
|
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:20.12.2-alpine3.19`).
|
|
22
|
-
3. **NEVER copy source code before `package.json`**: Always copy lockfiles and install dependencies first to leverage Docker's layer caching.
|
|
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.
|
|
24
|
-
5. **NEVER include build tools or devDependencies in the final runner image**: Always use multi-stage builds to discard compilers and package managers from production images.
|
|
25
|
-
|
|
26
|
-
### Multi-Stage Standard Pattern
|
|
27
|
-
|
|
28
|
-
```dockerfile
|
|
29
|
-
FROM node:20.12.2-alpine3.19 AS builder
|
|
30
|
-
WORKDIR /app
|
|
31
|
-
COPY package.json package-lock.json ./
|
|
32
|
-
RUN npm ci
|
|
33
|
-
COPY . .
|
|
34
|
-
RUN npm run build && npm prune --production
|
|
35
|
-
|
|
36
|
-
FROM node:20.12.2-alpine3.19 AS runner
|
|
37
|
-
WORKDIR /app
|
|
38
|
-
ENV NODE_ENV=production
|
|
39
|
-
RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 appuser -G appgroup
|
|
40
|
-
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
|
|
41
|
-
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
|
|
42
|
-
USER appuser
|
|
43
|
-
CMD ["node", "dist/index.js"]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Code Examples
|
|
47
|
-
|
|
48
|
-
See `EXAMPLES.md` for production Dockerfiles and dockerignore patterns.
|
|
49
|
-
|
|
50
|
-
## Validation Checklist
|
|
51
|
-
|
|
52
|
-
- [ ] Multi-stage build separates build tools from runtime
|
|
53
|
-
- [ ] Non-root `USER` directive active in final stage
|
|
54
|
-
- [ ] Base images pinned to exact versions
|
|
55
|
-
- [ ] `.dockerignore` file prevents leaking node_modules or secrets
|
|
56
|
-
|
|
57
|
-
## Common Mistakes
|
|
58
|
-
|
|
59
|
-
- Copying entire workspace before `npm ci`, breaking Docker cache. See `TROUBLESHOOTING.md`.
|
|
60
|
-
|
|
61
|
-
## Integration Notes
|
|
62
|
-
|
|
63
|
-
Interacts with `security` (container hardening) and `node` / `nextjs` / `fastapi`.
|
|
@@ -1,18 +0,0 @@
|
|
|
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.
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: docker
|
|
2
|
-
description: Docker containerization, multi-stage builds, non-root security, layer caching optimization, and docker-compose standards.
|
|
3
|
-
version: 1.0.0
|
|
4
|
-
category: devops
|
|
5
|
-
requires:
|
|
6
|
-
- security
|
|
7
|
-
triggers:
|
|
8
|
-
files:
|
|
9
|
-
- "Dockerfile"
|
|
10
|
-
- "Dockerfile.*"
|
|
11
|
-
- "docker-compose.yml"
|
|
12
|
-
- "docker-compose.yaml"
|
|
13
|
-
- "compose.yml"
|
|
14
|
-
- "compose.yaml"
|
|
15
|
-
- ".dockerignore"
|
|
16
|
-
keywords:
|
|
17
|
-
- "docker"
|
|
18
|
-
- "dockerfile"
|
|
19
|
-
- "container"
|
|
20
|
-
- "docker-compose"
|
|
21
|
-
- "image"
|
|
22
|
-
- "kubernetes"
|
|
23
|
-
- "k8s"
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,148 +0,0 @@
|
|
|
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
|
|
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 fastapi import Depends
|
|
70
|
-
from sqlalchemy.ext.asyncio import AsyncSession
|
|
71
|
-
|
|
72
|
-
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
73
|
-
async with async_session() as session:
|
|
74
|
-
yield session
|
|
75
|
-
|
|
76
|
-
async def get_current_user(
|
|
77
|
-
token: str = Depends(oauth2_scheme),
|
|
78
|
-
db: AsyncSession = Depends(get_db)
|
|
79
|
-
) -> User:
|
|
80
|
-
# Verify token, return user
|
|
81
|
-
...
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Async
|
|
85
|
-
|
|
86
|
-
- **Use async** for all I/O operations (database, HTTP calls, file I/O)
|
|
87
|
-
- **Never block the event loop** — no sync I/O in async endpoints
|
|
88
|
-
- **Use `asyncio.gather`** for parallel async operations
|
|
89
|
-
- **Background tasks** — `BackgroundTasks` for non-critical work
|
|
90
|
-
|
|
91
|
-
## Error Handling
|
|
92
|
-
|
|
93
|
-
```python
|
|
94
|
-
from fastapi import HTTPException
|
|
95
|
-
|
|
96
|
-
class AppException(HTTPException):
|
|
97
|
-
def __init__(self, status_code: int, detail: str, code: str):
|
|
98
|
-
super().__init__(status_code=status_code, detail=detail)
|
|
99
|
-
self.code = code
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Security
|
|
103
|
-
|
|
104
|
-
- **OAuth2 with JWT** — use `python-jose`
|
|
105
|
-
- **Password hashing** — bcrypt via `passlib`
|
|
106
|
-
- **CORS** — configure explicitly
|
|
107
|
-
- **Rate limiting** — use `slowapi`
|
|
108
|
-
- **Input validation** — Pydantic handles this automatically
|
|
109
|
-
|
|
110
|
-
## Testing
|
|
111
|
-
|
|
112
|
-
```python
|
|
113
|
-
import pytest
|
|
114
|
-
from httpx import AsyncClient
|
|
115
|
-
|
|
116
|
-
@pytest.mark.asyncio
|
|
117
|
-
async def test_create_user(client: AsyncClient):
|
|
118
|
-
response = await client.post("/api/v1/users", json={
|
|
119
|
-
"email": "test@example.com",
|
|
120
|
-
"name": "Test User"
|
|
121
|
-
})
|
|
122
|
-
assert response.status_code == 201
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Anti-Patterns
|
|
126
|
-
|
|
127
|
-
- [FAIL] Business logic in route handlers — use services
|
|
128
|
-
- [FAIL] Raw SQL without ORM — use SQLAlchemy
|
|
129
|
-
- [FAIL] Sync database calls — use async drivers
|
|
130
|
-
- [FAIL] Hardcoded settings — use Pydantic BaseSettings
|
|
131
|
-
- [FAIL] No schema validation — always use Pydantic models
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
## Code Examples
|
|
135
|
-
|
|
136
|
-
See `EXAMPLES.md` for detailed code examples.
|
|
137
|
-
|
|
138
|
-
## Validation Checklist
|
|
139
|
-
|
|
140
|
-
What to verify during the review phase before completing the task.
|
|
141
|
-
|
|
142
|
-
## Common Mistakes
|
|
143
|
-
|
|
144
|
-
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
145
|
-
|
|
146
|
-
## Integration Notes
|
|
147
|
-
|
|
148
|
-
How this skill interacts with other skills.
|
|
@@ -1,19 +0,0 @@
|
|
|
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.
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# FastAPI — Best Practices
|
|
2
|
-
|
|
3
|
-
## Project Structure
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
app/
|
|
7
|
-
├── main.py # App entry, CORS, middleware
|
|
8
|
-
├── config.py # Settings with Pydantic BaseSettings
|
|
9
|
-
├── database.py # Database session, engine
|
|
10
|
-
├── models/ # SQLAlchemy models
|
|
11
|
-
│ ├── __init__.py
|
|
12
|
-
│ └── user.py
|
|
13
|
-
├── schemas/ # Pydantic schemas (request/response)
|
|
14
|
-
│ ├── __init__.py
|
|
15
|
-
│ └── user.py
|
|
16
|
-
├── api/ # Route handlers
|
|
17
|
-
│ ├── __init__.py
|
|
18
|
-
│ ├── deps.py # Dependency injection
|
|
19
|
-
│ └── v1/
|
|
20
|
-
│ ├── __init__.py
|
|
21
|
-
│ └── users.py
|
|
22
|
-
├── services/ # Business logic
|
|
23
|
-
│ └── user_service.py
|
|
24
|
-
├── repositories/ # Database access
|
|
25
|
-
│ └── user_repo.py
|
|
26
|
-
└── tests/
|
|
27
|
-
└── test_users.py
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Pydantic Models
|
|
31
|
-
|
|
32
|
-
```python
|
|
33
|
-
from pydantic import BaseModel, EmailStr, Field
|
|
34
|
-
|
|
35
|
-
class UserCreate(BaseModel):
|
|
36
|
-
email: EmailStr
|
|
37
|
-
name: str = Field(..., min_length=1, max_length=100)
|
|
38
|
-
|
|
39
|
-
class UserResponse(BaseModel):
|
|
40
|
-
id: int
|
|
41
|
-
email: str
|
|
42
|
-
name: str
|
|
43
|
-
|
|
44
|
-
model_config = ConfigDict(from_attributes=True)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Dependency Injection
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
from fastapi import Depends
|
|
51
|
-
from sqlalchemy.ext.asyncio import AsyncSession
|
|
52
|
-
|
|
53
|
-
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
54
|
-
async with async_session() as session:
|
|
55
|
-
yield session
|
|
56
|
-
|
|
57
|
-
async def get_current_user(
|
|
58
|
-
token: str = Depends(oauth2_scheme),
|
|
59
|
-
db: AsyncSession = Depends(get_db)
|
|
60
|
-
) -> User:
|
|
61
|
-
# Verify token, return user
|
|
62
|
-
...
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Async
|
|
66
|
-
|
|
67
|
-
- **Use async** for all I/O operations (database, HTTP calls, file I/O)
|
|
68
|
-
- **Never block the event loop** — no sync I/O in async endpoints
|
|
69
|
-
- **Use `asyncio.gather`** for parallel async operations
|
|
70
|
-
- **Background tasks** — `BackgroundTasks` for non-critical work
|
|
71
|
-
|
|
72
|
-
## Error Handling
|
|
73
|
-
|
|
74
|
-
```python
|
|
75
|
-
from fastapi import HTTPException
|
|
76
|
-
|
|
77
|
-
class AppException(HTTPException):
|
|
78
|
-
def __init__(self, status_code: int, detail: str, code: str):
|
|
79
|
-
super().__init__(status_code=status_code, detail=detail)
|
|
80
|
-
self.code = code
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Security
|
|
84
|
-
|
|
85
|
-
- **OAuth2 with JWT** — use `python-jose`
|
|
86
|
-
- **Password hashing** — bcrypt via `passlib`
|
|
87
|
-
- **CORS** — configure explicitly
|
|
88
|
-
- **Rate limiting** — use `slowapi`
|
|
89
|
-
- **Input validation** — Pydantic handles this automatically
|
|
90
|
-
|
|
91
|
-
## Testing
|
|
92
|
-
|
|
93
|
-
```python
|
|
94
|
-
import pytest
|
|
95
|
-
from httpx import AsyncClient
|
|
96
|
-
|
|
97
|
-
@pytest.mark.asyncio
|
|
98
|
-
async def test_create_user(client: AsyncClient):
|
|
99
|
-
response = await client.post("/api/v1/users", json={
|
|
100
|
-
"email": "test@example.com",
|
|
101
|
-
"name": "Test User"
|
|
102
|
-
})
|
|
103
|
-
assert response.status_code == 201
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Anti-Patterns
|
|
107
|
-
|
|
108
|
-
- [FAIL] Business logic in route handlers — use services
|
|
109
|
-
- [FAIL] Raw SQL without ORM — use SQLAlchemy
|
|
110
|
-
- [FAIL] Sync database calls — use async drivers
|
|
111
|
-
- [FAIL] Hardcoded settings — use Pydantic BaseSettings
|
|
112
|
-
- [FAIL] No schema validation — always use Pydantic models
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: document-generator
|
|
3
|
-
description: >
|
|
4
|
-
Generates project documentation from a single idea. Creates PRD, Architecture,
|
|
5
|
-
Database, API, UI, Roadmap, Tasks, Decision Records, and Project Graph
|
|
6
|
-
using templates. Supports incremental updates.
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# document-generator
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
Automated technical documentation generator. Transforms initial project ideas and specs into comprehensive PRDs, architecture schemas, API contracts, database ERDs, and roadmap task breakdowns.
|
|
14
|
-
|
|
15
|
-
## When to Use
|
|
16
|
-
|
|
17
|
-
Activate during project kickoff (ctx init), new service scaffolding, or when generating baseline technical specs from high-level user requirements.
|
|
18
|
-
|
|
19
|
-
## Rules & Patterns
|
|
20
|
-
|
|
21
|
-
You generate project documentation from a user's idea. Use the templates in `templates/` as the structure for each document.
|
|
22
|
-
|
|
23
|
-
## Commands
|
|
24
|
-
|
|
25
|
-
### `ctx init`
|
|
26
|
-
|
|
27
|
-
Full project initialization. From one user prompt, generate ALL documents:
|
|
28
|
-
|
|
29
|
-
1. Ask clarifying questions (see Context OS SKILL.md)
|
|
30
|
-
2. Select profile and skill pack
|
|
31
|
-
3. Generate documents in this order:
|
|
32
|
-
- `docs/PRD.md` — Product Requirements (from template)
|
|
33
|
-
- `docs/ARCHITECTURE.md` — System Architecture
|
|
34
|
-
- `docs/DATABASE.md` — Database Schema
|
|
35
|
-
- `docs/API.md` — API Specification
|
|
36
|
-
- `docs/UI.md` — UI/UX Specification
|
|
37
|
-
- `docs/ROADMAP.md` — Development Roadmap
|
|
38
|
-
- `docs/TASKS.md` — Task Breakdown
|
|
39
|
-
- `docs/PROJECT_GRAPH.md` — Project Graph
|
|
40
|
-
4. Create `docs/decisions/` directory for future ADRs
|
|
41
|
-
5. Generate agent config via Adapters skill
|
|
42
|
-
|
|
43
|
-
### `ctx update`
|
|
44
|
-
|
|
45
|
-
Incremental update. When requirements change:
|
|
46
|
-
|
|
47
|
-
1. Identify which documents are affected
|
|
48
|
-
2. Update only affected documents
|
|
49
|
-
3. Show diff of changes
|
|
50
|
-
4. Ask user to confirm
|
|
51
|
-
5. Update Project Graph if structure changed
|
|
52
|
-
|
|
53
|
-
### `ctx plan`
|
|
54
|
-
|
|
55
|
-
Generate development plan from existing PRD:
|
|
56
|
-
|
|
57
|
-
1. Read `docs/PRD.md`
|
|
58
|
-
2. Break into modules (Project Graph)
|
|
59
|
-
3. Break modules into features
|
|
60
|
-
4. Break features into tasks
|
|
61
|
-
5. Estimate complexity (S/M/L/XL)
|
|
62
|
-
6. Output to `docs/TASKS.md`
|
|
63
|
-
|
|
64
|
-
## Template Usage
|
|
65
|
-
|
|
66
|
-
Each template contains:
|
|
67
|
-
|
|
68
|
-
- **Section headers** — required sections for the document
|
|
69
|
-
- **Placeholder prompts** — `{{description}}` markers that guide content generation
|
|
70
|
-
- **Examples** — sample content to illustrate the expected format
|
|
71
|
-
- **Validation rules** — what must be present for the document to be valid
|
|
72
|
-
|
|
73
|
-
When generating a document:
|
|
74
|
-
|
|
75
|
-
1. Read the template
|
|
76
|
-
2. Fill in each section based on the user's idea and clarifying answers
|
|
77
|
-
3. Replace all `{{placeholders}}` with real content
|
|
78
|
-
4. Remove the template comments (lines starting with `<!-- -->`)
|
|
79
|
-
5. Validate: ensure all required sections are present
|
|
80
|
-
|
|
81
|
-
## Document Dependencies
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
PRD.md
|
|
85
|
-
├── ARCHITECTURE.md
|
|
86
|
-
│ ├── DATABASE.md
|
|
87
|
-
│ ├── API.md
|
|
88
|
-
│ └── DEPLOYMENT.md
|
|
89
|
-
├── UI.md
|
|
90
|
-
├── ROADMAP.md
|
|
91
|
-
│ └── TASKS.md
|
|
92
|
-
└── PROJECT_GRAPH.md
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
When updating a parent document, check if child documents need updates too.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## Code Examples
|
|
99
|
-
|
|
100
|
-
See `EXAMPLES.md` for detailed code examples.
|
|
101
|
-
|
|
102
|
-
## Validation Checklist
|
|
103
|
-
|
|
104
|
-
What to verify during the review phase before completing the task.
|
|
105
|
-
|
|
106
|
-
## Common Mistakes
|
|
107
|
-
|
|
108
|
-
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
109
|
-
|
|
110
|
-
## Integration Notes
|
|
111
|
-
|
|
112
|
-
How this skill interacts with other skills.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# generators Troubleshooting & Common Mistakes
|
|
2
|
-
|
|
3
|
-
## 1. Generic Boilerplate Generation
|
|
4
|
-
|
|
5
|
-
- **Symptom**: Generated documentation contains placeholders like [Insert DB Name here].
|
|
6
|
-
- **Root Cause**: Generating docs before clarifying core project constraints.
|
|
7
|
-
- **Fix**: Run the interview-me protocol before generating technical documentation.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
name: generators
|
|
2
|
-
description: >
|
|
3
|
-
Generates complete project documentation (PRD, Architecture, Database, API, UI,
|
|
4
|
-
Roadmap, Tasks) from ideas and templates with incremental update support.
|
|
5
|
-
tags:
|
|
6
|
-
- documentation
|
|
7
|
-
- generators
|
|
8
|
-
- architecture
|
|
9
|
-
- templates
|
|
10
|
-
version: 1.0.0
|