fangdai-haiyao-hai-duojiu

A mortgage prepayment calculator: computes when the loan will be paid off if you prepay X ten thousand yuan each year; compares whether shortening the term or reducing monthly payments is more economical; and shows how to adjust the repayment plan when interest rates fall.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "fangdai-haiyao-hai-duojiu" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-5b18a017b04b608ca4bb436ae4c8684b7a5dab5b2920d2b9cec70520bea5de5d. Verify the upstream source and version against https://skillhub.cn/skills/user_c18b02ff/fangdai-haiyao-hai-duojiu before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A mortgage prepayment calculator: computes when the loan will be paid off if you prepay X ten thousand yuan each year; compares whether shortening the term or reducing monthly payments is more economical; and shows how to adjust the repayment plan when interest rates fall.

0 Downloads

Introduction source: third_party · user_c18b02ff · 1.0.5 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: 房贷还要还多久
displayName: 房贷还要还多久
slug: fangdai-haiyao-hai-duojiu
description: "房贷提前还款测算:算清每年提前还 X 万何时结清、缩短年限 vs 减少月供哪个更省、利率降了计划怎么变。"
version: "1.0.4"
author: "CodeBuddy AI"
created: "2026-07-14"
updated: "2026-07-15"
tags:
  - 房贷
  - 提前还款
  - 金融计算
  - 个人理财
keywords:
  - 房贷
  - 房贷提前
  - 提前还贷
  - 提前还款
  - 房贷结清
  - 还要还多久
  - 多久还清
  - 房贷计算器
  - 房贷利息
  - 省利息
  - 缩短年限
  - 减少月供
  - 月供重算
  - 结清时间
  - 剩余本金
  - 等额本金
  - 等额本息
  - 公积金提前还款
  - 商贷提前还款
  - LPR 房贷
  - 利率降了房贷怎么变
license: MIT

房贷提前还款测算(Mortgage Early Repayment)

定位

  1. 作用:给定「贷款本金 + 年限 + 利率 + 周期性提前还款」,测算何时结清、总利息多少、缩短年限 vs 减少月供哪个更省、利率变了计划怎么变;并支持用还款流水反推真实利率。

  2. 模型与公式(标准金融数学,算法通用、不绑定特定机构):

    • 等额本息月供(来源 [1]):$$P = L \cdot \frac{i(1+i)^n}{(1+i)^n - 1}$$
    • 每期偿还本金:$Bt = P - B{t-1} \cdot i$
    • 等额本金月供:$Mt = \frac{L}{n} + B{t-1} \cdot i$
    • 提前还款后重摊 = 国际金融标准概念 re-amortization / mortgage recast(来源 [2])
    • 缩短年限(锁月供 $P$):由 $B' = P \cdot \frac{1-(1+i)^{-m}}{i}$ 反解剩余期数 $m$
    • 减少月供(锁定期限 $m$):由 $P' = B' \cdot \frac{i(1+i)^m}{(1+i)^m - 1}$ 重摊新月供
  3. 计息天数与机构差异:提前还当期的按天计息口径(天数/30 还是 实际天数/360)各机构自定、无全国统一标准,无法统一建模,故默认按月边界计息;真正因机构而异的只有操作层(违约金/每年次数/最低金额/是否互转)。任意一笔真实贷款可用还款流水反推真实利率 $r$ 并保存为 profile 复用。

参考文献

提示词与触发

  • 触发关键词:房贷、房贷提前、提前还贷、提前还款、房贷结清、还要还多久、多久还清、房贷计算器、房贷利息、省利息、缩短年限、减少月供、月供重算、结清时间、剩余本金、等额本金、等额本息、公积金提前还款、商贷提前还款、LPR 房贷、利率降了房贷怎么变。
  • 唤起方式:用户或大模型直接说"用 / 打开『房贷还要还多久』";或大模型判断用户聊到提前还款即调用。

输入获取(怎么拿到用户关键信息)

真实参数有三条合法来源,任选其一或结合:

  1. 用户打字填:用户直接给数字,按用户说的算。
  2. 用户发还款流水 / 银行 App 截图:从图中反推贷款类型、月本金、月利率(见「反推 + 持久化」)。截图等价于给了流水。
  3. 二者结合:用图反推、用填的数字交叉验证,冲突时以反推为准。

执行顺序:接到任务第一步不是计算,而是核输入——检查必填项是否齐全。缺任一必填项,用编号清单追问用户(文本或截图均可),禁止用假设值直接算。信息齐全后直接测算。

必填项

  • 贷款金额 $L$、贷款年限 / 期数 $N$、年利率(打字给或截图反推)。
  • 贷后额外:已还期数 或 当前剩余本金;提前还款计划(节点 / 金额 / 缩短年限 or 减少月供 or 一次性结清)。
  • 利率来源:公积金政策利率 / 商业 LPR 浮动 / 固定利率(公积金不主动问第几套房;商贷问重定价日 + 加点)。

例外(可跳过追问):用户已提供流水 / 截图 → 跳过金额/年限/利率追问,直接反推;用户明确只问贷前月供 → 只需金额/年限/利率;用户说已有完整参数 → 直接算。

核心机制

1. 两种还款方式

  • 等额本息:月供恒定 $P$,每月只减本金部分 $P - B_{t-1} \cdot i$。
  • 等额本金:月本金固定 $L/n$,月供 $L/n + B_{t-1} \cdot i$,逐月递减。公积金贷多为等额本金。

2. 提前还款两种选择

  • 缩短年限(压缩期限):等额本金下月供会变($Pp + 剩余 \times r$),等额本息下月供锁死、砍掉期数。
  • 减少月供(不压缩期限):期限锁死为剩余原期限,月供重摊后下降,只省息、不提速。
  • 一次性全额结清:立即需还 = 剩余本金 + 剩余本金 × 月利率 ×(距上次还款天数 / 30);省下原本剩余利息。

3. 利率重定价

  • 三类:公积金政策利率(统次年 1 月 1 日调)、商业 LPR 浮动(重定价日 + 加点)、固定利率。
  • 建模:用重定价时间表 [(生效月, 年化), ...] 替代单一利率,simulate() / full_payoff() 逐月取当期适用利率。
  • 利率水平全国统一、公开;是否调息由 skill 主动对照已公告历史核查,不依赖用户记忆;绝不预测未来利率。

4. 反推 + 持久化(适配任意机构的核心)

  • 算法标准统一,可变的是利率 $r$ 与计息天数口径;靠「用用户流水反推真实参数 + 存盘复用」适配,不硬编码各家规则。
  • 流程:判断还款方式 → 反推月利率 $r_i = (月供 - Pp) / 期初本金$ → 年化 → save_profile() 落盘 profiles/<loan_id>.json → 下次 load_profile() 直接复用。

分析分支:贷前还是贷后

拿到完整信息后,先判断走哪条线:

  • 贷后(Branch B,核心):用户已有贷款且在还款中,带「已还期数 / 剩余本金 / 提前还款计划 / 利率变动重算」等信息 → 走贷后。
  • 贷前(Branch A,顺带):用户还没贷、或只问月供比价(只有金额 / 年限 / 利率)→ 走贷前。

判断依据:信息里是否出现贷后特征(已还期数、剩余本金、提前还款动作)。有 → 贷后;只有月供比价需求 → 贷前。

执行与输出

Branch B(贷后)

  1. 钉参数:有匹配 profile → 沿用;给了流水 / 截图 → 反推(最准);只打字 → 按用户说的算。
  2. 逐月模拟:到达提前还款节点,按用户选项更新期数 / 月供(缩短年限反解 $m$、减少月供重摊 $P'$、一次性结清算需还总额)。
  3. 输出:结清时间(月 / 年)、总利息、每次提前还款后的新月供 / 砍掉期数 / 剩余本金、缩短年限 vs 减少月供的省息对比。

Branch A(贷前)

  1. 计算:月供、总利息、等额本金 vs 等额本息比价。
  2. 输出:月供多少、总利息多少、两种方式差额、提前还款省息空间提示。

流程图

flowchart TD
    A[任务开始] --> B[获取关键信息:打字填 / 截图反推 / 二者结合]
    B --> C{必填项齐?}
    C -- 否 --> D[编号追问用户:文本或截图]
    D --> B
    C -- 是 --> E{分析:贷前 or 贷后}
    E -- 贷后 Branch B --> F[钉参数:profile / 反推 / 按用户说的算]
    E -- 贷前 Branch A --> G[算月供 / 总利息 / 比价]
    F --> H[逐月模拟:到节点按选项更新期数 / 月供]
    H --> I[输出:结清时间 / 总利息 / 新月供 / 砍掉期数 / 省息对比]
    G --> J[输出:月供 / 总利息 / 比价差额]

参考脚本

scripts/calc.py:流水反推(reverse_engineer)、逐月模拟(simulate)、一次性结清(full_payoff)、贷前测算(pre_loan)、持久化(save_profile / load_profile / build_profile_from_records / list_profiles)。python3 scripts/calc.py 看示例。

Current listing version

1.0.5

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决房贷提前还款核心痛点,高频刚需场景
  • 支持缩短年限 vs 减少月供对比,实用性强
  • 覆盖利率变动重算,适应真实用户决策需求
Trigger Precision95/100

Highlights

  • 触发词覆盖全面,边界清晰无歧义
  • keywords 字段完整包含房贷、提前还款、结清时间等核心术语
Structure and Standards90/100

Highlights

  • 结构完整,Phase/步骤清晰,有流程图辅助理解
  • frontmatter 完整,单文件长度合规
Execution Reliability90/100

Highlights

  • 基于标准金融数学公式,来源权威
  • 覆盖贷前/贷后分支及多种提前还款选项
  • 反推机制适配不同机构,提升执行鲁棒性
Evidence Verifiability (mean of the first four)92/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • corporatefinanceinstitute.com
  • www.investopedia.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.