cfsa-antigravity 2.0.0 → 2.1.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/README.md +14 -0
- package/package.json +1 -1
- package/template/.agent/instructions/commands.md +8 -32
- package/template/.agent/instructions/patterns.md +3 -3
- package/template/.agent/instructions/tech-stack.md +71 -23
- package/template/.agent/instructions/workflow.md +12 -1
- package/template/.agent/rules/completion-checklist.md +6 -0
- package/template/.agent/rules/security-first.md +3 -3
- package/template/.agent/rules/vertical-slices.md +1 -1
- package/template/.agent/skill-library/MANIFEST.md +6 -0
- package/template/.agent/skill-library/stack/devops/git-advanced/SKILL.md +972 -0
- package/template/.agent/skill-library/stack/devops/git-workflow/SKILL.md +420 -0
- package/template/.agent/skills/api-versioning/SKILL.md +44 -298
- package/template/.agent/skills/api-versioning/references/typescript.md +157 -0
- package/template/.agent/skills/architecture-mapping/SKILL.md +7 -7
- package/template/.agent/skills/bootstrap-agents/SKILL.md +151 -152
- package/template/.agent/skills/clean-code/SKILL.md +64 -118
- package/template/.agent/skills/clean-code/references/typescript.md +126 -0
- package/template/.agent/skills/database-schema-design/SKILL.md +93 -317
- package/template/.agent/skills/database-schema-design/references/relational.md +228 -0
- package/template/.agent/skills/error-handling-patterns/SKILL.md +62 -557
- package/template/.agent/skills/error-handling-patterns/references/go.md +162 -0
- package/template/.agent/skills/error-handling-patterns/references/python.md +262 -0
- package/template/.agent/skills/error-handling-patterns/references/rust.md +112 -0
- package/template/.agent/skills/error-handling-patterns/references/typescript.md +178 -0
- package/template/.agent/skills/idea-extraction/SKILL.md +119 -12
- package/template/.agent/skills/logging-best-practices/SKILL.md +108 -767
- package/template/.agent/skills/logging-best-practices/references/go.md +49 -0
- package/template/.agent/skills/logging-best-practices/references/python.md +52 -0
- package/template/.agent/skills/logging-best-practices/references/typescript.md +215 -0
- package/template/.agent/skills/migration-management/SKILL.md +127 -311
- package/template/.agent/skills/migration-management/references/relational.md +214 -0
- package/template/.agent/skills/parallel-feature-development/SKILL.md +34 -43
- package/template/.agent/skills/pipeline-rubrics/references/be-rubric.md +1 -1
- package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +1 -1
- package/template/.agent/skills/prd-templates/SKILL.md +20 -3
- package/template/.agent/skills/prd-templates/references/be-spec-template.md +2 -2
- package/template/.agent/skills/prd-templates/references/decomposition-templates.md +2 -2
- package/template/.agent/skills/prd-templates/references/fe-spec-template.md +1 -1
- package/template/.agent/skills/prd-templates/references/ideation-domain-template.md +8 -2
- package/template/.agent/skills/prd-templates/references/ideation-index-template.md +25 -1
- package/template/.agent/skills/prd-templates/references/operational-templates.md +1 -1
- package/template/.agent/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -21
- package/template/.agent/skills/prd-templates/references/skill-loading-protocol.md +32 -0
- package/template/.agent/skills/prd-templates/references/slice-completion-gates.md +21 -0
- package/template/.agent/skills/prd-templates/references/spec-coverage-sweep.md +3 -3
- package/template/.agent/skills/prd-templates/references/tdd-testing-policy.md +39 -0
- package/template/.agent/skills/prd-templates/references/vision-template.md +1 -1
- package/template/.agent/skills/regex-patterns/SKILL.md +122 -540
- package/template/.agent/skills/regex-patterns/references/go.md +44 -0
- package/template/.agent/skills/regex-patterns/references/javascript.md +63 -0
- package/template/.agent/skills/regex-patterns/references/python.md +77 -0
- package/template/.agent/skills/regex-patterns/references/rust.md +43 -0
- package/template/.agent/skills/session-continuity/SKILL.md +11 -9
- package/template/.agent/skills/session-continuity/protocols/02-progress-generation.md +2 -2
- package/template/.agent/skills/session-continuity/protocols/04-pattern-extraction.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/05-session-close.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/09-parallel-claim.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/10-placeholder-verification-gate.md +57 -78
- package/template/.agent/skills/session-continuity/protocols/11-parallel-synthesis.md +1 -1
- package/template/.agent/skills/tdd-workflow/SKILL.md +94 -317
- package/template/.agent/skills/tdd-workflow/references/typescript.md +231 -0
- package/template/.agent/skills/testing-strategist/SKILL.md +74 -687
- package/template/.agent/skills/testing-strategist/references/typescript.md +328 -0
- package/template/.agent/skills/workflow-automation/SKILL.md +62 -154
- package/template/.agent/skills/workflow-automation/references/inngest.md +88 -0
- package/template/.agent/skills/workflow-automation/references/temporal.md +64 -0
- package/template/.agent/workflows/bootstrap-agents-fill.md +85 -143
- package/template/.agent/workflows/bootstrap-agents-provision.md +90 -107
- package/template/.agent/workflows/create-prd-architecture.md +16 -14
- package/template/.agent/workflows/create-prd-compile.md +11 -12
- package/template/.agent/workflows/create-prd-design-system.md +1 -1
- package/template/.agent/workflows/create-prd-security.md +9 -11
- package/template/.agent/workflows/create-prd-stack.md +10 -4
- package/template/.agent/workflows/create-prd.md +5 -6
- package/template/.agent/workflows/decompose-architecture-structure.md +3 -5
- package/template/.agent/workflows/decompose-architecture-validate.md +18 -1
- package/template/.agent/workflows/evolve-contract.md +11 -11
- package/template/.agent/workflows/ideate-discover.md +10 -6
- package/template/.agent/workflows/ideate-extract.md +61 -4
- package/template/.agent/workflows/ideate-validate.md +3 -3
- package/template/.agent/workflows/ideate.md +2 -2
- package/template/.agent/workflows/implement-slice-setup.md +25 -23
- package/template/.agent/workflows/implement-slice-tdd.md +51 -92
- package/template/.agent/workflows/implement-slice.md +4 -4
- package/template/.agent/workflows/plan-phase-preflight.md +6 -2
- package/template/.agent/workflows/plan-phase-write.md +6 -8
- package/template/.agent/workflows/resolve-ambiguity.md +1 -1
- package/template/.agent/workflows/update-architecture-map.md +22 -5
- package/template/.agent/workflows/validate-phase.md +26 -29
- package/template/.agent/workflows/verify-infrastructure.md +10 -10
- package/template/.agent/workflows/write-architecture-spec-design.md +17 -12
- package/template/.agent/workflows/write-be-spec-classify.md +25 -21
- package/template/.agent/workflows/write-be-spec.md +1 -1
- package/template/.agent/workflows/write-fe-spec-classify.md +6 -12
- package/template/.agent/workflows/write-fe-spec-write.md +1 -1
- package/template/AGENTS.md +1 -1
- package/template/GEMINI.md +3 -3
- package/template/docs/kit-architecture.md +34 -8
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Relational Database Schema Patterns
|
|
2
|
+
|
|
3
|
+
Paradigm-specific patterns for the `database-schema-design` skill. Read `SKILL.md` first for universal methodology.
|
|
4
|
+
|
|
5
|
+
Covers: **PostgreSQL**, **MySQL**, **SQLite**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Normalization Examples
|
|
10
|
+
|
|
11
|
+
### First Normal Form (1NF) — Eliminate Repeating Groups
|
|
12
|
+
|
|
13
|
+
```sql
|
|
14
|
+
-- NOT 1NF: repeating group in single column
|
|
15
|
+
CREATE TABLE orders_bad (
|
|
16
|
+
id UUID PRIMARY KEY,
|
|
17
|
+
customer_name VARCHAR(255),
|
|
18
|
+
product_ids VARCHAR(255) -- "1,2,3" - repeating group
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- 1NF: separate table for repeating data
|
|
22
|
+
CREATE TABLE orders (
|
|
23
|
+
id UUID PRIMARY KEY,
|
|
24
|
+
customer_name VARCHAR(255),
|
|
25
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
CREATE TABLE order_items (
|
|
29
|
+
id UUID PRIMARY KEY,
|
|
30
|
+
order_id UUID NOT NULL,
|
|
31
|
+
product_id UUID NOT NULL,
|
|
32
|
+
quantity INTEGER NOT NULL,
|
|
33
|
+
FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Second Normal Form (2NF) — Remove Partial Dependencies
|
|
38
|
+
|
|
39
|
+
```sql
|
|
40
|
+
-- 2NF: separate tables for partial deps
|
|
41
|
+
CREATE TABLE enrollments (
|
|
42
|
+
id UUID PRIMARY KEY,
|
|
43
|
+
student_id UUID NOT NULL,
|
|
44
|
+
course_id UUID NOT NULL,
|
|
45
|
+
FOREIGN KEY (student_id) REFERENCES students(id),
|
|
46
|
+
FOREIGN KEY (course_id) REFERENCES courses(id),
|
|
47
|
+
UNIQUE(student_id, course_id)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
CREATE TABLE courses (
|
|
51
|
+
id UUID PRIMARY KEY,
|
|
52
|
+
name VARCHAR(255),
|
|
53
|
+
professor_id UUID NOT NULL,
|
|
54
|
+
FOREIGN KEY (professor_id) REFERENCES professors(id)
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Third Normal Form (3NF) — Remove Transitive Dependencies
|
|
59
|
+
|
|
60
|
+
```sql
|
|
61
|
+
-- 3NF: separate lookup tables
|
|
62
|
+
CREATE TABLE states (
|
|
63
|
+
id UUID PRIMARY KEY,
|
|
64
|
+
code VARCHAR(2) UNIQUE,
|
|
65
|
+
name VARCHAR(100),
|
|
66
|
+
tax_rate DECIMAL(5,3)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
CREATE TABLE orders (
|
|
70
|
+
id UUID PRIMARY KEY,
|
|
71
|
+
customer_city VARCHAR(100),
|
|
72
|
+
state_id UUID NOT NULL,
|
|
73
|
+
FOREIGN KEY (state_id) REFERENCES states(id)
|
|
74
|
+
);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Relationship Patterns
|
|
80
|
+
|
|
81
|
+
### One-to-Many
|
|
82
|
+
|
|
83
|
+
```sql
|
|
84
|
+
CREATE TABLE users (
|
|
85
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
86
|
+
email VARCHAR(255) UNIQUE NOT NULL,
|
|
87
|
+
name VARCHAR(255) NOT NULL,
|
|
88
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
CREATE TABLE orders (
|
|
92
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
93
|
+
user_id UUID NOT NULL,
|
|
94
|
+
order_date TIMESTAMP DEFAULT NOW(),
|
|
95
|
+
total DECIMAL(10,2),
|
|
96
|
+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
97
|
+
);
|
|
98
|
+
CREATE INDEX idx_orders_user_id ON orders(user_id);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### One-to-One
|
|
102
|
+
|
|
103
|
+
```sql
|
|
104
|
+
CREATE TABLE user_profiles (
|
|
105
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
106
|
+
user_id UUID UNIQUE NOT NULL,
|
|
107
|
+
bio TEXT,
|
|
108
|
+
avatar_url VARCHAR(500),
|
|
109
|
+
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
|
110
|
+
);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Many-to-Many (Junction Table)
|
|
114
|
+
|
|
115
|
+
```sql
|
|
116
|
+
CREATE TABLE course_enrollments (
|
|
117
|
+
id UUID PRIMARY KEY,
|
|
118
|
+
student_id UUID NOT NULL,
|
|
119
|
+
course_id UUID NOT NULL,
|
|
120
|
+
enrolled_at TIMESTAMP DEFAULT NOW(),
|
|
121
|
+
FOREIGN KEY (student_id) REFERENCES students(id) ON DELETE CASCADE,
|
|
122
|
+
FOREIGN KEY (course_id) REFERENCES courses(id) ON DELETE CASCADE,
|
|
123
|
+
UNIQUE(student_id, course_id)
|
|
124
|
+
);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Constraint Strategy
|
|
130
|
+
|
|
131
|
+
```sql
|
|
132
|
+
-- NOT NULL, UNIQUE, CHECK, DEFAULT
|
|
133
|
+
CREATE TABLE products (
|
|
134
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
135
|
+
name VARCHAR(255) NOT NULL,
|
|
136
|
+
sku VARCHAR(100) NOT NULL UNIQUE,
|
|
137
|
+
price DECIMAL(10,2) NOT NULL CHECK (price > 0),
|
|
138
|
+
status VARCHAR(20) NOT NULL CHECK (status IN ('active', 'archived', 'draft'))
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
CREATE TABLE audit_logs (
|
|
142
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
143
|
+
table_name VARCHAR(100) NOT NULL,
|
|
144
|
+
operation VARCHAR(10) NOT NULL,
|
|
145
|
+
user_id UUID,
|
|
146
|
+
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
147
|
+
);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Data Type Selection
|
|
153
|
+
|
|
154
|
+
### PostgreSQL
|
|
155
|
+
|
|
156
|
+
```sql
|
|
157
|
+
CREATE TABLE users (
|
|
158
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
159
|
+
email VARCHAR(255),
|
|
160
|
+
name TEXT,
|
|
161
|
+
age SMALLINT,
|
|
162
|
+
balance DECIMAL(15,2), -- Financial data (precise)
|
|
163
|
+
is_active BOOLEAN DEFAULT true,
|
|
164
|
+
birth_date DATE,
|
|
165
|
+
last_login TIMESTAMP WITH TIME ZONE,
|
|
166
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
167
|
+
metadata JSONB,
|
|
168
|
+
tags TEXT[] DEFAULT ARRAY[]::TEXT[] -- PostgreSQL arrays
|
|
169
|
+
);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### MySQL
|
|
173
|
+
|
|
174
|
+
```sql
|
|
175
|
+
CREATE TABLE users (
|
|
176
|
+
id CHAR(36) PRIMARY KEY, -- UUID as CHAR
|
|
177
|
+
email VARCHAR(255),
|
|
178
|
+
name VARCHAR(255),
|
|
179
|
+
age TINYINT UNSIGNED,
|
|
180
|
+
balance DECIMAL(15,2),
|
|
181
|
+
is_active BOOLEAN DEFAULT true,
|
|
182
|
+
birth_date DATE,
|
|
183
|
+
last_login TIMESTAMP,
|
|
184
|
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
185
|
+
metadata JSON,
|
|
186
|
+
KEY idx_email (email)
|
|
187
|
+
);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Schema Evolution
|
|
193
|
+
|
|
194
|
+
```sql
|
|
195
|
+
-- Add column with default (backward compatible)
|
|
196
|
+
ALTER TABLE users ADD COLUMN phone VARCHAR(20);
|
|
197
|
+
|
|
198
|
+
-- Add constraint on new column
|
|
199
|
+
ALTER TABLE orders ADD CONSTRAINT check_notes CHECK (LENGTH(notes) <= 500);
|
|
200
|
+
|
|
201
|
+
-- Deprecate column safely
|
|
202
|
+
ALTER TABLE users RENAME COLUMN old_field TO old_field_deprecated;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Performance: Partitioning
|
|
208
|
+
|
|
209
|
+
```sql
|
|
210
|
+
-- PostgreSQL: Partition by date range for time-series data
|
|
211
|
+
CREATE TABLE events (
|
|
212
|
+
id UUID PRIMARY KEY,
|
|
213
|
+
user_id UUID NOT NULL,
|
|
214
|
+
event_type VARCHAR(100),
|
|
215
|
+
created_at TIMESTAMP NOT NULL
|
|
216
|
+
) PARTITION BY RANGE (DATE_TRUNC('month', created_at));
|
|
217
|
+
|
|
218
|
+
CREATE TABLE events_2024_01 PARTITION OF events
|
|
219
|
+
FOR VALUES FROM ('2024-01-01') TO ('2024-02-01');
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Resources
|
|
225
|
+
|
|
226
|
+
- [PostgreSQL Data Types](https://www.postgresql.org/docs/current/datatype.html)
|
|
227
|
+
- [MySQL Data Types](https://dev.mysql.com/doc/refman/8.0/en/data-types.html)
|
|
228
|
+
- [Database Normalization Guide](https://en.wikipedia.org/wiki/Database_normalization)
|