typescript-dry-principle-skill

typescript-dry-principle-skill is a skill for OpenCode from darellchua2/opencode-config-template. It costs 26 tokens per session (7,372 once invoked), scanned C, original, Apache-2.0.

A refactoring skill for TypeScript projects that applies the DRY principle, meaning “Don't Repeat Yourself.” It finds repeated code, types, settings, and patterns, then helps combine them into shared, reusable pieces.

In plain words
What is it for?
Use it to find duplication, create shared utilities and types, reorganize related files, and check that the project still compiles and its tests pass.
Why use it?
It reduces copy-and-paste code and makes future changes less likely to require edits in many places.

Skill for OpenCode

Written for OpenCode: installed under .opencode/. Also seen: mentions OpenCode.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { formatFullName } from '../utils/stringUtils'.

Good fit Use it to find duplication, create shared utilities and types, reorganize related files, and check that the project still compiles and its tests pass.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/darellchua2/opencode-config-template
agentmods
npx agentmods add skills/darellchua2/opencode-config-template/typescript-dry-principle-skill

Made for: OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for typescript-dry-principle-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/typescript-dry-principle-skill.svg)](https://agentmods.dev/skills/darellchua2/opencode-config-template/typescript-dry-principle-skill)
Your own site
<a href="https://agentmods.dev/skills/darellchua2/opencode-config-template/typescript-dry-principle-skill"><img src="https://agentmods.dev/badge/skills/darellchua2/opencode-config-template/typescript-dry-principle-skill.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,372 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.07372
Opus 5 $0.00013 $0.03686
Sonnet 5 $0.00005 $0.01474
Haiku 4.5 $0.00003 $0.00737

Measured 4d ago against content hash e48c655e1384, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade C, and why

typescript-dry-principle-skill scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

When protocol is enabled, this skill defaults to `Iterations: 10` (sufficient for typical single-pass workflows). Override with `Iterations: N` for specific tasks. Safety blocks: `.env`, `node_modules/`, `rm -rf`, `git p

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url)
opencode_app/.opencode/skills/typescript-dry-principle-skill/SKILL.md · 1,081 lines

How it starts

The opening of the file, as written. The whole thing — 1,081 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What I do

I help you eliminate code duplication in TypeScript projects by applying the DRY (Don't Repeat Yourself) principle:

  1. Analyze Codebase: Scan TypeScript files to identify repeated code patterns, logic, types, and configurations
  2. Identify Duplication Patterns: Detect common anti-patterns including:
    • Duplicate logic across multiple functions/components
    • Repeated type definitions
    • Copy-pasted code blocks
    • Similar functions with slight variations
    • Scattered configuration values
  3. Extract Common Logic: Refactor duplicated code into reusable utility functions and modules
  4. Consolidate Type Definitions: Merge duplicate types into shared interfaces and type utilities
  5. Create Generic Solutions: Build type-safe reusable components using TypeScript generics
  6. Organize Folder Structure: Restructure code into logical directories (types/, utils/, constants/, hooks/, services/)
  7. Replace Duplicated Code: Update files to import from shared modules instead of duplicating code
  8. Verify Refactoring: Ensure code compiles and tests pass after changes

When to use me

Use this workflow when:

  • You notice similar code blocks across multiple TypeScript files
  • You're copy-pasting code between modules or components
  • Type definitions are duplicated or repeated across files
  • Business logic appears in multiple places with slight variations
  • Configuration values are scattered across multiple files
  • Tests contain repeated setup/teardown logic
  • You want to improve code maintainability and reduce technical debt
  • Preparing for a code review to address technical debt
  • Setting up a new TypeScript project with proper code organization

Ask clarifying questions if the scope of refactoring is unclear or if you want to focus on specific areas.

Prerequisites

  • TypeScript project with source code (.ts, .tsx files)
  • File permissions to read and modify TypeScript files
  • TypeScript compiler installed and configured
  • (Optional) Test suite to verify refactoring doesn't break functionality
  • (Optional) Git repository to commit refactoring changes

Read the full file on GitHub · 1,081 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 1,081 lines · 26 tokens per session scan C e48c655e1384

Subscribe to this mod's changes

typescript-dry-principle-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed yesterday), licensed Apache-2.0. It adds 26 tokens to every session and 7,372 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

mk:vue

Use when writing, reviewing, or refactoring Vue 3 code — components, composables, reactivity, Pinia state, Pinia Colada data-fetching, file-based routing, and forms. Targets Composition API + + TypeScript. Auto-activates on .vue files. For deep best-practices review/recommendations or the full ordered workflow…

ngocsangyem/MeowKit · 101 tokens

mk:angular

Use when working with Angular code — components, signals, services, forms, routing, HTTP, testing, SSR, or tooling. Targets Angular v20+ modern patterns. Auto-activates on .ts files in Angular projects (detected via angular.json).

ngocsangyem/MeowKit · 56 tokens

no-bare-casts

Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.

prisma/orm · 52 tokens

aws-sst-development

SST v4 (Ion) expert for managing AWS resources as code with the Pulumi-backed framework.

sickn33/agentic-awesome-skills · 26 tokens

league-akari-shard-development

Use when creating, extending, refactoring, splitting, or reviewing League Akari main or renderer shards, including shard file organization, controller/loader/executor/handler boundaries, naming conventions, renderer TSX usage, platform guards, and public contract compatibility.

LeagueAkari/LeagueAkari · 58 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens