@softspark/ai-toolkit 1.3.14 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +62 -16
- package/app/agents/backend-specialist.md +8 -0
- package/app/agents/code-reviewer.md +9 -0
- package/app/agents/database-architect.md +8 -0
- package/app/agents/debugger.md +8 -0
- package/app/agents/devops-implementer.md +8 -0
- package/app/agents/documenter.md +8 -0
- package/app/agents/frontend-specialist.md +8 -0
- package/app/agents/performance-optimizer.md +8 -0
- package/app/agents/security-auditor.md +9 -0
- package/app/agents/test-engineer.md +9 -0
- package/app/skills/analyze/SKILL.md +15 -0
- package/app/skills/api-patterns/SKILL.md +10 -0
- package/app/skills/ci-cd-patterns/SKILL.md +10 -0
- package/app/skills/clean-code/SKILL.md +10 -0
- package/app/skills/database-patterns/SKILL.md +10 -0
- package/app/skills/debug/SKILL.md +16 -0
- package/app/skills/docs/SKILL.md +16 -0
- package/app/skills/git-mastery/SKILL.md +10 -0
- package/app/skills/onboard/SKILL.md +15 -0
- package/app/skills/performance-profiling/SKILL.md +10 -0
- package/app/skills/plan/SKILL.md +16 -0
- package/app/skills/refactor/SKILL.md +16 -0
- package/app/skills/review/SKILL.md +58 -3
- package/app/skills/security-patterns/SKILL.md +10 -0
- package/app/skills/tdd/SKILL.md +6 -0
- package/app/skills/testing-patterns/SKILL.md +10 -0
- package/bin/ai-toolkit.js +33 -5
- package/kb/procedures/release-verification-sop.md +283 -0
- package/kb/reference/architecture-overview.md +36 -7
- package/kb/reference/competitive-features-implementation.md +51 -52
- package/kb/reference/language-rules.md +18 -4
- package/kb/reference/skills-catalog.md +57 -1
- package/llms-full.txt +451 -64
- package/llms.txt +1 -0
- package/manifest.json +1 -1
- package/package.json +4 -2
- package/scripts/dir_rules_shared.py +441 -0
- package/scripts/generate_antigravity.py +36 -0
- package/scripts/generate_augment_rules.py +107 -0
- package/scripts/generate_cline_rules.py +31 -0
- package/scripts/generate_conventions.py +37 -0
- package/scripts/generate_cursor_mdc.py +127 -0
- package/scripts/generate_roo_rules.py +30 -0
- package/scripts/generate_windsurf_rules.py +31 -0
- package/scripts/install.py +26 -1
- package/scripts/install_steps/ai_tools.py +149 -31
- package/scripts/install_steps/detect_language.py +68 -5
package/llms.txt
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
- [No Hardcoded Counts in Secondary Docs](kb/best-practices/no-hardcoded-counts.md)
|
|
16
16
|
- [How-To Guides](kb/howto/README.md)
|
|
17
17
|
- [SOP: Claude Toolkit Maintenance](kb/procedures/maintenance-sop.md)
|
|
18
|
+
- [SOP: Release Verification](kb/procedures/release-verification-sop.md)
|
|
18
19
|
- [Agents Catalog](kb/reference/agents-catalog.md)
|
|
19
20
|
- [Anti-Pattern Registry Format](kb/reference/anti-pattern-registry-format.md)
|
|
20
21
|
- [AI Toolkit Architecture](kb/reference/architecture-overview.md)
|
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softspark/ai-toolkit",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Professional-grade AI coding toolkit: 91 skills, 44 agents, multi-platform support (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, Aider, Augment), machine-enforced safety constitution, persona presets, skill security auditor, expanded lifecycle hooks, 11 plugin packs, and benchmark tooling.",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Professional-grade AI coding toolkit: 91 skills, 44 agents, multi-platform support (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo Code, Aider, Augment, Google Antigravity), machine-enforced safety constitution, persona presets, skill security auditor, expanded lifecycle hooks, 11 plugin packs, and benchmark tooling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
7
7
|
"claude-code",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"roo",
|
|
22
22
|
"aider",
|
|
23
23
|
"augment",
|
|
24
|
+
"antigravity",
|
|
25
|
+
"google-antigravity",
|
|
24
26
|
"multi-platform"
|
|
25
27
|
],
|
|
26
28
|
"homepage": "https://github.com/softspark/ai-toolkit",
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"""Shared content and helpers for directory-based rule generators.
|
|
2
|
+
|
|
3
|
+
Used by: Antigravity, Cursor .mdc, Windsurf, Cline, Roo Code.
|
|
4
|
+
All generators produce prefixed files (ai-toolkit-*) to avoid
|
|
5
|
+
overwriting user content. Re-running is idempotent.
|
|
6
|
+
|
|
7
|
+
Stdlib-only.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from emission import (
|
|
14
|
+
count_agents_and_skills,
|
|
15
|
+
emit_agents_bullets,
|
|
16
|
+
emit_skills_bullets,
|
|
17
|
+
generate_general_guidelines,
|
|
18
|
+
generate_quality_standards,
|
|
19
|
+
generate_workflow_guidelines,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
PREFIX = "ai-toolkit-"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
# Rule content generators (shared across all directory-based generators)
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
def rule_code_style() -> str:
|
|
30
|
+
return """\
|
|
31
|
+
# Code Style
|
|
32
|
+
|
|
33
|
+
* Follow language-specific conventions: PEP 8 (Python), StandardJS/Prettier (TypeScript), gofmt (Go), rustfmt (Rust)
|
|
34
|
+
* Use descriptive names: functions as verbs (`calculateTotal`), booleans as questions (`isValid`), constants as UPPER_SNAKE
|
|
35
|
+
* Keep functions short — single responsibility, max ~30 lines
|
|
36
|
+
* Prefer immutability: use `const`/`final`/`let` over mutable variables where possible
|
|
37
|
+
* No magic numbers — extract to named constants
|
|
38
|
+
* Avoid deep nesting (max 3 levels) — use early returns and guard clauses
|
|
39
|
+
* DRY: extract shared logic only when used 3+ times; premature abstraction is worse than duplication
|
|
40
|
+
* YAGNI: do not build features or abstractions for hypothetical future requirements
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def rule_testing() -> str:
|
|
45
|
+
return """\
|
|
46
|
+
# Testing
|
|
47
|
+
|
|
48
|
+
* Every new feature or bug fix must include tests
|
|
49
|
+
* Use Arrange-Act-Assert pattern for unit tests
|
|
50
|
+
* Test behavior, not implementation — tests should survive refactoring
|
|
51
|
+
* Use descriptive test names: `test_<what>_<when>_<expected>`
|
|
52
|
+
* Prefer real dependencies over mocks at integration boundaries
|
|
53
|
+
* Target >70% code coverage for new code
|
|
54
|
+
* Never skip or disable tests without a linked issue explaining why
|
|
55
|
+
* Run the full test suite before marking work as done
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def rule_security() -> str:
|
|
60
|
+
return """\
|
|
61
|
+
# Security
|
|
62
|
+
|
|
63
|
+
* Never commit secrets, API keys, credentials, or tokens — use environment variables
|
|
64
|
+
* Validate and sanitize all external input (user input, API responses, file uploads)
|
|
65
|
+
* Use parameterized queries — never concatenate SQL strings
|
|
66
|
+
* Escape output to prevent XSS in web contexts
|
|
67
|
+
* Apply principle of least privilege for file permissions and API scopes
|
|
68
|
+
* Keep dependencies updated — audit regularly for known CVEs
|
|
69
|
+
* Use HTTPS for all external communication
|
|
70
|
+
* Log security events without logging sensitive data (passwords, tokens, PII)
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def rule_workflow() -> str:
|
|
75
|
+
return """\
|
|
76
|
+
# Workflow
|
|
77
|
+
|
|
78
|
+
* Plan before implementing: tasks >1 hour need a plan, success criteria, and pre-mortem
|
|
79
|
+
* Research before acting: check existing code and documentation before proposing changes
|
|
80
|
+
* Use structured commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:` (Conventional Commits)
|
|
81
|
+
* Prefer editing existing files over creating new ones to avoid file bloat
|
|
82
|
+
* Read-only exploration first, then targeted changes — never explore and write simultaneously
|
|
83
|
+
* Quality gates must pass before done: lint, type-check, tests green
|
|
84
|
+
* Cite sources when making decisions based on existing knowledge or documentation
|
|
85
|
+
* No destructive commands (`rm -rf`, `DROP TABLE`, `--force`) without explicit user confirmation
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def rule_quality_standards() -> str:
|
|
90
|
+
return """\
|
|
91
|
+
# Quality Standards
|
|
92
|
+
|
|
93
|
+
* "Green tests" is the only definition of Done — forced merges on red tests are unacceptable
|
|
94
|
+
* All public APIs must have type annotations/signatures
|
|
95
|
+
* No data loss: never delete files without backup verification or using reversible operations
|
|
96
|
+
* No blind execution: never run generated code without review
|
|
97
|
+
* No infinite loops: all autonomous loops must have a maximum iteration count
|
|
98
|
+
* Commands like `rm -rf`, `DROP TABLE`, `FORMAT` require explicit user confirmation
|
|
99
|
+
* Never delete audit logs or archives without explicit approval and backup
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def rule_agents_and_skills() -> str:
|
|
104
|
+
"""Full listing of agents and skills — same content all platforms get."""
|
|
105
|
+
agents_count, skills_count = count_agents_and_skills()
|
|
106
|
+
lines = [
|
|
107
|
+
f"# AI Toolkit — {agents_count} Agents, {skills_count} Skills",
|
|
108
|
+
"",
|
|
109
|
+
"Shared AI development toolkit with specialized agents, skills, quality hooks, and a safety constitution.",
|
|
110
|
+
"",
|
|
111
|
+
"## Available Agents",
|
|
112
|
+
"",
|
|
113
|
+
"Specialized agent personas — apply their expertise for relevant tasks:",
|
|
114
|
+
"",
|
|
115
|
+
emit_agents_bullets(),
|
|
116
|
+
"",
|
|
117
|
+
"## Available Skills",
|
|
118
|
+
"",
|
|
119
|
+
"Skills are invocable slash commands or auto-loaded knowledge sources:",
|
|
120
|
+
"",
|
|
121
|
+
emit_skills_bullets(),
|
|
122
|
+
"",
|
|
123
|
+
generate_general_guidelines(),
|
|
124
|
+
"",
|
|
125
|
+
generate_quality_standards(),
|
|
126
|
+
"",
|
|
127
|
+
generate_workflow_guidelines(),
|
|
128
|
+
]
|
|
129
|
+
return "\n".join(lines) + "\n"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# Standard rule files every platform gets
|
|
133
|
+
STANDARD_RULES: dict[str, callable] = {
|
|
134
|
+
f"{PREFIX}agents-and-skills.md": rule_agents_and_skills,
|
|
135
|
+
f"{PREFIX}code-style.md": rule_code_style,
|
|
136
|
+
f"{PREFIX}testing.md": rule_testing,
|
|
137
|
+
f"{PREFIX}security.md": rule_security,
|
|
138
|
+
f"{PREFIX}workflow.md": rule_workflow,
|
|
139
|
+
f"{PREFIX}quality-standards.md": rule_quality_standards,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# ---------------------------------------------------------------------------
|
|
144
|
+
# Workflow content generators
|
|
145
|
+
# ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
def workflow_code_review() -> str:
|
|
148
|
+
return """\
|
|
149
|
+
---
|
|
150
|
+
description: Review code for quality, security, and correctness
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
# Code Review Workflow
|
|
154
|
+
|
|
155
|
+
1. Read all changed files and understand the context
|
|
156
|
+
2. Check for security vulnerabilities (OWASP Top 10)
|
|
157
|
+
3. Verify test coverage for new/changed code
|
|
158
|
+
4. Check naming conventions and code style consistency
|
|
159
|
+
5. Look for performance issues (N+1 queries, unnecessary allocations)
|
|
160
|
+
6. Verify error handling covers edge cases
|
|
161
|
+
7. Ensure no secrets or credentials in code
|
|
162
|
+
8. Provide actionable feedback with specific file:line references
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def workflow_feature_development() -> str:
|
|
167
|
+
return """\
|
|
168
|
+
---
|
|
169
|
+
description: Implement a new feature end-to-end with tests and documentation
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
# Feature Development Workflow
|
|
173
|
+
|
|
174
|
+
1. Understand the requirements — ask clarifying questions if ambiguous
|
|
175
|
+
2. Research existing code to find relevant patterns and integration points
|
|
176
|
+
3. Plan the implementation: list files to create/modify, identify risks
|
|
177
|
+
4. Write failing tests first (TDD red phase)
|
|
178
|
+
5. Implement the feature in small, incremental steps
|
|
179
|
+
6. Make tests pass (TDD green phase)
|
|
180
|
+
7. Refactor if needed (TDD refactor phase)
|
|
181
|
+
8. Run full test suite and lint checks
|
|
182
|
+
9. Update documentation if behavior changed
|
|
183
|
+
10. Create a structured commit with descriptive message
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def workflow_debug() -> str:
|
|
188
|
+
return """\
|
|
189
|
+
---
|
|
190
|
+
description: Systematically debug an issue and find root cause
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
# Debug Workflow
|
|
194
|
+
|
|
195
|
+
1. Reproduce the issue — get exact error message, stack trace, or unexpected behavior
|
|
196
|
+
2. Read the error carefully — understand what it actually says before guessing
|
|
197
|
+
3. Check recent changes (`git log`, `git diff`) for potential causes
|
|
198
|
+
4. Add targeted logging or breakpoints around the suspected area
|
|
199
|
+
5. Form a hypothesis and test it with the smallest possible change
|
|
200
|
+
6. If hypothesis fails, gather more data — do not guess repeatedly
|
|
201
|
+
7. Fix the root cause, not the symptom
|
|
202
|
+
8. Add a regression test that fails without the fix
|
|
203
|
+
9. Verify the fix doesn't break other tests
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def workflow_refactor() -> str:
|
|
208
|
+
return """\
|
|
209
|
+
---
|
|
210
|
+
description: Safely refactor code with test protection
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
# Refactor Workflow
|
|
214
|
+
|
|
215
|
+
1. Ensure existing tests pass before starting
|
|
216
|
+
2. Identify the specific code smell or improvement target
|
|
217
|
+
3. Make one small, focused change at a time
|
|
218
|
+
4. Run tests after each change — never batch multiple refactors
|
|
219
|
+
5. Use IDE rename/extract features when available
|
|
220
|
+
6. Keep the same external behavior — tests must stay green
|
|
221
|
+
7. If tests break, revert the last change and try a smaller step
|
|
222
|
+
8. Commit each successful refactor step separately
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def workflow_security_audit() -> str:
|
|
227
|
+
return """\
|
|
228
|
+
---
|
|
229
|
+
description: Multi-vector security assessment of codebase
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
# Security Audit Workflow
|
|
233
|
+
|
|
234
|
+
1. Scan dependencies for known CVEs (npm audit, pip audit, etc.)
|
|
235
|
+
2. Check for hardcoded secrets, API keys, and credentials
|
|
236
|
+
3. Review authentication and authorization logic
|
|
237
|
+
4. Test input validation — look for SQL injection, XSS, SSTI
|
|
238
|
+
5. Check file upload handling and path traversal risks
|
|
239
|
+
6. Review error handling — ensure no sensitive data in error messages
|
|
240
|
+
7. Verify HTTPS usage for all external communication
|
|
241
|
+
8. Check access control — principle of least privilege
|
|
242
|
+
9. Document findings with severity (HIGH/MEDIUM/LOW)
|
|
243
|
+
10. Create issues for each finding with fix recommendations
|
|
244
|
+
"""
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def workflow_test_coverage() -> str:
|
|
248
|
+
return """\
|
|
249
|
+
---
|
|
250
|
+
description: Boost test coverage for a module or feature
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
# Test Coverage Workflow
|
|
254
|
+
|
|
255
|
+
1. Run coverage report to identify untested code
|
|
256
|
+
2. Prioritize: critical paths > edge cases > happy paths already covered
|
|
257
|
+
3. Write tests for uncovered public APIs first
|
|
258
|
+
4. Add edge case tests: null inputs, empty collections, boundary values
|
|
259
|
+
5. Add error path tests: invalid inputs, network failures, timeouts
|
|
260
|
+
6. Run coverage again — verify improvement
|
|
261
|
+
7. Do not write tests just for coverage numbers — each test should catch real bugs
|
|
262
|
+
"""
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def workflow_api_design() -> str:
|
|
266
|
+
return """\
|
|
267
|
+
---
|
|
268
|
+
description: Design and implement a new API endpoint
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
# API Design Workflow
|
|
272
|
+
|
|
273
|
+
1. Define the resource and its relationships
|
|
274
|
+
2. Choose HTTP methods (GET/POST/PUT/PATCH/DELETE) following REST conventions
|
|
275
|
+
3. Define request/response schemas with types
|
|
276
|
+
4. Plan error responses (400, 401, 403, 404, 422, 500)
|
|
277
|
+
5. Implement validation for all input fields
|
|
278
|
+
6. Write integration tests covering happy path and error cases
|
|
279
|
+
7. Add rate limiting and authentication if needed
|
|
280
|
+
8. Document the endpoint (OpenAPI/Swagger or inline docs)
|
|
281
|
+
9. Test with real HTTP client (curl, httpie, Postman)
|
|
282
|
+
"""
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def workflow_database_migration() -> str:
|
|
286
|
+
return """\
|
|
287
|
+
---
|
|
288
|
+
description: Safely evolve database schema with zero-downtime migration
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# Database Migration Workflow
|
|
292
|
+
|
|
293
|
+
1. Write the migration script (up and down)
|
|
294
|
+
2. Test migration on a copy of production data
|
|
295
|
+
3. Check for breaking changes: column renames, type changes, NOT NULL on existing data
|
|
296
|
+
4. Plan backfill strategy for new columns with defaults
|
|
297
|
+
5. Consider index impact on large tables (concurrent index creation)
|
|
298
|
+
6. Update ORM models/entities to match new schema
|
|
299
|
+
7. Run the full test suite against the migrated schema
|
|
300
|
+
8. Document rollback procedure
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def workflow_incident_response() -> str:
|
|
305
|
+
return """\
|
|
306
|
+
---
|
|
307
|
+
description: Respond to production incidents systematically
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
# Incident Response Workflow
|
|
311
|
+
|
|
312
|
+
1. Acknowledge the incident — assign severity (P1-P4)
|
|
313
|
+
2. Identify impact: which users, which features, since when
|
|
314
|
+
3. Check monitoring dashboards and recent deployments
|
|
315
|
+
4. If recent deploy is the cause, consider rollback first
|
|
316
|
+
5. Gather logs, stack traces, and error rates
|
|
317
|
+
6. Implement a fix or workaround — prioritize restoring service
|
|
318
|
+
7. Verify the fix in production
|
|
319
|
+
8. Write a postmortem: timeline, root cause, action items
|
|
320
|
+
9. Create follow-up issues to prevent recurrence
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def workflow_performance_optimization() -> str:
|
|
325
|
+
return """\
|
|
326
|
+
---
|
|
327
|
+
description: Profile and optimize performance bottlenecks
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
# Performance Optimization Workflow
|
|
331
|
+
|
|
332
|
+
1. Measure first — establish baseline metrics (latency, throughput, memory)
|
|
333
|
+
2. Profile to find the actual bottleneck — do not guess
|
|
334
|
+
3. Check for N+1 queries, unnecessary allocations, blocking I/O
|
|
335
|
+
4. Implement the smallest change that addresses the bottleneck
|
|
336
|
+
5. Measure again — verify improvement with same benchmark
|
|
337
|
+
6. If no improvement, revert and investigate further
|
|
338
|
+
7. Document the optimization and its measured impact
|
|
339
|
+
"""
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def workflow_tdd() -> str:
|
|
343
|
+
return """\
|
|
344
|
+
---
|
|
345
|
+
description: Test-driven development with red-green-refactor loop
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
# TDD Workflow
|
|
349
|
+
|
|
350
|
+
1. Write a failing test that describes the expected behavior (RED)
|
|
351
|
+
2. Write the minimum code to make the test pass (GREEN)
|
|
352
|
+
3. Refactor to improve code quality while keeping tests green (REFACTOR)
|
|
353
|
+
4. Repeat for the next behavior
|
|
354
|
+
5. Keep each cycle small — one behavior per iteration
|
|
355
|
+
6. Run the full test suite after each green phase
|
|
356
|
+
7. Commit after each successful refactor
|
|
357
|
+
"""
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def workflow_codebase_onboarding() -> str:
|
|
361
|
+
return """\
|
|
362
|
+
---
|
|
363
|
+
description: Understand an unfamiliar codebase (read-only exploration)
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
# Codebase Onboarding Workflow
|
|
367
|
+
|
|
368
|
+
1. Read README, CLAUDE.md, and any architecture docs
|
|
369
|
+
2. Identify the tech stack: language, framework, database, build tools
|
|
370
|
+
3. Map the directory structure — locate entry points, configs, tests
|
|
371
|
+
4. Trace a request end-to-end: from entry point through layers to response
|
|
372
|
+
5. Read the test suite to understand expected behavior
|
|
373
|
+
6. Check git log for recent activity and active contributors
|
|
374
|
+
7. Note any patterns, conventions, or anti-patterns observed
|
|
375
|
+
8. Do NOT write or modify any code during onboarding
|
|
376
|
+
"""
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
def workflow_docs() -> str:
|
|
380
|
+
return """\
|
|
381
|
+
---
|
|
382
|
+
description: Generate or update documentation for code changes
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
# Documentation Workflow
|
|
386
|
+
|
|
387
|
+
1. Identify what changed: new feature, API change, config change, bug fix
|
|
388
|
+
2. Update inline code comments only where logic is non-obvious
|
|
389
|
+
3. Update README if setup, usage, or prerequisites changed
|
|
390
|
+
4. Update API docs if endpoints, params, or responses changed
|
|
391
|
+
5. Add examples for new features
|
|
392
|
+
6. Remove documentation for deleted features — no stale docs
|
|
393
|
+
7. Run any doc generation tools (typedoc, sphinx, etc.)
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
STANDARD_WORKFLOWS: dict[str, callable] = {
|
|
398
|
+
f"{PREFIX}code-review.md": workflow_code_review,
|
|
399
|
+
f"{PREFIX}feature-development.md": workflow_feature_development,
|
|
400
|
+
f"{PREFIX}debug.md": workflow_debug,
|
|
401
|
+
f"{PREFIX}refactor.md": workflow_refactor,
|
|
402
|
+
f"{PREFIX}security-audit.md": workflow_security_audit,
|
|
403
|
+
f"{PREFIX}test-coverage.md": workflow_test_coverage,
|
|
404
|
+
f"{PREFIX}api-design.md": workflow_api_design,
|
|
405
|
+
f"{PREFIX}database-migration.md": workflow_database_migration,
|
|
406
|
+
f"{PREFIX}incident-response.md": workflow_incident_response,
|
|
407
|
+
f"{PREFIX}performance-optimization.md": workflow_performance_optimization,
|
|
408
|
+
f"{PREFIX}tdd.md": workflow_tdd,
|
|
409
|
+
f"{PREFIX}codebase-onboarding.md": workflow_codebase_onboarding,
|
|
410
|
+
f"{PREFIX}docs.md": workflow_docs,
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
# ---------------------------------------------------------------------------
|
|
415
|
+
# Shared file generation helpers
|
|
416
|
+
# ---------------------------------------------------------------------------
|
|
417
|
+
|
|
418
|
+
def cleanup_stale(directory: Path, current_files: set[str]) -> None:
|
|
419
|
+
"""Remove ai-toolkit-* files that are no longer in the registry."""
|
|
420
|
+
if not directory.is_dir():
|
|
421
|
+
return
|
|
422
|
+
for f in directory.iterdir():
|
|
423
|
+
if f.name.startswith(PREFIX) and f.name not in current_files:
|
|
424
|
+
f.unlink()
|
|
425
|
+
print(f" Removed stale: {f.relative_to(directory.parent.parent)}")
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def write_rules(target_dir: Path, rules: dict[str, callable],
|
|
429
|
+
subdir: str = "rules", label: str = "") -> None:
|
|
430
|
+
"""Write rule files to target_dir/<subdir>/.
|
|
431
|
+
|
|
432
|
+
Only writes ai-toolkit-* files. User files are never touched.
|
|
433
|
+
"""
|
|
434
|
+
out_dir = target_dir / subdir
|
|
435
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
436
|
+
cleanup_stale(out_dir, set(rules.keys()))
|
|
437
|
+
|
|
438
|
+
for filename, content_fn in rules.items():
|
|
439
|
+
(out_dir / filename).write_text(content_fn(), encoding="utf-8")
|
|
440
|
+
tag = f" ({label})" if label else ""
|
|
441
|
+
print(f" Generated: {subdir}/{filename}{tag}")
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate Antigravity IDE .agent/rules/ and .agent/workflows/ files.
|
|
3
|
+
|
|
4
|
+
Antigravity reads rules from:
|
|
5
|
+
- GEMINI.md (highest priority) — already generated by generate_gemini.py
|
|
6
|
+
- AGENTS.md (cross-tool) — already generated by generate_agents_md.py
|
|
7
|
+
- .agent/rules/*.md — per-category rule files (this generator)
|
|
8
|
+
- .agent/workflows/*.md — workflow templates (this generator)
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
python3 scripts/generate_antigravity.py [target-dir]
|
|
12
|
+
|
|
13
|
+
Writes files directly to target-dir/.agent/rules/ and .agent/workflows/.
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import sys
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
21
|
+
from dir_rules_shared import STANDARD_RULES, STANDARD_WORKFLOWS, write_rules
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def generate(target_dir: Path) -> None:
|
|
25
|
+
"""Write .agent/rules/ and .agent/workflows/ files to target_dir."""
|
|
26
|
+
write_rules(target_dir, STANDARD_RULES, ".agent/rules")
|
|
27
|
+
write_rules(target_dir, STANDARD_WORKFLOWS, ".agent/workflows")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main() -> None:
|
|
31
|
+
target = Path(sys.argv[1]) if len(sys.argv) > 1 else Path.cwd()
|
|
32
|
+
generate(target)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
main()
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate .augment/rules/ai-toolkit-*.md files for Augment Code.
|
|
3
|
+
|
|
4
|
+
Augment supports per-file rules with frontmatter:
|
|
5
|
+
- type: always_apply — always in context
|
|
6
|
+
- type: auto_attached + globs — attached for matching files
|
|
7
|
+
|
|
8
|
+
The existing generate_augment.py creates a single always_apply file.
|
|
9
|
+
This generator adds granular per-category rules with appropriate types.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
python3 scripts/generate_augment_rules.py [target-dir]
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
20
|
+
from dir_rules_shared import (
|
|
21
|
+
PREFIX,
|
|
22
|
+
cleanup_stale,
|
|
23
|
+
rule_agents_and_skills,
|
|
24
|
+
rule_code_style,
|
|
25
|
+
rule_quality_standards,
|
|
26
|
+
rule_security,
|
|
27
|
+
rule_testing,
|
|
28
|
+
rule_workflow,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _augment_wrap(content: str, *, description: str,
|
|
33
|
+
rule_type: str = "always_apply",
|
|
34
|
+
globs: list[str] | None = None) -> str:
|
|
35
|
+
"""Wrap content with Augment YAML frontmatter."""
|
|
36
|
+
lines = ["---"]
|
|
37
|
+
lines.append(f"type: {rule_type}")
|
|
38
|
+
lines.append(f"description: {description}")
|
|
39
|
+
if globs:
|
|
40
|
+
globs_str = ", ".join(f'"{g}"' for g in globs)
|
|
41
|
+
lines.append(f"globs: [{globs_str}]")
|
|
42
|
+
lines.append("---")
|
|
43
|
+
lines.append("")
|
|
44
|
+
lines.append(content.rstrip("\n"))
|
|
45
|
+
lines.append("")
|
|
46
|
+
return "\n".join(lines)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _make_rules() -> dict[str, callable]:
|
|
50
|
+
return {
|
|
51
|
+
# Always active
|
|
52
|
+
f"{PREFIX}agents-and-skills.md": lambda: _augment_wrap(
|
|
53
|
+
rule_agents_and_skills(),
|
|
54
|
+
description="AI toolkit agents, skills, and guidelines catalog",
|
|
55
|
+
),
|
|
56
|
+
f"{PREFIX}security.md": lambda: _augment_wrap(
|
|
57
|
+
rule_security(),
|
|
58
|
+
description="Security rules — OWASP, secrets, input validation",
|
|
59
|
+
),
|
|
60
|
+
f"{PREFIX}quality-standards.md": lambda: _augment_wrap(
|
|
61
|
+
rule_quality_standards(),
|
|
62
|
+
description="Quality standards — tests, safety, operational integrity",
|
|
63
|
+
),
|
|
64
|
+
f"{PREFIX}workflow.md": lambda: _augment_wrap(
|
|
65
|
+
rule_workflow(),
|
|
66
|
+
description="Development workflow — planning, commits, quality gates",
|
|
67
|
+
),
|
|
68
|
+
# Auto-attached by file type
|
|
69
|
+
f"{PREFIX}code-style.md": lambda: _augment_wrap(
|
|
70
|
+
rule_code_style(),
|
|
71
|
+
description="Code style conventions",
|
|
72
|
+
rule_type="auto_attached",
|
|
73
|
+
globs=["*.py", "*.ts", "*.tsx", "*.js", "*.jsx", "*.go", "*.rs",
|
|
74
|
+
"*.java", "*.kt", "*.swift", "*.dart", "*.cs", "*.php",
|
|
75
|
+
"*.cpp", "*.cc", "*.rb"],
|
|
76
|
+
),
|
|
77
|
+
f"{PREFIX}testing.md": lambda: _augment_wrap(
|
|
78
|
+
rule_testing(),
|
|
79
|
+
description="Testing standards and patterns",
|
|
80
|
+
rule_type="auto_attached",
|
|
81
|
+
globs=["*.test.*", "*.spec.*", "test_*", "**/tests/**",
|
|
82
|
+
"**/test/**", "**/__tests__/**"],
|
|
83
|
+
),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
RULES = _make_rules()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def generate(target_dir: Path) -> None:
|
|
91
|
+
"""Write .augment/rules/ai-toolkit-*.md files to target_dir."""
|
|
92
|
+
rules_dir = target_dir / ".augment" / "rules"
|
|
93
|
+
rules_dir.mkdir(parents=True, exist_ok=True)
|
|
94
|
+
cleanup_stale(rules_dir, set(RULES.keys()) | {"ai-toolkit.md"})
|
|
95
|
+
|
|
96
|
+
for filename, content_fn in RULES.items():
|
|
97
|
+
(rules_dir / filename).write_text(content_fn(), encoding="utf-8")
|
|
98
|
+
print(f" Generated: .augment/rules/{filename}")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def main() -> None:
|
|
102
|
+
target = Path(sys.argv[1]) if len(sys.argv) > 1 else Path.cwd()
|
|
103
|
+
generate(target)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
main()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate .cline/rules/*.md files for Cline.
|
|
3
|
+
|
|
4
|
+
Cline reads directory-based rules from .cline/rules/*.md (since Q1 2025).
|
|
5
|
+
The legacy .clinerules single-file format is still generated separately
|
|
6
|
+
by generate_cline.py for backwards compatibility.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
python3 scripts/generate_cline_rules.py [target-dir]
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
17
|
+
from dir_rules_shared import STANDARD_RULES, write_rules
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def generate(target_dir: Path) -> None:
|
|
21
|
+
"""Write .cline/rules/*.md files to target_dir."""
|
|
22
|
+
write_rules(target_dir, STANDARD_RULES, ".cline/rules")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main() -> None:
|
|
26
|
+
target = Path(sys.argv[1]) if len(sys.argv) > 1 else Path.cwd()
|
|
27
|
+
generate(target)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate CONVENTIONS.md for Aider.
|
|
3
|
+
|
|
4
|
+
Aider automatically loads CONVENTIONS.md from the project root as
|
|
5
|
+
read-only context. This file contains coding standards, guidelines,
|
|
6
|
+
and the agent/skill catalog — same content other platforms get.
|
|
7
|
+
|
|
8
|
+
Output is plain markdown suitable for marker injection into an
|
|
9
|
+
existing CONVENTIONS.md (preserves user content outside markers).
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
python3 scripts/generate_conventions.py > CONVENTIONS.md
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
20
|
+
from generator_base import render_generator
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
render_generator({
|
|
24
|
+
"title": "# AI Toolkit — Coding Conventions",
|
|
25
|
+
"intro_template": (
|
|
26
|
+
"Shared AI development toolkit with specialized agents,"
|
|
27
|
+
" skills, quality hooks, and a safety constitution."
|
|
28
|
+
" Aider loads this file automatically as read-only context."
|
|
29
|
+
),
|
|
30
|
+
"agents_section": "## Available Agents",
|
|
31
|
+
"agents_intro": "Specialized agent personas — apply their expertise for relevant tasks:",
|
|
32
|
+
"agents_format": "bullets",
|
|
33
|
+
"skills_section": "## Available Skills",
|
|
34
|
+
"skills_intro": "Skills are invocable slash commands or auto-loaded knowledge sources:",
|
|
35
|
+
"skills_format": "bullets",
|
|
36
|
+
"guidelines": ["general", "quality_standards", "workflow"],
|
|
37
|
+
})
|