template-extraction

Extracts reusable code templates from open-source reference projects into .template files.

1|2|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/zhizhunbao/textbook-rag --skill template-extraction-zhizhunbao
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: template-extraction
Source: https://github.com/zhizhunbao/textbook-rag/tree/main/.agent/skills/dev-template_extraction
Command: npx skills add https://github.com/zhizhunbao/textbook-rag --skill template-extraction-zhizhunbao

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rebuilding common modules from scratch wastes engineering time when proven implementations already exist in open-source projects. This Skill provides a structured methodology for identifying, extracting, and migrating reusable code modules from reference projects into a standardized template library. ## Core Features & Use Cases - 5-Level Thinking Framework: Maps operations (reference, template, migrate, create, generate) to the right granularity level, with the module as the core unit of reuse. - Module Card Standard: Documents every extractable module with source paths, file manifests, dependencies, adaptation notes, and quality checklists. - Phased Extraction Workflow: Covers project analysis, template creation with {{placeholder}} variables, module migration, layer scaffolding, and file-level code generation. - Use Case: When adopting a chat citation component from a reference project, score it with the Value Matrix, create a Module Card, generate .template files with standardized placeholders, then migrate it into your project with adapted imports and i18n. ## Quick Start Analyze the reference project in .github/references and create Module Cards for the top reusable modules, then extract them as .template files into .agent/templates.

Frequently Asked Questions about template-extraction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract reusable code templates from an open-source project?▼

Scan the reference project's src or app directory, score candidate modules with the Value Matrix (reusability, complexity, quality, relevance), then create Module Cards. Replace hardcoded values with {{PLACEHOLDER}} variables and write .template files to .agent/templates.

What granularity is best for code reuse when migrating modules?▼

The module level is the recommended granularity because modules are self-contained with clear boundaries and portable across projects. Project-level is too coarse for direct reuse, while file-level extraction loses context and dependencies.

How do I migrate a .template file into my project?▼

Copy the template files to the target directory, remove the .template extension, replace all {{PLACEHOLDER}} values with project-specific values, install dependencies, adjust import path aliases, add i18n wrapping, and verify the build passes.

When should I skip extracting a module from a reference project?▼

Skip extraction when the module is not self-contained and its valuable parts cannot be isolated, or when a well-known npm or pip package already provides the functionality. Writing from scratch is the last resort.

What placeholder naming conventions should code templates use?▼

Use standardized names like {{ModuleName}} for PascalCase, {{module_name}} for snake_case, {{ALIAS}} for import path aliases, and {{API_BASE_URL}} for endpoints. Consistent naming ensures templates remain portable across projects.