Skip to content

Agent Zero AI framework

cleanup builtin skills

frdeld8ad556b8bf6
diff --git a/skills/api-development/SKILL.md b/skills/api-development/SKILL.md
deleted file mode 100644
index f57aee8d6..000000000
--- a/skills/api-development/SKILL.md
+++ /dev/null
@@ -1,385 +0,0 @@
----
-name: "api-development"
-description: "Best practices for designing and implementing RESTful and GraphQL APIs. Use when building, designing, or reviewing APIs."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["api", "rest", "graphql", "design", "backend", "web"]
-trigger_patterns:
- - "api"
- - "endpoint"
- - "rest"
- - "graphql"
- - "http"
----
-
-# API Development Skill
-
-Best practices for designing, implementing, and documenting APIs.
-
-## RESTful API Design
-
-### URL Structure
-
-```
-https://api.example.com/v1/resources/{id}/subresources
-```
-
-**Guidelines:**
-- Use nouns, not verbs: `/users` not `/getUsers`
-- Use plural nouns: `/users` not `/user`
-- Use kebab-case: `/user-profiles` not `/userProfiles`
-- Nest resources logically: `/users/{id}/orders`
-- Version your API: `/v1/`, `/v2/`
-
-### HTTP Methods
-
-| Method | Purpose | Example |
-|--------|---------|---------|
-| `GET` | Retrieve resource(s) | `GET /users/123` |
-| `POST` | Create resource | `POST /users` |
-| `PUT` | Replace resource | `PUT /users/123` |
-| `PATCH` | Partial update | `PATCH /users/123` |
-| `DELETE` | Remove resource | `DELETE /users/123` |
-
-### Status Codes
-
-| Code | Meaning | When to Use |
-|------|---------|-------------|
-| `200 OK` | Success | GET, PUT, PATCH success |
-| `201 Created` | Resource created | POST success |
-| `204 No Content` | Success, no body | DELETE success |
-| `400 Bad Request` | Invalid input | Validation failed |
-| `401 Unauthorized` | Not authenticated | Missing/invalid token |
-| `403 Forbidden` | Not authorized | Insufficient permissions |
-| `404 Not Found` | Resource not found | ID doesn't exist |
-| `409 Conflict` | Resource conflict | Duplicate entry |
-| `422 Unprocessable` | Semantic error | Valid syntax, invalid data |
-| `429 Too Many` | Rate limited | Exceeded request limit |
-| `500 Server Error` | Internal error | Unexpected failure |
-
-### Request/Response Format
-
-**Request:**
-```http
-POST /api/v1/users HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer <token>
-
-{
- "email": "[email protected]",
- "name": "John Doe",
- "role": "user"
-}
-```
-
-**Success Response:**
-```json
-{
- "data": {
- "id": "123",
- "email": "[email protected]",
- "name": "John Doe",
- "role": "user",
- "created_at": "2024-01-15T10:30:00Z"
- },
- "meta": {
- "request_id": "abc-123"
- }
-}
-```
-
-**Error Response:**
-```json
-{
- "error": {
- "code": "VALIDATION_ERROR",
- "message": "Invalid input data",
- "details": [
- {
- "field": "email",
- "message": "Invalid email format"
- }
- ]
- },
- "meta": {
- "request_id": "abc-123"
- }
-}
-```
-
-### Pagination
-
-**Request:**
-```http
-GET /api/v1/users?page=2&per_page=20
-```
-
-**Response:**
-```json
-{
- "data": [...],
- "meta": {
- "current_page": 2,
- "per_page": 20,
- "total_pages": 10,
- "total_count": 195
- },
- "links": {
- "first": "/api/v1/users?page=1&per_page=20",
- "prev": "/api/v1/users?page=1&per_page=20",
- "next": "/api/v1/users?page=3&per_page=20",
- "last": "/api/v1/users?page=10&per_page=20"
- }
-}
-```
-
-### Filtering & Sorting
-
-```http
-# Filtering
-GET /api/v1/users?status=active&role=admin
-
-# Sorting
-GET /api/v1/users?sort=created_at&order=desc
-
-# Multiple sort fields
-GET /api/v1/users?sort=-created_at,name
-```
-
-### Field Selection
-
-```http
-GET /api/v1/users?fields=id,name,email
-```
-
-## Authentication
-
-### JWT (JSON Web Token)
-
-```javascript
-// Token structure
-{
- "header": {
- "alg": "HS256",
- "typ": "JWT"
- },
- "payload": {
- "sub": "user_123",
- "email": "[email protected]",
- "role": "admin",
- "iat": 1516239022,
- "exp": 1516242622
- },
- "signature": "..."
-}
-```
-
-**Implementation:**
-
-```python
-# Python example with PyJWT
-import jwt
-from datetime import datetime, timedelta
-
-def create_token(user_id: str, secret: str) -> str:
- payload = {
- "sub": user_id,
- "iat": datetime.utcnow(),
- "exp": datetime.utcnow() + timedelta(hours=1)
- }
- return jwt.encode(payload, secret, algorithm="HS256")
-
-def verify_token(token: str, secret: str) -> dict:
- try:
- return jwt.decode(token, secret, algorithms=["HS256"])
- except jwt.ExpiredSignatureError:
- raise AuthError("Token expired")
- except jwt.InvalidTokenError:
- raise AuthError("Invalid token")
-```
-
-### API Keys
-
-```http
-# Header
-Authorization: Api-Key <key>
-
-# Query param (less secure)
-GET /api/v1/resource?api_key=<key>
-```
-
-## Rate Limiting
-
-**Headers:**
-```http
-X-RateLimit-Limit: 1000
-X-RateLimit-Remaining: 999
-X-RateLimit-Reset: 1609459200
-```
-
-**Implementation:**
-```python
-from functools import wraps
-import time
-
-class RateLimiter:
- def __init__(self, max_requests: int, window_seconds: int):
- self.max_requests = max_requests
- self.window = window_seconds
- self.requests = {}
-
- def is_allowed(self, client_id: str) -> bool:
- now = time.time()
- window_start = now - self.window
-
- # Clean old requests
- self.requests[client_id] = [
- t for t in self.requests.get(client_id, [])
- if t > window_start
- ]
-
- if len(self.requests[client_id]) >= self.max_requests:
- return False
-
- self.requests[client_id].append(now)
- return True
-```
-
-## Input Validation
-
-```python
-from pydantic import BaseModel, EmailStr, validator
-
-class CreateUserRequest(BaseModel):
- email: EmailStr
- name: str
- age: int
-
- @validator('name')
- def name_not_empty(cls, v):
- if not v.strip():
- raise ValueError('Name cannot be empty')
- return v.strip()
-
- @validator('age')
- def age_valid(cls, v):
- if v < 0 or v > 150:
- raise ValueError('Age must be between 0 and 150')
- return v
-```
-
-## Error Handling
-
-```python
-class APIError(Exception):
- def __init__(self, code: str, message: str, status_code: int = 400):
- self.code = code
- self.message = message
- self.status_code = status_code
-
-def handle_api_error(error):
- return jsonify({
- "error": {
- "code": error.code,
- "message": error.message
- }
- }), error.status_code
-
-# Usage
-raise APIError("USER_NOT_FOUND", "User with ID 123 not found", 404)
-```
-
-## API Documentation
-
-### OpenAPI/Swagger Example
-
-```yaml
-openapi: 3.0.0
-info:
- title: User API
- version: 1.0.0
-
-paths:
- /users:
- get:
- summary: List all users
- parameters:
- - name: page
- in: query
- schema:
- type: integer
- default: 1
- responses:
- '200':
- description: Successful response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/UserList'
- post:
- summary: Create a user
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreateUser'
- responses:
- '201':
- description: User created
-
-components:
- schemas:
- User:
- type: object
- properties:
- id:
- type: string
- email:
- type: string
- name:
- type: string
-```
-
-## Security Checklist
-
-```markdown
-- [ ] Use HTTPS only
-- [ ] Validate all input
-- [ ] Sanitize output
-- [ ] Use parameterized queries
-- [ ] Implement rate limiting
-- [ ] Use secure headers (CORS, CSP)
-- [ ] Don't expose internal errors
-- [ ] Log security events
-- [ ] Rotate secrets regularly
-- [ ] Version your API
-```
-
-## Performance Tips
-
-1. **Use caching headers**
- ```http
- Cache-Control: max-age=3600
- ETag: "abc123"
- ```
-
-2. **Implement compression**
- ```http
- Accept-Encoding: gzip
- Content-Encoding: gzip
- ```
-
-3. **Use pagination** for large datasets
-
-4. **Implement field selection** to reduce payload
-
-5. **Consider async processing** for long operations
- ```json
- {
- "status": "processing",
- "job_id": "job_123",
- "check_url": "/api/v1/jobs/job_123"
- }
- ```
diff --git a/skills/brainstorming/SKILL.md b/skills/brainstorming/SKILL.md
deleted file mode 100644
index 71aaa8ffe..000000000
--- a/skills/brainstorming/SKILL.md
+++ /dev/null
@@ -1,123 +0,0 @@
----
-name: "brainstorming"
-description: "Structured brainstorming and requirements exploration before implementation. Use this BEFORE any creative work like building features, creating components, or adding functionality."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["planning", "design", "requirements", "architecture", "creative"]
-trigger_patterns:
- - "create"
- - "build"
- - "implement"
- - "add feature"
- - "design"
- - "develop"
----
-
-# Brainstorming Skill
-
-**CRITICAL**: Use this skill BEFORE writing any implementation code. This ensures proper requirements exploration and design alignment.
-
-## When to Use
-
-Activate this skill when you encounter:
-- "Create a new feature..."
-- "Build a component that..."
-- "Implement X functionality..."
-- "Add support for..."
-- "Design a system that..."
-
-## The Brainstorming Process
-
-### Phase 1: Understanding Intent (5 questions max)
-
-Ask clarifying questions to understand:
-
-1. **Goal Clarity**: What specific outcome does the user want?
-2. **Context**: What existing code/systems does this interact with?
-3. **Constraints**: Are there performance, security, or compatibility requirements?
-4. **Edge Cases**: What happens in failure scenarios?
-5. **Success Criteria**: How will we know it's working correctly?
-
-### Phase 2: Design Options
-
-Present 2-3 implementation approaches with trade-offs:
-
-```markdown
-## Option A: [Name]
-**Approach**: Brief description
-**Pros**: List benefits
-**Cons**: List drawbacks
-**Best for**: When to choose this
-
-## Option B: [Name]
-**Approach**: Brief description
-**Pros**: List benefits
-**Cons**: List drawbacks
-**Best for**: When to choose this
-```
-
-### Phase 3: Technical Specification
-
-Once approach is chosen, document:
-
-1. **Files to Create/Modify**: List with brief description
-2. **Dependencies**: External packages or internal modules needed
-3. **Data Flow**: How data moves through the system
-4. **API Contracts**: Input/output specifications
-5. **Test Strategy**: How this will be tested
-
-### Phase 4: Implementation Plan
-
-Break down into ordered tasks:
-
-```markdown
-## Implementation Tasks
-1. [ ] Task 1 - Description
-2. [ ] Task 2 - Description (depends on 1)
-3. [ ] Task 3 - Description
-4. [ ] Task 4 - Integration testing
-```
-
-## Anti-Patterns to Avoid
-
-- **Jumping to Code**: Never start coding without understanding requirements
-- **Single Solution Bias**: Always consider at least 2 approaches
-- **Ignoring Context**: Always examine existing patterns in the codebase
-- **Over-Engineering**: Keep solutions proportional to the problem
-- **Under-Specifying**: Be specific enough that implementation is clear
-
-## Example Session
-
-**User**: "Add dark mode to the application"
-
-**Agent Response**:
-> Before implementing dark mode, let me understand your requirements:
->
-> 1. **Scope**: Should this apply to the entire application or specific sections?
-> 2. **Toggle**: How should users switch modes? (button, system preference, both?)
-> 3. **Persistence**: Should the preference be saved across sessions?
-> 4. **Theming Approach**: Do you have existing CSS variables, or should we create a new theme system?
-> 5. **Transition**: Should there be smooth transitions when switching modes?
-
-## Output Format
-
-After brainstorming, provide a clear summary:
-
-```markdown
-## Summary: [Feature Name]
-
-### Chosen Approach
-[Brief description of selected approach]
-
-### Key Decisions
-- Decision 1: Rationale
-- Decision 2: Rationale
-
-### Implementation Tasks
-1. Task 1
-2. Task 2
-3. Task 3
-
-### Ready to Implement
-Confirm with user before proceeding to implementation.
-```
diff --git a/skills/code-review/SKILL.md b/skills/code-review/SKILL.md
deleted file mode 100644
index be55b579b..000000000
--- a/skills/code-review/SKILL.md
+++ /dev/null
@@ -1,272 +0,0 @@
----
-name: "code-review"
-description: "Comprehensive code review skill for analyzing code quality, identifying issues, and suggesting improvements. Use when reviewing PRs or checking code quality."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["review", "quality", "security", "best-practices", "pr"]
-trigger_patterns:
- - "review"
- - "check code"
- - "code quality"
- - "pull request"
- - "PR"
----
-
-# Code Review Skill
-
-**Goal**: Provide actionable, constructive feedback that improves code quality.
-
-## Review Categories
-
-### 1. Correctness
-- Does the code do what it's supposed to?
-- Are there logic errors?
-- Are edge cases handled?
-
-### 2. Security
-- Input validation
-- Authentication/authorization
-- SQL injection, XSS prevention
-- Secrets exposure
-
-### 3. Performance
-- Algorithmic complexity
-- Database query efficiency
-- Memory usage
-- Caching opportunities
-
-### 4. Maintainability
-- Code readability
-- Naming conventions
-- Documentation
-- Single responsibility
-
-### 5. Testing
-- Test coverage
-- Test quality
-- Edge case testing
-
-## Review Process
-
-### Phase 1: Understand Context
-
-Before reviewing:
-1. What is the purpose of this change?
-2. What problem is it solving?
-3. What are the requirements?
-4. Are there related changes elsewhere?
-
-### Phase 2: High-Level Review
-
-Look at:
-1. **Architecture**: Does the approach make sense?
-2. **Design patterns**: Are appropriate patterns used?
-3. **File organization**: Is code in the right place?
-4. **Dependencies**: Are new dependencies justified?
-
-### Phase 3: Line-by-Line Review
-
-For each file:
-1. Read through understanding intent
-2. Check for issues in each category
-3. Note both problems and good practices
-
-### Phase 4: Provide Feedback
-
-Structure feedback clearly:
-
-```markdown
-## Review Summary
-
-### Must Fix (Blockers)
-- [ ] **Security**: SQL injection vulnerability in line 42
-- [ ] **Bug**: Off-by-one error in loop at line 78
-
-### Should Fix (Important)
-- [ ] **Performance**: N+1 query problem in user loader
-- [ ] **Maintainability**: Function too long (150+ lines)
-
-### Consider (Suggestions)
-- [ ] **Style**: Variable naming could be more descriptive
-- [ ] **Testing**: Add test for empty input case
-
-### Positives
-- Good use of error handling
-- Clear separation of concerns
-```
-
-## Code Smells to Watch For
-
-### Complexity
-- **Long methods**: > 20-30 lines
-- **Deep nesting**: > 3-4 levels
-- **Too many parameters**: > 4-5 params
-- **God classes**: Classes doing too much
-
-### Duplication
-- Copy-pasted code blocks
-- Similar logic in multiple places
-- Magic numbers repeated
-
-### Coupling
-- Tight coupling between modules
-- Circular dependencies
-- Inappropriate intimacy
-
-### Naming
-- Single-letter variables (except loops)
-- Misleading names
-- Inconsistent conventions
-
-## Security Checklist
-
-```markdown
-- [ ] Input validation on all user input
-- [ ] Parameterized queries (no string concatenation for SQL)
-- [ ] Output encoding (prevent XSS)
-- [ ] Authentication checked on protected routes
-- [ ] Authorization checked for resource access
-- [ ] Sensitive data not logged
-- [ ] Secrets not hardcoded
-- [ ] HTTPS enforced for sensitive data
-- [ ] Rate limiting on authentication endpoints
-- [ ] CORS properly configured
-```
-
-## Feedback Guidelines
-
-### Be Constructive
-```markdown
-# Bad
-"This code is terrible"
-
-# Good
-"This approach works, but consider using X for better
-performance because [specific reason]"
-```
-
-### Be Specific
-```markdown
-# Bad
-"Fix the naming"
-
-# Good
-"Rename `d` to `document_count` for clarity.
-Single-letter variables make the code harder to understand"
-```
-
-### Explain Why
-```markdown
-# Bad
-"Don't use global variables"
-
-# Good
-"Global variables can cause issues because:
-1. They make testing difficult
-2. They create hidden dependencies
-3. They can be modified from anywhere
-
-Consider passing this as a parameter instead."
-```
-
-### Offer Solutions
-```markdown
-# Instead of just:
-"This is inefficient"
-
-# Provide:
-"This is O(n²) due to the nested loops. Consider using
-a Set for the lookup to achieve O(n):
-
-```python
-seen = set(processed_ids)
-for item in items:
- if item.id in seen: # O(1) lookup
- continue
-```"
-```
-
-## Review Checklist Template
-
-```markdown
-## Code Review: [PR Title]
-
-### Context Understanding
-- [ ] I understand the purpose of this change
-- [ ] I've reviewed related documentation/tickets
-
-### Correctness
-- [ ] Logic is correct
-- [ ] Edge cases handled
-- [ ] Error handling appropriate
-
-### Security
-- [ ] No SQL injection vulnerabilities
-- [ ] No XSS vulnerabilities
-- [ ] Authentication/authorization correct
-- [ ] No secrets exposed
-
-### Performance
-- [ ] No obvious performance issues
-- [ ] Database queries efficient
-- [ ] No memory leaks
-
-### Maintainability
-- [ ] Code is readable
-- [ ] Functions are focused
-- [ ] Good naming
-- [ ] Appropriate comments
-
-### Testing
-- [ ] Adequate test coverage
-- [ ] Tests are meaningful
-- [ ] Edge cases tested
-
-### Verdict
-- [ ] Approved
-- [ ] Approved with comments
-- [ ] Request changes
-```
-
-## Example Review
-
-```markdown
-## Review: Add user registration endpoint
-
-### Summary
-Generally good implementation! A few security concerns to address.
-
-### Must Fix
-1. **Security (line 45)**: Password stored in plain text
- ```python
- # Current
- user.password = request.password
-
- # Fix
- user.password_hash = hash_password(request.password)
- ```
-
-2. **Validation (line 38)**: Email not validated
- Add email format validation before saving
-
-### Should Fix
-1. **Error Handling (line 52)**: Bare except catches too much
- ```python
- # Current
- except:
- return error_response()
-
- # Fix
- except ValidationError as e:
- return error_response(str(e))
- ```
-
-### Consider
-1. Add rate limiting to prevent spam registrations
-2. Send confirmation email async to improve response time
-
-### Positives
-- Good use of transactions
-- Clear API response structure
-- Comprehensive logging
-```
diff --git a/skills/create-skill/SKILL.md b/skills/create-skill/SKILL.md
index 262d599e8..8b82af840 100644
--- a/skills/create-skill/SKILL.md
+++ b/skills/create-skill/SKILL.md
@@ -66,7 +66,7 @@ Your skill instructions go here...
## Skill Directory Structure
```
-usr/skills/
+/a0/usr/skills/
└── custom/
└── my-skill/
├── SKILL.md # Required: Main skill file
diff --git a/skills/database-design/SKILL.md b/skills/database-design/SKILL.md
deleted file mode 100644
index 0b61dbae9..000000000
--- a/skills/database-design/SKILL.md
+++ /dev/null
@@ -1,335 +0,0 @@
----
-name: "database-design"
-description: "Database design, schema optimization, and query best practices. Use when designing schemas, optimizing queries, or working with databases."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["database", "sql", "schema", "optimization", "postgresql", "mysql"]
-trigger_patterns:
- - "database"
- - "schema"
- - "sql"
- - "query"
- - "table"
- - "index"
----
-
-# Database Design Skill
-
-Best practices for schema design, query optimization, and database management.
-
-## Schema Design Principles
-
-### Normalization
-
-**1NF (First Normal Form)**
-- Each column contains atomic values
-- No repeating groups
-
-**2NF (Second Normal Form)**
-- Meet 1NF
-- No partial dependencies (all non-key columns depend on the entire primary key)
-
-**3NF (Third Normal Form)**
-- Meet 2NF
-- No transitive dependencies (non-key columns don't depend on other non-key columns)
-
-### Example: Normalized Schema
-
-```sql
--- Users table
-CREATE TABLE users (
- id SERIAL PRIMARY KEY,
- email VARCHAR(255) UNIQUE NOT NULL,
- name VARCHAR(100) NOT NULL,
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
-);
-
--- Addresses table (1:N relationship)
-CREATE TABLE addresses (
- id SERIAL PRIMARY KEY,
- user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
- street VARCHAR(255) NOT NULL,
- city VARCHAR(100) NOT NULL,
- country VARCHAR(100) NOT NULL,
- postal_code VARCHAR(20),
- is_primary BOOLEAN DEFAULT FALSE
-);
-
--- Orders table
-CREATE TABLE orders (
- id SERIAL PRIMARY KEY,
- user_id INTEGER REFERENCES users(id),
- address_id INTEGER REFERENCES addresses(id),
- status VARCHAR(50) DEFAULT 'pending',
- total_amount DECIMAL(10, 2) NOT NULL,
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
-);
-
--- Order items (N:N through junction table)
-CREATE TABLE order_items (
- id SERIAL PRIMARY KEY,
- order_id INTEGER REFERENCES orders(id) ON DELETE CASCADE,
- product_id INTEGER REFERENCES products(id),
- quantity INTEGER NOT NULL CHECK (quantity > 0),
- unit_price DECIMAL(10, 2) NOT NULL
-);
-```
-
-### When to Denormalize
-
-Consider denormalization for:
-- Read-heavy workloads
-- Frequently joined tables
-- Reporting/analytics queries
-
-```sql
--- Denormalized order summary (materialized view)
-CREATE MATERIALIZED VIEW order_summaries AS
-SELECT
- o.id,
- o.created_at,
- u.name AS user_name,
- u.email AS user_email,
- a.city AS shipping_city,
- o.total_amount,
- COUNT(oi.id) AS item_count
-FROM orders o
-JOIN users u ON o.user_id = u.id
-JOIN addresses a ON o.address_id = a.id
-JOIN order_items oi ON o.id = oi.order_id
-GROUP BY o.id, u.name, u.email, a.city;
-
--- Refresh periodically
-REFRESH MATERIALIZED VIEW order_summaries;
-```
-
-## Index Optimization
-
-### Index Types
-
-```sql
--- B-tree (default, good for most cases)
-CREATE INDEX idx_users_email ON users(email);
-
--- Composite index (order matters!)
-CREATE INDEX idx_orders_user_date ON orders(user_id, created_at DESC);
-
--- Partial index (for filtered queries)
-CREATE INDEX idx_active_users ON users(email) WHERE status = 'active';
-
--- Expression index
-CREATE INDEX idx_users_lower_email ON users(LOWER(email));
-
--- GIN index (for arrays, JSONB)
-CREATE INDEX idx_products_tags ON products USING GIN(tags);
-
--- BRIN index (for large tables with natural ordering)
-CREATE INDEX idx_logs_timestamp ON logs USING BRIN(created_at);
-```
-
-### Index Guidelines
-
-```markdown
-## When to Add Indexes
-- [ ] Columns in WHERE clauses
-- [ ] Columns in JOIN conditions
-- [ ] Columns in ORDER BY
-- [ ] Foreign keys
-- [ ] Columns with high selectivity
-
-## When NOT to Add Indexes
-- [ ] Small tables (< 1000 rows)
-- [ ] Columns with low selectivity (boolean, status)
-- [ ] Tables with heavy write operations
-- [ ] Frequently updated columns
-```
-
-## Query Optimization
-
-### EXPLAIN ANALYZE
-
-```sql
-EXPLAIN ANALYZE
-SELECT u.name, COUNT(o.id) as order_count
-FROM users u
-LEFT JOIN orders o ON u.id = o.user_id
-WHERE u.created_at > '2024-01-01'
-GROUP BY u.id
-ORDER BY order_count DESC
-LIMIT 10;
-```
-
-### Common Optimizations
-
-**1. Use appropriate JOINs**
-```sql
--- Bad: Subquery for each row
-SELECT *, (SELECT COUNT(*) FROM orders WHERE user_id = u.id)
-FROM users u;
-
--- Good: Single JOIN
-SELECT u.*, COUNT(o.id) as order_count
-FROM users u
-LEFT JOIN orders o ON u.id = o.user_id
-GROUP BY u.id;
-```
-
-**2. Avoid SELECT ***
-```sql
--- Bad
-SELECT * FROM users WHERE id = 1;
-
--- Good
-SELECT id, name, email FROM users WHERE id = 1;
-```
-
-**3. Use LIMIT for pagination**
-```sql
--- Offset pagination (slow for large offsets)
-SELECT * FROM products ORDER BY id LIMIT 20 OFFSET 10000;
-
--- Keyset pagination (faster)
-SELECT * FROM products WHERE id > 10000 ORDER BY id LIMIT 20;
-```
-
-**4. Batch operations**
-```sql
--- Bad: Individual inserts
-INSERT INTO logs (message) VALUES ('log1');
-INSERT INTO logs (message) VALUES ('log2');
-
--- Good: Batch insert
-INSERT INTO logs (message) VALUES ('log1'), ('log2'), ('log3');
-```
-
-## Common Patterns
-
-### Soft Delete
-
-```sql
-ALTER TABLE users ADD COLUMN deleted_at TIMESTAMP;
-
--- "Delete" a user
-UPDATE users SET deleted_at = CURRENT_TIMESTAMP WHERE id = 1;
-
--- Query active users only
-SELECT * FROM users WHERE deleted_at IS NULL;
-
--- Create view for convenience
-CREATE VIEW active_users AS
-SELECT * FROM users WHERE deleted_at IS NULL;
-```
-
-### Audit Trail
-
-```sql
-CREATE TABLE audit_log (
- id SERIAL PRIMARY KEY,
- table_name VARCHAR(100) NOT NULL,
- record_id INTEGER NOT NULL,
- action VARCHAR(10) NOT NULL, -- INSERT, UPDATE, DELETE
- old_data JSONB,
- new_data JSONB,
- changed_by INTEGER REFERENCES users(id),
- changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
-);
-
--- Trigger function
-CREATE OR REPLACE FUNCTION audit_trigger()
-RETURNS TRIGGER AS $$
-BEGIN
- IF TG_OP = 'INSERT' THEN
- INSERT INTO audit_log (table_name, record_id, action, new_data)
- VALUES (TG_TABLE_NAME, NEW.id, 'INSERT', to_jsonb(NEW));
- ELSIF TG_OP = 'UPDATE' THEN
- INSERT INTO audit_log (table_name, record_id, action, old_data, new_data)
- VALUES (TG_TABLE_NAME, NEW.id, 'UPDATE', to_jsonb(OLD), to_jsonb(NEW));
- ELSIF TG_OP = 'DELETE' THEN
- INSERT INTO audit_log (table_name, record_id, action, old_data)
- VALUES (TG_TABLE_NAME, OLD.id, 'DELETE', to_jsonb(OLD));
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE plpgsql;
-```
-
-### Full-Text Search
-
-```sql
--- Add search column
-ALTER TABLE products ADD COLUMN search_vector tsvector;
-
--- Update search vector
-UPDATE products SET search_vector =
- setweight(to_tsvector('english', name), 'A') ||
- setweight(to_tsvector('english', description), 'B');
-
--- Create GIN index
-CREATE INDEX idx_products_search ON products USING GIN(search_vector);
-
--- Search query
-SELECT * FROM products
-WHERE search_vector @@ plainto_tsquery('english', 'wireless headphones')
-ORDER BY ts_rank(search_vector, plainto_tsquery('english', 'wireless headphones')) DESC;
-```
-
-## Performance Checklist
-
-```markdown
-## Schema Design
-- [ ] Appropriate data types (don't use VARCHAR(255) for everything)
-- [ ] Proper constraints (NOT NULL, UNIQUE, CHECK)
-- [ ] Foreign keys with proper ON DELETE behavior
-- [ ] UUID vs SERIAL for primary keys (consider use case)
-
-## Indexes
-- [ ] Primary key indexes exist
-- [ ] Foreign keys are indexed
-- [ ] Frequently queried columns indexed
-- [ ] No unused indexes (check pg_stat_user_indexes)
-
-## Queries
-- [ ] No N+1 queries
-- [ ] Appropriate use of JOINs vs subqueries
-- [ ] LIMIT on unbounded queries
-- [ ] EXPLAIN ANALYZE on slow queries
-
-## Maintenance
-- [ ] Regular VACUUM and ANALYZE
-- [ ] Connection pooling configured
-- [ ] Query timeouts set
-- [ ] Slow query logging enabled
-```
-
-## Useful Queries
-
-```sql
--- Find unused indexes
-SELECT
- schemaname || '.' || relname AS table,
- indexrelname AS index,
- pg_size_pretty(pg_relation_size(i.indexrelid)) AS index_size,
- idx_scan AS index_scans
-FROM pg_stat_user_indexes ui
-JOIN pg_index i ON ui.indexrelid = i.indexrelid
-WHERE idx_scan < 50
-ORDER BY pg_relation_size(i.indexrelid) DESC;
-
--- Find slow queries (requires pg_stat_statements)
-SELECT
- query,
- calls,
- mean_exec_time,
- total_exec_time
-FROM pg_stat_statements
-ORDER BY mean_exec_time DESC
-LIMIT 10;
-
--- Table sizes
-SELECT
- relname AS table,
- pg_size_pretty(pg_total_relation_size(relid)) AS total_size
-FROM pg_catalog.pg_statio_user_tables
-ORDER BY pg_total_relation_size(relid) DESC;
-```
diff --git a/skills/debugging/SKILL.md b/skills/debugging/SKILL.md
deleted file mode 100644
index 9f6a111a5..000000000
--- a/skills/debugging/SKILL.md
+++ /dev/null
@@ -1,179 +0,0 @@
----
-name: "debugging"
-description: "Systematic debugging methodology for identifying and fixing bugs. Use when encountering errors, unexpected behavior, or test failures."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["debugging", "troubleshooting", "errors", "testing", "analysis"]
-trigger_patterns:
- - "error"
- - "bug"
- - "not working"
- - "fails"
- - "broken"
- - "fix"
- - "debug"
----
-
-# Systematic Debugging Skill
-
-**CRITICAL**: Follow this systematic process. Never guess at fixes without understanding the root cause.
-
-## When to Use
-
-Activate this skill when you encounter:
-- Error messages or stack traces
-- Unexpected behavior
-- Test failures
-- Performance issues
-- "It was working before" scenarios
-
-## The Debugging Process
-
-### Phase 1: Reproduce the Issue
-
-**Goal**: Confirm you can consistently trigger the bug.
-
-1. **Document the steps** to reproduce
-2. **Identify the exact error** message or unexpected behavior
-3. **Note the environment**: OS, versions, configuration
-4. **Establish baseline**: When did it last work correctly?
-
-```markdown
-## Reproduction Steps
-1. Step 1
-2. Step 2
-3. Step 3
-Expected: [What should happen]
-Actual: [What actually happens]
-```
-
-### Phase 2: Gather Evidence
-
-**Goal**: Collect all relevant information before forming hypotheses.
-
-1. **Read the full error message** and stack trace
-2. **Check logs** at multiple levels (app, system, network)
-3. **Examine recent changes** (git diff, git log)
-4. **Review related code** paths
-5. **Check dependencies** and their versions
-
-```bash
-# Useful commands
-git log --oneline -20 # Recent commits
-git diff HEAD~5 # Recent changes
-cat /var/log/app.log # Application logs
-```
-
-### Phase 3: Form Hypotheses
-
-**Goal**: Generate multiple possible causes ranked by likelihood.
-
-List hypotheses in order of probability:
-
-```markdown
-## Hypotheses
-1. [Most likely] Description - Evidence supporting this
-2. [Likely] Description - Evidence supporting this
-3. [Possible] Description - Evidence supporting this
-```
-
-### Phase 4: Test Hypotheses
-
-**Goal**: Systematically eliminate possibilities.
-
-For each hypothesis:
-1. **Design a test** that would confirm or refute it
-2. **Execute the test** with minimal changes
-3. **Document results**
-4. **Move to next hypothesis** if not confirmed
-
-```markdown
-## Testing: Hypothesis 1
-Test: [What I'll do to test this]
-Result: [Confirmed/Refuted]
-Evidence: [What I observed]
-```
-
-### Phase 5: Implement Fix
-
-**Goal**: Fix the root cause, not just the symptom.
-
-1. **Isolate the fix**: Make the smallest change that fixes the issue
-2. **Verify the fix**: Confirm the original reproduction steps now pass
-3. **Check for regressions**: Ensure nothing else broke
-4. **Document the fix**: Explain what was wrong and why the fix works
-
-### Phase 6: Prevent Recurrence
-
-**Goal**: Stop this class of bug from happening again.
-
-1. **Add a test** that would have caught this bug
-2. **Consider defensive coding** (validation, error handling)
-3. **Update documentation** if needed
-4. **Share learnings** with team if relevant
-
-## Anti-Patterns to Avoid
-
-- **Random Changes**: Never make changes hoping something works
-- **Fix Symptoms**: Always find and fix the root cause
-- **Skip Reproduction**: Always confirm you can reproduce before fixing
-- **Single Hypothesis**: Consider multiple possibilities
-- **No Testing**: Always verify the fix works
-
-## Debugging Tools
-
-### For Python
-```python
-# Interactive debugging
-import pdb; pdb.set_trace()
-
-# Or using ipdb for better experience
-import ipdb; ipdb.set_trace()
-
-# Print debugging with context
-print(f"DEBUG: {variable=}, {type(variable)=}")
-```
-
-### For JavaScript
-```javascript
-// Debugger statement
-debugger;
-
-// Console logging with labels
-console.log({ variable, typeof: typeof variable });
-
-// Trace to see call stack
-console.trace("How did we get here?");
-```
-
-### General
-```bash
-# Check if process is running
-ps aux | grep <process>
-
-# Check port usage
-lsof -i :<port>
-
-# Watch file changes
-tail -f /path/to/log
-```
-
-## Example Session
-
-**User**: "The API endpoint returns 500 error"
-
-**Agent Response**:
-> Let me debug this systematically:
->
-> ## Phase 1: Reproduction
-> - Which endpoint specifically?
-> - What request parameters are you sending?
-> - Does it fail consistently or intermittently?
->
-> ## Phase 2: Gathering Evidence
-> Let me check:
-> 1. The server error logs
-> 2. Recent changes to this endpoint
-> 3. The full stack trace
->
-> [Proceeds systematically through each phase]
diff --git a/skills/docker-devops/SKILL.md b/skills/docker-devops/SKILL.md
deleted file mode 100644
index d048108a4..000000000
--- a/skills/docker-devops/SKILL.md
+++ /dev/null
@@ -1,394 +0,0 @@
----
-name: "docker-devops"
-description: "Docker and DevOps best practices for containerization, orchestration, and CI/CD pipelines. Use when working with containers, deployments, or infrastructure."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["docker", "devops", "containers", "kubernetes", "ci-cd", "infrastructure"]
-trigger_patterns:
- - "docker"
- - "container"
- - "kubernetes"
- - "k8s"
- - "deploy"
- - "ci/cd"
- - "pipeline"
----
-
-# Docker & DevOps Skill
-
-Best practices for containerization, orchestration, and deployment pipelines.
-
-## Docker Fundamentals
-
-### Dockerfile Best Practices
-
-```dockerfile
-# Use specific version tags
-FROM python:3.11-slim
-
-# Set working directory
-WORKDIR /app
-
-# Copy dependency files first (layer caching)
-COPY requirements.txt .
-
-# Install dependencies
-RUN pip install --no-cache-dir -r requirements.txt
-
-# Copy application code
-COPY . .
-
-# Use non-root user
-RUN useradd -m appuser && chown -R appuser:appuser /app
-USER appuser
-
-# Expose port
-EXPOSE 8000
-
-# Use exec form for CMD
-CMD ["python", "app.py"]
-```
-
-### Multi-Stage Builds
-
-```dockerfile
-# Build stage
-FROM node:18 AS builder
-WORKDIR /app
-COPY package*.json ./
-RUN npm ci
-COPY . .
-RUN npm run build
-
-# Production stage
-FROM nginx:alpine
-COPY --from=builder /app/dist /usr/share/nginx/html
-EXPOSE 80
-CMD ["nginx", "-g", "daemon off;"]
-```
-
-### Docker Compose
-
-```yaml
-version: '3.8'
-
-services:
- app:
- build:
- context: .
- dockerfile: Dockerfile
- ports:
- - "8000:8000"
- environment:
- - DATABASE_URL=postgresql://user:pass@db:5432/app
- depends_on:
- db:
- condition: service_healthy
- volumes:
- - ./app:/app
- healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
- interval: 30s
- timeout: 10s
- retries: 3
-
- db:
- image: postgres:15-alpine
- environment:
- POSTGRES_USER: user
- POSTGRES_PASSWORD: pass
- POSTGRES_DB: app
- volumes:
- - postgres_data:/var/lib/postgresql/data
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U user -d app"]
- interval: 10s
- timeout: 5s
- retries: 5
-
-volumes:
- postgres_data:
-```
-
-## Kubernetes Basics
-
-### Deployment
-
-```yaml
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: myapp
- labels:
- app: myapp
-spec:
- replicas: 3
- selector:
- matchLabels:
- app: myapp
- template:
- metadata:
- labels:
- app: myapp
- spec:
- containers:
- - name: myapp
- image: myapp:1.0.0
- ports:
- - containerPort: 8000
- resources:
- requests:
- memory: "128Mi"
- cpu: "100m"
- limits:
- memory: "256Mi"
- cpu: "200m"
- livenessProbe:
- httpGet:
- path: /health
- port: 8000
- initialDelaySeconds: 30
- periodSeconds: 10
- readinessProbe:
- httpGet:
- path: /ready
- port: 8000
- initialDelaySeconds: 5
- periodSeconds: 5
-```
-
-### Service
-
-```yaml
-apiVersion: v1
-kind: Service
-metadata:
- name: myapp-service
-spec:
- selector:
- app: myapp
- ports:
- - port: 80
- targetPort: 8000
- type: ClusterIP
-```
-
-### Ingress
-
-```yaml
-apiVersion: networking.k8s.io/v1
-kind: Ingress
-metadata:
- name: myapp-ingress
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
-spec:
- rules:
- - host: myapp.example.com
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: myapp-service
- port:
- number: 80
-```
-
-## CI/CD Pipelines
-
-### GitHub Actions
-
-```yaml
-name: CI/CD Pipeline
-
-on:
- push:
- branches: [main]
- pull_request:
- branches: [main]
-
-jobs:
- test:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: '3.11'
-
- - name: Install dependencies
- run: |
- pip install -r requirements.txt
- pip install pytest
-
- - name: Run tests
- run: pytest
-
- build:
- needs: test
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Build Docker image
- run: docker build -t myapp:${{ github.sha }} .
-
- - name: Login to Container Registry
- uses: docker/login-action@v2
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Push image
- run: |
- docker tag myapp:${{ github.sha }} ghcr.io/${{ github.repository }}:${{ github.sha }}
- docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
-
- deploy:
- needs: build
- if: github.ref == 'refs/heads/main'
- runs-on: ubuntu-latest
- steps:
- - name: Deploy to production
- run: |
- echo "Deploying ${{ github.sha }}"
- # kubectl set image deployment/myapp myapp=ghcr.io/${{ github.repository }}:${{ github.sha }}
-```
-
-### GitLab CI
-
-```yaml
-stages:
- - test
- - build
- - deploy
-
-variables:
- DOCKER_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
-
-test:
- stage: test
- image: python:3.11
- script:
- - pip install -r requirements.txt
- - pytest
-
-build:
- stage: build
- image: docker:latest
- services:
- - docker:dind
- script:
- - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- - docker build -t $DOCKER_IMAGE .
- - docker push $DOCKER_IMAGE
-
-deploy:
- stage: deploy
- only:
- - main
- script:
- - kubectl set image deployment/myapp myapp=$DOCKER_IMAGE
-```
-
-## Useful Commands
-
-### Docker
-
-```bash
-# Build image
-docker build -t myapp:latest .
-
-# Run container
-docker run -d -p 8000:8000 --name myapp myapp:latest
-
-# View logs
-docker logs -f myapp
-
-# Execute in container
-docker exec -it myapp /bin/sh
-
-# Clean up
-docker system prune -a
-
-# List resources
-docker ps -a
-docker images
-docker volume ls
-docker network ls
-```
-
-### Kubernetes
-
-```bash
-# Get resources
-kubectl get pods
-kubectl get services
-kubectl get deployments
-
-# Describe resource
-kubectl describe pod <pod-name>
-
-# Logs
-kubectl logs -f <pod-name>
-
-# Execute in pod
-kubectl exec -it <pod-name> -- /bin/sh
-
-# Apply configuration
-kubectl apply -f deployment.yaml
-
-# Scale deployment
-kubectl scale deployment myapp --replicas=5
-
-# Rollback
-kubectl rollout undo deployment/myapp
-```
-
-## Security Checklist
-
-```markdown
-- [ ] Use specific image tags, not 'latest'
-- [ ] Run as non-root user
-- [ ] Scan images for vulnerabilities
-- [ ] Use secrets management (not env vars for sensitive data)
-- [ ] Limit container resources
-- [ ] Enable network policies
-- [ ] Use read-only file systems where possible
-- [ ] Implement pod security policies
-- [ ] Rotate credentials regularly
-```
-
-## Monitoring & Logging
-
-```yaml
-# Prometheus ServiceMonitor
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- name: myapp
-spec:
- selector:
- matchLabels:
- app: myapp
- endpoints:
- - port: metrics
- interval: 30s
-```
-
-```yaml
-# Fluentd sidecar for logging
-containers:
-- name: myapp
- image: myapp:latest
-- name: fluentd
- image: fluent/fluentd:latest
- volumeMounts:
- - name: logs
- mountPath: /var/log/app
-```
diff --git a/skills/git-workflow/SKILL.md b/skills/git-workflow/SKILL.md
deleted file mode 100644
index f95ade39c..000000000
--- a/skills/git-workflow/SKILL.md
+++ /dev/null
@@ -1,357 +0,0 @@
----
-name: "git-workflow"
-description: "Git workflow best practices for branching, committing, and collaboration. Use when working with version control."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["git", "version-control", "branching", "collaboration", "workflow"]
-trigger_patterns:
- - "git"
- - "commit"
- - "branch"
- - "merge"
- - "pull request"
----
-
-# Git Workflow Skill
-
-Best practices for version control and team collaboration.
-
-## Branching Strategy
-
-### Branch Naming Convention
-
-```
-<type>/<ticket-id>-<short-description>
-```
-
-**Types:**
-- `feature/` - New features
-- `bugfix/` - Bug fixes
-- `hotfix/` - Urgent production fixes
-- `refactor/` - Code refactoring
-- `docs/` - Documentation updates
-- `test/` - Adding tests
-- `chore/` - Maintenance tasks
-
-**Examples:**
-```bash
-feature/PROJ-123-add-user-authentication
-bugfix/PROJ-456-fix-login-timeout
-hotfix/PROJ-789-critical-security-patch
-```
-
-### Branch Workflow
-
-```
-main (production)
- │
- ├── develop (integration)
- │ │
- │ ├── feature/add-login
- │ ├── feature/add-dashboard
- │ └── bugfix/fix-signup
- │
- └── hotfix/security-patch (urgent fixes from main)
-```
-
-## Commit Messages
-
-### Conventional Commits Format
-
-```
-<type>(<scope>): <description>
-
-[optional body]
-
-[optional footer(s)]
-```
-
-### Types
-
-| Type | Description |
-|------|-------------|
-| `feat` | New feature |
-| `fix` | Bug fix |
-| `docs` | Documentation |
-| `style` | Formatting (no code change) |
-| `refactor` | Code refactoring |
-| `test` | Adding tests |
-| `chore` | Maintenance |
-| `perf` | Performance improvement |
-| `ci` | CI/CD changes |
-
-### Examples
-
-```bash
-# Feature
-feat(auth): add JWT token refresh mechanism
-
-# Bug fix with ticket reference
-fix(api): resolve timeout issue on large payloads
-
-Closes #123
-
-# Breaking change
-feat(api)!: change user endpoint response format
-
-BREAKING CHANGE: User endpoint now returns nested
-address object instead of flat fields.
-
-# Multi-line with body
-refactor(database): optimize user query performance
-
-- Added composite index on (email, created_at)
-- Removed N+1 query in user loader
-- Cached frequently accessed user data
-
-Performance improved from 500ms to 50ms for user list.
-```
-
-## Common Workflows
-
-### Starting New Work
-
-```bash
-# 1. Update main branch
-git checkout main
-git pull origin main
-
-# 2. Create feature branch
-git checkout -b feature/PROJ-123-new-feature
-
-# 3. Make changes and commit
-git add .
-git commit -m "feat(module): add new functionality"
-
-# 4. Push and create PR
-git push -u origin feature/PROJ-123-new-feature
-```
-
-### Syncing with Main
-
-```bash
-# Option 1: Rebase (preferred for feature branches)
-git fetch origin
-git rebase origin/main
-
-# Option 2: Merge (when history preservation needed)
-git fetch origin
-git merge origin/main
-```
-
-### Interactive Rebase (Cleaning History)
-
-```bash
-# Squash last 3 commits
-git rebase -i HEAD~3
-
-# In editor, change 'pick' to 'squash' for commits to combine
-pick abc1234 feat: add login form
-squash def5678 fix: typo in form
-squash ghi9012 style: format code
-```
-
-### Undoing Changes
-
-```bash
-# Undo last commit (keep changes)
-git reset --soft HEAD~1
-
-# Undo last commit (discard changes)
-git reset --hard HEAD~1
-
-# Undo specific file changes
-git checkout -- path/to/file
-
-# Revert a pushed commit (safe)
-git revert <commit-hash>
-```
-
-### Stashing Work
-
-```bash
-# Save current changes
-git stash save "WIP: feature description"
-
-# List stashes
-git stash list
-
-# Apply most recent stash
-git stash pop
-
-# Apply specific stash
-git stash apply stash@{2}
-
-# Drop a stash
-git stash drop stash@{0}
-```
-
-## Pull Request Guidelines
-
-### Before Creating PR
-
-1. **Rebase on latest main**
- ```bash
- git fetch origin
- git rebase origin/main
- ```
-
-2. **Run tests locally**
- ```bash
- npm test # or your test command
- ```
-
-3. **Self-review your changes**
- ```bash
- git diff origin/main
- ```
-
-4. **Clean up commits**
- - Squash fixup commits
- - Write clear commit messages
-
-### PR Description Template
-
-```markdown
-## Summary
-Brief description of changes
-
-## Type of Change
-- [ ] Feature
-- [ ] Bug fix
-- [ ] Refactor
-- [ ] Documentation
-
-## Changes Made
-- Change 1
-- Change 2
-- Change 3
-
-## Testing Done
-- [ ] Unit tests pass
-- [ ] Integration tests pass
-- [ ] Manual testing completed
-
-## Screenshots (if applicable)
-[Add screenshots here]
-
-## Related Issues
-Closes #123
-```
-
-### PR Best Practices
-
-1. **Keep PRs Small**: < 400 lines ideally
-2. **One Concern Per PR**: Don't mix features
-3. **Descriptive Title**: Summarize the change
-4. **Link Issues**: Reference related tickets
-5. **Add Context**: Explain why, not just what
-6. **Request Reviews**: Tag appropriate reviewers
-
-## Resolving Conflicts
-
-### Step-by-Step
-
-```bash
-# 1. Update your branch
-git fetch origin
-
-# 2. Rebase on main
-git rebase origin/main
-
-# 3. When conflicts occur, Git will pause
-# Fix conflicts in your editor
-
-# 4. After fixing each file
-git add <fixed-file>
-
-# 5. Continue rebase
-git rebase --continue
-
-# 6. If too complex, abort and try merge instead
-git rebase --abort
-git merge origin/main
-```
-
-### Conflict Markers
-
-```
-<<<<<<< HEAD
-Your changes
-=======
-Their changes
->>>>>>> branch-name
-```
-
-## Git Hooks
-
-### Pre-commit Hook Example
-
-```bash
-#!/bin/sh
-# .git/hooks/pre-commit
-
-# Run linter
-npm run lint
-if [ $? -ne 0 ]; then
- echo "Lint failed. Fix errors before committing."
- exit 1
-fi
-
-# Run tests
-npm test
-if [ $? -ne 0 ]; then
- echo "Tests failed. Fix tests before committing."
- exit 1
-fi
-```
-
-### Commit Message Hook
-
-```bash
-#!/bin/sh
-# .git/hooks/commit-msg
-
-# Enforce conventional commits
-commit_regex='^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}'
-
-if ! grep -qE "$commit_regex" "$1"; then
- echo "Invalid commit message format."
- echo "Use: <type>(<scope>): <description>"
- exit 1
-fi
-```
-
-## Useful Aliases
-
-Add to `~/.gitconfig`:
-
-```ini
-[alias]
- # Status
- s = status -sb
-
- # Logging
- lg = log --oneline --graph --all
- last = log -1 HEAD --stat
-
- # Branching
- co = checkout
- cob = checkout -b
- br = branch -v
-
- # Committing
- cm = commit -m
- amend = commit --amend --no-edit
-
- # Stashing
- sl = stash list
- sp = stash pop
-
- # Diffing
- d = diff
- dc = diff --cached
-
- # Cleanup
- cleanup = "!git branch --merged | grep -v '\\*\\|main\\|develop' | xargs -n 1 git branch -d"
-```
diff --git a/skills/prompt-engineering/SKILL.md b/skills/prompt-engineering/SKILL.md
deleted file mode 100644
index c216fd9cd..000000000
--- a/skills/prompt-engineering/SKILL.md
+++ /dev/null
@@ -1,404 +0,0 @@
----
-name: "prompt-engineering"
-description: "Best practices for crafting effective prompts for LLMs. Use when designing prompts, creating system messages, or optimizing AI interactions."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["prompts", "llm", "ai", "gpt", "claude", "optimization"]
-trigger_patterns:
- - "prompt"
- - "system message"
- - "llm"
- - "ai instruction"
- - "chatgpt"
- - "claude"
----
-
-# Prompt Engineering Skill
-
-Best practices for designing effective prompts for Large Language Models.
-
-## Core Principles
-
-### 1. Be Specific and Clear
-
-```markdown
-# Bad
-"Write something about dogs"
-
-# Good
-"Write a 200-word article about the top 3 benefits of adopting
-a rescue dog. Include a brief introduction and conclusion.
-Use a friendly, conversational tone suitable for pet owners."
-```
-
-### 2. Provide Context
-
-```markdown
-# Bad
-"Fix this code"
-
-# Good
-"I have a Python function that should validate email addresses.
-Currently it accepts invalid emails like 'test@'.
-
-Current code:
-```python
-def validate_email(email):
- return '@' in email
-```
-
-Please fix this to properly validate email format."
-```
-
-### 3. Specify Output Format
-
-```markdown
-# Bad
-"List some programming languages"
-
-# Good
-"List 5 programming languages for web development.
-Format as a markdown table with columns:
-- Language name
-- Primary use case
-- Learning difficulty (Easy/Medium/Hard)"
-```
-
-## Prompt Patterns
-
-### Role Pattern
-
-Assign a specific persona to guide responses:
-
-```markdown
-You are a senior Python developer with 10 years of experience.
-You specialize in clean code, testing, and code reviews.
-When reviewing code, you:
-- Focus on readability and maintainability
-- Suggest improvements with explanations
-- Point out potential bugs or security issues
-
-Please review the following code:
-[code here]
-```
-
-### Chain of Thought
-
-Guide step-by-step reasoning:
-
-```markdown
-Solve this problem step by step:
-
-Problem: A store has 150 apples. They sell 30% on Monday,
-then receive a shipment of 50 apples on Tuesday.
-How many apples do they have now?
-
-Please show your work:
-1. Calculate apples sold on Monday
-2. Calculate remaining apples after Monday
-3. Add Tuesday's shipment
-4. State the final answer
-```
-
-### Few-Shot Learning
-
-Provide examples to establish patterns:
-
-```markdown
-Convert these sentences to formal English:
-
-Example 1:
-Casual: "gonna grab some coffee"
-Formal: "I am going to get some coffee."
-
-Example 2:
-Casual: "wanna come with?"
-Formal: "Would you like to accompany me?"
-
-Now convert:
-Casual: "lemme know if you're free"
-Formal:
-```
-
-### Template Pattern
-
-Create reusable structures:
-
-```markdown
-# Bug Report Template
-
-Please analyze this bug and provide:
-
-## Summary
-[One sentence description]
-
-## Root Cause
-[Technical explanation of why this bug occurs]
-
-## Impact
-[Who is affected and how]
-
-## Solution
-[Recommended fix with code example]
-
-## Prevention
-[How to prevent similar bugs in the future]
-
----
-Bug to analyze:
-[user's bug description]
-```
-
-## System Prompts
-
-### Structure
-
-```markdown
-# [Role/Identity]
-You are [description of the assistant's role and expertise]
-
-# [Core Behaviors]
-You should always:
-- [Behavior 1]
-- [Behavior 2]
-
-You should never:
-- [Anti-pattern 1]
-- [Anti-pattern 2]
-
-# [Response Format]
-When responding:
-- [Format guideline 1]
-- [Format guideline 2]
-
-# [Examples] (optional)
-Here's an example of how to respond:
-[example interaction]
-```
-
-### Example System Prompt
-
-```markdown
-# Role
-You are a helpful coding assistant specializing in Python.
-You have expertise in data science, web development, and automation.
-
-# Core Behaviors
-Always:
-- Write clean, well-documented code
-- Explain your reasoning
-- Suggest tests for code you write
-- Consider edge cases
-
-Never:
-- Write code without explanation
-- Use deprecated libraries
-- Ignore security best practices
-- Make assumptions about requirements without clarifying
-
-# Response Format
-When writing code:
-1. Start with a brief explanation of the approach
-2. Write the code with comments
-3. Explain any complex parts
-4. Suggest how to test it
-
-When debugging:
-1. Identify the likely cause
-2. Explain why it happens
-3. Provide the fix
-4. Suggest how to prevent similar issues
-```
-
-## Optimization Techniques
-
-### Iterative Refinement
-
-```markdown
-# First attempt
-"Write a story"
-
-# After iteration 1: Add specifics
-"Write a 500-word short story about a robot"
-
-# After iteration 2: Add constraints
-"Write a 500-word short story about a robot
-learning to paint. Include dialogue."
-
-# After iteration 3: Add style
-"Write a 500-word short story about a robot
-learning to paint. Include dialogue. Write in
-a warm, hopeful tone similar to Studio Ghibli films."
-```
-
-### Decomposition
-
-Break complex tasks into steps:
-
-```markdown
-Instead of:
-"Create a complete e-commerce website"
-
-Use:
-"Let's build an e-commerce website step by step:
-
-Step 1: Define the data models we need for products,
-users, and orders. Show me the schema.
-
-[Wait for response]
-
-Step 2: Based on those models, create the API endpoints.
-
-[Wait for response]
-
-Step 3: Now let's build the product listing page..."
-```
-
-### Constraint Setting
-
-```markdown
-# Add boundaries for better results
-"Write a product description for a coffee maker.
-
-Constraints:
-- Maximum 100 words
-- Include 3 key features
-- End with a call to action
-- Don't use superlatives like 'best' or 'amazing'
-- Write at a 6th-grade reading level"
-```
-
-## Common Pitfalls
-
-### 1. Vague Instructions
-
-```markdown
-# Bad
-"Make it better"
-
-# Good
-"Improve the readability by:
-- Using shorter sentences (max 20 words)
-- Adding subheadings every 100-150 words
-- Replacing jargon with plain language"
-```
-
-### 2. Missing Context
-
-```markdown
-# Bad
-"Why isn't my code working?"
-
-# Good
-"My Python code throws a TypeError.
-Environment: Python 3.11, macOS
-Error message: TypeError: 'NoneType' object is not iterable
-Code:
-```python
-def process(items):
- for item in items:
- print(item)
-
-process(get_items()) # Error occurs here
-```
-The get_items() function should return a list."
-```
-
-### 3. Overloading
-
-```markdown
-# Bad (too many things at once)
-"Write a blog post about AI, make it SEO optimized,
-include code examples, add images, make it funny but professional,
-target beginners but also appeal to experts..."
-
-# Good (focused request)
-"Write a 500-word introduction to machine learning
-for complete beginners. Use simple analogies and
-avoid technical jargon. Include 3 real-world examples."
-```
-
-## Evaluation Checklist
-
-```markdown
-Before submitting a prompt, verify:
-
-## Clarity
-- [ ] Is the task clearly defined?
-- [ ] Are ambiguous terms explained?
-- [ ] Is the expected output format specified?
-
-## Context
-- [ ] Is relevant background provided?
-- [ ] Are constraints clearly stated?
-- [ ] Are examples included if needed?
-
-## Structure
-- [ ] Is the prompt well-organized?
-- [ ] Are complex tasks broken into steps?
-- [ ] Is there a clear order of operations?
-
-## Completeness
-- [ ] Does it include all necessary information?
-- [ ] Are edge cases considered?
-- [ ] Is the success criteria clear?
-```
-
-## Examples by Use Case
-
-### Code Generation
-
-```markdown
-Write a Python function that:
-- Takes a list of dictionaries representing users
-- Filters users older than 18
-- Sorts by last name alphabetically
-- Returns their email addresses
-
-Input example:
-[{"name": "John Doe", "age": 25, "email": "[email protected]"}]
-
-Requirements:
-- Include type hints
-- Add docstring
-- Handle empty list case
-- Include unit test
-```
-
-### Data Analysis
-
-```markdown
-Analyze this sales data and provide:
-
-1. Summary statistics (mean, median, std dev)
-2. Top 3 performing products
-3. Month-over-month growth rate
-4. Any anomalies or patterns
-
-Present findings in a markdown table.
-Include a brief executive summary (3-4 sentences).
-
-Data:
-[paste data here]
-```
-
-### Writing Assistance
-
-```markdown
-Help me improve this email to a client:
-
-Context: We need to delay the project by 2 weeks
-due to unexpected technical issues.
-
-Current draft:
-"Hi, the project will be late. Sorry about that."
-
-Goals:
-- Maintain professional relationship
-- Clearly explain the delay
-- Provide new timeline
-- Offer mitigation options
-
-Tone: Professional but warm
-Length: 150-200 words
-```
diff --git a/skills/security-audit/SKILL.md b/skills/security-audit/SKILL.md
deleted file mode 100644
index eb8738dea..000000000
--- a/skills/security-audit/SKILL.md
+++ /dev/null
@@ -1,453 +0,0 @@
----
-name: "security-audit"
-description: "Security audit and vulnerability assessment skill. Use when reviewing code for security issues, hardening systems, or implementing security best practices."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["security", "audit", "vulnerability", "owasp", "hardening"]
-trigger_patterns:
- - "security"
- - "vulnerability"
- - "secure"
- - "audit"
- - "owasp"
- - "penetration"
----
-
-# Security Audit Skill
-
-Comprehensive security review and vulnerability assessment guidance.
-
-## OWASP Top 10 Checklist
-
-### 1. Broken Access Control
-
-```markdown
-## Check for:
-- [ ] Direct object references (IDOR)
-- [ ] Missing function-level access control
-- [ ] Privilege escalation paths
-- [ ] Bypassing access control via URL manipulation
-
-## Example vulnerability:
-```python
-# Bad: No authorization check
[email protected]("/api/users/{user_id}")
-def get_user(user_id: int):
- return db.get_user(user_id) # Any user can access any other user!
-
-# Good: Verify authorization
[email protected]("/api/users/{user_id}")
-def get_user(user_id: int, current_user: User = Depends(get_current_user)):
- if current_user.id != user_id and not current_user.is_admin:
- raise HTTPException(403, "Not authorized")
- return db.get_user(user_id)
-```
-```
-
-### 2. Cryptographic Failures
-
-```markdown
-## Check for:
-- [ ] Sensitive data transmitted in plaintext
-- [ ] Weak encryption algorithms (MD5, SHA1 for passwords)
-- [ ] Hardcoded secrets
-- [ ] Insecure random number generation
-
-## Secure practices:
-```python
-# Password hashing
-from argon2 import PasswordHasher
-ph = PasswordHasher()
-hash = ph.hash("password")
-ph.verify(hash, "password") # Raises exception if invalid
-
-# Secure token generation
-import secrets
-token = secrets.token_urlsafe(32)
-
-# Never do this:
-import hashlib
-hash = hashlib.md5(password.encode()).hexdigest() # WEAK!
-```
-```
-
-### 3. Injection
-
-```markdown
-## Check for:
-- [ ] SQL injection
-- [ ] NoSQL injection
-- [ ] Command injection
-- [ ] LDAP injection
-- [ ] XPath injection
-
-## SQL Injection Prevention:
-```python
-# Bad: String concatenation
-cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
-
-# Good: Parameterized queries
-cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
-
-# Good: ORM with proper escaping
-User.query.filter_by(id=user_id).first()
-```
-
-## Command Injection Prevention:
-```python
-# Bad
-os.system(f"echo {user_input}")
-
-# Good: Use subprocess with list arguments
-subprocess.run(["echo", user_input], shell=False)
-
-# Better: Avoid shell commands with user input entirely
-```
-```
-
-### 4. Insecure Design
-
-```markdown
-## Check for:
-- [ ] Missing threat modeling
-- [ ] No rate limiting on sensitive operations
-- [ ] Lack of defense in depth
-- [ ] Missing business logic validation
-
-## Example:
-```python
-# Bad: No rate limiting on login
-def login(credentials: Credentials):
- return authenticate(credentials)
-
-# Good: Rate limited
-from slowapi import Limiter
-limiter = Limiter(key_func=get_remote_address)
-
[email protected]("5/minute")
-def login(credentials: Credentials):
- return authenticate(credentials)
-```
-```
-
-### 5. Security Misconfiguration
-
-```markdown
-## Check for:
-- [ ] Default credentials in use
-- [ ] Unnecessary features enabled
-- [ ] Missing security headers
-- [ ] Verbose error messages in production
-- [ ] Outdated software
-
-## Security Headers:
-```python
-# Flask example
-def add_security_headers(response):
- response.headers['X-Content-Type-Options'] = 'nosniff'
- response.headers['X-Frame-Options'] = 'DENY'
- response.headers['X-XSS-Protection'] = '1; mode=block'
- response.headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains'
- response.headers['Content-Security-Policy'] = "default-src 'self'"
- return response
-```
-```
-
-### 6. Vulnerable Components
-
-```markdown
-## Check for:
-- [ ] Outdated dependencies
-- [ ] Known vulnerable packages
-- [ ] Unmaintained libraries
-
-## Tools:
-```bash
-# Python
-pip-audit
-safety check -r requirements.txt
-
-# JavaScript
-npm audit
-yarn audit
-
-# General
-snyk test
-```
-```
-
-### 7. Authentication Failures
-
-```markdown
-## Check for:
-- [ ] Weak password policies
-- [ ] Missing MFA option
-- [ ] Session fixation
-- [ ] Insecure session management
-
-## Secure Session Management:
-```python
-# Secure session configuration
-app.config.update(
- SESSION_COOKIE_SECURE=True, # HTTPS only
- SESSION_COOKIE_HTTPONLY=True, # No JavaScript access
- SESSION_COOKIE_SAMESITE='Lax', # CSRF protection
- PERMANENT_SESSION_LIFETIME=3600 # 1 hour timeout
-)
-
-# Regenerate session on login
[email protected]('/login', methods=['POST'])
-def login():
- if authenticate(request.form):
- session.regenerate() # Prevent session fixation
- session['user_id'] = user.id
-```
-```
-
-### 8. Data Integrity Failures
-
-```markdown
-## Check for:
-- [ ] Missing integrity checks on critical data
-- [ ] Insecure deserialization
-- [ ] Missing code signing
-
-## Secure Deserialization:
-```python
-# Bad: Pickle with untrusted data
-import pickle
-data = pickle.loads(untrusted_data) # DANGEROUS!
-
-# Good: Use safe serialization
-import json
-data = json.loads(untrusted_data)
-
-# If you must use pickle, sign and verify
-import hmac
-def safe_pickle_loads(data, key):
- signature = data[:32]
- pickled = data[32:]
- expected = hmac.new(key, pickled, 'sha256').digest()
- if not hmac.compare_digest(signature, expected):
- raise ValueError("Invalid signature")
- return pickle.loads(pickled)
-```
-```
-
-### 9. Logging & Monitoring Failures
-
-```markdown
-## Check for:
-- [ ] Sensitive data in logs
-- [ ] Missing audit logs
-- [ ] No alerting for security events
-- [ ] Logs not protected
-
-## Secure Logging:
-```python
-import logging
-
-# Configure secure logging
-logging.basicConfig(
- level=logging.INFO,
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
-)
-
-# Sanitize sensitive data
-def sanitize_log(data):
- sensitive_keys = ['password', 'token', 'api_key', 'ssn']
- return {k: '***' if k in sensitive_keys else v for k, v in data.items()}
-
-# Log security events
-def log_security_event(event_type, details):
- logger.warning(f"SECURITY: {event_type} - {sanitize_log(details)}")
-```
-```
-
-### 10. Server-Side Request Forgery (SSRF)
-
-```markdown
-## Check for:
-- [ ] URL parameters used for server requests
-- [ ] Unvalidated redirects
-- [ ] Internal service exposure
-
-## Prevention:
-```python
-from urllib.parse import urlparse
-import ipaddress
-
-ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com']
-BLOCKED_NETWORKS = [
- ipaddress.ip_network('10.0.0.0/8'),
- ipaddress.ip_network('172.16.0.0/12'),
- ipaddress.ip_network('192.168.0.0/16'),
- ipaddress.ip_network('127.0.0.0/8'),
-]
-
-def is_safe_url(url):
- try:
- parsed = urlparse(url)
-
- # Check allowed hosts
- if parsed.hostname not in ALLOWED_HOSTS:
- return False
-
- # Check not internal IP
- ip = ipaddress.ip_address(parsed.hostname)
- for network in BLOCKED_NETWORKS:
- if ip in network:
- return False
-
- return True
- except:
- return False
-```
-```
-
-## Security Audit Process
-
-### 1. Information Gathering
-
-```markdown
-- [ ] Identify all entry points (APIs, forms, file uploads)
-- [ ] Map authentication and authorization flows
-- [ ] Document data flows
-- [ ] List third-party integrations
-- [ ] Review infrastructure configuration
-```
-
-### 2. Automated Scanning
-
-```bash
-# Web application scanning
-nikto -h https://target.com
-nuclei -u https://target.com -t cves/
-
-# Dependency scanning
-npm audit
-pip-audit
-
-# Static analysis
-bandit -r ./src # Python
-semgrep --config auto ./src # Multi-language
-```
-
-### 3. Manual Testing
-
-```markdown
-## Input Validation
-- [ ] Test with SQL injection payloads
-- [ ] Test with XSS payloads
-- [ ] Test with path traversal (../)
-- [ ] Test file upload restrictions
-
-## Authentication
-- [ ] Test password reset flow
-- [ ] Test session timeout
-- [ ] Test concurrent session handling
-- [ ] Test remember me functionality
-
-## Authorization
-- [ ] Test horizontal privilege escalation
-- [ ] Test vertical privilege escalation
-- [ ] Test API endpoint permissions
-```
-
-### 4. Report Template
-
-```markdown
-# Security Audit Report
-
-## Executive Summary
-[Brief overview of findings]
-
-## Scope
-- Systems tested:
-- Testing period:
-- Methodology:
-
-## Findings
-
-### Critical
-| ID | Title | Impact | CVSS |
-|----|-------|--------|------|
-| C1 | SQL Injection in login | Data breach | 9.8 |
-
-### High
-[Similar table]
-
-### Medium
-[Similar table]
-
-### Low
-[Similar table]
-
-## Detailed Findings
-
-### C1: SQL Injection in Login Form
-
-**Description**: The login form is vulnerable to SQL injection...
-
-**Impact**: An attacker could bypass authentication and access any account...
-
-**Proof of Concept**:
-```
-Username: ' OR '1'='1
-Password: anything
-```
-
-**Recommendation**: Use parameterized queries...
-
-**References**:
-- CWE-89
-- OWASP SQL Injection
-```
-
-## Quick Reference
-
-### Input Validation
-
-```python
-import re
-from html import escape
-
-def sanitize_input(user_input: str) -> str:
- # Remove/escape HTML
- sanitized = escape(user_input)
-
- # Limit length
- sanitized = sanitized[:1000]
-
- # Remove null bytes
- sanitized = sanitized.replace('\x00', '')
-
- return sanitized
-
-def validate_email(email: str) -> bool:
- pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
- return bool(re.match(pattern, email))
-```
-
-### Environment Configuration
-
-```python
-# Never commit secrets!
-import os
-from dotenv import load_dotenv
-
-load_dotenv()
-
-DATABASE_URL = os.getenv('DATABASE_URL')
-SECRET_KEY = os.getenv('SECRET_KEY')
-API_KEY = os.getenv('API_KEY')
-
-# Verify all required env vars are set
-required = ['DATABASE_URL', 'SECRET_KEY', 'API_KEY']
-missing = [v for v in required if not os.getenv(v)]
-if missing:
- raise RuntimeError(f"Missing environment variables: {missing}")
-```
diff --git a/skills/tdd/SKILL.md b/skills/tdd/SKILL.md
deleted file mode 100644
index 6ba8d92a7..000000000
--- a/skills/tdd/SKILL.md
+++ /dev/null
@@ -1,229 +0,0 @@
----
-name: "tdd"
-description: "Test-Driven Development workflow. Write tests first, then implement code to make them pass. Use when implementing features or fixing bugs."
-version: "1.0.0"
-author: "Agent Zero Team"
-tags: ["testing", "tdd", "development", "quality", "best-practices"]
-trigger_patterns:
- - "test first"
- - "tdd"
- - "write tests"
- - "test-driven"
- - "unit test"
----
-
-# Test-Driven Development (TDD) Skill
-
-**CRITICAL**: Write tests BEFORE writing implementation code. This ensures code is testable and meets requirements.
-
-## The TDD Cycle
-
-```
- ┌─────────────────────────────────────┐
- │ │
- │ RED → GREEN → REFACTOR → Repeat │
- │ │
- └─────────────────────────────────────┘
-```
-
-1. **RED**: Write a failing test that defines expected behavior
-2. **GREEN**: Write minimum code to make the test pass
-3. **REFACTOR**: Clean up while keeping tests green
-4. **Repeat**: Add next test case
-
-## When to Use
-
-Activate TDD when:
-- Implementing new features
-- Fixing bugs (write test that reproduces bug first)
-- Refactoring existing code
-- Adding edge case handling
-
-## The TDD Process
-
-### Phase 1: Understand Requirements
-
-Before writing any code:
-1. Clarify what the feature should do
-2. Identify inputs, outputs, and edge cases
-3. List test cases needed
-
-```markdown
-## Feature: [Name]
-### Happy Path Cases
-- [ ] Test case 1: Given X, when Y, then Z
-- [ ] Test case 2: Given A, when B, then C
-
-### Edge Cases
-- [ ] Empty input
-- [ ] Invalid input
-- [ ] Boundary values
-
-### Error Cases
-- [ ] What should happen when X fails?
-```
-
-### Phase 2: RED - Write Failing Test
-
-Write a test that:
-1. Describes the expected behavior
-2. Fails for the right reason (not implementation exists yet)
-3. Is simple and focused
-
-```python
-# Python example
-def test_calculate_total_with_discount():
- """Should apply 10% discount for orders over $100"""
- order = Order(items=[Item(price=150)])
-
- result = order.calculate_total()
-
- assert result == 135.00 # 150 - 10% = 135
-```
-
-```javascript
-// JavaScript example
-describe('calculateTotal', () => {
- it('should apply 10% discount for orders over $100', () => {
- const order = new Order([{ price: 150 }]);
-
- const result = order.calculateTotal();
-
- expect(result).toBe(135);
- });
-});
-```
-
-### Phase 3: GREEN - Make Test Pass
-
-Write the simplest code that makes the test pass:
-1. Don't over-engineer
-2. Don't add features the test doesn't require
-3. It's okay if code is ugly - we'll refactor next
-
-```python
-def calculate_total(self):
- total = sum(item.price for item in self.items)
- if total > 100:
- total = total * 0.9 # 10% discount
- return total
-```
-
-### Phase 4: REFACTOR - Clean Up
-
-Improve code quality while keeping tests green:
-1. Remove duplication
-2. Improve naming
-3. Extract methods if needed
-4. Run tests after each change
-
-```python
-DISCOUNT_THRESHOLD = 100
-DISCOUNT_RATE = 0.10
-
-def calculate_total(self):
- subtotal = self._calculate_subtotal()
- discount = self._calculate_discount(subtotal)
- return subtotal - discount
-
-def _calculate_subtotal(self):
- return sum(item.price for item in self.items)
-
-def _calculate_discount(self, subtotal):
- if subtotal > DISCOUNT_THRESHOLD:
- return subtotal * DISCOUNT_RATE
- return 0
-```
-
-### Phase 5: Repeat
-
-Add the next test case and repeat the cycle.
-
-## Test Patterns
-
-### Arrange-Act-Assert (AAA)
-
-```python
-def test_user_creation():
- # Arrange - set up test data
- user_data = {"name": "Alice", "email": "[email protected]"}
-
- # Act - perform the action
- user = User.create(user_data)
-
- # Assert - verify the result
- assert user.name == "Alice"
- assert user.email == "[email protected]"
-```
-
-### Given-When-Then (BDD style)
-
-```python
-def test_user_login():
- # Given a registered user
- user = create_user(email="[email protected]", password="secret")
-
- # When they attempt to login with correct credentials
- result = login(email="[email protected]", password="secret")
-
- # Then they should be authenticated
- assert result.success == True
- assert result.token is not None
-```
-
-## Common Test Types
-
-### Unit Tests
-- Test single functions/methods in isolation
-- Mock external dependencies
-- Fast execution
-
-### Integration Tests
-- Test multiple components together
-- Use real databases (test instances)
-- Slower but more realistic
-
-### End-to-End Tests
-- Test full user workflows
-- Run against complete system
-- Slowest but most comprehensive
-
-## Anti-Patterns to Avoid
-
-- **Test After**: Writing tests after implementation defeats the purpose
-- **Testing Implementation**: Test behavior, not implementation details
-- **Brittle Tests**: Tests shouldn't break when refactoring
-- **Skipping Refactor**: Technical debt accumulates without refactoring
-- **Too Many Mocks**: Over-mocking makes tests meaningless
-
-## Example TDD Session
-
-**User**: "Implement a password validator"
-
-**Agent Response**:
-> Let me implement this using TDD:
->
-> ## Test Cases to Cover
-> 1. Password must be at least 8 characters
-> 2. Password must contain uppercase letter
-> 3. Password must contain number
-> 4. Password must contain special character
->
-> ## RED: First Test
-> ```python
-> def test_rejects_short_password():
-> result = validate_password("short")
-> assert result.valid == False
-> assert "at least 8 characters" in result.errors
-> ```
->
-> ## GREEN: Minimal Implementation
-> ```python
-> def validate_password(password):
-> errors = []
-> if len(password) < 8:
-> errors.append("Password must be at least 8 characters")
-> return ValidationResult(valid=len(errors) == 0, errors=errors)
-> ```
->
-> [Continues with next test case...]