> For the complete documentation index, see [llms.txt](https://ethan-lin.gitbook.io/refactoring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ethan-lin.gitbook.io/refactoring/xiang-jin-mei-gui/3-task-1.md).

# 任务1：初体验

第一个任务很简单：先自己尝试重构一下这道题。这么有趣的练习，怎能不让读者先自己尝试一遍呢？

## 你的任务

Java：

```
git clone git@github.com:linesh-simplicity/gildedrose-java.git
git checkout task-1-begin
./gradlew clean build
```

JavaScript：

```
git clone git@github.com:linesh-simplicity/gildedrose.git
git checkout task-1-begin
npm i
npm test
```

* 尝试自己重构一下代码。如果 60 分钟还没完成满意的重构，请先停止

## 反思

* 你从哪里入手进行重构？
* 你有没有尝试去理解代码的逻辑？
* 你如何保证软件的行为没有在重构过程发生改变？


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ethan-lin.gitbook.io/refactoring/xiang-jin-mei-gui/3-task-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
