---
name: jnzader-build-modules-layer
description: "Builds and evaluates Python module layers for the Gentleman-Skills ecosystem. Generates eval scenarios, adapts skills for LLM targets, and performs code analysis (dead code, complexity, blast radius). Trigger: When working in `build_modules/` — adding, modifying, or debugging module generation, adaptation, or analysis."
license: "MIT"
metadata:
  decimalai-skill-id: "eeb8ae94-e0e4-42c1-9ab3-1b9039117d95"
  decimalai-version-id: "b4260058-0ec5-4f74-a247-597e8ba21896"
  decimalai-version: "1"
  decimalai-body-sha256: "bdc0ce2b09c7698a49f6d830f8d869a60ce73aac3f524b3a8562ffa247c29811"
  decimalai-name: "jnzader/build_modules-layer"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "agent-tooling"
  decimalai-source: "https://app.decimal.ai/s/jnzader-build-modules-layer@1/SKILL.md"
---
<!-- L1:START -->
# build_modules-layer

This layer provides tools for building, evaluating, and analyzing Python modules within the Gentleman-Skills ecosystem. It handles module generation, LLM target adaptation, and code quality analysis.

**Trigger**: When working in `build_modules/` directory — adding, modifying, or debugging module generation, adaptation, or analysis.
<!-- L1:END -->

<!-- L2:START -->
## Quick Reference

| Task | Pattern |
|------|---------|
| Run eval scenarios | `python -m eval.harness run_all` |
| Adapt skills for LLM targets | `adapt_for_cursor/Codex/Gemini/Copilot` |
| Detect dead code | `detect_dead_code()` |

## Critical Patterns (Summary)
- **Pattern 1: Module Generation**: Use `make_fastapi_crud_module`, `make_nextjs_page_module`, `make_mixed_layer`, or `make_go_service_module` from `eval/harness.py` to generate module skeletons in various frameworks.
- **Pattern 2: Skill Adaptation**: Use `adapt_for_cursor`, `adapt_for_codex`, `adapt_for_gemini`, or `adapt_for_copilot` from `repoforge/adapters.py` to transform skill dictionaries for specific LLM targets.

## When to Use

- Adding a new module generation function to `eval/harness.py`
- Adapting existing skills for a different LLM target platform
- Detecting dead code or analyzing module complexity
- Running eval scenarios against generated modules

## Adding a New Module Generation Function

1. Add a new function to `eval/harness.py` following the pattern `make_<framework>_module() -> tuple[dict, dict]`
2. Export the function in `eval/harness.py` `__all__` if present
3. Test with `run_scenario` using the new module config
4. Verify output with `print_report`

## Commands

```bash
python -m eval.harness run_all
python -m eval.harness run_scenario <scenario_name>
adapt_for_cursor <skills_json>
adapt_for_copilot <skills_json>
detect_dead_code <ast_symbols_dict>
```

## Anti-Patterns

### Don't: Mix adaptation targets — using `adapt_for_copilot` skills with `adapt_for_cursor` expectations — each adapter formats skill dicts differently for its target LLM, causing integration failures.

```python
# BAD: Mixing adaptation targets
skills = adapt_for_cursor(skills_dict)
# Later using skills with Cursor — works
# But passing these same skills to adapt_for_codex will produce
# incorrectly formatted output for Codex's expectations.
```
<!-- L3:END -->
