fai-dead-code-removal
/fai-dead-code-removal
Znajduje i usuwa martwy kod w Pythonie i TypeScripcie: nieużywane eksporty, nieosiągalne gałęzie i osierocone pliki, z weryfikacją narzędziami.
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Znajduje i usuwa martwy kod w Pythonie i TypeScripcie: nieużywane eksporty, nieosiągalne gałęzie i osierocone pliki, z weryfikacją narzędziami.
Wyzwalacze z opisu
Oryginalny opis (EN)
Identify and remove dead code in Python/TypeScript — unused exports, unreachable branches, and orphaned files, verified by tooling. Use this skill when cleaning up a codebase, reducing bundle size, or before a refactor — even if the user only says "remove unused code".
Jak działa
- Overview
- Parameters
- Steps
- Output
- WAF Alignment
- Compatible Solution Plays
- Error Handling
- Usage
- Configuration Reference
- Monitoring
Podgląd SKILL.md
---
name: fai-dead-code-removal
description: Identify and remove dead code in Python/TypeScript — unused exports, unreachable branches, and orphaned files, verified by tooling. Use this skill when cleaning up a codebase, reducing bundle size, or before a refactor — even if the user only says "remove unused code".
---
# Fai Dead Code Removal
Identifies and safely removes dead code, unused imports, and unreachable branches.
## Overview
This skill provides a structured, repeatable procedure for identifies and safely removes dead code, unused imports, and unreachable branches.. It can be used standalone as a LEGO block or auto-wired inside solution plays via the FAI Protocol.
**Category:** Code Quality
**Complexity:** Medium
**Estimated Time:** 10-30 minutes
## Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `target` | string | Yes | — | Target resource, file, or endpoint |
| `environment` | enum | No | `dev` | Target environment: `dev`, `staging`, `prod` |
| `verbose` | boolean | No | `false` | Enable detailed output logging |
| `dry_run` | boolean | No | `false` | Validate without making changes |
| `config_path` | string | No | `config/` | Path to configuration directory |
## Steps
### Step 1: Validate Prerequisites
Verify all required tools, credentials, and dependencies are available.
```bash
# Check required tools
command -v node >/dev/null 2>&1 || { echo 'Node.js required'; exit 1; }
command -v az >/dev/null 2>&1 || { echo 'Azure CLI required'; exit 1; }
```
### Step 2: Load Configuration
Read settings from the FAI manifest and TuneKit config files.
```bash
# Load from fai-manifest.json if inside a play
CONFIG_DIR="${config_path:-config}"
if [ -f "fai-manifest.json" ]; then
echo "FAI Protocol detected — auto-wiring context"
fi
```
### Step 3: Execute Core Logic
Perform the primary operation: identifies and safely removes dead code, unused imports, and unreachable branches..
### Step 4: Validate Results
Verify the output meets quality thresholds and WAF compliance.
```bash
# Validate output
if [ "$?" -eq 0 ]; then
echo "✅ Skill completed successfully"
else
echo "❌ Skill failed — check logs"
exit 1
fi
```
## Output
| Output | Type | Description |
|--------|------|-------------|
| `status` | enum | `success`, `warning`, `failure` |
| `duration_ms` | number | Execution time in milliseconds |
| `artifacts` | string[] | List of generated/modified files |
| `logs` | string | Detailed execution log |
## WAF Alignment
| Pillar | How This Skill Contributes |
|--------|---------------------------|
| reliability | Includes retry logic, validates outputs, provides rollback steps |
| security | Validates credentials, enforces least-privilege, scans for secrets |
## Compatible Solution Plays
- **Play 24**
- **Play 51**
## Error Handling
| Exit Code | Meaning | Action |
|-----------|---------|--------|
| 0 | Success | Proceed to next step |
| 1 | Validation failure | Check input parameters |
| 2 | Dependency missing | Install required tools |
| 3 | Runtime error | Check logs, retry with `--verbose` |
## Usage
### Standalone
```bash
# Run this skill directly
npx frootai skill run fai-dead-code-removal
```
### Inside a Solution Play
When referenced in `fai-manifest.json`, this skill auto-wires with the play's context:
```json
{
"primitives": {
"skills": ["skills/fai-dead-code-removal/"]
}
}
```
### Via Agent Invocation
Agents can invoke this skill using the `/skill` command in Copilot Chat.
## Configuration Reference
```json
{
"skill": "skill-name",
"version": "1.0.0",
"timeout_seconds": 300,
"retry_attempts": 3,
"log_level": "info"
}
```
## Monitoring
Track skill execution metrics:
| Metric | Description | Alert Threshold |
|--------|-------------|----------------|
| Duration | Execution time | > 60 seconds |
| Success rate | Pass/fail ratio | < 95% |
| Error count | Failed executions | > 5/hour |
## Troubleshooting
| Symptom | Cause | Fix |
|---------|-------|-----|
| Timeout | Slow dependency | Increase timeout_seconds |
| Auth failure | Expired credentials | Refresh Managed Identity |
| Missing config | No fai-manifest.json | Create manifest or pass config_path |
| Validation error | Invalid input | Check parameter types and ranges |
## Notes
- This skill follows the FAI SKILL.md specification
- All outputs are deterministic when `dry_run=true`
- Integrates with FAI Engine for automated pipeline execution
- Part of the Code Quality category in the FAI primitives catalog
Pliki w paczce (3)
- SKILL.lean.md 4 KB
- SKILL.md 4 KB
- agents/openai.yaml 1 KB
Wersje
W bazie nie ma innych skilli o nazwie fai-dead-code-removal.
Migawka bazy z 28.10.2026 · wersja paczki 42144361fbc0 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100code-dead-code
Wykrywa martwy kod, nieużywane eksporty, nieosiągalne gałęzie i osierocone pliki, by zmniejszyć koszt utrzymania po refaktoryzacjach. - 84analyze-dead-code
Znajduje w repozytorium nieużywane eksporty, nieosiągalne moduły i martwe pliki, a następnie usuwa je z kodu. - 100dead-code-removal
Identyfikuje nieużywane funkcje, klasy, eksporty i pliki, a następnie bezpiecznie je usuwa z kodu. - 100find-dead-code
Znajduje nieużywane funkcje, klasy, importy i nieosiągalne ścieżki kodu, aby zmniejszyć rozmiar bazy kodu. - 100dead-code-audit
Wykrywa nieużywany kod: niewywoływane funkcje, zbędne importy, osierocone pliki i nieosiągalne gałęzie, przed sprzątaniem lub wydaniem. - 100knip
Znajduje i usuwa nieużywane pliki, zależności i eksporty w projektach JavaScript i TypeScript za pomocą Knip, także w integracji z CI.