Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/T-rav/hydraflow --skill hf-audit-codeコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SOC 職業分類に基づく
SKILL.md を表示中
| name | hf.audit-code |
| description | Code Quality Audit |
Run a comprehensive code quality audit across the entire repo. Dynamically analyzes source code for dead code, complexity, duplication, error handling gaps, type safety issues, and architectural problems. Creates GitHub issues for findings so HydraFlow can process them.
Resolve configuration before doing anything else:
echo "$HYDRAFLOW_GITHUB_REPO" — if set, use it as the target repo (e.g., owner/repo). If empty, run git remote get-url origin and extract the owner/repo slug (strip https://github.com/ prefix and .git suffix).echo "$HYDRAFLOW_GITHUB_ASSIGNEE" — if set, use it as the issue assignee. If empty, extract the owner from the repo slug (the part before /).hydraflow-plan as the label for created issues.$REPO, $ASSIGNEE, $LABEL.Discover project structure:
*.py source files, excluding .venv/, venv/, __pycache__/, node_modules/, dist/, build/.tests/ or matching test_*.py).Launch agents in parallel using Task with run_in_background: true and subagent_type: "general-purpose":
Any overuse, inconsistent return types, and public API gaps.Wait for all agents to complete.
After all finish, run gh issue list --repo $REPO --label $LABEL --state open --search "code quality" --limit 200 to show the user a final summary of all issues created.
You are a code quality auditor focused on dead code detection for the project at {repo_root}.
## Configuration
- GitHub repo: {REPO}
- Assignee: {ASSIGNEE}
- Label: {LABEL}
## Steps
### Phase 1: Map All Definitions
1. Use Glob to find all *.py source files (exclude tests/, .venv/, __pycache__/)
2. Read each source file and catalog every:
- Function/method definition (def, async def)
- Class definition
- Module-level constant
- Import statement
### Phase 2: Cross-Reference Usage
3. For each definition, search the codebase for references:
- Is the function/class actually called or imported elsewhere?
- Is the constant referenced outside its definition file?
- Are there imports that are never used?
- Are there entire modules that nothing imports from?
4. Check __init__.py re-exports — are re-exported names actually used by consumers?
5. Check for functions only called by other dead functions (transitive dead code)
### Phase 3: Detect Stale Patterns
6. Look for:
- **Commented-out code blocks** (> 3 lines of commented code)
- **TODO/FIXME/HACK comments** older than the surrounding code's last edit
- **Unused class methods** (defined but never called, including by tests)
- **Unreachable code** after unconditional return/raise/break
- **Empty function bodies** (just `pass` or `...`) that aren't abstract methods
- **Duplicate function signatures** (same name defined in multiple places)
### Phase 4: Create GitHub Issues
7. Check for duplicate GH issues first:
gh issue list --repo {REPO} --label {LABEL} --state open --search "<key terms>"
8. Create GH issues for NEW findings only, grouped by theme:
gh issue create --repo {REPO} --assignee {ASSIGNEE} --label {LABEL} --title "Code Quality: <theme>" --body "<details>"
## Issue Body Format
```markdown
## Context
<1-2 sentences on why this cleanup matters>
## Dead Code Found
| Type | File:Line | Name | Reason |
|------|-----------|------|--------|
| <function/class/import> | <path:line> | <name> | <never called/never imported/unreachable> |
## Suggested Actions
- [ ] Remove <item> — unused since <reason>
- [ ] Remove <item> — only referenced by other dead code
## Impact
- Lines removable: ~<N>
- Files affected: <N>
- Risk: <low — dead code removal>
Create ONE issue per theme, not one per dead function. Good themes:
Be pragmatic: exclude protocol/ABC methods, dunder methods, and test helpers. Verify a function is truly unused before flagging — check tests too, as test-only helpers are valid.
Return a summary of all findings grouped by category, with GH issue URLs created.
## Agent 2: Complexity & Duplication
You are a code quality auditor focused on complexity and duplication for the project at {repo_root}.
## Context
<1-2 sentences on why reducing complexity/duplication matters here>
## Findings
| Issue | File:Line | Function/Block | Metric |
|-------|-----------|---------------|--------|
| <long function/duplication/deep nesting> | <path:line> | <name> | <value> |
## Suggested Refactoring
- [ ] Extract <helper function> from <locations> — <what it does>
- [ ] Split <long function> into <sub-functions>
- [ ] Replace magic value `<value>` with named constant
## Code Example (Before/After)
<Show a concrete before/after for the highest-impact item>
Focus on high-impact items: functions > 80 lines, 3+ duplicated blocks, deeply nested logic. Skip trivial duplication (< 3 lines) and acceptable complexity (simple long switch-like patterns).
Return a summary of all findings grouped by category, with GH issue URLs created.
## Agent 3: Error Handling & Robustness
You are a code quality auditor focused on error handling and robustness for the project at {repo_root}.
except: or except Exception: that catches too broadlyexcept: pass or except Exception: pass — errors silently ignoredraise without chaining (raise X from e)check=True or manual returncode check)with, connections without cleanup## Context
<1-2 sentences on the robustness risk>
## Findings
| Severity | File:Line | Issue | Risk |
|----------|-----------|-------|------|
| <high/medium/low> | <path:line> | <description> | <what could go wrong> |
## Suggested Fixes
- [ ] <file:line> — Add error handling for <operation>
- [ ] <file:line> — Replace bare except with specific exception type
- [ ] <file:line> — Add timeout to subprocess call
## Impact
- Blast radius: <what breaks if this isn't fixed>
- Frequency: <how often this code path runs>
Focus on production code paths that run frequently. Skip test code and one-off scripts. Prioritize by blast radius — errors in the orchestrator or review loop matter more than CLI parsing.
Return a summary of all findings grouped by category, with GH issue URLs created.
## Agent 4: Type Safety & API Consistency
You are a code quality auditor focused on type safety and API consistency for the project at {repo_root}.
-> ReturnTypeAny overuse: Functions typed as -> Any or parameters as param: Any when a more specific type is availableX | Nonedict instead of dict[str, int], list instead of list[str]str that should be enums or Literal typesField(description=...)model_config for JSON serialization settingsissue_num vs issue_number vs issue_id)## Context
<1-2 sentences on why type safety/consistency matters here>
## Findings
| Issue | File:Line | Current | Suggested |
|-------|-----------|---------|-----------|
| <missing type/Any overuse/inconsistent name> | <path:line> | <current state> | <what it should be> |
## Suggested Fixes
- [ ] <file:line> — Add return type annotation `-> X`
- [ ] <file:line> — Replace `Any` with `SpecificType`
- [ ] <file:line> — Rename `issue_num` to `issue_number` for consistency
## Impact
- Type checker improvements: <N> new errors caught
- API consistency: <description of improvement>
Focus on public APIs and cross-module interfaces. Skip internal helper functions and test code. Prioritize by impact — type gaps in widely-used functions matter more than leaf functions.
Return a summary of all findings grouped by category, with GH issue URLs created.
## Important Notes
- Each agent should read files directly (no spawning sub-agents)
- Each agent should check `gh issue list` before creating any issue to avoid duplicates
- All issues should use the resolved `$REPO`, `$ASSIGNEE`, and `$LABEL`
- Group related findings into single themed issues — don't create one issue per finding
- Title format: "Code Quality: <theme>" for consistency
- Be pragmatic: focus on high-impact items that meaningfully improve code quality
- Skip nitpicks, style preferences, and issues already caught by ruff/pyright
- Don't duplicate what linters already catch — focus on semantic issues that require understanding the code