- Home
- Skills
- Productivity
- Learn Skills - Understand everything
Works with the AI Agents you already use
Learn Skills - Understand everything
Turn AI-written code into understanding through guided questions, practical exercises, and source-checked feedback
Free
Learn Skills - Understand everything
Example session with this skill installed
Use `learn-by-doing` on this JavaScript function. Give me three exercises: recreate its behavior, debug a broken version, and apply the pattern to a different problem. Keep solutions hidden until I’m ready. ``` export function discountedTotal(prices, discount = 0) { if (discount < 0 || discount > 1) throw new RangeError('discount'); return prices.reduce((sum, price) => sum + price, 0) * (1 - discount); } ```
- Read your context and instructions
- Compiled the learn - understand
# Practice: Understand the Discount Function Three exercises grounded in your code. Attempt each before opening the solutions. Bring your answers back for verification against the source. | Exercise | Your task | |---|---| | Recreate | Rebuild the behavior without copying | | Debug | Find the mistake in a plausible rewrite | | Transfer | Apply the same reasoning to refunds | ### 1. Recreate the behavior Read the original function, then hide it. Write your own `discountedTotal(prices, discount)` that: - Accepts an array of prices. - Defaults to no discount. - Rejects discounts below `0` or above `1`. - Returns the total after applying the discount. Before running your implementation, predict its output for: ```js discountedTotal([40, 60], 0.25) discountedTotal([40, 60]) discountedTotal([], 0.25) ``` Explain how one input value travels through your function to become part of the result. ### 2. Debug the rewrite **A teammate changes the return statement** ```js return prices.reduce((sum, price) => sum + price, 0) * discount; ``` **They say:** “We’re applying the discount, so multiplying by it makes sense.” **Your task** 1. Choose an input that exposes the mistake. 2. Predict the original and rewritten results. 3. Correct the expression. 4. Explain what happens at discounts of `0` and `1`. ### 3. Apply the pattern elsewhere A shop needs to calculate revenue retained after proportional refunds. **Implement** ```js retainedRevenue(payments, refundFraction) ``` **Requirements** - `payments` contains payment amounts. - `refundFraction` defaults to `0`. - Fractions outside `[0, 1]` throw a `RangeError`. - The result is the amount the shop keeps. Use `[40, 60]` with a refund fraction of `0.25` to explain your implementation. Which parts of your reasoning stayed the same when moving from discounts to refunds? --- ```html <details> ``` <summary>Open solutions — after attempting the exercises</summary> ### 1. Recreate **One valid implementation** ```js export function discountedTotal(prices, discount = 0) { if (discount < 0 || discount > 1) { throw new RangeError('discount'); } const subtotal = prices.reduce((sum, price) => sum + price, 0); return subtotal * (1 - discount); } ``` The three calls return **75**, **100**, and **0**. **Source:** the supplied function, lines 1–3. ### 2. Debug For `[40, 60]` and `0.25`: - Original: `100 × 0.75 = 75`. - Rewrite: `100 × 0.25 = 25`. The rewrite calculates the discounted portion instead of the remaining amount. **The correct multiplier is** ```js 1 - discount ``` A discount of `0` keeps the full total; a discount of `1` leaves zero. **Source:** the supplied function, line 3. ### 3. Transfer ```js export function retainedRevenue(payments, refundFraction = 0) { if (refundFraction < 0 || refundFraction > 1) { throw new RangeError('refundFraction'); } const total = payments.reduce((sum, payment) => sum + payment, 0); return total * (1 - refundFraction); } ``` For `[40, 60]` and `0.25`, retained revenue is **75**. **The shared pattern is:** add the amounts, then multiply by the fraction remaining. The meaning changes from discounted prices to retained revenue. **Source:** the supplied function’s validation and calculation, lines 2–3; the refund requirements above. **Send your first attempt when ready. I’ll check it against the code. If something doesn’t match, you’ll get a targeted question and a source reference before seeing the answer.**
Connects securely to your tools. The creator never sees your data.
About this skill
Understand what you build with AI. Learn Skills brings nine learning workflows to your coding agent. Explore an unfamiliar codebase, check your understanding of generated code, or start learning a topic from scratch. Start with `start-learn`: describe your goal and let the agent choose a suitable workflow. You can also invoke any skill directly: - Explain code in your own words and uncover gaps. - Test recall before reopening the source. - Connect unfamiliar concepts to things you already know. - Reason through problems with guided questions. - Practise with exercises and folded solutions. - Create linked notes and flashcards. - Assess demonstrated understanding and identify your next step. Feedback is grounded in your code, tests, and relevant documentation. For learning from scratch, create a dedicated workspace with an editable curriculum, HTML lessons generated on demand, a growing glossary, and assessment records. Includes plugin packaging for Claude Code and Codex, plus self-contained skill folders for compatible applications. No review scheduler or arbitrary percentage scores—just concrete practice, evidence, and actionable feedback.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 27 days ago
- Free to download with an account
Requires