@defai.digital/automatosx 5.0.13 → 5.1.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/CHANGELOG.md +110 -0
- package/README.md +310 -92
- package/dist/index.js +7784 -6097
- package/dist/index.js.map +1 -1
- package/dist/version.json +3 -3
- package/examples/AGENTS_INFO.md +495 -0
- package/examples/README.md +434 -0
- package/examples/abilities/accessibility.md +115 -0
- package/examples/abilities/api-design.md +159 -0
- package/examples/abilities/best-practices.md +102 -0
- package/examples/abilities/caching-strategy.md +165 -0
- package/examples/abilities/ci-cd.md +61 -0
- package/examples/abilities/code-generation.md +95 -0
- package/examples/abilities/code-review.md +42 -0
- package/examples/abilities/component-architecture.md +112 -0
- package/examples/abilities/content-creation.md +97 -0
- package/examples/abilities/data-modeling.md +171 -0
- package/examples/abilities/data-validation.md +50 -0
- package/examples/abilities/db-modeling.md +158 -0
- package/examples/abilities/debugging.md +43 -0
- package/examples/abilities/dependency-audit.md +60 -0
- package/examples/abilities/design-system-implementation.md +126 -0
- package/examples/abilities/documentation.md +54 -0
- package/examples/abilities/error-analysis.md +107 -0
- package/examples/abilities/etl-pipelines.md +44 -0
- package/examples/abilities/feasibility-study.md +20 -0
- package/examples/abilities/general-assistance.md +26 -0
- package/examples/abilities/idea-evaluation.md +21 -0
- package/examples/abilities/infra-as-code.md +57 -0
- package/examples/abilities/job-orchestration.md +44 -0
- package/examples/abilities/literature-review.md +19 -0
- package/examples/abilities/logical-analysis.md +21 -0
- package/examples/abilities/longform-report.md +25 -0
- package/examples/abilities/observability.md +61 -0
- package/examples/abilities/our-architecture-decisions.md +180 -0
- package/examples/abilities/our-code-review-checklist.md +149 -0
- package/examples/abilities/our-coding-standards.md +270 -0
- package/examples/abilities/our-project-structure.md +175 -0
- package/examples/abilities/performance-analysis.md +56 -0
- package/examples/abilities/performance.md +80 -0
- package/examples/abilities/problem-solving.md +50 -0
- package/examples/abilities/refactoring.md +49 -0
- package/examples/abilities/release-strategy.md +58 -0
- package/examples/abilities/risk-assessment.md +19 -0
- package/examples/abilities/secrets-policy.md +61 -0
- package/examples/abilities/secure-coding-review.md +51 -0
- package/examples/abilities/security-audit.md +65 -0
- package/examples/abilities/sql-optimization.md +84 -0
- package/examples/abilities/state-management.md +96 -0
- package/examples/abilities/task-planning.md +65 -0
- package/examples/abilities/technical-writing.md +77 -0
- package/examples/abilities/testing.md +47 -0
- package/examples/abilities/threat-modeling.md +49 -0
- package/examples/abilities/troubleshooting.md +80 -0
- package/examples/agents/.tmp +0 -0
- package/examples/agents/backend.yaml +69 -0
- package/examples/agents/ceo.yaml +60 -0
- package/examples/agents/cto.yaml +59 -0
- package/examples/agents/data.yaml +77 -0
- package/examples/agents/design.yaml +73 -0
- package/examples/agents/devops.yaml +82 -0
- package/examples/agents/frontend.yaml +74 -0
- package/examples/agents/product.yaml +69 -0
- package/examples/agents/quality.yaml +70 -0
- package/examples/agents/researcher.yaml +71 -0
- package/examples/agents/security.yaml +84 -0
- package/examples/agents/writer.yaml +77 -0
- package/examples/claude/commands/ax:agent.md +37 -0
- package/examples/claude/commands/ax:clear.md +22 -0
- package/examples/claude/commands/ax:init.md +25 -0
- package/examples/claude/commands/ax:list.md +19 -0
- package/examples/claude/commands/ax:memory.md +25 -0
- package/examples/claude/commands/ax:status.md +24 -0
- package/examples/claude/commands/ax:update.md +28 -0
- package/examples/claude/mcp/automatosx.json +244 -0
- package/examples/teams/business.yaml +56 -0
- package/examples/teams/core.yaml +59 -0
- package/examples/teams/design.yaml +58 -0
- package/examples/teams/engineering.yaml +69 -0
- package/examples/teams/research.yaml +56 -0
- package/examples/templates/analyst.yaml +60 -0
- package/examples/templates/assistant.yaml +48 -0
- package/examples/templates/basic-agent.yaml +28 -0
- package/examples/templates/code-reviewer.yaml +52 -0
- package/examples/templates/debugger.yaml +63 -0
- package/examples/templates/designer.yaml +69 -0
- package/examples/templates/developer.yaml +60 -0
- package/examples/templates/fullstack-developer.yaml +395 -0
- package/examples/templates/qa-specialist.yaml +71 -0
- package/examples/use-cases/01-web-app-development.md +374 -0
- package/package.json +2 -1
- package/version.json +3 -3
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Data Modeling
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Design efficient, scalable data models for relational and NoSQL databases. Focus on normalization, relationships, and schema design that supports business requirements while maintaining data integrity.
|
|
5
|
+
|
|
6
|
+
## Core Principles
|
|
7
|
+
|
|
8
|
+
### 1. Normalization (Relational)
|
|
9
|
+
Eliminate data redundancy through normal forms (1NF, 2NF, 3NF, BCNF).
|
|
10
|
+
|
|
11
|
+
### 2. Denormalization (When Needed)
|
|
12
|
+
Strategic denormalization for read-heavy workloads and performance optimization.
|
|
13
|
+
|
|
14
|
+
### 3. Schema Design Patterns
|
|
15
|
+
- **Star Schema**: Dimensional modeling for analytics (fact + dimension tables)
|
|
16
|
+
- **Snowflake Schema**: Normalized dimensional model
|
|
17
|
+
- **Data Vault**: Flexible, auditable data warehouse modeling
|
|
18
|
+
|
|
19
|
+
## Do's ✅
|
|
20
|
+
|
|
21
|
+
### Relational Data Model
|
|
22
|
+
```sql
|
|
23
|
+
-- ✅ Good: Normalized design
|
|
24
|
+
CREATE TABLE users (
|
|
25
|
+
id SERIAL PRIMARY KEY,
|
|
26
|
+
email VARCHAR(255) UNIQUE NOT NULL,
|
|
27
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
CREATE TABLE orders (
|
|
31
|
+
id SERIAL PRIMARY KEY,
|
|
32
|
+
user_id INTEGER REFERENCES users(id),
|
|
33
|
+
total_amount DECIMAL(10,2),
|
|
34
|
+
status VARCHAR(50),
|
|
35
|
+
created_at TIMESTAMP DEFAULT NOW()
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
CREATE TABLE order_items (
|
|
39
|
+
id SERIAL PRIMARY KEY,
|
|
40
|
+
order_id INTEGER REFERENCES orders(id),
|
|
41
|
+
product_id INTEGER REFERENCES products(id),
|
|
42
|
+
quantity INTEGER,
|
|
43
|
+
price DECIMAL(10,2)
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Indexes
|
|
48
|
+
```sql
|
|
49
|
+
-- ✅ Good: Index frequently queried columns
|
|
50
|
+
CREATE INDEX idx_orders_user_id ON orders(user_id);
|
|
51
|
+
CREATE INDEX idx_orders_created_at ON orders(created_at);
|
|
52
|
+
CREATE INDEX idx_order_items_order_id ON order_items(order_id);
|
|
53
|
+
|
|
54
|
+
-- ✅ Good: Composite index for multi-column queries
|
|
55
|
+
CREATE INDEX idx_orders_user_status ON orders(user_id, status);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### NoSQL Data Model (MongoDB)
|
|
59
|
+
```javascript
|
|
60
|
+
// ✅ Good: Embedded documents for one-to-few
|
|
61
|
+
{
|
|
62
|
+
_id: ObjectId("..."),
|
|
63
|
+
user_email: "user@example.com",
|
|
64
|
+
addresses: [
|
|
65
|
+
{ type: "home", street: "123 Main St", city: "NYC" },
|
|
66
|
+
{ type: "work", street: "456 Office Ave", city: "LA" }
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ✅ Good: References for one-to-many
|
|
71
|
+
// User document
|
|
72
|
+
{
|
|
73
|
+
_id: ObjectId("user123"),
|
|
74
|
+
email: "user@example.com"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Order documents (separate collection)
|
|
78
|
+
{
|
|
79
|
+
_id: ObjectId("order456"),
|
|
80
|
+
user_id: ObjectId("user123"),
|
|
81
|
+
items: [...],
|
|
82
|
+
total: 99.99
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Don'ts ❌
|
|
87
|
+
|
|
88
|
+
### Over-Normalization
|
|
89
|
+
```sql
|
|
90
|
+
-- ❌ Bad: Excessive normalization
|
|
91
|
+
CREATE TABLE user_first_names (
|
|
92
|
+
user_id INTEGER REFERENCES users(id),
|
|
93
|
+
first_name VARCHAR(100)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
CREATE TABLE user_last_names (
|
|
97
|
+
user_id INTEGER REFERENCES users(id),
|
|
98
|
+
last_name VARCHAR(100)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
-- ✅ Good: Appropriate normalization
|
|
102
|
+
CREATE TABLE users (
|
|
103
|
+
id SERIAL PRIMARY KEY,
|
|
104
|
+
first_name VARCHAR(100),
|
|
105
|
+
last_name VARCHAR(100),
|
|
106
|
+
email VARCHAR(255) UNIQUE
|
|
107
|
+
);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Missing Constraints
|
|
111
|
+
```sql
|
|
112
|
+
-- ❌ Bad: No constraints
|
|
113
|
+
CREATE TABLE orders (
|
|
114
|
+
id INTEGER,
|
|
115
|
+
user_id INTEGER,
|
|
116
|
+
total DECIMAL
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
-- ✅ Good: Proper constraints
|
|
120
|
+
CREATE TABLE orders (
|
|
121
|
+
id SERIAL PRIMARY KEY,
|
|
122
|
+
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
123
|
+
total DECIMAL(10,2) CHECK (total >= 0),
|
|
124
|
+
status VARCHAR(50) DEFAULT 'pending',
|
|
125
|
+
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
|
126
|
+
);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Embedding Large Arrays (NoSQL)
|
|
130
|
+
```javascript
|
|
131
|
+
// ❌ Bad: Unbounded array growth
|
|
132
|
+
{
|
|
133
|
+
user_id: "user123",
|
|
134
|
+
orders: [ /* Could grow to thousands */ ]
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ✅ Good: Reference pattern
|
|
138
|
+
{
|
|
139
|
+
user_id: "user123",
|
|
140
|
+
recent_orders: [ /* Last 5 orders */ ],
|
|
141
|
+
total_order_count: 1247
|
|
142
|
+
}
|
|
143
|
+
// Store full orders in separate collection
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Best Practices
|
|
147
|
+
|
|
148
|
+
### 1. Use Appropriate Data Types
|
|
149
|
+
- `TIMESTAMP` for dates (not VARCHAR)
|
|
150
|
+
- `DECIMAL` for money (not FLOAT)
|
|
151
|
+
- `ENUM` or `CHECK` constraints for fixed options
|
|
152
|
+
- `UUID` for distributed primary keys
|
|
153
|
+
|
|
154
|
+
### 2. Plan for Growth
|
|
155
|
+
- Partition large tables by date/region
|
|
156
|
+
- Use sharding for horizontal scalability
|
|
157
|
+
- Implement archival strategy for old data
|
|
158
|
+
|
|
159
|
+
### 3. Document Relationships
|
|
160
|
+
```
|
|
161
|
+
Users (1) ← (M) Orders (1) ← (M) OrderItems (M) → (1) Products
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 4. Version Schema Changes
|
|
165
|
+
Use migration tools (Flyway, Liquibase, Alembic) for schema versioning.
|
|
166
|
+
|
|
167
|
+
## Resources
|
|
168
|
+
|
|
169
|
+
- [Database Normalization](https://en.wikipedia.org/wiki/Database_normalization)
|
|
170
|
+
- [MongoDB Schema Design Patterns](https://www.mongodb.com/blog/post/building-with-patterns-a-summary)
|
|
171
|
+
- [PostgreSQL Documentation](https://www.postgresql.org/docs/)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Data Validation
|
|
2
|
+
|
|
3
|
+
Implement comprehensive data quality checks to ensure accuracy, completeness, and consistency. Catch data issues early before they impact downstream systems.
|
|
4
|
+
|
|
5
|
+
## Do's ✅
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
# ✅ Good: Schema validation with Pydantic
|
|
9
|
+
from pydantic import BaseModel, validator
|
|
10
|
+
|
|
11
|
+
class UserRecord(BaseModel):
|
|
12
|
+
id: int
|
|
13
|
+
email: str
|
|
14
|
+
age: int
|
|
15
|
+
|
|
16
|
+
@validator('email')
|
|
17
|
+
def email_must_be_valid(cls, v):
|
|
18
|
+
if '@' not in v:
|
|
19
|
+
raise ValueError('Invalid email')
|
|
20
|
+
return v
|
|
21
|
+
|
|
22
|
+
# ✅ Good: Data quality checks
|
|
23
|
+
def validate_data(df):
|
|
24
|
+
checks = [
|
|
25
|
+
('No nulls', df[['id', 'email']].notnull().all().all()),
|
|
26
|
+
('Unique IDs', df['id'].is_unique),
|
|
27
|
+
('Valid ages', df['age'].between(0, 150).all()),
|
|
28
|
+
]
|
|
29
|
+
failed = [check for check, passed in checks if not passed]
|
|
30
|
+
if failed:
|
|
31
|
+
raise ValueError(f"Validation failed: {failed}")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Don'ts ❌
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
# ❌ Bad: No validation
|
|
38
|
+
df = pd.read_csv('data.csv')
|
|
39
|
+
df.to_sql('users', engine) # Hope for the best!
|
|
40
|
+
|
|
41
|
+
# ❌ Bad: Silent failures
|
|
42
|
+
df = df.dropna() # What was dropped? Why?
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Best Practices
|
|
46
|
+
- Define data quality SLAs
|
|
47
|
+
- Implement continuous monitoring
|
|
48
|
+
- Document validation rules
|
|
49
|
+
- Use validation frameworks (Great Expectations, Pandera)
|
|
50
|
+
- Create data quality dashboards
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Database Modeling
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Design efficient, scalable, and maintainable database schemas for relational and NoSQL databases, focusing on data integrity, performance, and evolution.
|
|
5
|
+
|
|
6
|
+
## Core Principles
|
|
7
|
+
|
|
8
|
+
### 1. Normalization & Denormalization
|
|
9
|
+
- 3NF for transactional systems
|
|
10
|
+
- Strategic denormalization for read-heavy workloads
|
|
11
|
+
- Balance between data integrity and query performance
|
|
12
|
+
|
|
13
|
+
### 2. Data Integrity
|
|
14
|
+
- Primary keys on all tables
|
|
15
|
+
- Foreign key constraints
|
|
16
|
+
- Check constraints for data validation
|
|
17
|
+
- Unique constraints for business rules
|
|
18
|
+
|
|
19
|
+
### 3. Indexing Strategy
|
|
20
|
+
- Primary key indexes (clustered)
|
|
21
|
+
- Secondary indexes for frequent queries
|
|
22
|
+
- Composite indexes for multi-column filters
|
|
23
|
+
- Index maintenance and statistics
|
|
24
|
+
|
|
25
|
+
### 4. Schema Evolution
|
|
26
|
+
- Migration strategy (forward-only)
|
|
27
|
+
- Backward compatibility during deploys
|
|
28
|
+
- Column additions vs. breaking changes
|
|
29
|
+
- Versioning for schema changes
|
|
30
|
+
|
|
31
|
+
## Relational Database Design
|
|
32
|
+
|
|
33
|
+
### Table Design Essentials
|
|
34
|
+
- Primary key (BIGSERIAL, UUID)
|
|
35
|
+
- Timestamps (created_at, updated_at)
|
|
36
|
+
- Soft delete (deleted_at)
|
|
37
|
+
- Proper data types
|
|
38
|
+
|
|
39
|
+
### Relationship Patterns
|
|
40
|
+
- One-to-Many: Foreign key in child table
|
|
41
|
+
- Many-to-Many: Junction table with composite primary key
|
|
42
|
+
- One-to-One: Rare; consider column addition instead
|
|
43
|
+
|
|
44
|
+
### Partitioning Strategies
|
|
45
|
+
- Range partitioning (dates, IDs)
|
|
46
|
+
- List partitioning (regions, categories)
|
|
47
|
+
- Hash partitioning (even distribution)
|
|
48
|
+
- When to partition: >10M rows, predictable access patterns
|
|
49
|
+
|
|
50
|
+
## NoSQL Design Patterns
|
|
51
|
+
|
|
52
|
+
### Document Stores (MongoDB, DynamoDB)
|
|
53
|
+
- Embed vs. reference decision tree
|
|
54
|
+
- Avoid unbounded arrays
|
|
55
|
+
- Duplicate data strategically
|
|
56
|
+
- Query pattern drives schema
|
|
57
|
+
|
|
58
|
+
### Key-Value Stores (Redis, DynamoDB)
|
|
59
|
+
- Compound key design
|
|
60
|
+
- TTL for expiring data
|
|
61
|
+
- Secondary indexes trade-offs
|
|
62
|
+
|
|
63
|
+
### Graph Databases (Neo4j)
|
|
64
|
+
- Node and relationship properties
|
|
65
|
+
- Index on frequently queried properties
|
|
66
|
+
- Cypher query optimization
|
|
67
|
+
|
|
68
|
+
## Performance Optimization
|
|
69
|
+
|
|
70
|
+
### Query Performance
|
|
71
|
+
- EXPLAIN ANALYZE for execution plans
|
|
72
|
+
- Index usage verification
|
|
73
|
+
- Avoid N+1 queries (eager loading)
|
|
74
|
+
- Connection pooling configuration
|
|
75
|
+
|
|
76
|
+
### Write Optimization
|
|
77
|
+
- Batch inserts for bulk data
|
|
78
|
+
- Async writes for non-critical data
|
|
79
|
+
- Write-ahead logging (WAL) tuning
|
|
80
|
+
|
|
81
|
+
### Read Optimization
|
|
82
|
+
- Read replicas for scaling
|
|
83
|
+
- Query result caching
|
|
84
|
+
- Materialized views for complex aggregations
|
|
85
|
+
|
|
86
|
+
## Data Types Best Practices
|
|
87
|
+
|
|
88
|
+
### Choosing Types
|
|
89
|
+
- VARCHAR vs. TEXT vs. CHAR
|
|
90
|
+
- INTEGER vs. BIGINT (consider growth)
|
|
91
|
+
- DECIMAL for money (never FLOAT)
|
|
92
|
+
- TIMESTAMPTZ for dates (always use timezone)
|
|
93
|
+
- JSON/JSONB for semi-structured data
|
|
94
|
+
|
|
95
|
+
### Type Performance
|
|
96
|
+
- Smaller types = better performance
|
|
97
|
+
- Fixed-length types for indexes
|
|
98
|
+
- Avoid TEXT in WHERE clauses without indexes
|
|
99
|
+
|
|
100
|
+
## Migration Strategies
|
|
101
|
+
|
|
102
|
+
### Safe Migration Patterns
|
|
103
|
+
1. Add nullable column → Backfill → Add NOT NULL
|
|
104
|
+
2. Create new table → Dual write → Swap → Drop old
|
|
105
|
+
3. Add index CONCURRENTLY (PostgreSQL)
|
|
106
|
+
4. Rename via view (zero-downtime)
|
|
107
|
+
|
|
108
|
+
### Rollback Strategies
|
|
109
|
+
- Idempotent migrations
|
|
110
|
+
- Reversible changes
|
|
111
|
+
- Feature flags for data migrations
|
|
112
|
+
- Separate schema and data migrations
|
|
113
|
+
|
|
114
|
+
## Security & Compliance
|
|
115
|
+
|
|
116
|
+
### Access Control
|
|
117
|
+
- Principle of least privilege
|
|
118
|
+
- Row-level security (RLS)
|
|
119
|
+
- Column-level permissions
|
|
120
|
+
- Audit logging for sensitive data
|
|
121
|
+
|
|
122
|
+
### Data Encryption
|
|
123
|
+
- Encryption at rest
|
|
124
|
+
- Encryption in transit (SSL/TLS)
|
|
125
|
+
- Column-level encryption for PII
|
|
126
|
+
- Key rotation policies
|
|
127
|
+
|
|
128
|
+
### GDPR/Privacy
|
|
129
|
+
- Soft delete vs. hard delete
|
|
130
|
+
- Data retention policies
|
|
131
|
+
- PII identification and protection
|
|
132
|
+
- Right to be forgotten implementation
|
|
133
|
+
|
|
134
|
+
## Common Patterns
|
|
135
|
+
|
|
136
|
+
### Soft Delete
|
|
137
|
+
Use `deleted_at` timestamp with partial index
|
|
138
|
+
|
|
139
|
+
### Audit Trails
|
|
140
|
+
Track created_at, created_by, updated_at, updated_by
|
|
141
|
+
|
|
142
|
+
### Status/State Machine
|
|
143
|
+
Use CHECK constraints for valid states
|
|
144
|
+
|
|
145
|
+
## Design Checklist
|
|
146
|
+
|
|
147
|
+
- [ ] All tables have primary keys
|
|
148
|
+
- [ ] Foreign key constraints defined
|
|
149
|
+
- [ ] Indexes cover frequent query patterns
|
|
150
|
+
- [ ] Data types appropriately sized
|
|
151
|
+
- [ ] Nullable columns justified
|
|
152
|
+
- [ ] Constraints enforce business rules
|
|
153
|
+
- [ ] Migration scripts tested
|
|
154
|
+
- [ ] Rollback plan documented
|
|
155
|
+
- [ ] Performance testing completed
|
|
156
|
+
- [ ] Schema documented
|
|
157
|
+
- [ ] Backup/restore verified
|
|
158
|
+
- [ ] Security audit completed
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Debugging Ability
|
|
2
|
+
|
|
3
|
+
Systematically identify and fix bugs in code.
|
|
4
|
+
|
|
5
|
+
## Debugging Process
|
|
6
|
+
|
|
7
|
+
1. **Reproduce** the issue
|
|
8
|
+
- Understand error messages
|
|
9
|
+
- Identify conditions that trigger the bug
|
|
10
|
+
- Create minimal reproduction case
|
|
11
|
+
|
|
12
|
+
2. **Investigate** the problem
|
|
13
|
+
- Read stack traces carefully
|
|
14
|
+
- Add logging and breakpoints
|
|
15
|
+
- Check recent changes (git diff)
|
|
16
|
+
- Verify assumptions
|
|
17
|
+
|
|
18
|
+
3. **Isolate** the root cause
|
|
19
|
+
- Use binary search (comment out code blocks)
|
|
20
|
+
- Test components individually
|
|
21
|
+
- Check inputs and outputs
|
|
22
|
+
- Trace execution flow
|
|
23
|
+
|
|
24
|
+
4. **Fix** the bug
|
|
25
|
+
- Implement targeted fix
|
|
26
|
+
- Avoid introducing new bugs
|
|
27
|
+
- Update related code if needed
|
|
28
|
+
- Add regression test
|
|
29
|
+
|
|
30
|
+
5. **Verify** the solution
|
|
31
|
+
- Test the fix thoroughly
|
|
32
|
+
- Check for side effects
|
|
33
|
+
- Run full test suite
|
|
34
|
+
- Document the fix
|
|
35
|
+
|
|
36
|
+
## Common Bug Types
|
|
37
|
+
|
|
38
|
+
- Off-by-one errors
|
|
39
|
+
- Null/undefined reference errors
|
|
40
|
+
- Race conditions and timing issues
|
|
41
|
+
- Type mismatches
|
|
42
|
+
- Resource leaks (memory, file handles)
|
|
43
|
+
- Logic errors in conditionals
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Dependency Audit
|
|
2
|
+
|
|
3
|
+
Scan and manage third-party dependencies for known vulnerabilities. Keep dependencies updated and minimize supply chain risks.
|
|
4
|
+
|
|
5
|
+
## Do's ✅
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# ✅ Good: Regular scanning
|
|
9
|
+
npm audit
|
|
10
|
+
npm audit fix
|
|
11
|
+
|
|
12
|
+
npx snyk test
|
|
13
|
+
npx snyk monitor
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
# ✅ Good: Automated CI scanning
|
|
18
|
+
name: Security
|
|
19
|
+
on: [push, pull_request]
|
|
20
|
+
jobs:
|
|
21
|
+
security:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v3
|
|
25
|
+
- name: Run Snyk
|
|
26
|
+
uses: snyk/actions/node@master
|
|
27
|
+
env:
|
|
28
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
// ✅ Good: Pin versions
|
|
33
|
+
{
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"express": "4.18.2"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Don'ts ❌
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# ❌ Bad: Ignoring warnings
|
|
44
|
+
npm audit
|
|
45
|
+
# 15 vulnerabilities found
|
|
46
|
+
# (deploys anyway)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
// ❌ Bad: Unmaintained packages
|
|
51
|
+
const pkg = require('abandoned-library'); // Last update 5 years ago
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Best Practices
|
|
55
|
+
- Run `npm audit` in CI pipeline
|
|
56
|
+
- Use Dependabot/Renovate for auto-updates
|
|
57
|
+
- Review changelogs before updating
|
|
58
|
+
- Have rollback plan
|
|
59
|
+
- Monitor security advisories
|
|
60
|
+
- Use minimal dependencies
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Design System Implementation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Implement and maintain consistent design systems using tokens, components, and documentation. Ensure brand consistency and developer efficiency across the application.
|
|
5
|
+
|
|
6
|
+
## Core Concepts
|
|
7
|
+
|
|
8
|
+
### Design Tokens
|
|
9
|
+
Centralized design decisions (colors, typography, spacing) as code.
|
|
10
|
+
|
|
11
|
+
**Token Categories**:
|
|
12
|
+
- Colors (primary, secondary, success, danger)
|
|
13
|
+
- Spacing (xs, sm, md, lg, xl)
|
|
14
|
+
- Typography (font families, sizes)
|
|
15
|
+
- Breakpoints (mobile, tablet, desktop)
|
|
16
|
+
|
|
17
|
+
### Theme System
|
|
18
|
+
- Light/Dark theme support
|
|
19
|
+
- Consistent color schemes
|
|
20
|
+
- Themeable components
|
|
21
|
+
- Runtime theme switching
|
|
22
|
+
|
|
23
|
+
## Component Library Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/design-system
|
|
27
|
+
/tokens
|
|
28
|
+
colors.ts
|
|
29
|
+
spacing.ts
|
|
30
|
+
typography.ts
|
|
31
|
+
/components
|
|
32
|
+
/Button
|
|
33
|
+
Button.tsx
|
|
34
|
+
Button.test.tsx
|
|
35
|
+
Button.stories.tsx
|
|
36
|
+
/Input
|
|
37
|
+
/Card
|
|
38
|
+
/hooks
|
|
39
|
+
useTheme.ts
|
|
40
|
+
/utils
|
|
41
|
+
themed.ts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Best Practices
|
|
45
|
+
|
|
46
|
+
### 1. Use Design Tokens
|
|
47
|
+
- Reference tokens, not magic values
|
|
48
|
+
- Maintain consistency across app
|
|
49
|
+
- Single source of truth
|
|
50
|
+
|
|
51
|
+
### 2. Variant System
|
|
52
|
+
- Consistent variants (primary, secondary, ghost)
|
|
53
|
+
- Size variants (sm, md, lg)
|
|
54
|
+
- Type-safe props
|
|
55
|
+
|
|
56
|
+
### 3. Component Composition
|
|
57
|
+
- Build complex components from simpler ones
|
|
58
|
+
- Reusable building blocks
|
|
59
|
+
- Clear component hierarchy
|
|
60
|
+
|
|
61
|
+
### 4. Accessibility First
|
|
62
|
+
- Include ARIA attributes
|
|
63
|
+
- Keyboard navigation
|
|
64
|
+
- Screen reader support
|
|
65
|
+
- Color contrast compliance
|
|
66
|
+
|
|
67
|
+
### 5. Responsive Design
|
|
68
|
+
- Use responsive tokens
|
|
69
|
+
- Breakpoint consistency
|
|
70
|
+
- Mobile-first approach
|
|
71
|
+
|
|
72
|
+
### 6. Documentation
|
|
73
|
+
- Storybook for components
|
|
74
|
+
- Usage examples
|
|
75
|
+
- Props documentation
|
|
76
|
+
- Visual regression tests
|
|
77
|
+
|
|
78
|
+
## Do's ✅
|
|
79
|
+
|
|
80
|
+
- Use design tokens consistently
|
|
81
|
+
- Create variant systems for flexibility
|
|
82
|
+
- Document all components in Storybook
|
|
83
|
+
- Test accessibility requirements
|
|
84
|
+
- Maintain component library structure
|
|
85
|
+
- Version components properly
|
|
86
|
+
|
|
87
|
+
## Don'ts ❌
|
|
88
|
+
|
|
89
|
+
### Inconsistent Spacing
|
|
90
|
+
Avoid random spacing values—use spacing scale
|
|
91
|
+
|
|
92
|
+
### Hardcoded Colors
|
|
93
|
+
Use semantic color names from tokens
|
|
94
|
+
|
|
95
|
+
### Component Duplication
|
|
96
|
+
Single component with variants > multiple implementations
|
|
97
|
+
|
|
98
|
+
### Missing Documentation
|
|
99
|
+
Every component needs Storybook stories
|
|
100
|
+
|
|
101
|
+
## Component Checklist
|
|
102
|
+
|
|
103
|
+
- [ ] Uses design tokens
|
|
104
|
+
- [ ] Has variant system
|
|
105
|
+
- [ ] TypeScript interfaces defined
|
|
106
|
+
- [ ] Accessibility attributes included
|
|
107
|
+
- [ ] Responsive design implemented
|
|
108
|
+
- [ ] Storybook stories created
|
|
109
|
+
- [ ] Unit tests written
|
|
110
|
+
- [ ] Visual regression tests
|
|
111
|
+
- [ ] Documentation complete
|
|
112
|
+
- [ ] Breaking changes versioned
|
|
113
|
+
|
|
114
|
+
## Tools
|
|
115
|
+
|
|
116
|
+
- **Storybook**: Component documentation and testing
|
|
117
|
+
- **Styled Components / Tailwind**: Styling solutions
|
|
118
|
+
- **Figma**: Design source of truth
|
|
119
|
+
- **Chromatic**: Visual regression testing
|
|
120
|
+
|
|
121
|
+
## Resources
|
|
122
|
+
|
|
123
|
+
- [Material Design System](https://m3.material.io/)
|
|
124
|
+
- [Ant Design](https://ant.design/)
|
|
125
|
+
- [Chakra UI](https://chakra-ui.com/)
|
|
126
|
+
- [Radix UI](https://www.radix-ui.com/)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Documentation Ability
|
|
2
|
+
|
|
3
|
+
Create clear, comprehensive, and useful documentation.
|
|
4
|
+
|
|
5
|
+
## Documentation Types
|
|
6
|
+
|
|
7
|
+
1. **API Documentation**
|
|
8
|
+
- Function/method signatures
|
|
9
|
+
- Parameters and return values
|
|
10
|
+
- Usage examples
|
|
11
|
+
- Error conditions
|
|
12
|
+
|
|
13
|
+
2. **README Files**
|
|
14
|
+
- Project overview
|
|
15
|
+
- Installation instructions
|
|
16
|
+
- Quick start guide
|
|
17
|
+
- Links to detailed docs
|
|
18
|
+
|
|
19
|
+
3. **User Guides**
|
|
20
|
+
- Feature explanations
|
|
21
|
+
- Step-by-step tutorials
|
|
22
|
+
- Screenshots and diagrams
|
|
23
|
+
- Troubleshooting section
|
|
24
|
+
|
|
25
|
+
4. **Technical Specifications**
|
|
26
|
+
- Architecture overview
|
|
27
|
+
- Design decisions
|
|
28
|
+
- System requirements
|
|
29
|
+
- API contracts
|
|
30
|
+
|
|
31
|
+
5. **Code Comments**
|
|
32
|
+
- Explain why (not what)
|
|
33
|
+
- Document complex logic
|
|
34
|
+
- Add TODOs and FIXMEs
|
|
35
|
+
- Use JSDoc/docstrings
|
|
36
|
+
|
|
37
|
+
## Writing Principles
|
|
38
|
+
|
|
39
|
+
- **Clarity**: Use simple, direct language
|
|
40
|
+
- **Completeness**: Cover all necessary information
|
|
41
|
+
- **Accuracy**: Keep docs up to date
|
|
42
|
+
- **Usability**: Structure for easy navigation
|
|
43
|
+
- **Examples**: Show, don't just tell
|
|
44
|
+
|
|
45
|
+
## Documentation Checklist
|
|
46
|
+
|
|
47
|
+
- [ ] Project purpose clear
|
|
48
|
+
- [ ] Installation steps complete
|
|
49
|
+
- [ ] Usage examples included
|
|
50
|
+
- [ ] API documented
|
|
51
|
+
- [ ] Configuration options explained
|
|
52
|
+
- [ ] Troubleshooting guide provided
|
|
53
|
+
- [ ] Links to related resources
|
|
54
|
+
- [ ] Version/changelog maintained
|