@causyne/agent 0.0.0-stage → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -0
- package/README.md +31 -2
- package/SECURITY.md +24 -0
- package/bin/causyne.js +13 -0
- package/docs/ARCHITECTURE.md +63 -0
- package/docs/PROVENANCE.md +29 -0
- package/docs/SECURITY_REVIEW.md +89 -0
- package/docs/THIRD_PARTY_NOTICES.md +49 -0
- package/native-skills/ai-engineering/context-window-management/SKILL.md +43 -0
- package/native-skills/ai-engineering/llm-evaluation/SKILL.md +46 -0
- package/native-skills/ai-engineering/model-cost-and-latency/SKILL.md +46 -0
- package/native-skills/ai-engineering/prompt-construction/SKILL.md +42 -0
- package/native-skills/ai-engineering/retrieval-augmented-generation/SKILL.md +42 -0
- package/native-skills/ai-engineering/structured-output-and-schemas/SKILL.md +45 -0
- package/native-skills/ai-engineering/tool-calling-agents/SKILL.md +43 -0
- package/native-skills/android/app-performance-profiling/SKILL.md +42 -0
- package/native-skills/android/background-work-scheduling/SKILL.md +47 -0
- package/native-skills/android/compose-state-and-recomposition/SKILL.md +43 -0
- package/native-skills/android/gradle-build-configuration/SKILL.md +41 -0
- package/native-skills/android/lifecycle-and-leaks/SKILL.md +46 -0
- package/native-skills/android/play-store-release/SKILL.md +43 -0
- package/native-skills/android/room-and-persistence/SKILL.md +40 -0
- package/native-skills/backend/authentication-and-sessions/SKILL.md +45 -0
- package/native-skills/backend/background-jobs-and-queues/SKILL.md +42 -0
- package/native-skills/backend/caching-strategy/SKILL.md +44 -0
- package/native-skills/backend/graceful-shutdown/SKILL.md +42 -0
- package/native-skills/backend/rate-limiting-and-quotas/SKILL.md +40 -0
- package/native-skills/backend/rest-api-design/SKILL.md +40 -0
- package/native-skills/backend/webhook-delivery-and-receipt/SKILL.md +43 -0
- package/native-skills/cloud/cost-optimisation/SKILL.md +46 -0
- package/native-skills/cloud/iam-least-privilege/SKILL.md +43 -0
- package/native-skills/cloud/infrastructure-as-code/SKILL.md +43 -0
- package/native-skills/cloud/multi-region-and-failover/SKILL.md +43 -0
- package/native-skills/cloud/serverless-patterns/SKILL.md +47 -0
- package/native-skills/data/data-quality-monitoring/SKILL.md +51 -0
- package/native-skills/data/etl-pipeline-reliability/SKILL.md +43 -0
- package/native-skills/data/exploratory-analysis/SKILL.md +43 -0
- package/native-skills/data/metric-definition/SKILL.md +42 -0
- package/native-skills/data/notebook-to-production/SKILL.md +43 -0
- package/native-skills/database/backup-and-recovery/SKILL.md +43 -0
- package/native-skills/database/connection-pooling/SKILL.md +42 -0
- package/native-skills/database/data-integrity-and-constraints/SKILL.md +42 -0
- package/native-skills/database/query-optimisation/SKILL.md +38 -0
- package/native-skills/database/safe-migrations/SKILL.md +47 -0
- package/native-skills/database/schema-design/SKILL.md +38 -0
- package/native-skills/database/transactions-and-isolation/SKILL.md +41 -0
- package/native-skills/design/colour-system-construction/SKILL.md +38 -0
- package/native-skills/design/design-direction-brief/SKILL.md +41 -0
- package/native-skills/design/motion-and-transitions/SKILL.md +38 -0
- package/native-skills/design/responsive-strategy/SKILL.md +39 -0
- package/native-skills/design/spacing-and-rhythm/SKILL.md +38 -0
- package/native-skills/design/type-scale-and-hierarchy/SKILL.md +39 -0
- package/native-skills/design/visual-qa-loop/SKILL.md +42 -0
- package/native-skills/devops/docker-multi-stage-builds/SKILL.md +60 -0
- package/native-skills/devops/github-actions-ci/SKILL.md +60 -0
- package/native-skills/devops/incident-triage/SKILL.md +38 -0
- package/native-skills/devops/kubernetes-deployment-hardening/SKILL.md +64 -0
- package/native-skills/devops/observability-baseline/SKILL.md +38 -0
- package/native-skills/devops/secret-management/SKILL.md +40 -0
- package/native-skills/devops/terraform-state-and-modules/SKILL.md +36 -0
- package/native-skills/devops/zero-downtime-deploys/SKILL.md +40 -0
- package/native-skills/git/bisect-regression-hunt/SKILL.md +43 -0
- package/native-skills/git/branch-strategy/SKILL.md +39 -0
- package/native-skills/git/commit-hygiene/SKILL.md +41 -0
- package/native-skills/git/history-recovery/SKILL.md +44 -0
- package/native-skills/git/large-repository-surgery/SKILL.md +46 -0
- package/native-skills/git/merge-conflict-resolution/SKILL.md +42 -0
- package/native-skills/media/cinematic-3d-shot/SKILL.md +104 -0
- package/native-skills/mobile/app-startup-optimisation/SKILL.md +41 -0
- package/native-skills/mobile/cross-platform-tradeoffs/SKILL.md +42 -0
- package/native-skills/mobile/deep-linking/SKILL.md +39 -0
- package/native-skills/mobile/mobile-storage-security/SKILL.md +45 -0
- package/native-skills/mobile/offline-first-sync/SKILL.md +42 -0
- package/native-skills/mobile/push-notifications/SKILL.md +38 -0
- package/native-skills/performance/algorithmic-complexity/SKILL.md +43 -0
- package/native-skills/performance/concurrency-and-parallelism/SKILL.md +42 -0
- package/native-skills/performance/load-testing/SKILL.md +42 -0
- package/native-skills/performance/memory-and-leak-hunting/SKILL.md +41 -0
- package/native-skills/performance/network-and-payload-efficiency/SKILL.md +42 -0
- package/native-skills/performance/profiling-methodology/SKILL.md +46 -0
- package/native-skills/python/async-correctness/SKILL.md +40 -0
- package/native-skills/python/cli-tool-construction/SKILL.md +44 -0
- package/native-skills/python/data-processing-pipelines/SKILL.md +38 -0
- package/native-skills/python/environment-isolation/SKILL.md +41 -0
- package/native-skills/python/packaging-and-distribution/SKILL.md +56 -0
- package/native-skills/python/pytest-suite-design/SKILL.md +39 -0
- package/native-skills/python/type-hints-and-static-checking/SKILL.md +42 -0
- package/native-skills/security/authorization-model/SKILL.md +42 -0
- package/native-skills/security/crypto-usage/SKILL.md +48 -0
- package/native-skills/security/dependency-supply-chain/SKILL.md +42 -0
- package/native-skills/security/input-validation-and-injection/SKILL.md +44 -0
- package/native-skills/security/secure-file-uploads/SKILL.md +46 -0
- package/native-skills/security/security-headers-and-csp/SKILL.md +44 -0
- package/native-skills/security/threat-modelling/SKILL.md +46 -0
- package/native-skills/testing/end-to-end-test-stability/SKILL.md +42 -0
- package/native-skills/testing/property-based-testing/SKILL.md +46 -0
- package/native-skills/testing/regression-test-from-a-bug/SKILL.md +41 -0
- package/native-skills/testing/snapshot-and-visual-regression/SKILL.md +42 -0
- package/native-skills/testing/test-doubles-and-mocking/SKILL.md +43 -0
- package/native-skills/testing/test-strategy-and-pyramid/SKILL.md +39 -0
- package/native-skills/testing/writing-good-assertions/SKILL.md +42 -0
- package/native-skills/web/accessible-components/SKILL.md +45 -0
- package/native-skills/web/api-client-resilience/SKILL.md +39 -0
- package/native-skills/web/bundle-size-reduction/SKILL.md +38 -0
- package/native-skills/web/core-web-vitals/SKILL.md +40 -0
- package/native-skills/web/css-layout-systems/SKILL.md +41 -0
- package/native-skills/web/form-validation-ux/SKILL.md +39 -0
- package/native-skills/web/react-state-architecture/SKILL.md +41 -0
- package/native-skills/web/ssr-hydration-correctness/SKILL.md +45 -0
- package/package.json +68 -4
- package/src/agentLoop.js +2458 -0
- package/src/appChannel.js +109 -0
- package/src/approvalGrants.js +66 -0
- package/src/auditLog.js +52 -0
- package/src/autoUpdate.js +12 -0
- package/src/capabilities.js +36 -0
- package/src/checkpoints.js +1199 -0
- package/src/cliMode.js +638 -0
- package/src/commands.js +805 -0
- package/src/compiledSkills.js +540 -0
- package/src/config.js +130 -0
- package/src/contextManager.js +498 -0
- package/src/cortex/autoCondenser.js +192 -0
- package/src/cortex/provisioner.js +27 -0
- package/src/cortex/vectorDb.js +447 -0
- package/src/designPalettes.js +99 -0
- package/src/devMode.js +6 -0
- package/src/embodimentSession.js +180 -0
- package/src/entrypoint.js +194 -0
- package/src/execSafe.js +21 -0
- package/src/gitSnapshot.js +378 -0
- package/src/mcp/jsonRpc.js +165 -0
- package/src/mcp/mcpClient.js +136 -0
- package/src/mcp/mcpRegistry.js +207 -0
- package/src/memory.js +62 -0
- package/src/memoryManager.js +124 -0
- package/src/modelCatalogue.js +132 -0
- package/src/modelIds.js +42 -0
- package/src/modelRouter.js +145 -0
- package/src/outputStore.js +246 -0
- package/src/perception.js +124 -0
- package/src/planCache.js +437 -0
- package/src/procSignal.js +32 -0
- package/src/providers/anthropic.js +408 -0
- package/src/providers/base.js +328 -0
- package/src/providers/dashscope-byok.js +86 -0
- package/src/providers/deepseek.js +80 -0
- package/src/providers/factory.js +37 -0
- package/src/providers/gemini.js +346 -0
- package/src/providers/moonshot.js +73 -0
- package/src/providers/muse.js +169 -0
- package/src/providers/ollama.js +104 -0
- package/src/providers/openai-compatible.js +84 -0
- package/src/providers/openai.js +20 -0
- package/src/providers/qwen-byok.js +76 -0
- package/src/providers/xai.js +73 -0
- package/src/provisioning/capabilityConsent.js +24 -0
- package/src/provisioning/capabilityProvisioner.js +271 -0
- package/src/provisioning/capabilityTools.js +29 -0
- package/src/reporting.js +373 -0
- package/src/sandbox.js +529 -0
- package/src/sessionStore.js +279 -0
- package/src/skillsManager.js +288 -0
- package/src/slopDetector.js +307 -0
- package/src/taskBuffer.js +45 -0
- package/src/taskShape.js +241 -0
- package/src/textDiff.js +150 -0
- package/src/tokenTracker.js +560 -0
- package/src/tool-scripts/ax_snapshot.applescript +39 -0
- package/src/tool-scripts/ax_snapshot.ps1 +10 -0
- package/src/tool-scripts/desktop_act.applescript +58 -0
- package/src/tool-scripts/resolve_automator.py +119 -0
- package/src/toolPacks.js +524 -0
- package/src/tools/archive.js +63 -0
- package/src/tools/astryxOracle.js +78 -0
- package/src/tools/axSnapshot.js +165 -0
- package/src/tools/blenderAutomator.js +349 -0
- package/src/tools/browserAutomator.js +252 -0
- package/src/tools/checkSystemSpecs.js +64 -0
- package/src/tools/clipboard.js +36 -0
- package/src/tools/codeSearchAst.js +101 -0
- package/src/tools/codeSearcher.js +230 -0
- package/src/tools/codeTools.js +262 -0
- package/src/tools/codebaseSearch.js +75 -0
- package/src/tools/createSkill.js +129 -0
- package/src/tools/deferredMcpSearch.js +246 -0
- package/src/tools/desktopAct.js +208 -0
- package/src/tools/desktopOpen.js +34 -0
- package/src/tools/dynamicLoader.js +44 -0
- package/src/tools/executeProceduralMedia.js +93 -0
- package/src/tools/fsDelete.js +51 -0
- package/src/tools/fsEdit.js +105 -0
- package/src/tools/fsFind.js +128 -0
- package/src/tools/fsList.js +77 -0
- package/src/tools/fsMove.js +57 -0
- package/src/tools/fsRead.js +87 -0
- package/src/tools/fsSearch.js +198 -0
- package/src/tools/fsWrite.js +41 -0
- package/src/tools/gameAiBehaviorTree.js +208 -0
- package/src/tools/gameAnimationRig.js +194 -0
- package/src/tools/gameAssetFetcher.js +372 -0
- package/src/tools/gameAssetHarvester.js +210 -0
- package/src/tools/gameAudioSynth.js +267 -0
- package/src/tools/gameBuilder.js +886 -0
- package/src/tools/gameCanvasAudit.js +101 -0
- package/src/tools/gameCinematicSequencer.js +151 -0
- package/src/tools/gameDataForge.js +124 -0
- package/src/tools/gameDialogueTreeGen.js +166 -0
- package/src/tools/gameEconomyBalancer.js +161 -0
- package/src/tools/gameEntitySpawner.js +207 -0
- package/src/tools/gameLoreForge.js +153 -0
- package/src/tools/gameQuestArcBuilder.js +152 -0
- package/src/tools/gameSceneBuilder.js +158 -0
- package/src/tools/gameShaderForge.js +181 -0
- package/src/tools/gameTilemapGenerator.js +164 -0
- package/src/tools/gameUiHudBuilder.js +292 -0
- package/src/tools/gameVfxEmitterGen.js +108 -0
- package/src/tools/gameWebRuntimeInspector.js +91 -0
- package/src/tools/generateMediaViaApi.js +358 -0
- package/src/tools/gitExec.js +54 -0
- package/src/tools/godotAutomator.js +437 -0
- package/src/tools/manageLocalAiDependencies.js +220 -0
- package/src/tools/memoryWrite.js +99 -0
- package/src/tools/multiEdit.js +107 -0
- package/src/tools/palmierAutomator.js +104 -0
- package/src/tools/pdfReader.js +112 -0
- package/src/tools/persistentShell.js +148 -0
- package/src/tools/printer.js +316 -0
- package/src/tools/procTerm.js +91 -0
- package/src/tools/processList.js +52 -0
- package/src/tools/readNativeSkill.js +39 -0
- package/src/tools/registry.js +277 -0
- package/src/tools/resolveAutomator.js +102 -0
- package/src/tools/screenshot.js +75 -0
- package/src/tools/subagentOrchestrator.js +305 -0
- package/src/tools/sysRun.js +125 -0
- package/src/tools/todoWrite.js +75 -0
- package/src/tools/toolDispatch.js +127 -0
- package/src/tools/toolForge.js +124 -0
- package/src/tools/updatePlan.js +88 -0
- package/src/tools/viewImage.js +82 -0
- package/src/tools/visionInspector.js +154 -0
- package/src/tools/webFetch.js +74 -0
- package/src/tools/webSearch.js +82 -0
- package/src/tui/ask.js +164 -0
- package/src/tui/banner.js +158 -0
- package/src/tui/block.js +152 -0
- package/src/tui/chatRenderer.js +953 -0
- package/src/tui/completion.js +424 -0
- package/src/tui/dialogs.js +606 -0
- package/src/tui/diff.js +296 -0
- package/src/tui/history.js +135 -0
- package/src/tui/home.js +217 -0
- package/src/tui/invocation.js +105 -0
- package/src/tui/keys.js +443 -0
- package/src/tui/lineEditor.js +256 -0
- package/src/tui/overlay.js +256 -0
- package/src/tui/prompt.js +1258 -0
- package/src/tui/selectList.js +335 -0
- package/src/tui/stage.js +330 -0
- package/src/tui/stageSurface.js +609 -0
- package/src/tui/statusLine.js +254 -0
- package/src/tui/text.js +345 -0
- package/src/tui/theme.js +393 -0
- package/src/tui/toolDisplay.js +176 -0
- package/src/tui/transcript.js +235 -0
- package/src/tui/viewport.js +337 -0
- package/src/uncertainty.js +271 -0
- package/src/userSkills.js +265 -0
- package/src/utils/cli_ui.js +0 -0
- package/src/utils/inquirer.js +12 -0
- package/src/utils/paths.js +37 -0
- package/src/version.js +38 -0
- package/src/vfeTracker.js +220 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kubernetes-deployment-hardening
|
|
3
|
+
description: Write or review a Kubernetes Deployment, Service, or Helm chart. Use when a workload has no resource limits, no probes, or runs privileged.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Kubernetes Deployment Hardening
|
|
7
|
+
|
|
8
|
+
## Invariants
|
|
9
|
+
|
|
10
|
+
1. Every container declares `resources.requests` and `resources.limits`. Without requests the scheduler cannot place the pod sensibly; without limits one pod can starve a node.
|
|
11
|
+
2. Every container declares a readiness probe. Without one, traffic reaches a pod that is still starting.
|
|
12
|
+
3. `securityContext` runs non-root with a read-only root filesystem unless the workload provably needs otherwise.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Read the current manifest and name what is missing.
|
|
17
|
+
- Check for: requests, limits, readiness, liveness, securityContext, and an explicit image tag (never `latest`).
|
|
18
|
+
- **Done when:** you have a written list of the missing fields.
|
|
19
|
+
|
|
20
|
+
2. Set resources from measurement, not from a guess.
|
|
21
|
+
- If no measurement exists, say so and set a conservative starting point, then note that it must be revisited against real usage.
|
|
22
|
+
- **Done when:** requests and limits are present and the basis for the numbers is stated.
|
|
23
|
+
|
|
24
|
+
3. Separate the two probes.
|
|
25
|
+
- Readiness gates traffic. Liveness restarts. Pointing both at the same endpoint means a slow dependency triggers a restart loop.
|
|
26
|
+
- **Done when:** readiness and liveness use different endpoints or different thresholds.
|
|
27
|
+
|
|
28
|
+
4. Constrain the security context.
|
|
29
|
+
- `runAsNonRoot: true`, `allowPrivilegeEscalation: false`, `readOnlyRootFilesystem: true`, and drop all capabilities.
|
|
30
|
+
- **Done when:** the pod starts with those settings, or you have named the exact capability it needs and why.
|
|
31
|
+
|
|
32
|
+
## Template
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
spec:
|
|
36
|
+
template:
|
|
37
|
+
spec:
|
|
38
|
+
securityContext:
|
|
39
|
+
runAsNonRoot: true
|
|
40
|
+
seccompProfile: { type: RuntimeDefault }
|
|
41
|
+
containers:
|
|
42
|
+
- name: app
|
|
43
|
+
image: registry/app:1.4.2
|
|
44
|
+
resources:
|
|
45
|
+
requests: { cpu: 100m, memory: 128Mi }
|
|
46
|
+
limits: { cpu: 500m, memory: 512Mi }
|
|
47
|
+
readinessProbe:
|
|
48
|
+
httpGet: { path: /readyz, port: 8080 }
|
|
49
|
+
initialDelaySeconds: 3
|
|
50
|
+
livenessProbe:
|
|
51
|
+
httpGet: { path: /livez, port: 8080 }
|
|
52
|
+
periodSeconds: 20
|
|
53
|
+
failureThreshold: 3
|
|
54
|
+
securityContext:
|
|
55
|
+
allowPrivilegeEscalation: false
|
|
56
|
+
readOnlyRootFilesystem: true
|
|
57
|
+
capabilities: { drop: ["ALL"] }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Verification
|
|
61
|
+
|
|
62
|
+
- `kubectl apply --dry-run=server -f manifest.yaml` accepts it.
|
|
63
|
+
- `kubectl rollout status deploy/app` completes.
|
|
64
|
+
- Killing the readiness endpoint removes the pod from the Service endpoints without restarting it.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability-baseline
|
|
3
|
+
description: Add logging, metrics, or tracing to a service. Use when an incident could not be diagnosed from what the service already emits, or when logs are unstructured strings.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Observability Baseline
|
|
7
|
+
|
|
8
|
+
## The three questions
|
|
9
|
+
|
|
10
|
+
Instrumentation exists to answer: is it up, is it slow, and what broke. Anything that answers none of those is noise with a retention cost.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Structure the logs.
|
|
15
|
+
- One JSON object per line, with a level, a timestamp, a message, and a request or trace identifier. Never interpolate values into a prose sentence — that makes them unsearchable.
|
|
16
|
+
- **Done when:** every log line parses as JSON and carries a correlation identifier.
|
|
17
|
+
|
|
18
|
+
2. Emit the four signals that matter for a request-serving service.
|
|
19
|
+
- Request rate, error rate, duration distribution, and saturation (queue depth, pool usage, memory).
|
|
20
|
+
- Use histograms for duration, never averages. An average hides the tail, and the tail is the user experience.
|
|
21
|
+
- **Done when:** a dashboard can show p50, p95 and p99 latency.
|
|
22
|
+
|
|
23
|
+
3. Propagate a trace identifier across every boundary.
|
|
24
|
+
- Generate at the edge, accept from an incoming header, attach to every outbound call and every log line.
|
|
25
|
+
- **Done when:** one identifier follows a request through every service it touches.
|
|
26
|
+
|
|
27
|
+
4. Redact before emitting.
|
|
28
|
+
- Tokens, passwords, keys and personal data must be masked at the logging boundary, not filtered downstream.
|
|
29
|
+
- **Done when:** a deliberate log of a credential-shaped value comes out masked.
|
|
30
|
+
|
|
31
|
+
5. Alert on symptoms, not causes.
|
|
32
|
+
- Alert on error rate and latency, which users feel. Do not alert on CPU, which they do not.
|
|
33
|
+
- **Done when:** every alert would have woken someone for a real user-visible problem.
|
|
34
|
+
|
|
35
|
+
## Verification
|
|
36
|
+
|
|
37
|
+
- Trigger an error and follow it from the log line to the trace to the metric.
|
|
38
|
+
- Confirm no alert fires during a normal deploy.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secret-management
|
|
3
|
+
description: Handle credentials, API keys, or certificates in an application or pipeline. Use when a secret appears in a config file, in an environment file committed to the repository, or in CI logs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Secret Management
|
|
7
|
+
|
|
8
|
+
## Invariants
|
|
9
|
+
|
|
10
|
+
1. A secret in version control is compromised, including in deleted files — history retains it. Rotate it; do not merely delete it.
|
|
11
|
+
2. Secrets reach the process through the environment or a mounted file, injected at runtime by a secret store. Never through the image, the repository, or the build args.
|
|
12
|
+
3. Every secret has a rotation path. One that cannot be rotated is a permanent liability.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Find what is already exposed.
|
|
17
|
+
- Search the working tree and the history for key-shaped strings: long base64 or hex runs, `-----BEGIN`, and assignments to names containing key, token, secret, or password.
|
|
18
|
+
- **Done when:** you have a list of every exposure, with the file and the commit.
|
|
19
|
+
|
|
20
|
+
2. Rotate before you clean.
|
|
21
|
+
- Cleaning history without rotating leaves a live credential in every existing clone and in every fork.
|
|
22
|
+
- **Done when:** the old value is revoked at the provider.
|
|
23
|
+
|
|
24
|
+
3. Move the value to a store.
|
|
25
|
+
- Cloud secret manager, or the platform's own secret object. Reference it by name from config; never inline it.
|
|
26
|
+
- **Done when:** the repository contains the secret's NAME and never its value.
|
|
27
|
+
|
|
28
|
+
4. Block the next one.
|
|
29
|
+
- Add a pre-commit secret scan and a `.gitignore` entry for the environment file. Commit an example file with placeholder values so the shape is documented without the values.
|
|
30
|
+
- **Done when:** a test commit containing a fake key is rejected locally.
|
|
31
|
+
|
|
32
|
+
5. Mask in CI.
|
|
33
|
+
- Register every secret with the CI provider so it is masked in logs. A secret echoed by a debug command is a public secret on a public repository.
|
|
34
|
+
- **Done when:** a deliberate echo of the secret shows as a mask in the run log.
|
|
35
|
+
|
|
36
|
+
## Verification
|
|
37
|
+
|
|
38
|
+
- No key-shaped string survives in the working tree.
|
|
39
|
+
- The application starts with values supplied only by the environment.
|
|
40
|
+
- A commit containing a fake credential is rejected by the local hook.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: terraform-state-and-modules
|
|
3
|
+
description: Write or review Terraform. Use when state is stored locally, when a module is copy-pasted between environments, or before a first apply against real infrastructure.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Terraform State and Modules
|
|
7
|
+
|
|
8
|
+
## Invariants
|
|
9
|
+
|
|
10
|
+
1. State lives in a remote backend with locking. Local state means the first concurrent apply corrupts it and the second person destroys production.
|
|
11
|
+
2. `terraform plan` output is read before every apply. An apply nobody read is an outage waiting for a trigger.
|
|
12
|
+
3. Secrets never appear in `.tf` files or in `terraform.tfvars` committed to the repository. State itself contains secrets in plaintext — treat the backend as a secret store.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Check the backend first.
|
|
17
|
+
- If `backend "local"` or no backend block exists, that is the finding to report before anything else.
|
|
18
|
+
- **Done when:** the backend is remote and versioned, with locking enabled.
|
|
19
|
+
|
|
20
|
+
2. Parameterise instead of duplicating.
|
|
21
|
+
- Environments differ by variable values, not by copied directories. Use one module and separate `.tfvars` or workspaces.
|
|
22
|
+
- **Done when:** adding a third environment requires a new variables file and no new resource blocks.
|
|
23
|
+
|
|
24
|
+
3. Pin every provider and module version.
|
|
25
|
+
- `required_providers` with `~>` constraints, and module sources with an explicit `?ref=` tag.
|
|
26
|
+
- **Done when:** `terraform init` in a clean directory resolves to the same versions it did before.
|
|
27
|
+
|
|
28
|
+
4. Plan, then read the plan.
|
|
29
|
+
- Count creates, updates and destroys. Any unexpected destroy stops the work and gets reported.
|
|
30
|
+
- **Done when:** every line of the plan is explained, especially each destroy.
|
|
31
|
+
|
|
32
|
+
## Verification
|
|
33
|
+
|
|
34
|
+
- `terraform fmt -check` and `terraform validate` pass.
|
|
35
|
+
- `terraform plan` shows zero unexplained changes against the current state.
|
|
36
|
+
- The backend block names a remote store and locking is confirmed.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zero-downtime-deploys
|
|
3
|
+
description: Design or repair a deployment strategy. Use when a release causes a visible outage, when migrations and code ship together, or when rollback is untested.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Zero-Downtime Deploys
|
|
7
|
+
|
|
8
|
+
## The rule that governs everything else
|
|
9
|
+
|
|
10
|
+
Old code and new code will run at the same time. Every change must be safe in that window, or the deploy is not zero-downtime regardless of the orchestration.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Classify the change.
|
|
15
|
+
- Additive (new column, new endpoint, new field): safe to ship together.
|
|
16
|
+
- Destructive (dropped column, renamed field, changed semantics): must be split across releases.
|
|
17
|
+
- **Done when:** every change in the release is labelled additive or destructive.
|
|
18
|
+
|
|
19
|
+
2. Split every destructive change into the expand/contract sequence.
|
|
20
|
+
- Release 1: add the new shape, write to both, read from the old.
|
|
21
|
+
- Release 2: read from the new. Deploy, then verify.
|
|
22
|
+
- Release 3: stop writing the old, then drop it.
|
|
23
|
+
- **Done when:** no single release both writes and removes the same shape.
|
|
24
|
+
|
|
25
|
+
3. Make migrations independent of the deploy.
|
|
26
|
+
- Migrations run before the new code and must be safe for the old code still serving traffic.
|
|
27
|
+
- **Done when:** the migration can run with zero new instances started.
|
|
28
|
+
|
|
29
|
+
4. Verify rollback before you need it.
|
|
30
|
+
- Roll back in a staging environment and confirm the previous version serves correctly against the migrated schema.
|
|
31
|
+
- **Done when:** rollback has actually been executed once, not merely documented.
|
|
32
|
+
|
|
33
|
+
5. Drain connections on shutdown.
|
|
34
|
+
- Handle the termination signal: stop accepting new work, finish in-flight work, then exit. A process that exits immediately drops live requests.
|
|
35
|
+
- **Done when:** a rolling restart under load shows zero failed requests.
|
|
36
|
+
|
|
37
|
+
## Verification
|
|
38
|
+
|
|
39
|
+
- Run a rolling restart with a load generator active; error count stays at zero.
|
|
40
|
+
- Roll back one version with traffic flowing; error count stays at zero.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bisect-regression-hunt
|
|
3
|
+
description: Find the commit that introduced a bug. Use when something worked before and does not now, and the cause is not obvious from a recent diff.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bisect a Regression
|
|
7
|
+
|
|
8
|
+
## Why this beats reading diffs
|
|
9
|
+
|
|
10
|
+
Bisect is a binary search over history. A thousand commits take ten tests. Reading diffs is linear and relies on recognising the bug on sight, which is exactly what has already failed.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Write the test FIRST.
|
|
15
|
+
- A command that exits non-zero when the bug is present and zero when it is not. Without this you will make subjective calls at each step and the search will land on the wrong commit.
|
|
16
|
+
- **Done when:** the command fails on the current commit and passes on a commit you know is good.
|
|
17
|
+
|
|
18
|
+
2. Find the bounds.
|
|
19
|
+
- A known-bad commit (usually HEAD) and a known-good one. If the good end is unknown, step backwards by powers of two until the test passes.
|
|
20
|
+
- **Done when:** `git bisect start <bad> <good>` is accepted.
|
|
21
|
+
|
|
22
|
+
3. Automate the search.
|
|
23
|
+
- `git bisect run ./check.sh` runs the test at each step with no further input.
|
|
24
|
+
- The script must exit 125 when the commit cannot be tested at all (a broken build), so bisect skips rather than mislabels it.
|
|
25
|
+
- **Done when:** bisect reports a single first-bad commit.
|
|
26
|
+
|
|
27
|
+
4. Confirm the verdict.
|
|
28
|
+
- Check out the reported commit and its parent, and run the test on both by hand. Bisect is only as correct as the test.
|
|
29
|
+
- **Done when:** the parent passes and the reported commit fails, verified manually.
|
|
30
|
+
|
|
31
|
+
5. Reset.
|
|
32
|
+
- `git bisect reset` returns to where you started. Forgetting this leaves the tree detached at an arbitrary commit.
|
|
33
|
+
- **Done when:** `git status` shows the original branch.
|
|
34
|
+
|
|
35
|
+
## When the history is merges
|
|
36
|
+
|
|
37
|
+
`git bisect` handles merge commits, but a first-bad merge means the bug came from the merged branch. Re-run bisect within that branch's own commits.
|
|
38
|
+
|
|
39
|
+
## Verification
|
|
40
|
+
|
|
41
|
+
- The reported commit fails the test and its parent passes.
|
|
42
|
+
- The change in that commit plausibly explains the symptom.
|
|
43
|
+
- `git status` is back on the original branch.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: branch-strategy
|
|
3
|
+
description: Set up or repair a branching model for a team. Use when merges are painful, when long-lived branches diverge badly, or when there is no agreement on where releases come from.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Branch Strategy
|
|
7
|
+
|
|
8
|
+
## The bias
|
|
9
|
+
|
|
10
|
+
Prefer short-lived branches off a single main line. Almost every branching pain is a symptom of branches living too long, and no model fixes that.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Establish one source of truth.
|
|
15
|
+
- `main` is always releasable. Everything branches from it and merges back into it.
|
|
16
|
+
- **Done when:** there is exactly one branch nobody force-pushes.
|
|
17
|
+
|
|
18
|
+
2. Keep feature branches short.
|
|
19
|
+
- Under a few days. Anything longer merges into a codebase it no longer recognises. Split the work and use a feature flag if the feature is not ready to be seen.
|
|
20
|
+
- **Done when:** the median open branch age is measured in days, not weeks.
|
|
21
|
+
|
|
22
|
+
3. Choose integration direction deliberately.
|
|
23
|
+
- Rebase a private branch onto main to keep history linear. Merge a shared branch, because rebasing rewrites commits other people have.
|
|
24
|
+
- **Done when:** the rule is written down and matches what people actually do.
|
|
25
|
+
|
|
26
|
+
4. Protect the main line mechanically.
|
|
27
|
+
- Require review, require CI, forbid force-push. A convention nobody enforces is a convention nobody follows.
|
|
28
|
+
- **Done when:** a direct push to main is rejected by the server.
|
|
29
|
+
|
|
30
|
+
5. Tag releases; do not branch them.
|
|
31
|
+
- A tag is an immutable pointer. A release branch is a second main line that will drift.
|
|
32
|
+
- Branch a release only to backport a fix to a version that is still supported.
|
|
33
|
+
- **Done when:** every shipped version corresponds to a tag.
|
|
34
|
+
|
|
35
|
+
## Verification
|
|
36
|
+
|
|
37
|
+
- Branch protection rejects a direct push and an unreviewed merge.
|
|
38
|
+
- The oldest open feature branch is days old, not months.
|
|
39
|
+
- Every release in the changelog has a matching tag.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit-hygiene
|
|
3
|
+
description: Structure commits and write commit messages. Use when a change is being committed, when a branch has a messy history before review, or when a message says only "fix".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Commit Hygiene
|
|
7
|
+
|
|
8
|
+
## What a commit is for
|
|
9
|
+
|
|
10
|
+
A commit is a message to whoever runs `git blame` on this line in two years. It should say WHY, because the diff already says what.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. One commit, one logical change.
|
|
15
|
+
- A refactor and a behaviour change in one commit cannot be reviewed or reverted separately. Split them.
|
|
16
|
+
- `git add -p` stages hunks rather than whole files.
|
|
17
|
+
- **Done when:** each commit could be reverted alone without breaking the build.
|
|
18
|
+
|
|
19
|
+
2. Write the subject as an instruction.
|
|
20
|
+
- Imperative mood, under about seventy characters, no trailing period: `fix race in session close`, not `fixed a race` or `fixing races`.
|
|
21
|
+
- **Done when:** the subject completes the sentence "if applied, this commit will …".
|
|
22
|
+
|
|
23
|
+
3. Use the body for the why.
|
|
24
|
+
- What was wrong, why this approach, what was considered and rejected. Reference the issue.
|
|
25
|
+
- Skip the body only when the subject is genuinely complete.
|
|
26
|
+
- **Done when:** a reader who disagrees with the change knows what to argue with.
|
|
27
|
+
|
|
28
|
+
4. Never commit noise.
|
|
29
|
+
- Debug prints, commented-out code, unrelated formatting, generated files that should be ignored.
|
|
30
|
+
- `git diff --cached` before every commit.
|
|
31
|
+
- **Done when:** every line in the staged diff is intentional.
|
|
32
|
+
|
|
33
|
+
5. Clean the branch before review.
|
|
34
|
+
- Squash the "fix typo" commits into what they fix. Do this only on a branch nobody else has pulled.
|
|
35
|
+
- **Done when:** the branch reads as a sequence of deliberate steps.
|
|
36
|
+
|
|
37
|
+
## Verification
|
|
38
|
+
|
|
39
|
+
- `git log --oneline origin/main..HEAD` reads as a coherent narrative.
|
|
40
|
+
- No commit message is a single word.
|
|
41
|
+
- `git diff origin/main...HEAD` contains no debug output or unrelated reformatting.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: history-recovery
|
|
3
|
+
description: Recover lost commits or undo a destructive git operation. Use after a bad reset, a deleted branch, a force-push over someone else`s work, or an amended commit that ate a change.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# History Recovery
|
|
7
|
+
|
|
8
|
+
## The fact that makes recovery possible
|
|
9
|
+
|
|
10
|
+
Git almost never deletes a commit immediately. A commit that nothing references is unreachable, not gone, and stays in the object store until garbage collection runs — usually weeks. `git reflog` is the index of where HEAD has been.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Stop and take a snapshot.
|
|
15
|
+
- Do not run further git commands that move HEAD. Copy the whole working directory first if the state is valuable.
|
|
16
|
+
- **Done when:** a copy of the current directory exists outside the repository.
|
|
17
|
+
|
|
18
|
+
2. Find the lost commit in the reflog.
|
|
19
|
+
- `git reflog` for HEAD, `git reflog show <branch>` for a specific branch.
|
|
20
|
+
- Each entry has a hash. The one just before the destructive command is what you want.
|
|
21
|
+
- **Done when:** you have the hash and have confirmed it with `git show <hash>`.
|
|
22
|
+
|
|
23
|
+
3. Recover without overwriting.
|
|
24
|
+
- Prefer a new branch: `git branch recovered <hash>`. This is non-destructive and inspectable.
|
|
25
|
+
- Only after inspection: `git reset --hard <hash>` on the original branch.
|
|
26
|
+
- **Done when:** the recovered content is visible on a branch and verified with `git log`.
|
|
27
|
+
|
|
28
|
+
4. If the reflog is empty, search unreachable objects.
|
|
29
|
+
- `git fsck --lost-found --unreachable` lists dangling commits. `git show` each candidate.
|
|
30
|
+
- **Done when:** the content is found, or you can state that it never reached the object store.
|
|
31
|
+
|
|
32
|
+
## The specific disasters
|
|
33
|
+
|
|
34
|
+
- **Bad `reset --hard`:** the previous HEAD is the reflog entry above the reset.
|
|
35
|
+
- **Deleted branch:** `git reflog show` no longer works, but the branch tip is still in `git reflog` under HEAD, or in `fsck --unreachable`.
|
|
36
|
+
- **Bad `commit --amend`:** the pre-amend commit is one reflog entry back.
|
|
37
|
+
- **Force-push over a colleague:** the old remote tip is in their local reflog, and in the remote's reflog if you have server access. Ask before rewriting again.
|
|
38
|
+
- **Detached HEAD with commits:** `git branch <name> HEAD` before checking anything else out.
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
- `git log --oneline` on the recovered branch shows the missing commits.
|
|
43
|
+
- The files that were lost are present with the expected content.
|
|
44
|
+
- Nothing else moved: `git status` is clean.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: large-repository-surgery
|
|
3
|
+
description: Remove a large file or a secret from git history, or split a repository. Use when a clone is slow because of a committed binary, or when a credential must be purged from history.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Large Repository Surgery
|
|
7
|
+
|
|
8
|
+
## Before anything else
|
|
9
|
+
|
|
10
|
+
Rewriting history breaks every existing clone. Everyone must re-clone or reset. Confirm the team knows, and if the goal is removing a secret, ROTATE THE SECRET FIRST — the rewrite does not reach forks, caches or anyone's existing clone.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Measure before you cut.
|
|
15
|
+
- Find the largest objects in history and confirm they are what is actually causing the size.
|
|
16
|
+
- `git count-objects -vH` gives the total; `git rev-list --objects --all` piped through `git cat-file --batch-check` and sorted by size gives the offenders.
|
|
17
|
+
- **Done when:** you can name the paths responsible for most of the repository size.
|
|
18
|
+
|
|
19
|
+
2. Back up.
|
|
20
|
+
- `git clone --mirror` to a separate location. A rewrite has no undo.
|
|
21
|
+
- **Done when:** the mirror exists and `git log` in it shows the current history.
|
|
22
|
+
|
|
23
|
+
3. Rewrite with a purpose-built tool.
|
|
24
|
+
- `git filter-repo` is the current tool. `filter-branch` is deprecated, orders of magnitude slower, and easy to get subtly wrong.
|
|
25
|
+
- `git filter-repo --path secrets.env --invert-paths` removes a path from all history.
|
|
26
|
+
- **Done when:** the path no longer appears in `git log --all -- <path>`.
|
|
27
|
+
|
|
28
|
+
4. Expire and collect.
|
|
29
|
+
- The old objects are still reachable through the reflog until it is expired.
|
|
30
|
+
- **Done when:** `git count-objects -vH` shows the reduced size.
|
|
31
|
+
|
|
32
|
+
5. Coordinate the push.
|
|
33
|
+
- Force-push all branches and tags, then have everyone re-clone. Anyone who merges an old clone reintroduces the history.
|
|
34
|
+
- **Done when:** every collaborator has confirmed a fresh clone.
|
|
35
|
+
|
|
36
|
+
## Prevention
|
|
37
|
+
|
|
38
|
+
- Add the file pattern to `.gitignore`.
|
|
39
|
+
- Use Git LFS for binaries that genuinely belong in the repository.
|
|
40
|
+
- Add a pre-commit size check.
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
- The removed path is absent from `git log --all`.
|
|
45
|
+
- Repository size has dropped as expected.
|
|
46
|
+
- CI passes against the rewritten history.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merge-conflict-resolution
|
|
3
|
+
description: Resolve merge or rebase conflicts. Use when a merge stops with conflicts, when a rebase halts, or when conflict markers appear in a file.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Merge Conflict Resolution
|
|
7
|
+
|
|
8
|
+
## Invariants
|
|
9
|
+
|
|
10
|
+
1. Never resolve a conflict by taking one side wholesale without reading both. That silently discards someone's work.
|
|
11
|
+
2. Never commit a file containing `<<<<<<<`, `=======` or `>>>>>>>`.
|
|
12
|
+
3. Run the tests after resolving. A syntactically valid resolution can still be semantically wrong.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. See the shape of the conflict before editing.
|
|
17
|
+
- `git status` lists the conflicted paths. `git diff --diff-filter=U` shows only the conflicting hunks.
|
|
18
|
+
- **Done when:** you have the list of conflicted files and know which are code and which are generated.
|
|
19
|
+
|
|
20
|
+
2. Resolve generated files by regenerating, not by editing.
|
|
21
|
+
- Lock files, build output and snapshots: check out one side, then re-run the generator.
|
|
22
|
+
- `git checkout --theirs package-lock.json && npm install`
|
|
23
|
+
- **Done when:** the generated file matches what the tool produces from the merged source.
|
|
24
|
+
|
|
25
|
+
3. Resolve code by understanding both intents.
|
|
26
|
+
- `git log --merge -p <path>` shows the commits from each side that touched the file. Read them; the right resolution is often neither side but a combination.
|
|
27
|
+
- **Done when:** the resolved hunk preserves the intent of both branches, or you can state which was deliberately dropped and why.
|
|
28
|
+
|
|
29
|
+
4. Verify before continuing.
|
|
30
|
+
- `git add` the resolved files, then run the tests BEFORE `git rebase --continue` or `git commit`.
|
|
31
|
+
- **Done when:** the test suite passes on the resolved tree.
|
|
32
|
+
|
|
33
|
+
## Escape hatches
|
|
34
|
+
|
|
35
|
+
- Abandon the attempt cleanly: `git merge --abort` or `git rebase --abort`. Both return to the pre-merge state and lose nothing.
|
|
36
|
+
- Recover a resolution you already made once: `git rerere` records and replays them.
|
|
37
|
+
|
|
38
|
+
## Verification
|
|
39
|
+
|
|
40
|
+
- `grep -rn '<<<<<<<' .` finds nothing outside test fixtures.
|
|
41
|
+
- The test suite passes.
|
|
42
|
+
- `git diff <base>...HEAD` contains no unrelated change.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cinematic-3d-shot
|
|
3
|
+
description: Build a 3D object in Blender and render it as a short cinematic clip. Use when a task asks for a 3D model, a product shot, a turntable, or a rendered animation of a few seconds.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cinematic 3D Shot
|
|
7
|
+
|
|
8
|
+
A render looks amateur for four reasons, always the same four: default grey
|
|
9
|
+
material, one flat light, the camera where Blender left it, and nobody looked at
|
|
10
|
+
the result before shipping it. Fix those four and an ordinary model reads as a
|
|
11
|
+
product shot.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. Verify Blender before planning anything.
|
|
16
|
+
- Use the local CLI path. Budget a low-cost `renderFrame` whenever you need
|
|
17
|
+
to inspect the current visual result.
|
|
18
|
+
- **Done when:** the local Blender binary is available and the review loop is planned.
|
|
19
|
+
|
|
20
|
+
2. Clear the scene.
|
|
21
|
+
- Blender opens with a cube, one lamp and a camera. Building around them is
|
|
22
|
+
how the default cube ends up in a client render.
|
|
23
|
+
- **Done when:** `clearScene` has run.
|
|
24
|
+
|
|
25
|
+
3. Build the silhouette, then the detail.
|
|
26
|
+
- A shape is read as an outline before it is read as a surface. If the form
|
|
27
|
+
does not identify itself at thumbnail size, no amount of material work will
|
|
28
|
+
save it. Use `smartGeometry` — it applies bevel and subdivision, and a
|
|
29
|
+
bevel is what catches a highlight along an edge. Perfectly sharp edges are
|
|
30
|
+
the most common tell of untouched 3D: nothing in the real world has them.
|
|
31
|
+
- **Done when:** the object is recognisable as a flat grey silhouette.
|
|
32
|
+
|
|
33
|
+
4. Give every visible object a material.
|
|
34
|
+
- `smartMaterial` on each one. One untouched object in a dressed scene reads
|
|
35
|
+
as unfinished more loudly than a whole scene of grey.
|
|
36
|
+
- Match the material to the object's story: a pen barrel is brushed metal or
|
|
37
|
+
lacquered resin, not plastic; the grip is rubber, and rubber is rough where
|
|
38
|
+
metal is not. Contrast between materials is what tells the eye there are
|
|
39
|
+
two parts.
|
|
40
|
+
- **Done when:** no object still carries the default surface.
|
|
41
|
+
|
|
42
|
+
5. Light with three lights, in this order.
|
|
43
|
+
- `setupStudioLighting` gives key, fill and rim. The ratio does the work:
|
|
44
|
+
the key states the form, the fill keeps the shadow side from going black,
|
|
45
|
+
and the RIM is what separates the subject from the background. A render
|
|
46
|
+
that looks flat is almost always missing the rim.
|
|
47
|
+
- **Done when:** the subject's edge is visibly brighter than what is behind it.
|
|
48
|
+
|
|
49
|
+
6. Add atmosphere only after the lights exist.
|
|
50
|
+
- `cinematicAtmosphere`. Fog scatters the light you already have, so adding
|
|
51
|
+
it first means tuning against something that will change. Keep the density
|
|
52
|
+
low — visible haze reads as a mistake unless the shot is about weather.
|
|
53
|
+
- **Done when:** there is depth between foreground and background, and the
|
|
54
|
+
subject is still crisp.
|
|
55
|
+
|
|
56
|
+
7. Frame it deliberately.
|
|
57
|
+
- `autoFrameCamera`. A longer lens (65mm and up) flatters an object; a wide
|
|
58
|
+
lens distorts it and is why so many AI renders look like a fisheye photo of
|
|
59
|
+
a toy. Put the camera slightly above the eye line and the subject a little
|
|
60
|
+
off-centre.
|
|
61
|
+
- **Done when:** the camera is not where Blender put it.
|
|
62
|
+
|
|
63
|
+
8. Look at it before you animate.
|
|
64
|
+
- `captureViewport`, or one low-sample `renderFrame`, then `view_image` or
|
|
65
|
+
`vision_inspect_ui`. Ask the specific question: is anything still grey, is
|
|
66
|
+
the subject separated from the background, does the silhouette read?
|
|
67
|
+
- **A render nobody has looked at is not a finished render.** This step is
|
|
68
|
+
the difference between the two outcomes, not a formality.
|
|
69
|
+
- **Done when:** you have described what you actually see, not what you
|
|
70
|
+
intended to build.
|
|
71
|
+
|
|
72
|
+
9. One camera move, and do the arithmetic out loud.
|
|
73
|
+
- Seconds x fps = frames. 8s at 24fps is frames 1-192; set the range
|
|
74
|
+
explicitly or Blender renders its own 250-frame default.
|
|
75
|
+
- ONE move per short shot: a slow orbit, a push-in, or a rise. Three moves in
|
|
76
|
+
eight seconds reads as a screensaver. Ease the ends — constant velocity is
|
|
77
|
+
what makes a move feel mechanical.
|
|
78
|
+
- **Done when:** the frame range matches the requested duration exactly.
|
|
79
|
+
|
|
80
|
+
10. Render with settings that fit the budget.
|
|
81
|
+
- EEVEE for anything short. Cycles at default samples will spend an entire
|
|
82
|
+
task budget on one frame and is almost never what a few seconds of
|
|
83
|
+
turntable needs.
|
|
84
|
+
- **Done when:** the file exists, and you have opened it to confirm it is
|
|
85
|
+
not zero bytes or a single black frame.
|
|
86
|
+
|
|
87
|
+
## Failure modes worth naming
|
|
88
|
+
|
|
89
|
+
- **Everything is grey.** A material step was skipped, or applied to one object.
|
|
90
|
+
- **It looks flat.** No rim light, or fill too close to key.
|
|
91
|
+
- **The object looks like a toy.** Lens too wide, or the camera is too close.
|
|
92
|
+
- **The animation stutters.** Frame range and fps disagree with the duration.
|
|
93
|
+
- **Blender is not installed.** Say so and offer the alternative. Do not loop
|
|
94
|
+
retrying the same missing binary — that spends budget to learn nothing.
|
|
95
|
+
|
|
96
|
+
## Verification
|
|
97
|
+
|
|
98
|
+
- The rendered file exists, is larger than a few kilobytes, and opens.
|
|
99
|
+
- Open the first frame and the middle frame. Neither is black, neither is empty,
|
|
100
|
+
and the subject is in frame in both.
|
|
101
|
+
- No object in shot still carries the default grey surface.
|
|
102
|
+
- The subject's edge is brighter than the background directly behind it.
|
|
103
|
+
- Frame count equals requested seconds x fps, exactly.
|
|
104
|
+
- The camera position differs from Blender's default.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: app-startup-optimisation
|
|
3
|
+
description: Reduce mobile app startup time. Use when a cold start takes more than about two seconds, when a splash screen lingers, or when the first frame is blank.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# App Startup Optimisation
|
|
7
|
+
|
|
8
|
+
## The three starts
|
|
9
|
+
|
|
10
|
+
Cold (no process), warm (process alive, activity recreated), hot (everything alive). Cold start is what users judge you on, and it is the only one worth optimising first.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Measure each phase separately.
|
|
15
|
+
- Process creation, framework initialisation, application setup, first layout, first frame, first useful content. Optimising before you know which dominates is guessing.
|
|
16
|
+
- **Done when:** every phase has a measured duration on a mid-tier device.
|
|
17
|
+
|
|
18
|
+
2. Move work out of application initialisation.
|
|
19
|
+
- Analytics, crash reporting, image loaders and dependency graphs commonly initialise eagerly. Almost none of them are needed before the first frame. Defer them behind lazy initialisation or a post-first-frame hook.
|
|
20
|
+
- **Done when:** application setup does only what the first screen needs.
|
|
21
|
+
|
|
22
|
+
3. Make the first screen cheap.
|
|
23
|
+
- The first frame should render from cached or placeholder data, not from a network call. A skeleton that appears instantly beats correct content that appears in three seconds.
|
|
24
|
+
- **Done when:** something meaningful renders before any network response.
|
|
25
|
+
|
|
26
|
+
4. Do not hide the problem behind a splash screen.
|
|
27
|
+
- An artificial splash delay makes the measured start longer. Use the platform's own splash mechanism, which shows during process creation and costs nothing.
|
|
28
|
+
- **Done when:** no artificial delay exists on the startup path.
|
|
29
|
+
|
|
30
|
+
5. Ship ahead-of-time compilation hints.
|
|
31
|
+
- A baseline profile covering launch and the first interaction removes interpretation on the critical path.
|
|
32
|
+
- **Done when:** a profile generated from a real launch journey is included in the release.
|
|
33
|
+
|
|
34
|
+
6. Audit the dependency graph.
|
|
35
|
+
- Each library initialising at startup costs time. Some register a startup provider automatically — check what is actually running before your first line of code.
|
|
36
|
+
- **Done when:** every automatic initialiser is either needed or disabled.
|
|
37
|
+
|
|
38
|
+
## Verification
|
|
39
|
+
|
|
40
|
+
- Cold start to first useful content is measured before and after, on a mid-tier device, on a release build.
|
|
41
|
+
- Nothing on the startup path performs network or disk work that the first screen does not need.
|