freddie 0.0.41
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.md +180 -0
- package/CHANGELOG.md +32 -0
- package/README.md +130 -0
- package/bin/freddie.js +116 -0
- package/package.json +59 -0
- package/skills/creative/README.md +3 -0
- package/skills/creative/architecture-diagram/SKILL.md +52 -0
- package/skills/creative/ascii-video/SKILL.md +60 -0
- package/skills/creative/concept-diagrams/SKILL.md +65 -0
- package/skills/data/README.md +3 -0
- package/skills/data/etl-pipelines/SKILL.md +60 -0
- package/skills/data/sql-explainer/SKILL.md +60 -0
- package/skills/ops/README.md +3 -0
- package/skills/ops/incident-response/SKILL.md +74 -0
- package/skills/ops/log-triage/SKILL.md +79 -0
- package/skills/planning/README.md +3 -0
- package/skills/planning/okr-drafter/SKILL.md +60 -0
- package/skills/planning/weekly-review/SKILL.md +64 -0
- package/skills/software-development/README.md +3 -0
- package/skills/software-development/code-review/SKILL.md +70 -0
- package/skills/software-development/rfc-writer/SKILL.md +68 -0
- package/skills/software-development/systematic-debugging/SKILL.md +80 -0
- package/src/acp/auth.js +21 -0
- package/src/acp/entry.js +2 -0
- package/src/acp/events.js +10 -0
- package/src/acp/main.js +8 -0
- package/src/acp/permissions.js +29 -0
- package/src/acp/server.js +84 -0
- package/src/acp/session.js +26 -0
- package/src/acp/tools.js +17 -0
- package/src/agent/account_usage.js +19 -0
- package/src/agent/acptoapi-bridge.js +80 -0
- package/src/agent/anthropic_adapter.js +10 -0
- package/src/agent/auxiliary_client.js +20 -0
- package/src/agent/bedrock_adapter.js +11 -0
- package/src/agent/codex_responses_adapter.js +10 -0
- package/src/agent/compress/compressor.js +55 -0
- package/src/agent/compress/fallback.js +14 -0
- package/src/agent/compress/index.js +6 -0
- package/src/agent/compress/policy.js +47 -0
- package/src/agent/compress/prompt.js +46 -0
- package/src/agent/compress/prune.js +16 -0
- package/src/agent/compress/tokens.js +31 -0
- package/src/agent/context_references.js +40 -0
- package/src/agent/copilot_acp_client.js +6 -0
- package/src/agent/credential_pool.js +30 -0
- package/src/agent/credential_sources.js +18 -0
- package/src/agent/curator.js +5 -0
- package/src/agent/display.js +23 -0
- package/src/agent/error_classifier.js +15 -0
- package/src/agent/file_safety.js +9 -0
- package/src/agent/gemini_cloudcode_adapter.js +9 -0
- package/src/agent/gemini_native_adapter.js +11 -0
- package/src/agent/gemini_schema.js +19 -0
- package/src/agent/google_code_assist.js +8 -0
- package/src/agent/google_oauth.js +21 -0
- package/src/agent/image_gen_provider.js +8 -0
- package/src/agent/image_gen_registry.js +6 -0
- package/src/agent/image_routing.js +13 -0
- package/src/agent/insights.js +9 -0
- package/src/agent/llm_resolver.js +21 -0
- package/src/agent/lmstudio_reasoning.js +13 -0
- package/src/agent/machine.js +102 -0
- package/src/agent/manual_compression_feedback.js +5 -0
- package/src/agent/memory_manager.js +14 -0
- package/src/agent/memory_provider.js +1 -0
- package/src/agent/model_metadata.js +28 -0
- package/src/agent/models_dev.js +13 -0
- package/src/agent/moonshot_schema.js +11 -0
- package/src/agent/oauth_endpoints.js +79 -0
- package/src/agent/onboarding.js +16 -0
- package/src/agent/pi-bridge.js +37 -0
- package/src/agent/prompt_builder.js +12 -0
- package/src/agent/prompt_caching.js +24 -0
- package/src/agent/rate_limit_tracker.js +12 -0
- package/src/agent/redact.js +25 -0
- package/src/agent/retry_utils.js +17 -0
- package/src/agent/shell_hooks.js +16 -0
- package/src/agent/skill_commands.js +16 -0
- package/src/agent/skill_preprocessing.js +12 -0
- package/src/agent/skill_utils.js +14 -0
- package/src/agent/subdirectory_hints.js +17 -0
- package/src/agent/title_generator.js +13 -0
- package/src/agent/trajectory.js +9 -0
- package/src/agent/usage_pricing.js +16 -0
- package/src/auth.js +84 -0
- package/src/batch.js +32 -0
- package/src/cli/auth_commands.js +17 -0
- package/src/cli/azure_detect.js +9 -0
- package/src/cli/backup.js +17 -0
- package/src/cli/banner.js +13 -0
- package/src/cli/browser_connect.js +11 -0
- package/src/cli/callbacks.js +5 -0
- package/src/cli/claw.js +8 -0
- package/src/cli/cli_output.js +19 -0
- package/src/cli/clipboard.js +24 -0
- package/src/cli/codex_models.js +8 -0
- package/src/cli/colors.js +13 -0
- package/src/cli/completer.js +98 -0
- package/src/cli/completion.js +21 -0
- package/src/cli/copilot_auth.js +9 -0
- package/src/cli/curator_cli.js +5 -0
- package/src/cli/curses.js +15 -0
- package/src/cli/debug.js +6 -0
- package/src/cli/default_soul.js +20 -0
- package/src/cli/dingtalk_auth.js +12 -0
- package/src/cli/doctor.js +15 -0
- package/src/cli/dump.js +11 -0
- package/src/cli/env_loader.js +25 -0
- package/src/cli/fallback_cmd.js +9 -0
- package/src/cli/gateway_cli.js +17 -0
- package/src/cli/hooks.js +9 -0
- package/src/cli/interactive.js +61 -0
- package/src/cli/logs.js +32 -0
- package/src/cli/main.js +7 -0
- package/src/cli/mcp_config.js +9 -0
- package/src/cli/memory_setup.js +12 -0
- package/src/cli/model_catalog.js +23 -0
- package/src/cli/model_normalize.js +12 -0
- package/src/cli/model_switch.js +11 -0
- package/src/cli/models.js +13 -0
- package/src/cli/nous_subscription.js +12 -0
- package/src/cli/oneshot.js +6 -0
- package/src/cli/pairing.js +21 -0
- package/src/cli/platforms.js +14 -0
- package/src/cli/plugins.js +4 -0
- package/src/cli/plugins_cmd.js +21 -0
- package/src/cli/profiles_cli.js +6 -0
- package/src/cli/providers.js +18 -0
- package/src/cli/pty_bridge.js +16 -0
- package/src/cli/relaunch.js +7 -0
- package/src/cli/runtime_provider.js +9 -0
- package/src/cli/setup.js +131 -0
- package/src/cli/skills_config.js +6 -0
- package/src/cli/skills_hub.js +8 -0
- package/src/cli/slack_cli.js +17 -0
- package/src/cli/status.js +10 -0
- package/src/cli/timeouts.js +5 -0
- package/src/cli/tips.js +14 -0
- package/src/cli/tools_config.js +15 -0
- package/src/cli/uninstall.js +8 -0
- package/src/cli/vercel_auth.js +13 -0
- package/src/cli/voice.js +6 -0
- package/src/cli/web_server.js +13 -0
- package/src/cli/webhook.js +12 -0
- package/src/commands/profile.js +72 -0
- package/src/commands/registry.js +94 -0
- package/src/config.js +125 -0
- package/src/context/engine.js +42 -0
- package/src/cron/cron-parse.js +27 -0
- package/src/cron/scheduler.js +63 -0
- package/src/db.js +178 -0
- package/src/gateway/base.js +13 -0
- package/src/gateway/builtin_hooks/boot.js +5 -0
- package/src/gateway/builtin_hooks/broadcast.js +3 -0
- package/src/gateway/builtin_hooks/deny.js +6 -0
- package/src/gateway/builtin_hooks/index.js +17 -0
- package/src/gateway/builtin_hooks/presence.js +4 -0
- package/src/gateway/builtin_hooks/routing.js +7 -0
- package/src/gateway/helpers.js +27 -0
- package/src/gateway/platforms/api_server.js +21 -0
- package/src/gateway/platforms/bluebubbles.js +32 -0
- package/src/gateway/platforms/dingtalk.js +32 -0
- package/src/gateway/platforms/discord.js +24 -0
- package/src/gateway/platforms/email.js +51 -0
- package/src/gateway/platforms/feishu.js +32 -0
- package/src/gateway/platforms/feishu_comment.js +12 -0
- package/src/gateway/platforms/feishu_comment_rules.js +11 -0
- package/src/gateway/platforms/homeassistant.js +32 -0
- package/src/gateway/platforms/matrix.js +40 -0
- package/src/gateway/platforms/mattermost.js +29 -0
- package/src/gateway/platforms/qqbot.js +32 -0
- package/src/gateway/platforms/signal.js +33 -0
- package/src/gateway/platforms/slack.js +34 -0
- package/src/gateway/platforms/sms.js +34 -0
- package/src/gateway/platforms/telegram.js +38 -0
- package/src/gateway/platforms/telegram_network.js +17 -0
- package/src/gateway/platforms/webhook.js +19 -0
- package/src/gateway/platforms/wecom.js +32 -0
- package/src/gateway/platforms/wecom_callback.js +15 -0
- package/src/gateway/platforms/wecom_crypto.js +16 -0
- package/src/gateway/platforms/weixin.js +32 -0
- package/src/gateway/platforms/whatsapp.js +40 -0
- package/src/gateway/platforms/yuanbao.js +9 -0
- package/src/gateway/platforms/yuanbao_media.js +5 -0
- package/src/gateway/platforms/yuanbao_proto.js +9 -0
- package/src/gateway/platforms/yuanbao_sticker.js +6 -0
- package/src/gateway/run.js +42 -0
- package/src/gateway/service.js +143 -0
- package/src/home.js +44 -0
- package/src/index.js +47 -0
- package/src/mcp/server.js +49 -0
- package/src/observability/debug.js +31 -0
- package/src/observability/log.js +38 -0
- package/src/plugins/achievements/index.js +9 -0
- package/src/plugins/cockpit/index.js +8 -0
- package/src/plugins/context_engine/index.js +13 -0
- package/src/plugins/disk_cleanup/index.js +22 -0
- package/src/plugins/google_meet/index.js +19 -0
- package/src/plugins/image_gen/index.js +5 -0
- package/src/plugins/manager.js +66 -0
- package/src/plugins/memory/_index.js +8 -0
- package/src/plugins/memory/byterover.js +25 -0
- package/src/plugins/memory/hindsight.js +25 -0
- package/src/plugins/memory/holographic.js +31 -0
- package/src/plugins/memory/honcho.js +25 -0
- package/src/plugins/memory/mem0.js +25 -0
- package/src/plugins/memory/openviking.js +25 -0
- package/src/plugins/memory/provider.js +35 -0
- package/src/plugins/memory/retaindb.js +25 -0
- package/src/plugins/memory/supermemory.js +25 -0
- package/src/plugins/observability/index.js +18 -0
- package/src/plugins/platforms/index.js +20 -0
- package/src/plugins/spotify/index.js +22 -0
- package/src/rl/atropos.js +22 -0
- package/src/rl/cli.js +18 -0
- package/src/sessions.js +84 -0
- package/src/skills/index.js +49 -0
- package/src/skin/engine.js +81 -0
- package/src/swe/runner.js +26 -0
- package/src/time.js +25 -0
- package/src/tools/ansi_strip.js +8 -0
- package/src/tools/approval.js +15 -0
- package/src/tools/bash.js +35 -0
- package/src/tools/binary_extensions.js +22 -0
- package/src/tools/browser.js +48 -0
- package/src/tools/budget_config.js +13 -0
- package/src/tools/checkpoint.js +29 -0
- package/src/tools/clarify.js +15 -0
- package/src/tools/code_execution.js +27 -0
- package/src/tools/credential_files.js +16 -0
- package/src/tools/cronjob.js +16 -0
- package/src/tools/debug_helpers.js +9 -0
- package/src/tools/delegate.js +28 -0
- package/src/tools/discord_tool.js +13 -0
- package/src/tools/edit.js +31 -0
- package/src/tools/env_passthrough.js +15 -0
- package/src/tools/environments/base.js +26 -0
- package/src/tools/environments/daytona.js +48 -0
- package/src/tools/environments/docker.js +14 -0
- package/src/tools/environments/file_sync.js +60 -0
- package/src/tools/environments/index.js +36 -0
- package/src/tools/environments/local.js +31 -0
- package/src/tools/environments/modal.js +33 -0
- package/src/tools/environments/singularity.js +38 -0
- package/src/tools/environments/ssh.js +14 -0
- package/src/tools/environments/vercel_sandbox.js +47 -0
- package/src/tools/feishu_doc.js +15 -0
- package/src/tools/feishu_drive.js +14 -0
- package/src/tools/file_operations.js +17 -0
- package/src/tools/file_state.js +16 -0
- package/src/tools/file_tools.js +23 -0
- package/src/tools/fuzzy_match.js +8 -0
- package/src/tools/grep.js +51 -0
- package/src/tools/homeassistant_tool.js +15 -0
- package/src/tools/image_gen.js +33 -0
- package/src/tools/interrupt.js +18 -0
- package/src/tools/managed_tool_gateway.js +11 -0
- package/src/tools/mcp_oauth.js +21 -0
- package/src/tools/mcp_oauth_manager.js +20 -0
- package/src/tools/mcp_tool.js +36 -0
- package/src/tools/memory.js +66 -0
- package/src/tools/mixture_of_agents.js +14 -0
- package/src/tools/neutts_synth.js +13 -0
- package/src/tools/openrouter_client.js +13 -0
- package/src/tools/osv_check.js +11 -0
- package/src/tools/patch_parser.js +42 -0
- package/src/tools/path_security.js +16 -0
- package/src/tools/process_registry.js +17 -0
- package/src/tools/read.js +26 -0
- package/src/tools/registry.js +54 -0
- package/src/tools/rl_training.js +13 -0
- package/src/tools/schema_sanitizer.js +18 -0
- package/src/tools/send_message.js +32 -0
- package/src/tools/session_search.js +23 -0
- package/src/tools/skill_manager.js +17 -0
- package/src/tools/skill_usage.js +20 -0
- package/src/tools/skills_guard.js +17 -0
- package/src/tools/skills_hub.js +31 -0
- package/src/tools/skills_index.js +14 -0
- package/src/tools/skills_sync.js +19 -0
- package/src/tools/skills_tool.js +11 -0
- package/src/tools/slash_confirm.js +16 -0
- package/src/tools/terminal.js +29 -0
- package/src/tools/tirith_security.js +25 -0
- package/src/tools/todo.js +54 -0
- package/src/tools/tool_backend_helpers.js +26 -0
- package/src/tools/tool_output_limits.js +15 -0
- package/src/tools/tool_result_storage.js +20 -0
- package/src/tools/transcription.js +19 -0
- package/src/tools/tts.js +19 -0
- package/src/tools/url_safety.js +15 -0
- package/src/tools/vision.js +18 -0
- package/src/tools/voice_mode.js +10 -0
- package/src/tools/web_search.js +37 -0
- package/src/tools/web_tools.js +18 -0
- package/src/tools/website_policy.js +14 -0
- package/src/tools/write.js +25 -0
- package/src/tools/xai_http.js +13 -0
- package/src/tools/yuanbao_tools.js +13 -0
- package/src/toolset_distributions.js +18 -0
- package/src/toolsets.js +26 -0
- package/src/tui/index.js +26 -0
- package/src/utils.js +54 -0
- package/src/web/app.js +547 -0
- package/src/web/index.html +167 -0
- package/src/web/server.js +109 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: concept-diagrams
|
|
3
|
+
description: Generate concept maps, mind maps, and ER diagrams from free-form descriptions
|
|
4
|
+
category: creative
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Concept Diagrams
|
|
8
|
+
|
|
9
|
+
Extract structure from free-form descriptions and render as concept maps, mind maps, or entity-relationship diagrams.
|
|
10
|
+
|
|
11
|
+
## Diagram types
|
|
12
|
+
|
|
13
|
+
### Mind map (Mermaid mindmap)
|
|
14
|
+
Hierarchical, radiating from a central concept. Use when exploring a topic.
|
|
15
|
+
|
|
16
|
+
```mermaid
|
|
17
|
+
mindmap
|
|
18
|
+
root((Cloud Native))
|
|
19
|
+
Containers
|
|
20
|
+
Docker
|
|
21
|
+
Podman
|
|
22
|
+
Orchestration
|
|
23
|
+
Kubernetes
|
|
24
|
+
Nomad
|
|
25
|
+
Observability
|
|
26
|
+
Metrics
|
|
27
|
+
Logs
|
|
28
|
+
Traces
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Concept map (Mermaid graph)
|
|
32
|
+
Nodes connected by labelled relationships.
|
|
33
|
+
|
|
34
|
+
```mermaid
|
|
35
|
+
graph LR
|
|
36
|
+
Domain -->|contains| BoundedContext
|
|
37
|
+
BoundedContext -->|has| AggregateRoot
|
|
38
|
+
AggregateRoot -->|emits| DomainEvent
|
|
39
|
+
DomainEvent -->|handled by| EventHandler
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### ER diagram (Mermaid erDiagram)
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
erDiagram
|
|
46
|
+
USER ||--o{ ORDER : places
|
|
47
|
+
ORDER ||--|{ LINE_ITEM : contains
|
|
48
|
+
PRODUCT ||--o{ LINE_ITEM : appears-in
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Process
|
|
52
|
+
|
|
53
|
+
1. Identify **nouns** (entities/concepts) and **verbs** (relationships/actions).
|
|
54
|
+
2. Choose diagram type: hierarchy → mindmap, relationships → concept map, data model → ER.
|
|
55
|
+
3. Assign cardinalities for ER, labels for concept maps, levels for mind maps.
|
|
56
|
+
4. Produce the diagram with a brief explanation of key relationships.
|
|
57
|
+
|
|
58
|
+
## Rules
|
|
59
|
+
|
|
60
|
+
- Every edge must have a label.
|
|
61
|
+
- Keep node names ≤3 words; longer names in `""`.
|
|
62
|
+
- Do not add nodes not mentioned unless structurally necessary.
|
|
63
|
+
- For ER: include primary keys when schema details are provided.
|
|
64
|
+
|
|
65
|
+
Produce the diagram immediately from the user's description.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: etl-pipelines
|
|
3
|
+
description: Design, implement, and debug ETL/ELT pipelines — batch or streaming, any source/sink
|
|
4
|
+
category: data
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ETL Pipelines
|
|
8
|
+
|
|
9
|
+
You are a data engineering expert. Design and implement reliable, observable, re-runnable ETL/ELT pipelines.
|
|
10
|
+
|
|
11
|
+
## Pipeline anatomy
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
[Extract] → [Validate] → [Transform] → [Load] → [Reconcile]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- **Extract**: idempotent reads with watermark/cursor (last_updated_at, offset)
|
|
18
|
+
- **Validate**: schema, null, range checks — fail fast before writing
|
|
19
|
+
- **Transform**: pure functions, no side effects
|
|
20
|
+
- **Load**: upsert over truncate+insert; use staging tables for bulk
|
|
21
|
+
- **Reconcile**: row count + checksum comparison between source and sink
|
|
22
|
+
|
|
23
|
+
## Patterns
|
|
24
|
+
|
|
25
|
+
### Incremental load
|
|
26
|
+
```python
|
|
27
|
+
last_run = get_watermark('orders')
|
|
28
|
+
rows = db.query("SELECT * FROM orders WHERE updated_at > %s", last_run)
|
|
29
|
+
load_to_warehouse(rows)
|
|
30
|
+
set_watermark('orders', datetime.utcnow())
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Idempotent upsert (Postgres)
|
|
34
|
+
```sql
|
|
35
|
+
INSERT INTO orders_dw SELECT * FROM orders_staging
|
|
36
|
+
ON CONFLICT (order_id) DO UPDATE SET
|
|
37
|
+
status = EXCLUDED.status,
|
|
38
|
+
updated_at = EXCLUDED.updated_at;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Streaming (Kafka → sink)
|
|
42
|
+
```js
|
|
43
|
+
consumer.on('message', async (msg) => {
|
|
44
|
+
const row = JSON.parse(msg.value)
|
|
45
|
+
await validate(row)
|
|
46
|
+
await sink.upsert(transform(row))
|
|
47
|
+
await consumer.commitOffset(msg)
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Never truncate+insert a production table without a staging safety net.
|
|
54
|
+
- Always log: rows extracted, rows loaded, rows rejected, duration.
|
|
55
|
+
- Make every pipeline re-runnable: same input → same output, no duplicates.
|
|
56
|
+
- Store watermarks in a durable location (DB table, not in-memory).
|
|
57
|
+
- Chunk large loads to ≤50k rows per transaction.
|
|
58
|
+
|
|
59
|
+
Produce: pipeline code, schema validation block, reconciliation query, and monitoring note.
|
|
60
|
+
Ask the user for source, sink, and transformation rules before generating code.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sql-explainer
|
|
3
|
+
description: "Explain SQL queries, execution plans, and performance issues in plain English with rewrites"
|
|
4
|
+
category: data
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SQL Explainer
|
|
8
|
+
|
|
9
|
+
Explain SQL queries, analyse execution plans, identify performance bottlenecks, and suggest rewrites.
|
|
10
|
+
|
|
11
|
+
## Explanation format
|
|
12
|
+
|
|
13
|
+
For any query:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
WHAT IT DOES (one sentence)
|
|
17
|
+
|
|
18
|
+
STEP BY STEP:
|
|
19
|
+
1. FROM / JOIN — which tables, join type and implications
|
|
20
|
+
2. WHERE — filters, sargability (can indexes be used?)
|
|
21
|
+
3. GROUP BY / HAVING — aggregation logic
|
|
22
|
+
4. SELECT — columns, computed expressions
|
|
23
|
+
5. ORDER BY / LIMIT — sort and pagination
|
|
24
|
+
|
|
25
|
+
EDGE CASES:
|
|
26
|
+
- NULLs: which columns and how they affect results
|
|
27
|
+
- Empty sets: what happens if a subquery returns no rows
|
|
28
|
+
- Duplicates: expected or a bug?
|
|
29
|
+
|
|
30
|
+
PERFORMANCE NOTES:
|
|
31
|
+
- Estimated scan type
|
|
32
|
+
- Columns that should have indexes
|
|
33
|
+
- Estimated row count at each stage
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## EXPLAIN ANALYZE reading
|
|
37
|
+
|
|
38
|
+
- Highest **actual time** node = bottleneck.
|
|
39
|
+
- **rows estimated vs actual** divergence → stale statistics (`ANALYZE` needed).
|
|
40
|
+
- **Seq Scan on large table with filter** → missing index.
|
|
41
|
+
- **Hash Join with large hash** → may spill to disk; check `work_mem`.
|
|
42
|
+
- **Nested Loop on large outer, inner Seq Scan** → N+1; index the join key.
|
|
43
|
+
|
|
44
|
+
## Common rewrites
|
|
45
|
+
|
|
46
|
+
| Anti-pattern | Fix |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `SELECT *` in subquery | Select only the join key |
|
|
49
|
+
| `NOT IN (subquery with NULLs)` | Use `NOT EXISTS` |
|
|
50
|
+
| Correlated subquery in SELECT | LEFT JOIN + COALESCE |
|
|
51
|
+
| `DISTINCT` hiding a bad join | Fix the join |
|
|
52
|
+
| `ORDER BY` on un-indexed column with small LIMIT | Index the sort column |
|
|
53
|
+
|
|
54
|
+
## Rules
|
|
55
|
+
|
|
56
|
+
- Always state the SQL dialect assumed (PostgreSQL, MySQL, SQLite, BigQuery, etc.).
|
|
57
|
+
- Never change query semantics in a rewrite without flagging the difference.
|
|
58
|
+
- If slow but correct, suggest `EXPLAIN ANALYZE` output before guessing at indexes.
|
|
59
|
+
|
|
60
|
+
Paste the query (and optionally DDL + EXPLAIN output) and I will explain immediately.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incident-response
|
|
3
|
+
description: "Guide incident response: triage, diagnosis, mitigation, communication, and post-mortem"
|
|
4
|
+
category: ops
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Incident Response
|
|
8
|
+
|
|
9
|
+
You are a senior SRE leading incident response. Keep a clear head, drive toward mitigation, document everything.
|
|
10
|
+
|
|
11
|
+
## Severity levels
|
|
12
|
+
|
|
13
|
+
| Sev | Definition | Response |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| P0 | Complete outage, data loss, security breach | <5 min |
|
|
16
|
+
| P1 | Major feature down, >20% users affected | <15 min |
|
|
17
|
+
| P2 | Degraded, workaround exists | <1 hour |
|
|
18
|
+
| P3 | Minor, no user impact | Next business day |
|
|
19
|
+
|
|
20
|
+
## Response phases
|
|
21
|
+
|
|
22
|
+
### 1. TRIAGE (first 5 min)
|
|
23
|
+
- Confirm the incident is real (not a false positive).
|
|
24
|
+
- Assign an Incident Commander (IC). Open a war room.
|
|
25
|
+
- Post first status update. Identify blast radius.
|
|
26
|
+
|
|
27
|
+
### 2. DIAGNOSIS
|
|
28
|
+
1. What changed recently? (deploy, config, traffic spike)
|
|
29
|
+
2. Which component is the source? (check error rates by service)
|
|
30
|
+
3. What does the error look like? (logs, stack traces, status codes)
|
|
31
|
+
4. Getting better, worse, or stable?
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
kubectl top pods -A | sort -k3 -rn | head -20
|
|
35
|
+
kubectl rollout history deployment/<name>
|
|
36
|
+
kubectl logs -f deployment/<name> --tail=100
|
|
37
|
+
psql -c "SELECT count(*), state FROM pg_stat_activity GROUP BY state;"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. MITIGATION (reduce blast radius first)
|
|
41
|
+
|
|
42
|
+
1. **Rollback**: `kubectl rollout undo deployment/<name>`
|
|
43
|
+
2. **Feature flag**: disable without a deploy
|
|
44
|
+
3. **Scale up**: `kubectl scale deployment/<name> --replicas=N`
|
|
45
|
+
4. **Circuit break**: route traffic away from unhealthy instance
|
|
46
|
+
5. **Failover**: promote replica to primary
|
|
47
|
+
|
|
48
|
+
### 4. COMMUNICATION
|
|
49
|
+
|
|
50
|
+
Post updates every 15 minutes:
|
|
51
|
+
```
|
|
52
|
+
[P1 UPDATE — 14:35 UTC]
|
|
53
|
+
Status: Investigating
|
|
54
|
+
Impact: ~15% of users seeing 502 errors on checkout
|
|
55
|
+
Root cause: Under investigation
|
|
56
|
+
Next update: 14:50 UTC
|
|
57
|
+
IC: @name
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 5. POST-MORTEM (within 48 hours)
|
|
61
|
+
|
|
62
|
+
- Timeline (UTC), Root cause (specific), Contributing factors
|
|
63
|
+
- Impact (users, duration, data loss), What went well
|
|
64
|
+
- Action items (owner + due date)
|
|
65
|
+
|
|
66
|
+
## Rules
|
|
67
|
+
|
|
68
|
+
- Mitigation before root cause — stop the bleeding first.
|
|
69
|
+
- One IC owns the call. Others execute, do not freelance.
|
|
70
|
+
- Never restart without capturing logs first.
|
|
71
|
+
- Every action logged with a timestamp.
|
|
72
|
+
- Blameless post-mortems only.
|
|
73
|
+
|
|
74
|
+
Describe the current incident and I will guide you through triage.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: log-triage
|
|
3
|
+
description: Triage application and system logs to find root causes, anomalies, and error patterns
|
|
4
|
+
category: ops
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Log Triage
|
|
8
|
+
|
|
9
|
+
Given logs, structured JSONL, or excerpts — identify errors, anomalies, and root causes quickly.
|
|
10
|
+
|
|
11
|
+
## What you do
|
|
12
|
+
|
|
13
|
+
1. **Parse** — identify format (plain text, JSON, syslog, nginx, k8s).
|
|
14
|
+
2. **Classify** — group by level (ERROR/WARN/INFO) and origin (service, host, pod).
|
|
15
|
+
3. **Correlate** — link errors by request ID, trace ID, or timestamp.
|
|
16
|
+
4. **Identify root cause** — find the first error in the causal chain.
|
|
17
|
+
5. **Summarise** — triage report with counts, timeline, top errors.
|
|
18
|
+
|
|
19
|
+
## Triage process
|
|
20
|
+
|
|
21
|
+
### Step 1 — Extract errors
|
|
22
|
+
```bash
|
|
23
|
+
# JSON logs
|
|
24
|
+
jq 'select(.level == "error" or .level == "fatal")' app.log | jq -c '{ts, msg, service, err}'
|
|
25
|
+
# Plain text
|
|
26
|
+
grep -E 'ERROR|FATAL|panic|exception' app.log | sort | uniq -c | sort -rn | head -20
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 2 — Find the first error (usually root cause)
|
|
30
|
+
```bash
|
|
31
|
+
grep -m1 -E 'ERROR|FATAL' app.log
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 3 — Correlate by request/trace ID
|
|
35
|
+
```bash
|
|
36
|
+
grep '"trace_id":"abc123"' *.log | sort -k1
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 4 — Count error frequency
|
|
40
|
+
```bash
|
|
41
|
+
jq -r 'select(.level=="error") | .msg' app.log | sort | uniq -c | sort -rn
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Common patterns
|
|
45
|
+
|
|
46
|
+
| Error pattern | Likely cause |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `connection refused` on DB port | DB down or pool exhausted |
|
|
49
|
+
| `timeout` on upstream | Upstream slow or dead; check circuit breaker |
|
|
50
|
+
| `OOM killed` in k8s | Memory limit too low or memory leak |
|
|
51
|
+
| `too many open files` | File descriptor limit; check `ulimit -n` |
|
|
52
|
+
| `certificate has expired` | TLS cert needs renewal |
|
|
53
|
+
| `ECONNRESET` in Node.js | Client disconnected; benign unless spike |
|
|
54
|
+
| `deadlock detected` in Postgres | Competing transactions; check slow query log |
|
|
55
|
+
|
|
56
|
+
## Triage report format
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
LOG TRIAGE REPORT — <date>
|
|
60
|
+
Source: <file or service>
|
|
61
|
+
Time range: <start> → <end>
|
|
62
|
+
|
|
63
|
+
SUMMARY
|
|
64
|
+
Total lines: N | ERROR: N | WARN: N | INFO: N
|
|
65
|
+
|
|
66
|
+
TOP ERRORS
|
|
67
|
+
1. [N×] "message" — first seen <ts>
|
|
68
|
+
2. [N×] "message" — first seen <ts>
|
|
69
|
+
|
|
70
|
+
ROOT CAUSE HYPOTHESIS
|
|
71
|
+
First error at <ts>: "<message>"
|
|
72
|
+
Caused by: <analysis>
|
|
73
|
+
Likely trigger: <deploy/traffic/dependency>
|
|
74
|
+
|
|
75
|
+
RECOMMENDED ACTIONS
|
|
76
|
+
1. ...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Paste the logs (or describe the file) and I will triage immediately.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: okr-drafter
|
|
3
|
+
description: Draft Objectives and Key Results from goals, strategy docs, or free-form priorities
|
|
4
|
+
category: planning
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# OKR Drafter
|
|
8
|
+
|
|
9
|
+
Draft ambitious, measurable Objectives and Key Results aligned with strategy and trackable weekly.
|
|
10
|
+
|
|
11
|
+
## OKR fundamentals
|
|
12
|
+
|
|
13
|
+
- **Objective**: qualitative, inspiring, time-bound (one quarter). *What do we want to achieve?*
|
|
14
|
+
- **Key Result**: quantitative, binary-completable, max 3-5 per objective. *How do we know we achieved it?*
|
|
15
|
+
- **Initiative**: the work that drives KRs (not part of the OKR).
|
|
16
|
+
|
|
17
|
+
### Good vs bad KRs
|
|
18
|
+
|
|
19
|
+
| Bad (output) | Good (outcome) |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Launch feature X | Feature X used by ≥30% of active users |
|
|
22
|
+
| Fix bugs | P1 bug resolution time <4 hours |
|
|
23
|
+
| Improve performance | p95 API latency <200ms for checkout |
|
|
24
|
+
| Write documentation | Docs CSAT score ≥4.2/5 |
|
|
25
|
+
|
|
26
|
+
## Process
|
|
27
|
+
|
|
28
|
+
1. Read the team's **mission** and **top 3 priorities for the quarter**.
|
|
29
|
+
2. Identify 2-4 **themes** from those priorities.
|
|
30
|
+
3. Draft one **Objective** per theme — active verbs, no jargon.
|
|
31
|
+
4. Draft 3-5 **Key Results** per Objective — each needs baseline, target, and unit.
|
|
32
|
+
5. Sanity-check: measurable today? Baseline known? Target ambitious but ≥70% confident?
|
|
33
|
+
|
|
34
|
+
## Output format
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
QUARTER: Q2 2026
|
|
38
|
+
TEAM: <team>
|
|
39
|
+
|
|
40
|
+
O1: Make our checkout experience the fastest in the industry
|
|
41
|
+
KR1.1 p95 checkout latency: 800ms → 200ms
|
|
42
|
+
KR1.2 Cart abandonment rate: 34% → 22%
|
|
43
|
+
KR1.3 Lighthouse performance score for /checkout ≥ 90
|
|
44
|
+
|
|
45
|
+
O2: Build the foundation for self-serve onboarding
|
|
46
|
+
KR2.1 Time-to-first-value: 3 days → 4 hours
|
|
47
|
+
KR2.2 Support tickets from onboarding: 120/wk → 30/wk
|
|
48
|
+
KR2.3 ≥80% of new accounts complete setup without human help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Objectives use active verbs: "Become", "Establish", "Deliver", "Eliminate".
|
|
54
|
+
- KRs are **outcomes**, never tasks or outputs.
|
|
55
|
+
- Every KR has a **from → to** metric or a binary milestone.
|
|
56
|
+
- Max 4 Objectives per team per quarter.
|
|
57
|
+
- No "increase engagement" without numbers.
|
|
58
|
+
- Flag any KR without a known baseline — it cannot be tracked.
|
|
59
|
+
|
|
60
|
+
Tell me the team name, quarter, and top priorities and I will draft OKRs immediately.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: weekly-review
|
|
3
|
+
description: Facilitate a structured weekly review covering what shipped, blockers, decisions, and next week's priorities
|
|
4
|
+
category: planning
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Weekly Review
|
|
8
|
+
|
|
9
|
+
Facilitate a structured weekly review. Surface what matters, clear blockers, align on priorities.
|
|
10
|
+
|
|
11
|
+
## Review structure (45 minutes)
|
|
12
|
+
|
|
13
|
+
### 1. SHIPPED THIS WEEK (10 min)
|
|
14
|
+
Format: `[scope] description — impact`
|
|
15
|
+
Example: `[checkout] Reduced p95 latency 800ms → 210ms — unblocks Q2 KR1.1`
|
|
16
|
+
|
|
17
|
+
### 2. IN PROGRESS (5 min)
|
|
18
|
+
State + estimated completion date. Flag anything >50% over estimate.
|
|
19
|
+
|
|
20
|
+
### 3. BLOCKERS (10 min)
|
|
21
|
+
For each: what is blocked, who can unblock it, ETA.
|
|
22
|
+
Escalate anything blocked >2 days without a clear owner.
|
|
23
|
+
|
|
24
|
+
### 4. DECISIONS NEEDED (10 min)
|
|
25
|
+
Format: `[decision] options + recommendation + owner + deadline`
|
|
26
|
+
|
|
27
|
+
### 5. NEXT WEEK PRIORITIES (10 min)
|
|
28
|
+
Top 3-5 items, ranked by impact, with an owner.
|
|
29
|
+
|
|
30
|
+
## Output format
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
WEEKLY REVIEW — Week of 2026-04-28
|
|
34
|
+
|
|
35
|
+
SHIPPED
|
|
36
|
+
✓ [auth] Migrated session storage to Redis — reduces DB load 40%
|
|
37
|
+
✓ [infra] Upgraded k8s cluster to 1.29 — zero downtime
|
|
38
|
+
|
|
39
|
+
IN PROGRESS
|
|
40
|
+
→ [checkout] Payment provider migration — 60% done, ETA 2026-05-05
|
|
41
|
+
→ [data] ETL pipeline — blocked (see blockers)
|
|
42
|
+
|
|
43
|
+
BLOCKERS
|
|
44
|
+
⚠ ETL pipeline needs Snowflake credentials — owner: @alice, ETA: 2026-05-02
|
|
45
|
+
⚠ Design review for onboarding — waiting on design since 2026-04-25
|
|
46
|
+
|
|
47
|
+
DECISIONS NEEDED
|
|
48
|
+
? Monorepo vs multi-repo for mobile — recommend monorepo — owner: @bob — deadline: 2026-05-03
|
|
49
|
+
|
|
50
|
+
NEXT WEEK
|
|
51
|
+
1. Finish payment provider migration — @carol
|
|
52
|
+
2. Unblock ETL pipeline — @dave
|
|
53
|
+
3. Ship onboarding v2 to 10% of new signups — @eve
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Rules
|
|
57
|
+
|
|
58
|
+
- Shipped items: completed/shipped/merged only — no "worked on X".
|
|
59
|
+
- Blockers must have an owner and deadline, or they are risks not blockers.
|
|
60
|
+
- Decisions without a deadline are discussions not decisions.
|
|
61
|
+
- Next week: ≤5 priorities. Help rank and drop if the team lists more.
|
|
62
|
+
- Carry unresolved blockers from last week to the top of this week's list.
|
|
63
|
+
|
|
64
|
+
Paste last week's notes, Jira/Linear export, or describe what happened and I will produce the review.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Perform thorough code reviews covering correctness, security, performance, readability, and test coverage
|
|
4
|
+
category: software-development
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Review
|
|
8
|
+
|
|
9
|
+
Perform rigorous, constructive code reviews. Flag real issues, suggest concrete fixes, acknowledge what is done well.
|
|
10
|
+
|
|
11
|
+
## Review dimensions (in order of severity)
|
|
12
|
+
|
|
13
|
+
### 1. CORRECTNESS
|
|
14
|
+
- Does the code do what the PR description claims?
|
|
15
|
+
- Off-by-one errors, wrong comparisons, wrong variable names?
|
|
16
|
+
- Async/await patterns correct? Error propagation complete?
|
|
17
|
+
- Null/undefined/empty cases handled?
|
|
18
|
+
|
|
19
|
+
### 2. SECURITY
|
|
20
|
+
- Injection: SQL, shell, HTML, path traversal
|
|
21
|
+
- Hardcoded secrets or tokens in logs
|
|
22
|
+
- Protected routes actually protected?
|
|
23
|
+
- User input validated at boundaries?
|
|
24
|
+
- New deps pinned? Known CVEs?
|
|
25
|
+
|
|
26
|
+
### 3. PERFORMANCE
|
|
27
|
+
- N+1 queries (loop that calls DB/API per iteration)
|
|
28
|
+
- Missing indexes for new query patterns
|
|
29
|
+
- Blocking calls in async context
|
|
30
|
+
- Large allocations in hot paths
|
|
31
|
+
|
|
32
|
+
### 4. READABILITY
|
|
33
|
+
- Names accurate and unambiguous?
|
|
34
|
+
- Functions ≤20 lines?
|
|
35
|
+
- Magic numbers replaced with named constants?
|
|
36
|
+
- Error handling consistent with codebase?
|
|
37
|
+
|
|
38
|
+
### 5. TESTS
|
|
39
|
+
- New behaviour covered?
|
|
40
|
+
- Tests assert outcomes, not implementation details?
|
|
41
|
+
- Error paths tested, not just happy path?
|
|
42
|
+
- Tests deterministic (no flaky sleeps, no ordering dependence)?
|
|
43
|
+
|
|
44
|
+
## Comment format
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
[BLOCKER] src/auth.js:42 — SQL built by string concatenation. Use: db.query('SELECT * FROM users WHERE id = $1', [id])
|
|
48
|
+
|
|
49
|
+
[SUGGESTION] src/api.js:88 — Loop calls getUserById() N times. Fetch all with WHERE id = ANY($1) and build a Map.
|
|
50
|
+
|
|
51
|
+
[NITPICK] src/util.js:15 — Variable name `d` is ambiguous. Use `date` or `deadline`.
|
|
52
|
+
|
|
53
|
+
[PRAISE] src/cache.js — Cache invalidation logic is clean; TTL=0 and concurrent write edge cases handled correctly.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Severity:
|
|
57
|
+
- **BLOCKER** — must fix before merge (bug, security, data loss)
|
|
58
|
+
- **SUGGESTION** — should fix, significant improvement
|
|
59
|
+
- **NITPICK** — optional, style/clarity
|
|
60
|
+
- **PRAISE** — acknowledge explicitly
|
|
61
|
+
|
|
62
|
+
## Rules
|
|
63
|
+
|
|
64
|
+
- File:line reference on every comment.
|
|
65
|
+
- Every BLOCKER includes a concrete fix.
|
|
66
|
+
- Do not nitpick formatting if there is a linter — reference the linter rule.
|
|
67
|
+
- Do not comment on code outside the diff unless the diff depends on it.
|
|
68
|
+
- End with: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION.
|
|
69
|
+
|
|
70
|
+
Paste the diff or describe the PR and I will review it.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rfc-writer
|
|
3
|
+
description: Write technical RFCs and design documents from a problem statement or rough notes
|
|
4
|
+
category: software-development
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# RFC Writer
|
|
8
|
+
|
|
9
|
+
Write clear, well-structured technical RFCs that drive decisions, not just describe ideas.
|
|
10
|
+
|
|
11
|
+
## RFC structure
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# RFC-NNN: <Title>
|
|
15
|
+
|
|
16
|
+
**Status**: Draft | In Review | Accepted | Rejected | Superseded by RFC-NNN
|
|
17
|
+
**Author(s)**: <names>
|
|
18
|
+
**Date**: YYYY-MM-DD
|
|
19
|
+
**Decision deadline**: YYYY-MM-DD
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
One paragraph. What are we proposing, and why does it matter?
|
|
23
|
+
|
|
24
|
+
## Problem statement
|
|
25
|
+
Current situation, pain caused, data (error rates, latency, support tickets, developer hours).
|
|
26
|
+
|
|
27
|
+
## Goals
|
|
28
|
+
Specific, measurable outcomes this RFC achieves.
|
|
29
|
+
|
|
30
|
+
## Non-goals
|
|
31
|
+
Explicitly out of scope.
|
|
32
|
+
|
|
33
|
+
## Proposed solution
|
|
34
|
+
Architecture diagram (Mermaid preferred), key data structures, API contracts,
|
|
35
|
+
migration path, rollout plan (feature flags, gradual rollout, kill switch).
|
|
36
|
+
|
|
37
|
+
## Alternatives considered
|
|
38
|
+
For each: what it is, why rejected (specific reasons — not just "too complex").
|
|
39
|
+
|
|
40
|
+
## Impact assessment
|
|
41
|
+
| Dimension | Assessment |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Performance | adds 2ms p99 latency |
|
|
44
|
+
| Security | no new attack surface |
|
|
45
|
+
| Reliability | one new external dependency |
|
|
46
|
+
| Cost | +$200/mo Snowflake compute |
|
|
47
|
+
|
|
48
|
+
## Open questions
|
|
49
|
+
Numbered list. Each has an owner and resolution deadline.
|
|
50
|
+
|
|
51
|
+
## Implementation plan
|
|
52
|
+
- [ ] Phase 1: ... (owner, ETA)
|
|
53
|
+
- [ ] Phase 2: ... (owner, ETA)
|
|
54
|
+
|
|
55
|
+
## References
|
|
56
|
+
Related RFCs, ADRs, tickets, papers, external docs.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Rules
|
|
60
|
+
|
|
61
|
+
- Problem statement before solution. Never lead with "we want to build X".
|
|
62
|
+
- Every alternative must explain specifically why it was rejected.
|
|
63
|
+
- Open questions must have owners. Ownerless questions are abandoned questions.
|
|
64
|
+
- Summary readable by someone unfamiliar with the domain.
|
|
65
|
+
- Total RFC under 2000 words. Appendices OK for data.
|
|
66
|
+
- If the decision deadline is missing, add one.
|
|
67
|
+
|
|
68
|
+
Describe the problem and rough solution and I will draft the RFC immediately.
|