Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

fai-java-extract-method

/fai-java-extract-method

Refaktoryzuje kod Java metodą extract method i pokrewnymi wzorcami, aby zmniejszyć złożoność i poprawić testowalność, gdy metoda jest zbyt długa lub logika się powtarza.

Repozytorium
frootai ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
3
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Refaktoryzuje kod Java metodą extract method i pokrewnymi wzorcami, aby zmniejszyć złożoność i poprawić testowalność, gdy metoda jest zbyt długa lub logika się powtarza.

Wyzwalacze z opisu

clean up this Java codethis function is doing too much
Oryginalny opis (EN)

Refactor Java code using extract-method and related patterns to cut complexity and improve testability. Use this skill when a method is too long, logic is duplicated, or a class is hard to test — even if the user only says "clean up this Java code" or "this function is doing too much".

Jak działa

  1. Overview
  2. Parameters
  3. Steps
  4. Output
  5. WAF Alignment
  6. Error Handling
  7. Usage
  8. Configuration Reference
  9. Monitoring
  10. Troubleshooting
Sekcje z nagłówków SKILL.md, w oryginale · 153 linii, 655 słów
Podgląd SKILL.md
---
name: fai-java-extract-method
description: Refactor Java code using extract-method and related patterns to cut complexity and improve testability. Use this skill when a method is too long, logic is duplicated, or a class is hard to test — even if the user only says "clean up this Java code" or "this function is doing too much".
---

# Fai Java Extract Method

Applies Extract Method refactoring in Java with proper error handling and testing.

## Overview

This skill provides a structured, repeatable procedure for applies extract method refactoring in java with proper error handling and testing.. It can be used standalone as a LEGO block or auto-wired inside solution plays via the FAI Protocol.

**Category:** General
**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: applies extract method refactoring in java with proper error handling and testing..

### 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 |
| operational-excellence | Produces structured logs, integrates with CI/CD, follows IaC patterns |

## 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-java-extract-method
```

### Inside a Solution Play

When referenced in `fai-manifest.json`, this skill auto-wires with the play's context:

```json
{
  "primitives": {
    "skills": ["skills/fai-java-extract-method/"]
  }
}
```

### 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 General 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-java-extract-method.

Migawka bazy z 28.10.2026 · wersja paczki 8a259f28d28e (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

  • 100fai-refactor-complexity
    Zmniejsza złożoność kodu analizą cyklomatyczną, wzorcami extract method i refaktoryzacją małymi krokami, gdy wyniki złożoności są wysokie lub kod trudno zrozumieć i testować.
  • 84refactor-code
    Refaktoryzuje kod z kontrolami bezpieczeństwa i zastosowaniem wzorców: upraszcza logikę, wydziela funkcje, stosuje wzorzec strategii i zmniejsza złożoność modułu.
  • 100code-refactoring
    Upraszcza i refaktoryzuje kod bez zmiany zachowania, usuwa duplikację i stosuje wzorce projektowe, w tym Extract Method, DRY i SOLID.
  • 96java
    Podaje wytyczne budowy aplikacji Java dla plików .java, od struktury kodu po obsługę błędów.
  • 100refactor
    Systematycznie refaktoryzuje kod, aby poprawić jego utrzymywalność, upraszcza go i usuwa code smells, zawsze zachowując istniejące zachowanie.
  • 100refactor
    Bezpiecznie refaktoryzuje kod pod ochroną testów: czyści, upraszcza, wydziela funkcje i poprawia jakość bez zmiany zachowania.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.