ai-dev-starter 0.0.0-stage → 1.0.1

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.
Files changed (42) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +383 -2
  3. package/adapters/antigravity/AGENTS.md +71 -0
  4. package/adapters/antigravity/skills/architecture-review/SKILL.md +33 -0
  5. package/adapters/antigravity/skills/bug-fix/SKILL.md +36 -0
  6. package/adapters/antigravity/skills/code-review/SKILL.md +34 -0
  7. package/adapters/antigravity/skills/feature-development/SKILL.md +37 -0
  8. package/adapters/antigravity/skills/performance-audit/SKILL.md +34 -0
  9. package/adapters/antigravity/skills/refactor/SKILL.md +35 -0
  10. package/adapters/antigravity/skills/security-audit/SKILL.md +35 -0
  11. package/adapters/antigravity/skills/test-generation/SKILL.md +34 -0
  12. package/adapters/cursor/bug-fix.mdc +38 -0
  13. package/adapters/cursor/code-review.mdc +56 -0
  14. package/adapters/cursor/core-rules.mdc +56 -0
  15. package/adapters/cursor/feature-development.mdc +31 -0
  16. package/adapters/cursor/performance-arch-tests.mdc +57 -0
  17. package/adapters/cursor/refactor-and-security.mdc +50 -0
  18. package/bin/ai-dev-starter.js +2 -0
  19. package/core/agent-principles.md +96 -0
  20. package/core/git-analysis.md +150 -0
  21. package/core/review-methodology.md +154 -0
  22. package/core/safety-policy.md +70 -0
  23. package/core/severity-levels.md +104 -0
  24. package/package.json +40 -4
  25. package/scripts/ai-dev-starter.js +709 -0
  26. package/scripts/detector.js +406 -0
  27. package/standards/backend.md +84 -0
  28. package/standards/database.md +100 -0
  29. package/standards/frontend.md +81 -0
  30. package/standards/security.md +84 -0
  31. package/standards/testing.md +132 -0
  32. package/templates/architecture-decision.md +92 -0
  33. package/templates/project-context.md +145 -0
  34. package/templates/review-report.md +102 -0
  35. package/workflows/architecture-review.md +186 -0
  36. package/workflows/bug-fix.md +149 -0
  37. package/workflows/code-review.md +189 -0
  38. package/workflows/feature-development.md +154 -0
  39. package/workflows/performance-audit.md +169 -0
  40. package/workflows/refactor.md +128 -0
  41. package/workflows/security-audit.md +164 -0
  42. package/workflows/test-generation.md +168 -0
@@ -0,0 +1,84 @@
1
+ # Security Standards
2
+
3
+ > **Scope:** Universal application security baseline.
4
+ > **Load:** Always loaded for security-audit workflow. Referenced by code-review.
5
+
6
+ ---
7
+
8
+ ## OWASP Top 10 Baseline
9
+
10
+ ### A01 — Broken Access Control
11
+ - Enforce authorization on every state-changing request.
12
+ - Deny by default. Grant access explicitly.
13
+ - Do not rely on obscure URLs or hidden UI elements for access control.
14
+ - Validate that the authenticated user owns or has rights to each resource they access.
15
+
16
+ ### A02 — Cryptographic Failures
17
+ - Use TLS 1.2+ for all data in transit.
18
+ - Use AES-256 for symmetric encryption at rest.
19
+ - Use bcrypt, argon2, or scrypt for password hashing.
20
+ - Never roll custom cryptographic algorithms.
21
+ - Rotate keys and manage them through a secrets manager, not source code.
22
+
23
+ ### A03 — Injection
24
+ - Use parameterized queries or ORMs for all database interactions.
25
+ - Never pass user input to `eval`, `exec`, `shell_exec`, `system`, or similar.
26
+ - Sanitize and encode output before rendering in HTML (use framework templating engines).
27
+ - Validate file paths — prevent directory traversal.
28
+
29
+ ### A04 — Insecure Design
30
+ - Apply the principle of least privilege to all roles and service accounts.
31
+ - Design rate limiting for authentication endpoints and sensitive operations.
32
+ - Limit failed login attempts (lockout or CAPTCHA after N failures).
33
+
34
+ ### A05 — Security Misconfiguration
35
+ - Disable debug mode and verbose errors in production.
36
+ - Remove default accounts and credentials.
37
+ - Apply security headers: `Content-Security-Policy`, `X-Frame-Options`, `Strict-Transport-Security`.
38
+ - Review and restrict CORS policies — do not allow `*` for credentialed requests.
39
+
40
+ ### A06 — Vulnerable and Outdated Components
41
+ - Track direct dependencies for known CVEs.
42
+ - Run `composer audit`, `npm audit`, or `pip-audit` as part of CI.
43
+ - Update dependencies regularly, especially for security patches.
44
+
45
+ ### A07 — Identification and Authentication Failures
46
+ - Use multi-factor authentication for administrative access.
47
+ - Use secure, `HttpOnly`, `Secure`, `SameSite=Strict` cookie attributes.
48
+ - Implement CSRF protection for all state-changing form submissions.
49
+ - Invalidate sessions after logout and after password change.
50
+
51
+ ### A08 — Software and Data Integrity Failures
52
+ - Verify file checksums or signatures for critical downloads.
53
+ - Use lockfiles (`composer.lock`, `package-lock.json`) for reproducible builds.
54
+ - Do not deserialize untrusted data without strict type validation.
55
+
56
+ ### A09 — Security Logging and Monitoring
57
+ - Log authentication events, permission denials, and input validation failures.
58
+ - Do not log sensitive data (passwords, tokens, PII).
59
+ - Set up alerts for suspicious patterns (many failed logins, unusual data volumes).
60
+
61
+ ### A10 — Server-Side Request Forgery (SSRF)
62
+ - Validate and allowlist URLs before making server-side HTTP requests.
63
+ - Block requests to internal IP ranges (169.254.x.x, 10.x.x.x, 172.16-31.x.x, 192.168.x.x).
64
+ - Do not use user-provided URLs in server-side HTTP calls without validation.
65
+
66
+ ---
67
+
68
+ ## Credential Management
69
+
70
+ - Store all secrets in environment variables or a secrets manager (Vault, AWS Secrets Manager, GCP Secret Manager).
71
+ - Never commit secrets, API keys, or passwords to version control.
72
+ - Use `.gitignore` to exclude `.env` files.
73
+ - Rotate credentials when team members leave.
74
+ - Audit `.git` history if a credential has been accidentally committed.
75
+
76
+ ---
77
+
78
+ ## API Security
79
+
80
+ - Authenticate all API endpoints unless explicitly designed to be public.
81
+ - Rate limit all APIs — especially auth, registration, and search.
82
+ - Return generic error messages for auth failures (do not reveal whether a user exists).
83
+ - Version APIs — do not break existing clients with silent changes.
84
+ - Validate `Content-Type` on request bodies.
@@ -0,0 +1,132 @@
1
+ # Testing Standards
2
+
3
+ > **Scope:** Universal testing principles. Framework-specific details inferred from project setup.
4
+ > **Load:** On demand for test-generation workflow and code reviews.
5
+
6
+ ---
7
+
8
+ ## Testing Pyramid
9
+
10
+ ```
11
+ /\
12
+ / \ E2E Tests
13
+ /----\ (few, slow, expensive)
14
+ / \
15
+ / Integr. \ Integration Tests
16
+ /------------\ (moderate, test real interactions)
17
+ / \
18
+ / Unit Tests \ (many, fast, isolated)
19
+ /------------------\
20
+ ```
21
+
22
+ - **Unit tests:** Test one function or class in isolation. Fast, numerous.
23
+ - **Integration tests:** Test multiple units working together (service + database, controller + middleware).
24
+ - **E2E tests:** Test full user flows through the UI or API. Expensive; use sparingly.
25
+
26
+ Target: **Unit tests for business logic, Integration tests for API endpoints, E2E for critical user flows only.**
27
+
28
+ ---
29
+
30
+ ## Test Quality Criteria
31
+
32
+ ### A Good Test
33
+ - Tests a single, clearly named behavior.
34
+ - Has a descriptive name: `test_create_order_with_zero_stock_returns_error`.
35
+ - Has three distinct sections: Arrange / Act / Assert.
36
+ - Passes consistently (no flakiness from timing or external state).
37
+ - Runs in isolation (no dependency on test execution order).
38
+ - Cleans up after itself (no residual database or file state).
39
+
40
+ ### A Bad Test
41
+ - Tests multiple behaviors in one test method.
42
+ - Has an uninformative name: `test_order_1`.
43
+ - Relies on external services without mocking.
44
+ - Checks implementation details rather than behavior.
45
+ - Cannot fail — asserts are missing or trivially true.
46
+
47
+ ---
48
+
49
+ ## What to Test
50
+
51
+ ### Always Test
52
+ - Core business logic (calculations, state transitions, validations).
53
+ - Authorization rules (who can access what).
54
+ - Data validation (what inputs are accepted and rejected).
55
+ - Error paths (what happens when dependencies fail).
56
+ - Security-critical behavior (input sanitization, permission checks).
57
+
58
+ ### Usually Test
59
+ - API endpoint contracts (request/response shapes, status codes).
60
+ - Database persistence (do the right records get created/updated/deleted?).
61
+ - Background job behavior.
62
+
63
+ ### Often Skip
64
+ - Framework boilerplate (resource controllers that only delegate to services).
65
+ - Simple getters and setters.
66
+ - Generated code.
67
+
68
+ ---
69
+
70
+ ## Test Structure
71
+
72
+ ```php
73
+ // PHP — Pest
74
+ it('charges the customer once per order', function () {
75
+ // Arrange
76
+ $payment = Mockery::mock(PaymentGateway::class);
77
+ $payment->expects('charge')->once()->andReturn(['status' => 'success']);
78
+ app()->instance(PaymentGateway::class, $payment);
79
+ $order = Order::factory()->make();
80
+
81
+ // Act
82
+ $result = app(OrderService::class)->place($order);
83
+
84
+ // Assert
85
+ expect($result->status)->toBe('confirmed');
86
+ });
87
+ ```
88
+
89
+ ```typescript
90
+ // TypeScript — Vitest / Jest
91
+ describe('OrderService', () => {
92
+ it('places an order and returns confirmed status', async () => {
93
+ // Arrange
94
+ const mockPayment = { charge: vi.fn().mockResolvedValue({ status: 'success' }) };
95
+ const service = new OrderService(mockPayment);
96
+
97
+ // Act
98
+ const result = await service.place({ productId: 1, quantity: 2 });
99
+
100
+ // Assert
101
+ expect(result.status).toBe('confirmed');
102
+ expect(mockPayment.charge).toHaveBeenCalledTimes(1);
103
+ });
104
+ });
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Mocking Guidelines
110
+
111
+ - Mock at the boundary of your system (external APIs, email providers, payment gateways).
112
+ - Do not mock internal business logic — test it directly.
113
+ - Use fakes (in-memory implementations) over mocks when possible for stability.
114
+ - Reset mocks between tests.
115
+
116
+ ---
117
+
118
+ ## Test Coverage
119
+
120
+ - Coverage metrics are a guide, not a goal. 100% coverage does not mean correctness.
121
+ - Target 80%+ branch coverage on business logic classes.
122
+ - Prioritize covering error paths and edge cases.
123
+ - Use coverage reports to find untested critical paths, not to game percentages.
124
+
125
+ ---
126
+
127
+ ## Test Data
128
+
129
+ - Use factories to generate test data. Do not use production data in tests.
130
+ - Seed deterministic test data for predictable assertions.
131
+ - Do not rely on specific IDs (auto-increment values differ between runs).
132
+ - Isolate database state between tests (transaction rollback or database refresh).
@@ -0,0 +1,92 @@
1
+ # Architecture Decision Record (ADR)
2
+
3
+ > **Template:** Use this to document significant architectural decisions.
4
+ > **File naming:** `docs/adr/NNNN-short-title.md` (e.g., `docs/adr/0001-use-event-sourcing.md`).
5
+
6
+ ---
7
+
8
+ ## ADR-{{NUMBER}}: {{TITLE}}
9
+
10
+ **Status:** `Proposed` | `Accepted` | `Deprecated` | `Superseded by ADR-NNN`
11
+ **Date:** YYYY-MM-DD
12
+ **Deciders:** {{names or roles}}
13
+
14
+ ---
15
+
16
+ ## Context
17
+
18
+ <!-- What is the situation that is forcing us to make a decision?
19
+ What constraints or forces are at play? Be specific. -->
20
+
21
+ {{context_description}}
22
+
23
+ ---
24
+
25
+ ## Decision Drivers
26
+
27
+ - {{driver_1}}: e.g., "Team is unfamiliar with event sourcing"
28
+ - {{driver_2}}: e.g., "We need audit logs for compliance"
29
+ - {{driver_3}}
30
+
31
+ ---
32
+
33
+ ## Options Considered
34
+
35
+ ### Option A: {{option_a_name}}
36
+
37
+ **Description:** {{brief description}}
38
+
39
+ **Pros:**
40
+ - {{pro_1}}
41
+
42
+ **Cons:**
43
+ - {{con_1}}
44
+
45
+ ---
46
+
47
+ ### Option B: {{option_b_name}}
48
+
49
+ **Description:** {{brief description}}
50
+
51
+ **Pros:**
52
+ - {{pro_1}}
53
+
54
+ **Cons:**
55
+ - {{con_1}}
56
+
57
+ ---
58
+
59
+ ## Decision
60
+
61
+ **Chosen:** Option {{A/B/C}}
62
+
63
+ **Rationale:**
64
+ {{1–3 paragraphs explaining why this option was chosen over the alternatives, referencing the decision drivers}}
65
+
66
+ ---
67
+
68
+ ## Consequences
69
+
70
+ ### Positive
71
+ - {{positive_outcome_1}}
72
+
73
+ ### Negative / Trade-offs
74
+ - {{trade_off_1}}
75
+
76
+ ### Neutral
77
+ - {{neutral_note_1}}
78
+
79
+ ---
80
+
81
+ ## Implementation Notes
82
+
83
+ <!-- Specific guidance for implementing this decision. -->
84
+
85
+ {{implementation_notes_or_none}}
86
+
87
+ ---
88
+
89
+ ## References
90
+
91
+ - {{link_to_relevant_documentation}}
92
+ - {{link_to_related_ADR}}
@@ -0,0 +1,145 @@
1
+ # Project Context
2
+
3
+ > **Instructions for the AI agent:** Read this file first when starting any task in this project.
4
+ > Do NOT overwrite this file without user permission.
5
+ > Fill in every field. Leave unknown fields as `unknown` or `[]`.
6
+
7
+ ---
8
+
9
+ ## Project Identity
10
+
11
+ ```yaml
12
+ project_name: "My Project"
13
+ version: "1.0.0"
14
+ description: "Brief description of what this project does"
15
+ repository: "https://github.com/org/repo"
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Tech Stack
21
+
22
+ ```yaml
23
+ # Backend
24
+ backend_language: "" # php, typescript, python, go, etc.
25
+ backend_framework: "" # laravel, express, fastapi, gin, etc.
26
+ backend_version: "" # e.g., Laravel 11, Node.js 20
27
+
28
+ # Frontend
29
+ frontend_framework: "" # react, next, vue, nuxt, angular, none
30
+ frontend_language: "" # typescript, javascript
31
+ styling: "" # tailwind, css-modules, styled-components, etc.
32
+
33
+ # Database
34
+ databases: # list all
35
+ - type: "" # mysql, postgresql, mongodb, redis, etc.
36
+ version: ""
37
+ orm: "" # eloquent, prisma, sqlalchemy, etc.
38
+
39
+ # Infrastructure
40
+ hosting: "" # AWS, GCP, Azure, Vercel, Hetzner, etc.
41
+ containerized: false # true/false
42
+ ci_cd: "" # GitHub Actions, GitLab CI, Bitbucket Pipelines, etc.
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Architecture
48
+
49
+ ```yaml
50
+ pattern: "" # MVC, Clean Architecture, Hexagonal, DDD, Microservices, etc.
51
+ layers:
52
+ - name: "" # e.g., Controllers, Services, Repositories, Models
53
+ path: "" # e.g., app/Http/Controllers
54
+
55
+ key_directories:
56
+ - path: "" # e.g., app/Services
57
+ purpose: "" # Business logic layer
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Development Commands
63
+
64
+ ```yaml
65
+ install: "composer install && npm install"
66
+ dev_server: "php artisan serve"
67
+ build: "npm run build"
68
+ test: "php artisan test"
69
+ lint: "php cs-fixer fix --dry-run"
70
+ format: "php cs-fixer fix"
71
+ migrate: "php artisan migrate"
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Testing Setup
77
+
78
+ ```yaml
79
+ backend_test_framework: "" # phpunit, pest, pytest, jest, vitest
80
+ test_directory: "tests/"
81
+ integration_tests: false
82
+ e2e_tests: false
83
+ test_database: "" # e.g., sqlite in-memory, test MySQL database
84
+ coverage_target: 80
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Coding Conventions
90
+
91
+ ```yaml
92
+ # Naming
93
+ class_naming: "" # PascalCase
94
+ method_naming: "" # camelCase
95
+ variable_naming: "" # camelCase / snake_case
96
+ file_naming: "" # PascalCase for classes, kebab-case for components
97
+
98
+ # Formatting
99
+ indentation: 4 # spaces
100
+ max_line_length: 120
101
+ trailing_commas: true
102
+
103
+ # Specific rules (add project-specific rules here)
104
+ custom_rules:
105
+ - ""
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Important Constraints
111
+
112
+ ```yaml
113
+ # Things the AI must never do in this project
114
+ never_do:
115
+ - "Never push to main branch directly"
116
+ - "Never run migrations in production manually"
117
+ - "Never bypass the OrderService for order creation"
118
+
119
+ # High-risk areas requiring extra caution
120
+ sensitive_areas:
121
+ - path: ""
122
+ reason: ""
123
+
124
+ # External dependencies or services this project uses
125
+ external_services:
126
+ - name: ""
127
+ purpose: ""
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Review and Report Settings
133
+
134
+ ```yaml
135
+ report_language: "fa" # fa = Persian (Farsi), en = English
136
+ severity_threshold: "P2" # Minimum severity to include in reports (P0, P1, P2, P3)
137
+ auto_review_on_change: true # When true, AI automatically runs PR-Agent review after every code change prompt
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Project Notes
143
+
144
+ <!-- Add any additional context the AI should know about this project. -->
145
+ <!-- Examples: unusual conventions, legacy areas to avoid, known technical debt, etc. -->
@@ -0,0 +1,102 @@
1
+ # Code Review Report
2
+
3
+ > **Template:** Used by the Code Review workflow to structure output.
4
+ > **Language:** Fill report in the language configured in project-context.md → `report_language`.
5
+
6
+ ---
7
+
8
+ ## گزارش بررسی کد / Code Review Report
9
+
10
+ **شاخه (Branch):** `{{branch}}` → `{{base_branch}}`
11
+ **تعداد فایل‌های تغییریافته (Files changed):** {{file_count}}
12
+ **تعداد کامیت‌ها (Commits):** {{commit_count}}
13
+ **تاریخ (Date):** {{date}}
14
+ **بررسی‌کننده (Reviewer):** AI Agent (ai-dev-starter)
15
+
16
+ ---
17
+
18
+ ## خلاصه تغییرات / Walkthrough
19
+
20
+ {{walkthrough_paragraph}}
21
+
22
+ ---
23
+
24
+ ## فایل‌های تغییریافته / Changed Files
25
+
26
+ | فایل (File) | تغییرات (Changes) | نوع (Type) |
27
+ |-------------|-------------------|------------|
28
+ | `{{file_path}}` | +{{added}} / -{{removed}} | {{type: modified/added/deleted}} |
29
+
30
+ ---
31
+
32
+ ## یافته‌ها / Findings
33
+
34
+ <!-- Repeat the following block for each finding, ordered P0 → P3 -->
35
+
36
+ ### [{{SEVERITY}}] {{short_title}}
37
+
38
+ **فایل (File):** `{{file_path}}` خط (Line) {{line_number}}
39
+ **نوع آسیب‌پذیری (Type):** {{category: Security / Logic / Performance / Architecture / Quality}}
40
+
41
+ **مشکل (Problem):**
42
+ {{problem_description_in_report_language}}
43
+
44
+ **شواهد (Evidence):**
45
+ ```{{language}}
46
+ {{relevant_code_snippet}}
47
+ ```
48
+
49
+ **تأثیر (Impact):**
50
+ {{impact_description}}
51
+
52
+ **پیشنهاد رفع (Fix):**
53
+ {{fix_suggestion}}
54
+
55
+ ```{{language}}
56
+ {{fix_code_snippet_if_applicable}}
57
+ ```
58
+
59
+ **روش تأیید (Verification):**
60
+ {{verification_method}}
61
+
62
+ ---
63
+
64
+ <!-- End of finding block -->
65
+
66
+ ---
67
+
68
+ ## مشاهدات / Observations
69
+
70
+ <!-- Pre-existing issues noticed outside the diff scope -->
71
+
72
+ {{observations_or_none}}
73
+
74
+ ---
75
+
76
+ ## نکات مثبت / Positive Notes
77
+
78
+ {{positive_observations}}
79
+
80
+ ---
81
+
82
+ ## خلاصه اولویت‌ها / Priority Summary
83
+
84
+ | اولویت (Severity) | تعداد (Count) |
85
+ |-------------------|---------------|
86
+ | P0 — بحرانی (Critical) | {{p0_count}} |
87
+ | P1 — بالا (High) | {{p1_count}} |
88
+ | P2 — متوسط (Medium) | {{p2_count}} |
89
+ | P3 — پایین (Low) | {{p3_count}} |
90
+
91
+ ---
92
+
93
+ ## اقدامات پیشنهادی / Recommended Actions
94
+
95
+ 1. {{action_1_p0_or_p1_fix}}
96
+ 2. {{action_2}}
97
+ 3. ...
98
+
99
+ ---
100
+
101
+ *گزارش توسط ai-dev-starter تولید شد. منابع: PR-Agent methodology (Qodo, MIT License).*
102
+ *Report generated by ai-dev-starter. Source methodology adapted from PR-Agent (Qodo, MIT License).*