@baselane/packs 0.1.3 → 0.1.5
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/dist/aliases.js +1 -0
- package/package.json +2 -2
- package/packs/database-review/pack.json +75 -9
- package/packs/database-review/rendered/.claude/agents/database-reviewer.md +75 -2
- package/packs/database-review/rendered/.claude/commands/migration-review.md +6 -0
- package/packs/database-review/rendered/.claude/settings.json +11 -0
- package/packs/database-review/rendered/.claude/skills/database-migrations/SKILL.md +431 -0
- package/packs/database-review/rendered/.claude/skills/mysql-patterns/SKILL.md +414 -0
- package/packs/database-review/rendered/.claude/skills/postgres-patterns/SKILL.md +149 -0
- package/packs/database-review/rendered/.github/copilot-instructions.md +1096 -14
- package/packs/database-review/rendered/AGENTS.md +45 -16
- package/packs/database-review/rendered/CLAUDE.md +4 -0
- package/packs/database-review/rendered/GEMINI.md +987 -0
- package/packs/go-rules/pack.json +65 -9
- package/packs/go-rules/rendered/.claude/agents/go-build-resolver.md +90 -0
- package/packs/go-rules/rendered/.claude/agents/go-reviewer.md +72 -2
- package/packs/go-rules/rendered/.claude/commands/go-build.md +6 -0
- package/packs/go-rules/rendered/.claude/commands/go-review.md +1 -1
- package/packs/go-rules/rendered/.claude/commands/go-test.md +6 -0
- package/packs/go-rules/rendered/.claude/settings.json +9 -0
- package/packs/go-rules/rendered/.claude/skills/golang-patterns/SKILL.md +673 -0
- package/packs/go-rules/rendered/.claude/skills/golang-testing/SKILL.md +719 -0
- package/packs/go-rules/rendered/.github/copilot-instructions.md +1783 -7
- package/packs/go-rules/rendered/AGENTS.md +244 -8
- package/packs/go-rules/rendered/CLAUDE.md +5 -0
- package/packs/go-rules/rendered/GEMINI.md +1394 -0
- package/packs/python-rules/pack.json +87 -10
- package/packs/python-rules/rendered/.claude/agents/django-reviewer.md +159 -0
- package/packs/python-rules/rendered/.claude/agents/fastapi-reviewer.md +70 -0
- package/packs/python-rules/rendered/.claude/agents/python-reviewer.md +92 -2
- package/packs/python-rules/rendered/.claude/commands/django-review.md +6 -0
- package/packs/python-rules/rendered/.claude/commands/fastapi-review.md +6 -0
- package/packs/python-rules/rendered/.claude/commands/python-review.md +1 -1
- package/packs/python-rules/rendered/.claude/settings.json +1 -1
- package/packs/python-rules/rendered/.claude/skills/django-security/SKILL.md +642 -0
- package/packs/python-rules/rendered/.claude/skills/django-tdd/SKILL.md +728 -0
- package/packs/python-rules/rendered/.claude/skills/fastapi-patterns/SKILL.md +512 -0
- package/packs/python-rules/rendered/.claude/skills/python-patterns/SKILL.md +749 -0
- package/packs/python-rules/rendered/.claude/skills/python-testing/SKILL.md +815 -0
- package/packs/python-rules/rendered/.github/copilot-instructions.md +3815 -12
- package/packs/python-rules/rendered/AGENTS.md +73 -13
- package/packs/python-rules/rendered/CLAUDE.md +9 -0
- package/packs/python-rules/rendered/GEMINI.md +3448 -0
- package/packs/security-review/pack.json +51 -7
- package/packs/security-review/rendered/.claude/agents/security-reviewer.md +29 -2
- package/packs/security-review/rendered/.claude/settings.json +11 -0
- package/packs/security-review/rendered/.claude/skills/security-review/SKILL.md +302 -0
- package/packs/security-review/rendered/.claude/skills/security-review/cloud-infrastructure-security.md +171 -0
- package/packs/security-review/rendered/.claude/skills/security-scan-config/SKILL.md +56 -0
- package/packs/security-review/rendered/.github/copilot-instructions.md +658 -15
- package/packs/security-review/rendered/AGENTS.md +283 -17
- package/packs/security-review/rendered/CLAUDE.md +2 -0
- package/packs/security-review/rendered/GEMINI.md +352 -0
- package/packs/software-engineer-harness/pack.json +249 -13
- package/packs/software-engineer-harness/rendered/.claude/agents/build-error-resolver.md +15 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/code-explorer.md +67 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/performance-optimizer.md +444 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/pr-test-analyzer.md +43 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/refactor-cleaner.md +12 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/silent-failure-hunter.md +16 -0
- package/packs/software-engineer-harness/rendered/.claude/agents/tdd-guide.md +16 -0
- package/packs/software-engineer-harness/rendered/.claude/commands/feature-dev.md +6 -0
- package/packs/software-engineer-harness/rendered/.claude/commands/fix-build.md +6 -0
- package/packs/software-engineer-harness/rendered/.claude/commands/hunt-silent-failures.md +6 -0
- package/packs/software-engineer-harness/rendered/.claude/commands/tdd.md +6 -0
- package/packs/software-engineer-harness/rendered/.claude/settings.json +29 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/api-design/SKILL.md +522 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/architecture-decision-records/SKILL.md +178 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/backend-patterns/SKILL.md +560 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/codebase-onboarding/SKILL.md +232 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/deployment-patterns/SKILL.md +426 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/docker-patterns/SKILL.md +363 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/e2e-testing/SKILL.md +325 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/tdd-red-green-refactor/SKILL.md +20 -0
- package/packs/software-engineer-harness/rendered/.claude/skills/tdd-workflow/SKILL.md +580 -0
- package/packs/software-engineer-harness/rendered/.github/copilot-instructions.md +3948 -2
- package/packs/software-engineer-harness/rendered/AGENTS.md +194 -4
- package/packs/software-engineer-harness/rendered/CLAUDE.md +20 -0
- package/packs/software-engineer-harness/rendered/GEMINI.md +3208 -0
- package/packs/typescript-rules/pack.json +68 -5
- package/packs/typescript-rules/rendered/.claude/agents/react-reviewer.md +165 -0
- package/packs/typescript-rules/rendered/.claude/agents/type-design-analyzer.md +48 -0
- package/packs/typescript-rules/rendered/.claude/commands/react-review.md +6 -0
- package/packs/typescript-rules/rendered/.claude/settings.json +9 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-patterns/SKILL.md +340 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-performance/SKILL.md +573 -0
- package/packs/typescript-rules/rendered/.claude/skills/react-testing/SKILL.md +422 -0
- package/packs/typescript-rules/rendered/.github/copilot-instructions.md +2459 -53
- package/packs/typescript-rules/rendered/AGENTS.md +893 -17
- package/packs/typescript-rules/rendered/CLAUDE.md +6 -0
- package/packs/typescript-rules/rendered/GEMINI.md +1335 -0
|
@@ -1,53 +1,113 @@
|
|
|
1
1
|
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
<!-- generated from workflow-pack python-rules
|
|
3
|
+
<!-- generated from workflow-pack python-rules v2.0.0 -->
|
|
4
4
|
<!-- adapted from affaan-m/ECC (MIT) — https://github.com/affaan-m/ECC -->
|
|
5
5
|
|
|
6
6
|
## Python conventions (beyond what the linter enforces)
|
|
7
7
|
|
|
8
|
-
`ruff` and `black` already enforce PEP 8, import order, bare `except`, and mutable default arguments — this pack is the judgment they can't encode. Keep the mechanical checks in CI (`ruff check .`, `bandit -r src/`, `pytest --cov`); the
|
|
8
|
+
`ruff` and `black` already enforce PEP 8, import order, bare `except`, and mutable default arguments — this pack is the judgment they can't encode. Keep the mechanical checks in CI (`ruff check .`, `bandit -r src/`, `pytest --cov`); the reviewers cover the rest.
|
|
9
|
+
|
|
10
|
+
### Standards and formatting
|
|
11
|
+
|
|
12
|
+
- Follow PEP 8 conventions; annotate every function signature, including internal helpers.
|
|
13
|
+
- Format with **black**, sort imports with **isort**, lint with **ruff**.
|
|
14
|
+
- Import order: stdlib, then third-party, then local — enforced by isort.
|
|
15
|
+
|
|
16
|
+
### Core principles
|
|
17
|
+
|
|
18
|
+
- **Readability counts.** Code should be obvious; prefer a clear loop over a clever one-liner.
|
|
19
|
+
- **Explicit is better than implicit.** Avoid hidden side effects (e.g. a bare `some_module.setup()` import with no visible call site).
|
|
20
|
+
- **EAFP over LBYL.** Prefer `try`/`except KeyError` over `if key in dictionary` — Python favors asking forgiveness over checking permission first.
|
|
9
21
|
|
|
10
22
|
### Data shapes
|
|
11
23
|
|
|
12
24
|
- Model value objects as `@dataclass(frozen=True)` or `NamedTuple`, not a mutable class with public attributes.
|
|
13
25
|
- Use a `Protocol` when a caller needs only an interface, not a concrete base class; use plain `@dataclass` for request/DTO shapes at API and service boundaries.
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
### Types
|
|
17
|
-
|
|
18
|
-
- Annotate every function signature, including internal helpers — not just the public API a type checker would force.
|
|
26
|
+
- Validate invariants in `__post_init__` (e.g. reject a malformed email or an out-of-range age at construction, not later).
|
|
27
|
+
- Acquire every resource (files, locks, connections, DB transactions) through a context manager (`with`); write custom ones with `@contextlib.contextmanager` or an `__enter__`/`__exit__` class when reuse pays off. Use generators for lazy, memory-efficient iteration and to avoid building large intermediate lists.
|
|
19
28
|
|
|
20
29
|
### Errors
|
|
21
30
|
|
|
22
31
|
- Catch specific exception types and preserve the chain when wrapping (`raise NewError(...) from err`); never swallow into a bare `except` or drop the cause.
|
|
32
|
+
- Build a small custom exception hierarchy (`AppError` → `ValidationError`, `NotFoundError`, ...) instead of raising bare `Exception` or built-ins for domain errors.
|
|
23
33
|
|
|
24
34
|
### Boundaries
|
|
25
35
|
|
|
26
36
|
- Validate external input at the boundary before it reaches business logic; fail fast with a clear message (Pydantic or an explicit check).
|
|
27
|
-
- Read required secrets with `os.environ["KEY"]` so a missing value raises at startup — never `os.environ.get(...)` with a fallback that lets a misconfigured app boot.
|
|
37
|
+
- Read required secrets with `os.environ["KEY"]` so a missing value raises at startup — never `os.environ.get(...)` with a fallback that lets a misconfigured app boot silently.
|
|
38
|
+
|
|
39
|
+
### Concurrency
|
|
40
|
+
|
|
41
|
+
- Use `ThreadPoolExecutor` for I/O-bound work, `ProcessPoolExecutor` for CPU-bound work, and `asyncio`/`aiohttp` for concurrent I/O — pick the tool that matches what's actually blocking.
|
|
42
|
+
- Guard shared mutable state with `threading.Lock`; don't mix sync and async call paths in the same function.
|
|
43
|
+
- Batch queries instead of issuing one per loop iteration (N+1).
|
|
44
|
+
|
|
45
|
+
### Performance
|
|
28
46
|
|
|
29
|
-
|
|
47
|
+
- Avoid `result += str(item)` in a loop (O(n²) due to string immutability) — use `"".join(...)` or `io.StringIO`.
|
|
48
|
+
- Use `__slots__` on high-volume value classes to cut per-instance memory.
|
|
49
|
+
- Prefer a generator over building a full list when the data is only consumed once.
|
|
30
50
|
|
|
51
|
+
### Anti-patterns (flag in review — a linter won't catch these)
|
|
52
|
+
|
|
53
|
+
- Mutable default arguments: `def f(x=[])` — use `def f(x=None)` and create the list inside.
|
|
54
|
+
- `type(obj) == list` instead of `isinstance(obj, list)`.
|
|
55
|
+
- `value == None` instead of `value is None`.
|
|
56
|
+
- `from module import *` — namespace pollution.
|
|
31
57
|
- A mutable class used where a frozen value object belongs.
|
|
32
58
|
- A concrete base class used where a `Protocol` would decouple the caller.
|
|
33
59
|
- A wrapped exception that drops `from err` and loses the cause.
|
|
34
60
|
- A required secret read via `.get()` with a silent fallback default.
|
|
35
61
|
|
|
62
|
+
### Security
|
|
63
|
+
|
|
64
|
+
- Read secrets from the environment (`os.environ["KEY"]`, or `python-dotenv`'s `load_dotenv()` in development) — never hardcode them.
|
|
65
|
+
- Run **bandit** for static security analysis: `bandit -r src/`.
|
|
66
|
+
- SQL injection: never interpolate user input into a query string — use parameterized queries or the ORM.
|
|
67
|
+
- Command injection: never pass unvalidated input to a shell — use `subprocess` with a list of args, not `shell=True` with a formatted string.
|
|
68
|
+
- Path traversal: validate user-controlled paths with `normpath` and reject `..` segments.
|
|
69
|
+
- Avoid `eval`/`exec` on untrusted input, unsafe deserialization (`pickle`, `yaml.load` without `SafeLoader`), and weak crypto (MD5/SHA1 for anything security-sensitive).
|
|
70
|
+
|
|
71
|
+
### Testing
|
|
72
|
+
|
|
73
|
+
- Use **pytest**; follow the TDD cycle (red — write a failing test, green — minimal code to pass, refactor — clean up while green).
|
|
74
|
+
- Target 80%+ coverage overall, 100% on critical paths: `pytest --cov=src --cov-report=term-missing`.
|
|
75
|
+
- Use `pytest.mark` to categorize tests (`unit`, `integration`, `slow`) and `pytest -m "not slow"` to skip the slow ones in a fast local loop.
|
|
76
|
+
- Mock external dependencies (`unittest.mock.patch`), not the code under test; prefer `tmp_path` over hand-rolled temp files.
|
|
77
|
+
|
|
78
|
+
### Reference
|
|
79
|
+
|
|
80
|
+
See skills `python-patterns` (idioms, decorators, concurrency, package layout), `python-testing` (pytest fixtures, mocking, parametrization), `fastapi-patterns` (async API layering), and `django-security`/`django-tdd` for framework-specific depth.
|
|
81
|
+
|
|
36
82
|
## Workflow pack: Python rules
|
|
37
83
|
|
|
38
|
-
|
|
84
|
+
Full ECC Python corpus: conventions, three framework-aware reviewers (Python/FastAPI/Django), five deep-reference skills, and a ruff guard hook.
|
|
39
85
|
|
|
40
86
|
### Roles
|
|
41
87
|
|
|
42
|
-
- **python-reviewer** —
|
|
88
|
+
- **python-reviewer** — Expert Python code reviewer for PEP 8, Pythonic idioms, type hints, security (injection, unsafe deserialization, weak crypto), error handling, concurrency, and code quality. Reports file:line + severity. Use for all Python code changes.
|
|
89
|
+
- **fastapi-reviewer** — Reviews FastAPI applications for async correctness, dependency injection, Pydantic schemas, security (secrets, SQL injection, CORS, auth), OpenAPI quality, and test dependency overrides. Use after any FastAPI change.
|
|
90
|
+
- **django-reviewer** — Expert Django code reviewer for ORM correctness (N+1, atomic(), bulk_create), DRF patterns, migration safety, security misconfigurations (mark_safe, CSRF, DEBUG, SECRET_KEY), and production-grade practices. Use for all Django code changes.
|
|
43
91
|
|
|
44
92
|
### Commands
|
|
45
93
|
|
|
46
94
|
- **/python-review** `[base ref]` — Run the Python reviewer over the current change against this pack's Python standards.
|
|
47
|
-
- How it runs: Invoke the python-reviewer subagent on the changed Python files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks this pack's conventions — frozen dataclasses for value objects, Protocols for structural typing, `raise ... from`, and os.environ[] over silent .get() fallbacks — and reports file:line + severity. Style and coverage are CI's job; don't re-litigate them. Fix any
|
|
95
|
+
- How it runs: Invoke the python-reviewer subagent on the changed Python files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks this pack's conventions — frozen dataclasses for value objects, Protocols for structural typing, `raise ... from`, and os.environ[] over silent .get() fallbacks, plus security, type hints, and code quality — and reports file:line + severity. Style and coverage are CI's job; don't re-litigate them. Fix any CRITICAL or HIGH findings before merging.
|
|
96
|
+
- **/fastapi-review** `[base ref]` — Run the FastAPI reviewer over the current change for async correctness, DI, schemas, and API security.
|
|
97
|
+
- How it runs: Invoke the fastapi-reviewer subagent on the changed FastAPI files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks app construction, routing, Pydantic request/response schemas, async dependency injection, auth/CORS/rate limits, and test dependency overrides, reporting file:line + severity plus `Tests checked:` and `Residual risk:`. Fix any Critical or High findings before merging.
|
|
98
|
+
- **/django-review** `[base ref]` — Run the Django reviewer over the current change for ORM correctness, DRF patterns, migration safety, and security.
|
|
99
|
+
- How it runs: Invoke the django-reviewer subagent on the changed Django files (the diff since $ARGUMENTS, or the working tree if no ref is given). It checks ORM correctness (N+1, atomic(), bulk_create), DRF serializer/permission/pagination patterns, migration safety, and security misconfigurations (mark_safe, CSRF, DEBUG, SECRET_KEY), reporting file:line + severity. Run `python-review` too for general Python quality. Fix any CRITICAL or HIGH findings before merging.
|
|
48
100
|
|
|
49
101
|
### Guardrails
|
|
50
102
|
|
|
51
|
-
- After an edit, lint with ruff when it
|
|
103
|
+
- After an edit, lint and typecheck with ruff when it's installed and the repo looks like a Python project.
|
|
104
|
+
|
|
105
|
+
### Skills
|
|
106
|
+
|
|
107
|
+
- **python-patterns** — Pythonic idioms, type hints, error handling, context managers, comprehensions/generators, dataclasses, decorators, concurrency, package layout, and anti-patterns. Use when writing, reviewing, or refactoring Python code, or designing a package/module layout.
|
|
108
|
+
- **python-testing** — pytest fundamentals, fixtures (scopes, params, autouse, conftest), parametrization, mocking/patching, async test patterns, and TDD methodology with coverage targets. Use when writing or reviewing Python tests, or setting up a pytest suite.
|
|
109
|
+
- **fastapi-patterns** — FastAPI project layout, app factory/lifespan, pydantic-settings config, Pydantic v2 request/response schemas, async dependency injection, router design, a transactional service layer, and httpx+pytest testing. Use when building or reviewing a FastAPI application.
|
|
110
|
+
- **django-security** — Django production security settings, authentication and custom user models, authorization/RBAC and DRF permissions, SQL injection and XSS prevention, CSRF, file-upload validation, rate limiting, security headers, and secret management. Use when configuring or reviewing Django security posture.
|
|
111
|
+
- **django-tdd** — Django testing with pytest-django and factory_boy: TDD workflow, test settings, fixtures, model/view/serializer/DRF-API testing, mocking external services and email, and integration/full-flow tests, plus coverage targets. Use when writing or reviewing Django tests.
|
|
52
112
|
|
|
53
113
|
Tool-specific implementations live alongside this file (see `CLAUDE.md` for the Claude Code implementation). Tools without a native subagent/command surface should treat the sections above as operating instructions.
|
|
@@ -4,5 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
This project defines a native Claude Code implementation of this workflow pack:
|
|
6
6
|
- Subagent: `.claude/agents/python-reviewer.md`
|
|
7
|
+
- Subagent: `.claude/agents/fastapi-reviewer.md`
|
|
8
|
+
- Subagent: `.claude/agents/django-reviewer.md`
|
|
7
9
|
- Command: `.claude/commands/python-review.md`
|
|
10
|
+
- Command: `.claude/commands/fastapi-review.md`
|
|
11
|
+
- Command: `.claude/commands/django-review.md`
|
|
8
12
|
- Hooks: see `.claude/settings.json`
|
|
13
|
+
- Skill: `.claude/skills/python-patterns/SKILL.md` — Pythonic idioms, type hints, error handling, context managers, comprehensions/generators, dataclasses, decorators, concurrency, package layout, and anti-patterns. Use when writing, reviewing, or refactoring Python code, or designing a package/module layout.
|
|
14
|
+
- Skill: `.claude/skills/python-testing/SKILL.md` — pytest fundamentals, fixtures (scopes, params, autouse, conftest), parametrization, mocking/patching, async test patterns, and TDD methodology with coverage targets. Use when writing or reviewing Python tests, or setting up a pytest suite.
|
|
15
|
+
- Skill: `.claude/skills/fastapi-patterns/SKILL.md` — FastAPI project layout, app factory/lifespan, pydantic-settings config, Pydantic v2 request/response schemas, async dependency injection, router design, a transactional service layer, and httpx+pytest testing. Use when building or reviewing a FastAPI application.
|
|
16
|
+
- Skill: `.claude/skills/django-security/SKILL.md` — Django production security settings, authentication and custom user models, authorization/RBAC and DRF permissions, SQL injection and XSS prevention, CSRF, file-upload validation, rate limiting, security headers, and secret management. Use when configuring or reviewing Django security posture.
|
|
17
|
+
- Skill: `.claude/skills/django-tdd/SKILL.md` — Django testing with pytest-django and factory_boy: TDD workflow, test settings, fixtures, model/view/serializer/DRF-API testing, mocking external services and email, and integration/full-flow tests, plus coverage targets. Use when writing or reviewing Django tests.
|