@kolbo/kolbo-code-linux-arm64-musl 1.1.74 → 2.0.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/bin/kolbo +0 -0
- package/package.json +1 -1
- package/skills/brainstorming/SKILL.md +164 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +287 -0
- package/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/docx/.skillfish.json +10 -0
- package/skills/docx/SKILL.md +196 -0
- package/skills/docx/docx-js.md +350 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +599 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/document.py +1272 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/fullstack-app/SKILL.md +621 -0
- package/skills/ollama-vision/SKILL.md +105 -0
- package/skills/pdf/.skillfish.json +10 -0
- package/skills/pdf/FORMS.md +205 -0
- package/skills/pdf/REFERENCE.md +612 -0
- package/skills/pdf/SKILL.md +293 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/photo-studio/SKILL.md +122 -0
- package/skills/pptx/.skillfish.json +10 -0
- package/skills/pptx/SKILL.md +483 -0
- package/skills/pptx/html2pptx.md +626 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/html2pptx.js +995 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/supabase/.skillfish.json +10 -0
- package/skills/supabase/SKILL.md +106 -0
- package/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/skills/supabase/references/skill-feedback.md +17 -0
- package/skills/supabase-postgres-best-practices/.skillfish.json +10 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/skills/supabase-postgres-best-practices/references/security-rls-performance.md +57 -0
- package/skills/supabase-quickstart/SKILL.md +400 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/using-superpowers/SKILL.md +115 -0
- package/skills/using-superpowers/references/codex-tools.md +100 -0
- package/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +152 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +655 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/xlsx/.skillfish.json +10 -0
- package/skills/xlsx/SKILL.md +288 -0
- package/skills/xlsx/recalc.py +178 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Apply Principle of Least Privilege
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: Reduced attack surface, better audit trail
|
|
5
|
+
tags: privileges, security, roles, permissions
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Apply Principle of Least Privilege
|
|
9
|
+
|
|
10
|
+
Grant only the minimum permissions required. Never use superuser for application queries.
|
|
11
|
+
|
|
12
|
+
**Incorrect (overly broad permissions):**
|
|
13
|
+
|
|
14
|
+
```sql
|
|
15
|
+
-- Application uses superuser connection
|
|
16
|
+
-- Or grants ALL to application role
|
|
17
|
+
grant all privileges on all tables in schema public to app_user;
|
|
18
|
+
grant all privileges on all sequences in schema public to app_user;
|
|
19
|
+
|
|
20
|
+
-- Any SQL injection becomes catastrophic
|
|
21
|
+
-- drop table users; cascades to everything
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Correct (minimal, specific grants):**
|
|
25
|
+
|
|
26
|
+
```sql
|
|
27
|
+
-- Create role with no default privileges
|
|
28
|
+
create role app_readonly nologin;
|
|
29
|
+
|
|
30
|
+
-- Grant only SELECT on specific tables
|
|
31
|
+
grant usage on schema public to app_readonly;
|
|
32
|
+
grant select on public.products, public.categories to app_readonly;
|
|
33
|
+
|
|
34
|
+
-- Create role for writes with limited scope
|
|
35
|
+
create role app_writer nologin;
|
|
36
|
+
grant usage on schema public to app_writer;
|
|
37
|
+
grant select, insert, update on public.orders to app_writer;
|
|
38
|
+
grant usage on sequence orders_id_seq to app_writer;
|
|
39
|
+
-- No DELETE permission
|
|
40
|
+
|
|
41
|
+
-- Login role inherits from these
|
|
42
|
+
create role app_user login password 'xxx';
|
|
43
|
+
grant app_writer to app_user;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Revoke public defaults:
|
|
47
|
+
|
|
48
|
+
```sql
|
|
49
|
+
-- Revoke default public access
|
|
50
|
+
revoke all on schema public from public;
|
|
51
|
+
revoke all on all tables in schema public from public;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Reference: [Roles and Privileges](https://supabase.com/blog/postgres-roles-and-privileges)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Enable Row Level Security for Multi-Tenant Data
|
|
3
|
+
impact: CRITICAL
|
|
4
|
+
impactDescription: Database-enforced tenant isolation, prevent data leaks
|
|
5
|
+
tags: rls, row-level-security, multi-tenant, security
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Enable Row Level Security for Multi-Tenant Data
|
|
9
|
+
|
|
10
|
+
Row Level Security (RLS) enforces data access at the database level, ensuring users only see their own data.
|
|
11
|
+
|
|
12
|
+
**Incorrect (application-level filtering only):**
|
|
13
|
+
|
|
14
|
+
```sql
|
|
15
|
+
-- Relying only on application to filter
|
|
16
|
+
select * from orders where user_id = $current_user_id;
|
|
17
|
+
|
|
18
|
+
-- Bug or bypass means all data is exposed!
|
|
19
|
+
select * from orders; -- Returns ALL orders
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Correct (database-enforced RLS):**
|
|
23
|
+
|
|
24
|
+
```sql
|
|
25
|
+
-- Enable RLS on the table
|
|
26
|
+
alter table orders enable row level security;
|
|
27
|
+
|
|
28
|
+
-- Create policy for users to see only their orders
|
|
29
|
+
create policy orders_user_policy on orders
|
|
30
|
+
for all
|
|
31
|
+
using (user_id = current_setting('app.current_user_id')::bigint);
|
|
32
|
+
|
|
33
|
+
-- Force RLS even for table owners
|
|
34
|
+
alter table orders force row level security;
|
|
35
|
+
|
|
36
|
+
-- Set user context and query
|
|
37
|
+
set app.current_user_id = '123';
|
|
38
|
+
select * from orders; -- Only returns orders for user 123
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Policy for authenticated role:
|
|
42
|
+
|
|
43
|
+
```sql
|
|
44
|
+
create policy orders_user_policy on orders
|
|
45
|
+
for all
|
|
46
|
+
to authenticated
|
|
47
|
+
using (user_id = auth.uid());
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Reference: [Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Optimize RLS Policies for Performance
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: 5-10x faster RLS queries with proper patterns
|
|
5
|
+
tags: rls, performance, security, optimization
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Optimize RLS Policies for Performance
|
|
9
|
+
|
|
10
|
+
Poorly written RLS policies can cause severe performance issues. Use subqueries and indexes strategically.
|
|
11
|
+
|
|
12
|
+
**Incorrect (function called for every row):**
|
|
13
|
+
|
|
14
|
+
```sql
|
|
15
|
+
create policy orders_policy on orders
|
|
16
|
+
using (auth.uid() = user_id); -- auth.uid() called per row!
|
|
17
|
+
|
|
18
|
+
-- With 1M rows, auth.uid() is called 1M times
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Correct (wrap functions in SELECT):**
|
|
22
|
+
|
|
23
|
+
```sql
|
|
24
|
+
create policy orders_policy on orders
|
|
25
|
+
using ((select auth.uid()) = user_id); -- Called once, cached
|
|
26
|
+
|
|
27
|
+
-- 100x+ faster on large tables
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use security definer functions for complex checks:
|
|
31
|
+
|
|
32
|
+
```sql
|
|
33
|
+
-- Create helper function (runs as definer, bypasses RLS)
|
|
34
|
+
create or replace function is_team_member(team_id bigint)
|
|
35
|
+
returns boolean
|
|
36
|
+
language sql
|
|
37
|
+
security definer
|
|
38
|
+
set search_path = ''
|
|
39
|
+
as $$
|
|
40
|
+
select exists (
|
|
41
|
+
select 1 from public.team_members
|
|
42
|
+
where team_id = $1 and user_id = (select auth.uid())
|
|
43
|
+
);
|
|
44
|
+
$$;
|
|
45
|
+
|
|
46
|
+
-- Use in policy (indexed lookup, not per-row check)
|
|
47
|
+
create policy team_orders_policy on orders
|
|
48
|
+
using ((select is_team_member(team_id)));
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Always add indexes on columns used in RLS policies:
|
|
52
|
+
|
|
53
|
+
```sql
|
|
54
|
+
create index orders_user_id_idx on orders (user_id);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Reference: [RLS Performance](https://supabase.com/docs/guides/database/postgres/row-level-security#rls-performance-recommendations)
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supabase-quickstart
|
|
3
|
+
description: "Use when a user wants to build a fullstack app with Supabase, set up a new Supabase project, connect Supabase to a frontend framework, or says anything like 'build me an app', 'I need a database', 'set up auth', 'create a backend'. Guides non-technical users step-by-step through project creation, MCP server setup, auth, database schema, and generates project-level AGENTS.md rules."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Supabase Fullstack Quickstart
|
|
7
|
+
|
|
8
|
+
You are guiding a user — who may have zero backend experience — through building a fullstack app powered by Supabase. Your job is to automate everything possible, explain only what the user needs to decide, and leave behind project rules so future sessions stay consistent.
|
|
9
|
+
|
|
10
|
+
## Phase 0: Understand What They Want
|
|
11
|
+
|
|
12
|
+
Before touching any tool, ask the user THREE things (skip any they already answered):
|
|
13
|
+
|
|
14
|
+
1. **What does the app do?** (e.g., "a todo app", "a SaaS dashboard", "a booking system")
|
|
15
|
+
2. **Do they already have a Supabase project?** (yes → get project URL + anon key; no → guide creation)
|
|
16
|
+
3. **What frontend?** (Next.js / React + Vite / SvelteKit / Astro / other — default to Next.js if unsure)
|
|
17
|
+
|
|
18
|
+
## Phase 1: Supabase Project Setup
|
|
19
|
+
|
|
20
|
+
### If user has NO Supabase project
|
|
21
|
+
|
|
22
|
+
Walk them through this — they'll do the clicking, you tell them exactly what to click:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. Go to https://supabase.com/dashboard → Sign up or log in
|
|
26
|
+
2. Click "New Project"
|
|
27
|
+
3. Pick an organization (or create one — any name is fine)
|
|
28
|
+
4. Set:
|
|
29
|
+
- Project name: [suggest based on their app idea]
|
|
30
|
+
- Database password: [tell them to save it somewhere safe]
|
|
31
|
+
- Region: [suggest closest to their location]
|
|
32
|
+
5. Click "Create new project" — wait ~2 minutes for provisioning
|
|
33
|
+
6. Once ready, go to Project Settings → API
|
|
34
|
+
7. Copy these two values:
|
|
35
|
+
- Project URL (looks like https://xxxxx.supabase.co)
|
|
36
|
+
- anon/public key (starts with eyJ...)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### If user HAS a Supabase project
|
|
40
|
+
|
|
41
|
+
Ask for:
|
|
42
|
+
- Project URL
|
|
43
|
+
- Anon key (public, safe for frontend)
|
|
44
|
+
- Service role key (only if they'll need admin operations — warn them this is sensitive)
|
|
45
|
+
|
|
46
|
+
## Phase 2: Supabase CLI & MCP Server
|
|
47
|
+
|
|
48
|
+
### Install Supabase CLI
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Check if already installed
|
|
52
|
+
supabase --version
|
|
53
|
+
|
|
54
|
+
# If not installed:
|
|
55
|
+
# macOS/Linux
|
|
56
|
+
brew install supabase/tap/supabase
|
|
57
|
+
# or npx (works everywhere)
|
|
58
|
+
npx supabase --version
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Configure MCP Server (so YOU can interact with their database directly)
|
|
62
|
+
|
|
63
|
+
Add to the project's `opencode.json` (create if it doesn't exist):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcp": {
|
|
68
|
+
"supabase": {
|
|
69
|
+
"type": "remote",
|
|
70
|
+
"url": "https://mcp.supabase.com/mcp",
|
|
71
|
+
"oauth": true
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then tell the user:
|
|
78
|
+
```
|
|
79
|
+
I've configured the Supabase MCP server. You need to authenticate it:
|
|
80
|
+
1. Restart this session (or reload the editor)
|
|
81
|
+
2. When prompted, complete the OAuth flow in your browser
|
|
82
|
+
3. Once authenticated, I'll be able to create tables, run queries,
|
|
83
|
+
and manage your database directly — no copy-pasting SQL needed.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If MCP auth fails, fall back to the CLI: `supabase db query "SELECT 1"` to verify connectivity.
|
|
87
|
+
|
|
88
|
+
### Link to their project (for local dev)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
supabase login
|
|
92
|
+
supabase link --project-ref <project-ref>
|
|
93
|
+
# project-ref is the xxxxx part of https://xxxxx.supabase.co
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Phase 3: Frontend Scaffolding
|
|
97
|
+
|
|
98
|
+
### Create the project (if starting fresh)
|
|
99
|
+
|
|
100
|
+
Based on their framework choice:
|
|
101
|
+
|
|
102
|
+
**Next.js (recommended for beginners):**
|
|
103
|
+
```bash
|
|
104
|
+
npx create-next-app@latest my-app --typescript --tailwind --app --eslint
|
|
105
|
+
cd my-app
|
|
106
|
+
npm install @supabase/supabase-js @supabase/ssr
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**React + Vite:**
|
|
110
|
+
```bash
|
|
111
|
+
npm create vite@latest my-app -- --template react-ts
|
|
112
|
+
cd my-app
|
|
113
|
+
npm install @supabase/supabase-js
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**SvelteKit:**
|
|
117
|
+
```bash
|
|
118
|
+
npx sv create my-app
|
|
119
|
+
cd my-app
|
|
120
|
+
npm install @supabase/supabase-js @supabase/ssr
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Environment variables
|
|
124
|
+
|
|
125
|
+
Create `.env.local` (Next.js) or `.env` (Vite/Svelte):
|
|
126
|
+
```
|
|
127
|
+
NEXT_PUBLIC_SUPABASE_URL=https://xxxxx.supabase.co
|
|
128
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
IMPORTANT: Never put the service_role key in a `NEXT_PUBLIC_` or `VITE_` variable — it gets shipped to the browser.
|
|
132
|
+
|
|
133
|
+
### Create the Supabase client
|
|
134
|
+
|
|
135
|
+
**Next.js (App Router) — create `src/lib/supabase/`:**
|
|
136
|
+
|
|
137
|
+
`client.ts` (browser):
|
|
138
|
+
```typescript
|
|
139
|
+
import { createBrowserClient } from "@supabase/ssr"
|
|
140
|
+
|
|
141
|
+
export function createClient() {
|
|
142
|
+
return createBrowserClient(
|
|
143
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
144
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`server.ts` (server components/actions):
|
|
150
|
+
```typescript
|
|
151
|
+
import { createServerClient } from "@supabase/ssr"
|
|
152
|
+
import { cookies } from "next/headers"
|
|
153
|
+
|
|
154
|
+
export async function createClient() {
|
|
155
|
+
const cookieStore = await cookies()
|
|
156
|
+
return createServerClient(
|
|
157
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
158
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
159
|
+
{
|
|
160
|
+
cookies: {
|
|
161
|
+
getAll() { return cookieStore.getAll() },
|
|
162
|
+
setAll(cookiesToSet) {
|
|
163
|
+
try {
|
|
164
|
+
cookiesToSet.forEach(({ name, value, options }) =>
|
|
165
|
+
cookieStore.set(name, value, options))
|
|
166
|
+
} catch {}
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`middleware.ts` (in project root):
|
|
175
|
+
```typescript
|
|
176
|
+
import { createServerClient } from "@supabase/ssr"
|
|
177
|
+
import { NextResponse, type NextRequest } from "next/server"
|
|
178
|
+
|
|
179
|
+
export async function middleware(request: NextRequest) {
|
|
180
|
+
let response = NextResponse.next({ request })
|
|
181
|
+
const supabase = createServerClient(
|
|
182
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
183
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
|
184
|
+
{
|
|
185
|
+
cookies: {
|
|
186
|
+
getAll() { return request.cookies.getAll() },
|
|
187
|
+
setAll(cookiesToSet) {
|
|
188
|
+
cookiesToSet.forEach(({ name, value }) =>
|
|
189
|
+
request.cookies.set(name, value))
|
|
190
|
+
response = NextResponse.next({ request })
|
|
191
|
+
cookiesToSet.forEach(({ name, value, options }) =>
|
|
192
|
+
response.cookies.set(name, value, options))
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
)
|
|
197
|
+
await supabase.auth.getUser()
|
|
198
|
+
return response
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const config = {
|
|
202
|
+
matcher: ["/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)"],
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**React + Vite:**
|
|
207
|
+
```typescript
|
|
208
|
+
import { createClient } from "@supabase/supabase-js"
|
|
209
|
+
|
|
210
|
+
export const supabase = createClient(
|
|
211
|
+
import.meta.env.VITE_SUPABASE_URL,
|
|
212
|
+
import.meta.env.VITE_SUPABASE_ANON_KEY,
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Phase 4: Auth Setup
|
|
217
|
+
|
|
218
|
+
Ask the user: "Do you need user login? (email/password, Google, GitHub, magic link?)"
|
|
219
|
+
|
|
220
|
+
### Email/Password (simplest)
|
|
221
|
+
|
|
222
|
+
Enable in Supabase Dashboard → Auth → Providers → Email.
|
|
223
|
+
|
|
224
|
+
Create signup/login pages with forms. Example (Next.js):
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
// app/auth/login/page.tsx
|
|
228
|
+
"use client"
|
|
229
|
+
import { createClient } from "@/lib/supabase/client"
|
|
230
|
+
import { useRouter } from "next/navigation"
|
|
231
|
+
import { useState } from "react"
|
|
232
|
+
|
|
233
|
+
export default function Login() {
|
|
234
|
+
const [email, setEmail] = useState("")
|
|
235
|
+
const [password, setPassword] = useState("")
|
|
236
|
+
const [error, setError] = useState("")
|
|
237
|
+
const router = useRouter()
|
|
238
|
+
const supabase = createClient()
|
|
239
|
+
|
|
240
|
+
const handleLogin = async (e: React.FormEvent) => {
|
|
241
|
+
e.preventDefault()
|
|
242
|
+
const { error } = await supabase.auth.signInWithPassword({ email, password })
|
|
243
|
+
if (error) setError(error.message)
|
|
244
|
+
else router.push("/dashboard")
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<form onSubmit={handleLogin}>
|
|
249
|
+
<input type="email" value={email} onChange={e => setEmail(e.target.value)} placeholder="Email" required />
|
|
250
|
+
<input type="password" value={password} onChange={e => setPassword(e.target.value)} placeholder="Password" required />
|
|
251
|
+
{error && <p style={{color:"red"}}>{error}</p>}
|
|
252
|
+
<button type="submit">Log in</button>
|
|
253
|
+
</form>
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### OAuth (Google, GitHub, etc.)
|
|
259
|
+
|
|
260
|
+
Guide the user through the dashboard:
|
|
261
|
+
```
|
|
262
|
+
1. Supabase Dashboard → Auth → Providers
|
|
263
|
+
2. Enable Google/GitHub/etc.
|
|
264
|
+
3. For Google: Create OAuth credentials at console.cloud.google.com
|
|
265
|
+
- Authorized redirect: https://xxxxx.supabase.co/auth/v1/callback
|
|
266
|
+
4. Paste Client ID + Client Secret into Supabase
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Then add OAuth login button:
|
|
270
|
+
```typescript
|
|
271
|
+
const { data, error } = await supabase.auth.signInWithOAuth({
|
|
272
|
+
provider: "google",
|
|
273
|
+
options: { redirectTo: `${window.location.origin}/auth/callback` }
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Phase 5: Database Schema
|
|
278
|
+
|
|
279
|
+
Based on what the user described in Phase 0, design the schema. Use MCP `execute_sql` if available, otherwise generate migration files.
|
|
280
|
+
|
|
281
|
+
### Example flow
|
|
282
|
+
|
|
283
|
+
1. Design tables based on app requirements
|
|
284
|
+
2. Create them:
|
|
285
|
+
```sql
|
|
286
|
+
CREATE TABLE public.todos (
|
|
287
|
+
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
288
|
+
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE NOT NULL,
|
|
289
|
+
title TEXT NOT NULL,
|
|
290
|
+
completed BOOLEAN DEFAULT false,
|
|
291
|
+
created_at TIMESTAMPTZ DEFAULT now()
|
|
292
|
+
);
|
|
293
|
+
```
|
|
294
|
+
3. ALWAYS enable RLS:
|
|
295
|
+
```sql
|
|
296
|
+
ALTER TABLE public.todos ENABLE ROW LEVEL SECURITY;
|
|
297
|
+
|
|
298
|
+
CREATE POLICY "Users can read own todos"
|
|
299
|
+
ON public.todos FOR SELECT
|
|
300
|
+
USING (auth.uid() = user_id);
|
|
301
|
+
|
|
302
|
+
CREATE POLICY "Users can insert own todos"
|
|
303
|
+
ON public.todos FOR INSERT
|
|
304
|
+
WITH CHECK (auth.uid() = user_id);
|
|
305
|
+
|
|
306
|
+
CREATE POLICY "Users can update own todos"
|
|
307
|
+
ON public.todos FOR UPDATE
|
|
308
|
+
USING (auth.uid() = user_id);
|
|
309
|
+
|
|
310
|
+
CREATE POLICY "Users can delete own todos"
|
|
311
|
+
ON public.todos FOR DELETE
|
|
312
|
+
USING (auth.uid() = user_id);
|
|
313
|
+
```
|
|
314
|
+
4. Generate migration: `supabase db pull --local --yes`
|
|
315
|
+
|
|
316
|
+
## Phase 6: Generate Project Rules (AGENTS.md)
|
|
317
|
+
|
|
318
|
+
**CRITICAL: After setup is complete, ALWAYS generate an `AGENTS.md` file in the project root.** This ensures all future agent sessions know how the project is configured.
|
|
319
|
+
|
|
320
|
+
Template — adapt based on actual setup:
|
|
321
|
+
|
|
322
|
+
```markdown
|
|
323
|
+
# [App Name] — Agent Rules
|
|
324
|
+
|
|
325
|
+
## Stack
|
|
326
|
+
- Frontend: [Next.js 15 / React + Vite / SvelteKit] + TypeScript + Tailwind CSS
|
|
327
|
+
- Backend: Supabase (Database, Auth, RLS, Edge Functions)
|
|
328
|
+
- Database: PostgreSQL via Supabase
|
|
329
|
+
|
|
330
|
+
## Supabase Configuration
|
|
331
|
+
- Project URL: stored in `NEXT_PUBLIC_SUPABASE_URL` env var
|
|
332
|
+
- Anon Key: stored in `NEXT_PUBLIC_SUPABASE_ANON_KEY` env var
|
|
333
|
+
- MCP server configured in `opencode.json` — use MCP tools to query/modify the database directly
|
|
334
|
+
|
|
335
|
+
## Auth
|
|
336
|
+
- Provider: [Email/Password | Google OAuth | GitHub OAuth | Magic Link]
|
|
337
|
+
- Client setup: `src/lib/supabase/client.ts` (browser) and `src/lib/supabase/server.ts` (server)
|
|
338
|
+
- Middleware at `middleware.ts` refreshes auth tokens on every request
|
|
339
|
+
- Protected routes: [list or pattern, e.g., "/dashboard/*"]
|
|
340
|
+
|
|
341
|
+
## Database Rules
|
|
342
|
+
- **RLS is ON for all tables** — every new table MUST have RLS enabled with appropriate policies
|
|
343
|
+
- **user_id pattern**: All user-owned tables have a `user_id UUID REFERENCES auth.users(id)` column
|
|
344
|
+
- **Never use `user_metadata`** for authorization — it's user-editable
|
|
345
|
+
- **Migrations**: Use `supabase db pull --local --yes` to generate, never create migration files manually
|
|
346
|
+
|
|
347
|
+
## Schema
|
|
348
|
+
[List tables and their purpose, e.g.:]
|
|
349
|
+
- `todos` — User tasks (CRUD by owner only)
|
|
350
|
+
- `profiles` — Extended user info (read by anyone, write by owner)
|
|
351
|
+
|
|
352
|
+
## Development
|
|
353
|
+
- Local dev: `npm run dev` (frontend) + Supabase cloud (no local Supabase instance)
|
|
354
|
+
- Environment: `.env.local` for secrets (gitignored)
|
|
355
|
+
- Never expose `service_role` key in frontend code
|
|
356
|
+
|
|
357
|
+
## Security Checklist (run before any PR)
|
|
358
|
+
- [ ] All new tables have RLS enabled
|
|
359
|
+
- [ ] No `service_role` key in client-side code
|
|
360
|
+
- [ ] No `user_metadata` used for authorization
|
|
361
|
+
- [ ] Views use `security_invoker = true`
|
|
362
|
+
- [ ] Functions in private schema if `security definer`
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Phase 7: Verify Everything Works
|
|
366
|
+
|
|
367
|
+
Run through this checklist before telling the user "you're ready":
|
|
368
|
+
|
|
369
|
+
1. `npm run dev` starts without errors
|
|
370
|
+
2. Can sign up a test user
|
|
371
|
+
3. Can log in with that user
|
|
372
|
+
4. Can create/read data (confirms RLS works)
|
|
373
|
+
5. `AGENTS.md` exists in project root
|
|
374
|
+
6. `.env.local` is in `.gitignore`
|
|
375
|
+
7. MCP server is connected (if applicable)
|
|
376
|
+
|
|
377
|
+
Tell the user:
|
|
378
|
+
```
|
|
379
|
+
Your app is set up and running. Here's what I've configured:
|
|
380
|
+
- [Framework] project with Supabase connected
|
|
381
|
+
- User authentication with [provider]
|
|
382
|
+
- Database with [N] tables, all with Row Level Security
|
|
383
|
+
- Project rules in AGENTS.md so I'll remember this setup next time
|
|
384
|
+
- MCP server so I can query your database directly
|
|
385
|
+
|
|
386
|
+
You can now ask me to add features, and I'll build on this foundation.
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Adapting to Existing Projects
|
|
390
|
+
|
|
391
|
+
If the user already has a frontend project and wants to ADD Supabase:
|
|
392
|
+
|
|
393
|
+
1. Install packages: `npm install @supabase/supabase-js @supabase/ssr`
|
|
394
|
+
2. Create env vars
|
|
395
|
+
3. Create Supabase client files (Phase 3)
|
|
396
|
+
4. Add middleware (if Next.js/SvelteKit)
|
|
397
|
+
5. Set up MCP (Phase 2)
|
|
398
|
+
6. Generate/update AGENTS.md (Phase 6)
|
|
399
|
+
|
|
400
|
+
Do NOT restructure their existing project — add Supabase to their existing patterns.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Creation Log: Systematic Debugging Skill
|
|
2
|
+
|
|
3
|
+
Reference example of extracting, structuring, and bulletproofing a critical skill.
|
|
4
|
+
|
|
5
|
+
## Source Material
|
|
6
|
+
|
|
7
|
+
Extracted debugging framework from `/Users/jesse/.claude/CLAUDE.md`:
|
|
8
|
+
- 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
|
|
9
|
+
- Core mandate: ALWAYS find root cause, NEVER fix symptoms
|
|
10
|
+
- Rules designed to resist time pressure and rationalization
|
|
11
|
+
|
|
12
|
+
## Extraction Decisions
|
|
13
|
+
|
|
14
|
+
**What to include:**
|
|
15
|
+
- Complete 4-phase framework with all rules
|
|
16
|
+
- Anti-shortcuts ("NEVER fix symptom", "STOP and re-analyze")
|
|
17
|
+
- Pressure-resistant language ("even if faster", "even if I seem in a hurry")
|
|
18
|
+
- Concrete steps for each phase
|
|
19
|
+
|
|
20
|
+
**What to leave out:**
|
|
21
|
+
- Project-specific context
|
|
22
|
+
- Repetitive variations of same rule
|
|
23
|
+
- Narrative explanations (condensed to principles)
|
|
24
|
+
|
|
25
|
+
## Structure Following skill-creation/SKILL.md
|
|
26
|
+
|
|
27
|
+
1. **Rich when_to_use** - Included symptoms and anti-patterns
|
|
28
|
+
2. **Type: technique** - Concrete process with steps
|
|
29
|
+
3. **Keywords** - "root cause", "symptom", "workaround", "debugging", "investigation"
|
|
30
|
+
4. **Flowchart** - Decision point for "fix failed" → re-analyze vs add more fixes
|
|
31
|
+
5. **Phase-by-phase breakdown** - Scannable checklist format
|
|
32
|
+
6. **Anti-patterns section** - What NOT to do (critical for this skill)
|
|
33
|
+
|
|
34
|
+
## Bulletproofing Elements
|
|
35
|
+
|
|
36
|
+
Framework designed to resist rationalization under pressure:
|
|
37
|
+
|
|
38
|
+
### Language Choices
|
|
39
|
+
- "ALWAYS" / "NEVER" (not "should" / "try to")
|
|
40
|
+
- "even if faster" / "even if I seem in a hurry"
|
|
41
|
+
- "STOP and re-analyze" (explicit pause)
|
|
42
|
+
- "Don't skip past" (catches the actual behavior)
|
|
43
|
+
|
|
44
|
+
### Structural Defenses
|
|
45
|
+
- **Phase 1 required** - Can't skip to implementation
|
|
46
|
+
- **Single hypothesis rule** - Forces thinking, prevents shotgun fixes
|
|
47
|
+
- **Explicit failure mode** - "IF your first fix doesn't work" with mandatory action
|
|
48
|
+
- **Anti-patterns section** - Shows exactly what shortcuts look like
|
|
49
|
+
|
|
50
|
+
### Redundancy
|
|
51
|
+
- Root cause mandate in overview + when_to_use + Phase 1 + implementation rules
|
|
52
|
+
- "NEVER fix symptom" appears 4 times in different contexts
|
|
53
|
+
- Each phase has explicit "don't skip" guidance
|
|
54
|
+
|
|
55
|
+
## Testing Approach
|
|
56
|
+
|
|
57
|
+
Created 4 validation tests following skills/meta/testing-skills-with-subagents:
|
|
58
|
+
|
|
59
|
+
### Test 1: Academic Context (No Pressure)
|
|
60
|
+
- Simple bug, no time pressure
|
|
61
|
+
- **Result:** Perfect compliance, complete investigation
|
|
62
|
+
|
|
63
|
+
### Test 2: Time Pressure + Obvious Quick Fix
|
|
64
|
+
- User "in a hurry", symptom fix looks easy
|
|
65
|
+
- **Result:** Resisted shortcut, followed full process, found real root cause
|
|
66
|
+
|
|
67
|
+
### Test 3: Complex System + Uncertainty
|
|
68
|
+
- Multi-layer failure, unclear if can find root cause
|
|
69
|
+
- **Result:** Systematic investigation, traced through all layers, found source
|
|
70
|
+
|
|
71
|
+
### Test 4: Failed First Fix
|
|
72
|
+
- Hypothesis doesn't work, temptation to add more fixes
|
|
73
|
+
- **Result:** Stopped, re-analyzed, formed new hypothesis (no shotgun)
|
|
74
|
+
|
|
75
|
+
**All tests passed.** No rationalizations found.
|
|
76
|
+
|
|
77
|
+
## Iterations
|
|
78
|
+
|
|
79
|
+
### Initial Version
|
|
80
|
+
- Complete 4-phase framework
|
|
81
|
+
- Anti-patterns section
|
|
82
|
+
- Flowchart for "fix failed" decision
|
|
83
|
+
|
|
84
|
+
### Enhancement 1: TDD Reference
|
|
85
|
+
- Added link to skills/testing/test-driven-development
|
|
86
|
+
- Note explaining TDD's "simplest code" ≠ debugging's "root cause"
|
|
87
|
+
- Prevents confusion between methodologies
|
|
88
|
+
|
|
89
|
+
## Final Outcome
|
|
90
|
+
|
|
91
|
+
Bulletproof skill that:
|
|
92
|
+
- ✅ Clearly mandates root cause investigation
|
|
93
|
+
- ✅ Resists time pressure rationalization
|
|
94
|
+
- ✅ Provides concrete steps for each phase
|
|
95
|
+
- ✅ Shows anti-patterns explicitly
|
|
96
|
+
- ✅ Tested under multiple pressure scenarios
|
|
97
|
+
- ✅ Clarifies relationship to TDD
|
|
98
|
+
- ✅ Ready for use
|
|
99
|
+
|
|
100
|
+
## Key Insight
|
|
101
|
+
|
|
102
|
+
**Most important bulletproofing:** Anti-patterns section showing exact shortcuts that feel justified in the moment. When Claude thinks "I'll just add this one quick fix", seeing that exact pattern listed as wrong creates cognitive friction.
|
|
103
|
+
|
|
104
|
+
## Usage Example
|
|
105
|
+
|
|
106
|
+
When encountering a bug:
|
|
107
|
+
1. Load skill: skills/debugging/systematic-debugging
|
|
108
|
+
2. Read overview (10 sec) - reminded of mandate
|
|
109
|
+
3. Follow Phase 1 checklist - forced investigation
|
|
110
|
+
4. If tempted to skip - see anti-pattern, stop
|
|
111
|
+
5. Complete all phases - root cause found
|
|
112
|
+
|
|
113
|
+
**Time investment:** 5-10 minutes
|
|
114
|
+
**Time saved:** Hours of symptom-whack-a-mole
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
*Created: 2025-10-03*
|
|
119
|
+
*Purpose: Reference example for skill extraction and bulletproofing*
|