SuperAPI AI Directory

reuse-before-build

Coding & development

View repository

Updated 10-31 04:29

About this skill

Discover and reuse before implementing

Put capability investigation before implementation. Being able to write it yourself is not grounds for choosing to build in-house. Check all new or replacement implementations, including simple business logic; group by the complete capability the user needs, and do not select per line of code. Follow the technical route, existing authorization, and project constraints already specified by the user, and do not expand the investigation into a full project overhaul.

1. Clarify the capability and check local evidence

Confirm the functionality, inputs and outputs, runtime environment, and necessary constraints from the task. Check before editing the implementation of that capability:

  • Look for the project's existing components, business wrappers, utility functions, and nearby usage patterns, and judge whether they apply.
  • Check the language standard library and the runtime platform's native capabilities.
  • Read the relevant dependency manifests, locked versions, and actually installed packages; verify capabilities using the corresponding version's exports, types, bundled documentation, or examples. If a dependency is not installed, state this limitation clearly, verify against the locked version and official version documentation, and do not treat the declared range as the actual version.
  • Do not conclude that the project lacks the capability just because the current file has no import; do not conclude that the currently installed version has an API just because the latest documentation provides it.

Give a brief conclusion: what to reuse, where it is proven applicable, and what adaptations are still needed. No need to show the full search log. When reusing code internal to the project, still respect module boundaries and do not introduce unreasonable coupling for the sake of reuse.

2. Suitable capability exists: reuse directly

When the task is already authorized and the existing capability applies, use it directly without additional questions. Prefer following the project's suitable wrappers and conventions; when a wrapper does not apply, check the underlying public capability and do not mechanically reuse the wrong abstraction.

Use the real public interfaces of components, functions, or SDKs. Styling, data mapping, and business wiring are allowed; do not rewrite, under the name of an "adapter" or "wrapper", a state machine, algorithm, or interaction that the dependency already provides. Do not modify dependency source code to verify a guess.

"Partial coverage" must be clearly split: which parts the existing capability handles, and which remaining capabilities still need investigation. Preserve the behavior the user requires, and do not silently cut features to make fitting a library convenient.

3. Local gap exists: investigate online first

Before writing a replacement implementation, proactively search for mature libraries, official components, SDKs, standard solutions, or other approaches suitable for the current task. Every new implementation not reasonably covered by local capabilities goes through this step, including business-specific logic; it is not required that every business rule have a corresponding library.

Search based on functionality and the actual environment, and verify candidates using official documentation, official repositories, and version records. Search summaries can only surface leads and cannot serve as final evidence of capability or maintenance status. The investigation should be sufficient to judge feasibility, without endless searching; prioritize forming a small number of genuinely applicable candidates. Clearly mark capabilities, compatibility, or costs with insufficient evidence, and do not fabricate conclusions.

When the network is unavailable, state the blocked items; do not claim there is no mature solution, and do not automatically start building in-house. Continue completing work that does not depend on that selection, and explain to the user the available paths such as resuming the investigation or explicitly authorizing in-house development.

4. Compare, recommend, and confirm the route

Usually compare 2–3 realistically feasible options; if there is only one candidate or none, state this truthfully and do not pad the list. A compact table may be used:

Option and official source Capability coverage and gaps Environment/version compatibility Integration and maintenance cost

Discuss only the factors that affect the current choice: necessary size, performance, licensing, maintenance status, or service fees; do not list irrelevant metrics. Recommendations should be based on current needs, the existing tech stack, and total cost, not just popularity or the number of features.

Give a clear conclusion: “I recommend X because…; it requires introducing/upgrading…, and … still needs to be implemented by us; do you agree to use it?” Use the question-asking tool provided by the current environment; if no tool is available, ask directly.

The following routes require user confirmation unless the same route was previously explicitly authorized:

  • Introducing new dependencies, upgrading dependencies, introducing services, or switching frameworks. Upgrades must state the gaps in the existing version and the compatibility impact.
  • Deciding to build in-house after investigation: explain the basis for excluding candidates, the minimum in-house scope, the verification method, and maintenance responsibility, then ask the user to confirm. When common capabilities can be reused and business rules must be written by us, the explanation may be combined and confirmed once.

A general “implement a feature” request does not replace the above selection confirmation. If the user has already specified a library or explicitly authorized in-house development, retain that authorization, still verify suitability, and do not ask repeatedly; if something is found to exceed the authorized scope, raise the specific differences again.

Before confirmation, read-only checks and option preparation may be done; do not install, do not change dependency declarations, do not call paid services, and do not write a substitute implementation for that gap. No reply or rejection of a candidate does not equal agreeing to in-house development. After the user rejects, adjust candidates based on the reason or propose the remaining routes.

If this Skill causes a pause, note it and link to the “Compare, recommend, and confirm route” rule in the current SKILL.md, briefly explaining which unauthorized choice is being waited on; do not describe this rule as a tool-enforced block.

5. Implementation and verification

Execute according to the confirmed route, using the minimum necessary adaptation and avoiding unnecessary dependencies or large frameworks. Verify actual behavior, version compatibility, and affected regressions; check that the final code actually calls the selected capability and does not secretly retain a duplicate implementation or an unapproved in-house fallback.

The delivery note should state what was reused, the necessary custom parts, the check results, and the unverified items. If a candidate is found in practice not to meet the requirements, return to the selection stage and do not silently switch routes.

Verify this Skill

Read only when creating, modifying, or evaluating this Skill behavior acceptance scenarios. Structural validation is not behavior verification, and passing an explicit invocation does not mean a natural coding request can trigger it automatically. Do not claim that this Skill guarantees automatic loading every time.