ast-anti-pattern-slayerlisted
Install: claude install-skill RMAzrim/opencode-artes
# AST Anti-Pattern Slayer
## 1. System Architecture & Prerequisites
- Runtime binary: **Python 3.9 or newer** (requires `ast.unparse`, stable type hints, and `ast.TryStar`/`ast.Match` handling). Python 3.11+ is recommended.
- Standard library used (no third-party packages): `ast`, `argparse`, `json`, `sys`, `pathlib`.
- Input surface: a single Python source file (`*.py`) with the assignment to execute.
- The module never executes the analyzed code; all analysis is static and import-free, so the input file does not need resolvable imports at analysis time.
- The sample reference implementation `ast_slayer.py` doubles as a CLI:
- `python ast_slayer.py path/to/script.py` — prints the JSON report.
- `python ast_slayer.py path/to/script.py --fix` — additionally rewrites the file in place with guard clauses (only when a conservative rewrite is possible).
- JavaScript-style input is supported only conceptually (the same decision-node counting maps onto Mozilla ESTree shapes once the AST is parsed with a JS toolchain such as `acorn`/`esprima`); this skill ships the Python AST pipeline, which is architecture-identical.
## 2. Input/Output Data Contracts
### 2.1 CLI input options (JSON Schema)
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ast_slayer_cli_options",
"type": "object",
"properties": {
"path": { "type": "string", "description": "Path to the Python source file to analyze." },
"fix": { "type": "boolean", "defau